<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/vm_trace.c, branch v3_4_9</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>Backport WASI setjmp handler memory leak fixes to Ruby 3.4 (#14788)</title>
<updated>2025-10-09T14:30:42+00:00</updated>
<author>
<name>刘皓</name>
<email>whiteaxe@tuta.io</email>
</author>
<published>2025-10-09T14:30:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=17877eb2481977a415dd6e51ffe0a9103d575ce7'/>
<id>17877eb2481977a415dd6e51ffe0a9103d575ce7</id>
<content type='text'>
[Bug #21626]</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[Bug #21626]</pre>
</div>
</content>
</entry>
<entry>
<title>[Bug #20915] Fix SEGV with `TracePoint#parameters` and aliased C method</title>
<updated>2024-11-29T23:42:48+00:00</updated>
<author>
<name>viralpraxis</name>
<email>iaroslav2k@gmail.com</email>
</author>
<published>2024-11-29T21:13:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=660b995365f719fa59ed6f2809bb1527e6470d14'/>
<id>660b995365f719fa59ed6f2809bb1527e6470d14</id>
<content type='text'>
The following snippet results with a SEGV:

```ruby
C = Class.new do
  alias_method :new_to_s, :to_s
end

TracePoint.new(:c_call, &amp;:parameters).enable { C.new.new_to_s }
```

at MRI 3.3.6 and ruby 3.4.0dev

The root cause of the issue lies in the `rb_tracearg_parameters` function
within the `RUBY_EVENT_C_RETURN` branch. Specifically, when the invoked
method is an alias for a C function,
`rb_method_entry_without_refinements(..., trace_arg-&gt;called_id, ...)`
may return NULL. In that case we can fallback to `trace_arg-&gt;id`.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The following snippet results with a SEGV:

```ruby
C = Class.new do
  alias_method :new_to_s, :to_s
end

TracePoint.new(:c_call, &amp;:parameters).enable { C.new.new_to_s }
```

at MRI 3.3.6 and ruby 3.4.0dev

The root cause of the issue lies in the `rb_tracearg_parameters` function
within the `RUBY_EVENT_C_RETURN` branch. Specifically, when the invoked
method is an alias for a C function,
`rb_method_entry_without_refinements(..., trace_arg-&gt;called_id, ...)`
may return NULL. In that case we can fallback to `trace_arg-&gt;id`.
</pre>
</div>
</content>
</entry>
<entry>
<title>Cast via `uintptr_t` function pointer between object pointer</title>
<updated>2024-10-08T14:29:49+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2024-10-08T06:41:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=9a90cd228466ec088d6f0da8d1aa065f03daa7c8'/>
<id>9a90cd228466ec088d6f0da8d1aa065f03daa7c8</id>
<content type='text'>
- ISO C forbids conversion of function pointer to object pointer type
- ISO C forbids conversion of object pointer to function pointer type
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
- ISO C forbids conversion of function pointer to object pointer type
- ISO C forbids conversion of object pointer to function pointer type
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix assertion error when TracePoint has incompatible events</title>
<updated>2024-08-16T20:12:49+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2024-08-16T14:27:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=2fe6a4f84d2bcf97d3be9bffa5f3232604201f55'/>
<id>2fe6a4f84d2bcf97d3be9bffa5f3232604201f55</id>
<content type='text'>
TracePoints with incompatible events (i.e. events not in ISEQ_TRACE_EVENTS)
with a method target will fail an assertion error because it does not
filter for the supported events. For example, the following lines will
cause an assertion error:

    def foo; end
    # No arguments passed into TracePoint.new enables all ISEQ_TRACE_EVENTS
    TracePoint.new {}.enable(target: method(:foo))
    # Raise is not supported with a target
    TracePoint.new(:raise, :return) {}.enable(target: method(:foo))
    foo

Crashes with:

    Assertion Failed: vm_insnhelper.c:7026:vm_trace:(iseq_local_events &amp; ~(0x0001 | 0x0002 | 0x0004 | 0x0008 | 0x0010| 0x0020| 0x0040 | 0x0100 | 0x0200 | 0x4000 | 0x010000| 0x020000)) == 0
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
TracePoints with incompatible events (i.e. events not in ISEQ_TRACE_EVENTS)
with a method target will fail an assertion error because it does not
filter for the supported events. For example, the following lines will
cause an assertion error:

    def foo; end
    # No arguments passed into TracePoint.new enables all ISEQ_TRACE_EVENTS
    TracePoint.new {}.enable(target: method(:foo))
    # Raise is not supported with a target
    TracePoint.new(:raise, :return) {}.enable(target: method(:foo))
    foo

Crashes with:

    Assertion Failed: vm_insnhelper.c:7026:vm_trace:(iseq_local_events &amp; ~(0x0001 | 0x0002 | 0x0004 | 0x0008 | 0x0010| 0x0020| 0x0040 | 0x0100 | 0x0200 | 0x4000 | 0x010000| 0x020000)) == 0
</pre>
</div>
</content>
</entry>
<entry>
<title>Prefer `enum ruby_tag_type` over `int`</title>
<updated>2024-03-17T06:57:19+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2023-08-07T15:32:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=28a2105a554d875cc5c6fc2b5ac20e0e6c04966e'/>
<id>28a2105a554d875cc5c6fc2b5ac20e0e6c04966e</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Move FL_SINGLETON to FL_USER1</title>
<updated>2024-03-06T18:11:41+00:00</updated>
<author>
<name>Jean Boussier</name>
<email>byroot@ruby-lang.org</email>
</author>
<published>2024-03-06T16:04:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=b4a69351ec7d6f0a5e34e3bb586053814be352c0'/>
<id>b4a69351ec7d6f0a5e34e3bb586053814be352c0</id>
<content type='text'>
This frees FL_USER0 on both T_MODULE and T_CLASS.

Note: prior to this, FL_SINGLETON was never set on T_MODULE,
so checking for `FL_SINGLETON` without first checking that
`FL_TYPE` was `T_CLASS` was valid. That's no longer the case.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This frees FL_USER0 on both T_MODULE and T_CLASS.

Note: prior to this, FL_SINGLETON was never set on T_MODULE,
so checking for `FL_SINGLETON` without first checking that
`FL_TYPE` was `T_CLASS` was valid. That's no longer the case.
</pre>
</div>
</content>
</entry>
<entry>
<title>Do not include a backtick in error messages and backtraces</title>
<updated>2024-02-15T09:42:31+00:00</updated>
<author>
<name>Yusuke Endoh</name>
<email>mame@ruby-lang.org</email>
</author>
<published>2024-01-19T07:03:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=25d74b9527cd525042ad0b612b794fa331d3a318'/>
<id>25d74b9527cd525042ad0b612b794fa331d3a318</id>
<content type='text'>
[Feature #16495]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[Feature #16495]
</pre>
</div>
</content>
</entry>
<entry>
<title>Memory leak with TracePoint on bmethod</title>
<updated>2024-01-23T15:47:04+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2024-01-19T15:26:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=b14674b236445fb70f484603e678722760f678f4'/>
<id>b14674b236445fb70f484603e678722760f678f4</id>
<content type='text'>
[Bug #20194]

When disabling the TracePoint on bmethod, the hooks list is not freed.

For example:

    obj = Object.new
    obj.define_singleton_method(:foo) {}
    bmethod = obj.method(:foo)
    tp = TracePoint.new(:return) {}

    10.times do
      100_000.times do
        tp.enable(target: bmethod) {}
      end

      puts `ps -o rss= -p #{$$}`
    end

Before:

    18208
    22832
    26528
    29728
    34000
    37776
    40864
    44400
    47680
    51504

After:

    16688
    17168
    17168
    17248
    17696
    17760
    17824
    17824
    17856
    17920
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[Bug #20194]

When disabling the TracePoint on bmethod, the hooks list is not freed.

For example:

    obj = Object.new
    obj.define_singleton_method(:foo) {}
    bmethod = obj.method(:foo)
    tp = TracePoint.new(:return) {}

    10.times do
      100_000.times do
        tp.enable(target: bmethod) {}
      end

      puts `ps -o rss= -p #{$$}`
    end

Before:

    18208
    22832
    26528
    29728
    34000
    37776
    40864
    44400
    47680
    51504

After:

    16688
    17168
    17168
    17248
    17696
    17760
    17824
    17824
    17856
    17920
</pre>
</div>
</content>
</entry>
<entry>
<title>Rename BUILTIN_ATTR_SINGLE_NOARG_INLINE</title>
<updated>2024-01-17T01:31:27+00:00</updated>
<author>
<name>Takashi Kokubun</name>
<email>takashikkbn@gmail.com</email>
</author>
<published>2024-01-17T01:31:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=8642a573e6d1091fefbb552bb714ebcf8da66289'/>
<id>8642a573e6d1091fefbb552bb714ebcf8da66289</id>
<content type='text'>
to BUILTIN_ATTR_SINGLE_NOARG_LEAF

The attribute was created when the other attribute was called BUILTIN_ATTR_INLINE.
Now that the original attribute is renamed to BUILTIN_ATTR_LEAF, it's
only confusing that we call it "_INLINE".
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
to BUILTIN_ATTR_SINGLE_NOARG_LEAF

The attribute was created when the other attribute was called BUILTIN_ATTR_INLINE.
Now that the original attribute is renamed to BUILTIN_ATTR_LEAF, it's
only confusing that we call it "_INLINE".
</pre>
</div>
</content>
</entry>
<entry>
<title>Adjust styles and indents [ci skip]</title>
<updated>2024-01-07T15:50:41+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2024-01-07T15:50:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=c30b8ae947e4e0e01df74b07282b27b1b1c70df8'/>
<id>c30b8ae947e4e0e01df74b07282b27b1b1c70df8</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
