diff options
author | Jean Boussier <[email protected]> | 2025-05-22 14:01:46 +0200 |
---|---|---|
committer | Jean Boussier <[email protected]> | 2025-06-12 07:58:16 +0200 |
commit | 3abdd4241fd5231a5711ce1b087d660c667ef30d (patch) | |
tree | ddcdd184ca6720bac671cf296a5b7474a22477f5 /zjit/src | |
parent | 166ff187bd2a84fddd7a633bdbdbcd4ae393c91e (diff) |
Turn `rb_classext_t.fields` into a T_IMEMO/class_fields
This behave almost exactly as a T_OBJECT, the layout is entirely
compatible.
This aims to solve two problems.
First, it solves the problem of namspaced classes having
a single `shape_id`. Now each namespaced classext
has an object that can hold the namespace specific
shape.
Second, it open the door to later make class instance variable
writes atomics, hence be able to read class variables
without locking the VM.
In the future, in multi-ractor mode, we can do the write
on a copy of the `fields_obj` and then atomically swap it.
Considerations:
- Right now the `RClass` shape_id is always synchronized,
but with namespace we should likely mark classes that have
multiple namespace with a specific shape flag.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/13411
Diffstat (limited to 'zjit/src')
-rw-r--r-- | zjit/src/cruby_bindings.inc.rs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/zjit/src/cruby_bindings.inc.rs b/zjit/src/cruby_bindings.inc.rs index 0447f46fd0..34f6ded80d 100644 --- a/zjit/src/cruby_bindings.inc.rs +++ b/zjit/src/cruby_bindings.inc.rs @@ -226,6 +226,7 @@ pub const imemo_parser_strterm: imemo_type = 10; pub const imemo_callinfo: imemo_type = 11; pub const imemo_callcache: imemo_type = 12; pub const imemo_constcache: imemo_type = 13; +pub const imemo_class_fields: imemo_type = 14; pub type imemo_type = u32; pub const METHOD_VISI_UNDEF: rb_method_visibility_t = 0; pub const METHOD_VISI_PUBLIC: rb_method_visibility_t = 1; |