diff options
author | Peter Zhu <peter@peterzhu.ca> | 2023-12-01 16:10:11 -0500 |
---|---|---|
committer | Peter Zhu <peter@peterzhu.ca> | 2023-12-02 09:06:03 -0500 |
commit | d1691617d6d6a115db52e7861f584fe98039ed1b (patch) | |
tree | 67c3a47c05e876f8ff016c759c1e5e4a7bc407f6 /iseq.c | |
parent | 092a17e7bd97525904c2874228a7febcaea74bf7 (diff) | |
download | ruby-d1691617d6d6a115db52e7861f584fe98039ed1b.tar.gz |
Pin instruction storage
The operands in each instruction needs to be pinned because if
auto-compaction runs in iseq_set_sequence, then the objects could exist
on the generated_iseq buffer, which would not be reference updated which
can lead to T_MOVED (and subsequently T_NONE) objects on the iseq.
Diffstat (limited to 'iseq.c')
-rw-r--r-- | iseq.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -393,7 +393,14 @@ rb_iseq_mark_and_move(rb_iseq_t *iseq, bool reference_updating) else if (FL_TEST_RAW((VALUE)iseq, ISEQ_USE_COMPILE_DATA)) { const struct iseq_compile_data *const compile_data = ISEQ_COMPILE_DATA(iseq); - rb_iseq_mark_and_move_insn_storage(compile_data->insn.storage_head); + if (!reference_updating) { + /* The operands in each instruction needs to be pinned because + * if auto-compaction runs in iseq_set_sequence, then the objects + * could exist on the generated_iseq buffer, which would not be + * reference updated which can lead to T_MOVED (and subsequently + * T_NONE) objects on the iseq. */ + rb_iseq_mark_and_pin_insn_storage(compile_data->insn.storage_head); + } rb_gc_mark_and_move((VALUE *)&compile_data->err_info); rb_gc_mark_and_move((VALUE *)&compile_data->catch_table_ary); |