Prior to a26f528b3bf1eaecff18520f6ba8083c9c0cbf73, `rbimpl_rtypeddata_p`
checked whether a flag that is no longer used since that commit was set.
As a result, typed data objects created in newer versions of Ruby are
considered as untyped in extension libraries compiled with older headers.
This allows us to treat the two types of T_DATA the same way when
reading instance variables.
Non-TypedData T_DATA are deprecated, so making them faster isn't
particularly important, but it is helpful to avoid needing to test for
TypedData and adding another special case.
Same optimization that was applied to `set_table` in
85c52079aa35a1d2e063a5b40eebe91701c8cb9e
This saves one pointer per `st_table`.
Now that GC support 64B slots, if we can save another 8B
either in `st_table` or in `struct RHash`, hashes would now
fit in 64B slots.
That API made sense before b00f280d4b9569e7153365d7e1c522b3d6b3c6cf
as finding a module name was costly, but it now is a very cheap
operation, and that function is now just an outdated alias.
Move rb_int_parse_cstr() declaration and RB_INT_PARSE_* flags from
internal/bignum.h to the public header include/ruby/internal/intern/bignum.h
so that C extensions can use this function without writing their own
prototype declarations.
The flags are changed from an enum to #define macros to follow the
convention used in the public header for similar constants.
This is a generalization of the optimization done in re.c
as part of d0fbdb005cecd8513aeacb234365d71f9a9b521e.
Code that deal with coderange can benefit significantly from
avoiding that function call, assuming coderange is often already
known.
Ref: https://github.com/ruby/json/pull/974
There's no reason to ever call this and the "count" value is ignored.
Because this is part of the public API I left it as a stub, but it could
likely be removed.
Related to [Bug #21842].
* rb_interned_str: document what decides whether the returned string is
in US-ASCII or BINARY encoding.
* rb_interned_str_cstr: include the same description as rb_interned_str
for the encoding. This one was still missing the update for US-ASCII
and erroneously said the returned string was alwasy in BINARY encoding
* rb_str_to_interned_str: document how the encoding of the result is
defined.
Co-authored-by: Herwin <herwinw@users.noreply.github.com>
This commit adds a field handle_weak_references to rb_data_type_struct for
the callback when handling weak references. This avoids TypedData objects
from needing to expose their rb_data_type_struct and weak references function.