Skip to content

Avoid pinning storage_head in iseq_mark_and_move#568

Closed
eileencodes wants to merge 1 commit intomasterfrom
avoid-pinning-iseq-storage-head
Closed

Avoid pinning storage_head in iseq_mark_and_move#568
eileencodes wants to merge 1 commit intomasterfrom
avoid-pinning-iseq-storage-head

Conversation

@eileencodes
Copy link
Member

This refactor changes the behavior of iseq_mark_and_move to avoid pinning the storage_head. Previously pinning was required because they could be gc'd during iseq_set_sequence it would be possible to end up with a half build array of instructions. However, in order to implement a moving immix algorithm we can't pin these objects so this rafactoring changes the code to mark and move. To accomplish this, it was required to add iseq_size, iseq_encoded, and the mark_bits union to the iseq_compile_data struct. In addition iseq_compile_data sets a bool for whether there is a single or list of mark bits. While this change is needed for moving immix, it should be better for Ruby's GC as well.

cc/ @tenderlove @peterzhu2118

This refactor changes the behavior of `iseq_mark_and_move` to avoid
pinning the `storage_head`. Previously pinning was required because they
could be gc'd during `iseq_set_sequence` it would be possible to end
up with a half build array of instructions. However, in order to
implement a moving immix algorithm we can't pin these objects so this
rafactoring changes the code to mark and move. To accomplish this, it was
required to add `iseq_size`, `iseq_encoded`, and the `mark_bits` union
to the `iseq_compile_data` struct. In addition `iseq_compile_data` sets
a bool for whether there is a single or list of mark bits. While this
change is needed for moving immix, it should be better for Ruby's GC
as well.
@eileencodes eileencodes closed this Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant