-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Refactor generic fields to use T_IMEMO/fields
objects.
#13626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms 8000 of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This comment has been minimized.
This comment has been minimized.
ced5ed0
to
96c27d4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the difference between generic_field_set
and generic_ivar_set
? It seems like "fields" is just used for object ids?
I see some logic WRT shapes in generic_update_fields_obj
, but I don't know if that's legit for both code paths. Other than that, I can't see from this diff what the problem is.
MEMCPY(fields, rb_imemo_fields_ptr(original_fields_obj), VALUE, fields_count); | ||
for (attr_index_t i = 0; i < fields_count; i++) { | ||
RB_OBJ_WRITTEN(fields_obj, Qundef, fields[i]); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could do rb_gc_writebarrier_remember(fields_obj)
here so we don't have to iterate the list. Someone will eventually have to iterate this list, but at least we only need to put 1 item in the remembered set instead of N items.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unfamiliar with rb_gc_writebarrier_remember
but I'll read on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hum, I tried to use it as a replacement for firing write barriers on all fields, but instantly ran into GC crashes. So I suspect I don't understand how it's meant to be used.
|
||
fields_lookup->resize = true; | ||
} | ||
generic_update_fields_obj(obj, fields_obj, original_fields_obj); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a comment here that generic_update_fields_obj
fires a WB? I was looking for missing WBs. This function clearly fires them from the fields object to the values, but I couldn't see where the obj -> fields_obj barrier is fired.
Yes, currently it's only used for Ideally I'd like |
db3466b
to
fa0a255
Compare
f7b04e8
to
985ce43
Compare
Followup: ruby#13589 This simplify a lot of things, as we no longer need to manually manage the memory, we can use the Read-Copy-Update pattern and avoid numerous race conditions. Co-Authored-By: Étienne Barrié <etienne.barrie@gmail.com>
a13de46
to
23a70aa
Compare
Followup: #13589
This simplify a lot of things, as we no longer need to manually manage the memory, we can use the Read-Copy-Update pattern and avoid numerous race conditions.