<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/include/ruby/internal, branch v3_4_0_preview2</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>fix rb_memsearch() document</title>
<updated>2024-09-24T06:12:48+00:00</updated>
<author>
<name>NAITOH Jun</name>
<email>naitoh@gmail.com</email>
</author>
<published>2024-09-13T21:36:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=373f679e48068ebead61a029922a48879c39bef5'/>
<id>373f679e48068ebead61a029922a48879c39bef5</id>
<content type='text'>
## Why?
The explanation of x and y is reversed.

https://github.com/ruby/ruby/blob/ddbd64400199fd408d23c85f9fb0d7f742ecf9e1/re.c#L251-L256
```
long
rb_memsearch(const void *x0, long m, const void *y0, long n, rb_encoding *enc)
{
    const unsigned char *x = x0, *y = y0;

    if (m &gt; n) return -1;
```
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
## Why?
The explanation of x and y is reversed.

https://github.com/ruby/ruby/blob/ddbd64400199fd408d23c85f9fb0d7f742ecf9e1/re.c#L251-L256
```
long
rb_memsearch(const void *x0, long m, const void *y0, long n, rb_encoding *enc)
{
    const unsigned char *x = x0, *y = y0;

    if (m &gt; n) return -1;
```
</pre>
</div>
</content>
</entry>
<entry>
<title>[DOC] Mention rb_io_fdopen() takes ownership of the FD</title>
<updated>2024-08-28T21:27:57+00:00</updated>
<author>
<name>Alan Wu</name>
<email>alanwu@ruby-lang.org</email>
</author>
<published>2024-08-28T21:27:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=3fa5b4be195a84391e7cbde88b4c7d2e6fcf0e7c'/>
<id>3fa5b4be195a84391e7cbde88b4c7d2e6fcf0e7c</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix sign-conversion warning</title>
<updated>2024-08-11T07:04:37+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2024-08-11T07:04:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=1fd0a1b4ceef29a5aade5e1d896dca5b74258e6f'/>
<id>1fd0a1b4ceef29a5aade5e1d896dca5b74258e6f</id>
<content type='text'>
```
../../.././include/ruby/internal/special_consts.h:349:36: error: conversion to ‘VALUE’ {aka ‘long unsigned int’} from ‘int’ may change the sign of the result [-Werror=sign-conversion]
  349 |     return RB_SPECIAL_CONST_P(obj) * RUBY_Qtrue;
      |            ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
```
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
```
../../.././include/ruby/internal/special_consts.h:349:36: error: conversion to ‘VALUE’ {aka ‘long unsigned int’} from ‘int’ may change the sign of the result [-Werror=sign-conversion]
  349 |     return RB_SPECIAL_CONST_P(obj) * RUBY_Qtrue;
      |            ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
```
</pre>
</div>
</content>
</entry>
<entry>
<title>Make rb_check_frozen_inline() static inline again</title>
<updated>2024-07-19T21:47:12+00:00</updated>
<author>
<name>Alan Wu</name>
<email>XrXr@users.noreply.github.com</email>
</author>
<published>2024-07-19T19:53:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=8cf708d7b495f62d6239a49af25c362d0156e6aa'/>
<id>8cf708d7b495f62d6239a49af25c362d0156e6aa</id>
<content type='text'>
Since 730e3b2ce01915c4a98b79bb281b2c38a9ff1131
("Stop exposing `rb_str_chilled_p`"), we noticed a speed loss on a few
benchmarks that are string operations heavy. This is partially due to
routines no longer having the options to inline rb_check_frozen_inline()
in non-LTO builds. Make it an inlining candidate again to recover speed.

Testing this patch on my machine, the fannkuchredux benchmark gets a
1.15 speed-up with YJIT and 1.03 without YJIT.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Since 730e3b2ce01915c4a98b79bb281b2c38a9ff1131
("Stop exposing `rb_str_chilled_p`"), we noticed a speed loss on a few
benchmarks that are string operations heavy. This is partially due to
routines no longer having the options to inline rb_check_frozen_inline()
in non-LTO builds. Make it an inlining candidate again to recover speed.

