Turn rb_classext_t.fields
into a T_IMEMO/class_fields
#13411
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
RClass
shape_id is always synchronized, but with namespace we should likely mark classes that have multiple namespace with a specific shape flag.