Skip to content
  • Eileen M. Uchitelle's avatar
    c85dffee
    Avoid pinning `storage_head` in `iseq_mark_and_move` (#12880) · c85dffee
    Eileen M. Uchitelle authored
    
    
    * Avoid pinning `storage_head` in `iseq_mark_and_move`
    
    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.
    
    * Don't allocate mark_offset_bits for one word
    
    If only one word is needed, we don't need to allocate mark_offset_bits
    and can instead directly write to it.
    
    ---------
    
    Co-authored-by: default avatarPeter Zhu <peter@peterzhu.ca>
    c85dffee
    Avoid pinning `storage_head` in `iseq_mark_and_move` (#12880)
    Eileen M. Uchitelle authored
    
    
    * Avoid pinning `storage_head` in `iseq_mark_and_move`
    
    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.
    
    * Don't allocate mark_offset_bits for one word
    
    If only one word is needed, we don't need to allocate mark_offset_bits
    and can instead directly write to it.
    
    ---------
    
    Co-authored-by: default avatarPeter Zhu <peter@peterzhu.ca>
Loading