Testing this patch on my machine, the fannkuchredux benchmark gets a
1.15 speed-up with YJIT and 1.03 without YJIT.
</pre>
</div>
</content>
</entry>
<entry>
<title>[DOC] Note that rb_obj_freeze_inline() can raise NoMemoryError</title>
<updated>2024-07-17T14:25:20+00:00</updated>
<author>
<name>Alan Wu</name>
<email>XrXr@users.noreply.github.com</email>
</author>
<published>2024-07-16T22:21:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=99825a539f990dff7e0d7cae082ab195a82ffaa5'/>
<id>99825a539f990dff7e0d7cae082ab195a82ffaa5</id>
<content type='text'>
And move it back to a public header because Doxygen might not be
scanning the .c files.

[Feature #18776]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
And move it back to a public header because Doxygen might not be
scanning the .c files.

[Feature #18776]
</pre>
</div>
</content>
</entry>
<entry>
<title>[DOC] No more is rb_ary_freeze() an alias of rb_obj_freeze()</title>
<updated>2024-07-17T14:25:20+00:00</updated>
<author>
<name>Alan Wu</name>
<email>XrXr@users.noreply.github.com</email>
</author>
<published>2024-07-16T22:03:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=cd428b490d635726e3d39ae8aa896bc41708cbc4'/>
<id>cd428b490d635726e3d39ae8aa896bc41708cbc4</id>
<content type='text'>
[Feature #20589]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[Feature #20589]
</pre>
</div>
</content>
</entry>
<entry>
<title>give up USE_GC_MALLOC_OBJ_INFO_DETAILS</title>
<updated>2024-07-12T01:21:07+00:00</updated>
<author>
<name>卜部昌平</name>
<email>shyouhei@ruby-lang.org</email>
</author>
<published>2024-07-11T02:45:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=fa6bf1da576430c1db0ff1d68fb9b5992a1d71c8'/>
<id>fa6bf1da576430c1db0ff1d68fb9b5992a1d71c8</id>
<content type='text'>
This feature is no longer possible under current design; now that our GC
is pluggable, we cannot assume what was achieved by this compiler flag
is always possble by the dynamically-loaded GC implementation.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This feature is no longer possible under current design; now that our GC
is pluggable, we cannot assume what was achieved by this compiler flag
is always possble by the dynamically-loaded GC implementation.
</pre>
</div>
</content>
</entry>
<entry>
<title>Add rb_block_call2, a flexible variant of rb_block_call</title>
<updated>2024-07-10T04:00:47+00:00</updated>
<author>
<name>Yusuke Endoh</name>
<email>mame@ruby-lang.org</email>
</author>
<published>2024-07-09T09:27:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=114e32b35796ca546f429ee3295607a127d7e519'/>
<id>114e32b35796ca546f429ee3295607a127d7e519</id>
<content type='text'>
This function accepts flags:

RB_NO_KEYWORDS, RB_PASS_KEYWORDS, RB_PASS_CALLED_KEYWORDS:
Works as the same as rb_block_call_kw.

RB_BLOCK_NO_USE_PACKED_ARGS:
The given block ("bl_proc") does not use "yielded_arg" of rb_block_call_func_t.
Instead, the block accesses the yielded arguments via "argc" and "argv".
This flag allows the called method to yield arguments without allocating an Array.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This function accepts flags:

RB_NO_KEYWORDS, RB_PASS_KEYWORDS, RB_PASS_CALLED_KEYWORDS:
Works as the same as rb_block_call_kw.

RB_BLOCK_NO_USE_PACKED_ARGS:
The given block ("bl_proc") does not use "yielded_arg" of rb_block_call_func_t.
Instead, the block accesses the yielded arguments via "argc" and "argv".
This flag allows the called method to yield arguments without allocating an Array.
</pre>
</div>
</content>
</entry>
<entry>
<title>Show more in `RBIMPL_ASSERT_TYPE`</title>
<updated>2024-06-21T00:25:00+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2024-06-19T05:21:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=249a1fb0eb26a79370c7a0b3833b2e25f92866a9'/>
<id>249a1fb0eb26a79370c7a0b3833b2e25f92866a9</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Crash instead of raising with Check_Type() in RBIMPL_ASSERT_TYPE() in debug builds</title>
<updated>2024-06-13T21:43:41+00:00</updated>
<author>
<name>Alan Wu</name>
<email>XrXr@users.noreply.github.com</email>
</author>
<published>2024-06-13T21:43:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=2699e230e467e395c868a9c4daa4af6fc6eb7d8b'/>
<id>2699e230e467e395c868a9c4daa4af6fc6eb7d8b</id>
<content type='text'>
Previously, RBIMPL_ASSERT_TYPE() used Check_Type() only in RUBY_DEBUG
builds. It raised TypeError, but only in debug builds. For people testing
type mismatch using debug builds looking for a Ruby exception, this can
be misleading -- the code could be missing a type check in non-debug builds
if it is relying on for example RSTRING_LEN() to raise.

Also, Check_Type() can obscure the true cause of error in debug mode.
When type check fails because the object is corrupt, instead of crashing
with a clear type assertion message, it can crash while trying to
construct an exception object to raise. You can see this for example in
&lt;https://github.com/ruby/ruby/actions/runs/9489999591/job/26152506434?pr=10985&gt;,
where RB_ENCODING_GET() is used on a corrupt object, but the crash
happens later and says "Assertion Failed:
../src/vm_method.c:1477:callable_method_entry_or_negative".
RBIMPL_ASSERT_TYPE() should assert right away.

RBIMPL_ASSERT_OR_ASSUME() asserts when RUBY_DEBUG and assumes in release
builds, as desired.

This should help investigate flaky CI failures that show up as TypeError
from `Kernel#require`, e.g.
"'Kernel#require': wrong argument type false (expected String) (TypeError)".

Same CI failure examples:
 - https://github.com/ruby/ruby/actions/runs/9034787861/job/24828147431
 - https://github.com/ruby/ruby/actions/runs/9418303667/job/25945492440
 - https://github.com/ruby/ruby/actions/runs/9505650952/job/26201031314

The failure occurs with and without use of YJIT.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previously, RBIMPL_ASSERT_TYPE() used Check_Type() only in RUBY_DEBUG
builds. It raised TypeError, but only in debug builds. For people testing
type mismatch using debug builds looking for a Ruby exception, this can
be misleading -- the code could be missing a type check in non-debug builds
if it is relying on for example RSTRING_LEN() to raise.

Also, Check_Type() can obscure the true cause of error in debug mode.
When type check fails because the object is corrupt, instead of crashing
with a clear type assertion message, it can crash while trying to
construct an exception object to raise. You can see this for example in
&lt;https://github.com/ruby/ruby/actions/runs/9489999591/job/26152506434?pr=10985&gt;,
where RB_ENCODING_GET() is used on a corrupt object, but the crash
happens later and says "Assertion Failed:
../src/vm_method.c:1477:callable_method_entry_or_negative".
RBIMPL_ASSERT_TYPE() should assert right away.

RBIMPL_ASSERT_OR_ASSUME() asserts when RUBY_DEBUG and assumes in release
builds, as desired.

This should help investigate flaky CI failures that show up as TypeError
from `Kernel#require`, e.g.
"'Kernel#require': wrong argument type false (expected String) (TypeError)".

Same CI failure examples:
 - https://github.com/ruby/ruby/actions/runs/9034787861/job/24828147431
 - https://github.com/ruby/ruby/actions/runs/9418303667/job/25945492440
 - https://github.com/ruby/ruby/actions/runs/9505650952/job/26201031314

The failure occurs with and without use of YJIT.</pre>
</div>
</content>
</entry>
</feed>
