Skip to content

Commit b659f69

Browse files
tenderloveKaanOzkan
authored andcommitted
fix compation / freeing
1 parent e72aa01 commit b659f69

2 files changed

Lines changed: 13 additions & 8 deletions

File tree

iseq.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,15 @@ rb_iseq_free(const rb_iseq_t *iseq)
182182
#endif
183183
ruby_xfree((void *)body->is_entries);
184184
ruby_xfree(body->call_data);
185+
186+
if (body->block_ccs) {
187+
for (int i = 0; i < body->block_ccs->len; i++) {
188+
vm_cc_invalidate(body->block_ccs->entries[i].cc);
189+
}
190+
ruby_xfree(body->block_ccs->entries);
191+
ruby_xfree(body->block_ccs);
192+
}
193+
185194
ruby_xfree((void *)body->catch_table);
186195
ruby_xfree((void *)body->param.opt_table);
187196
if (ISEQ_MBITS_BUFLEN(body->iseq_size) > 1 && body->mark_bits.list) {
@@ -377,7 +386,9 @@ rb_iseq_mark_and_move(rb_iseq_t *iseq, bool reference_updating)
377386
}
378387

379388
if (body->block_ccs) {
380-
rb_cc_list_mark(body->block_ccs, (VALUE)iseq);
389+
for (int i = 0; i < body->block_ccs->len; i++) {
390+
rb_gc_mark_and_move_ptr(&body->block_ccs->entries[i].cc);
391+
}
381392
}
382393

383394
if (body->param.flags.has_kw && body->param.keyword != NULL) {

vm_insnhelper.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5953,12 +5953,7 @@ vm_invokeblock_i(struct rb_execution_context_struct *ec,
59535953
const struct rb_callinfo *ci = calling->cd->ci;
59545954
VALUE block_handler = VM_CF_BLOCK_HANDLER(GET_CFP());
59555955

5956-
if (block_handler == VM_BLOCK_HANDLER_NONE) {
5957-
rb_vm_localjump_error("no block given (yield)", Qnil, 0);
5958-
}
5959-
else {
5960-
return vm_invoke_block(ec, GET_CFP(), calling, ci, false, block_handler);
5961-
}
5956+
return vm_invoke_block(ec, GET_CFP(), calling, ci, false, block_handler);
59625957
}
59635958

59645959
enum method_explorer_type {
@@ -5997,7 +5992,6 @@ vm_invokeblock_fastpath(struct rb_execution_context_struct *ec,
59975992
const rb_iseq_t *iseq = rb_iseq_check(captured->code.iseq);
59985993

59995994
// check cache
6000-
// if (iseq == cc->iseq, we're good
60015995
if (LIKELY(cd->cc->klass == (VALUE)iseq)) {
60025996
ret = cd->cc;
60035997
}

0 commit comments

Comments
 (0)