Fix issue in yjit_free_block causing segfault

This addresses issue #55
This commit is contained in:
Maxime Chevalier-Boisvert 2021-06-08 14:15:02 -04:00 коммит произвёл Alan Wu
Родитель 67c2cdc59a
Коммит 99341d4a18
1 изменённых файлов: 13 добавлений и 0 удалений

Просмотреть файл

@ -816,6 +816,19 @@ yjit_free_block(block_t *block)
yjit_unlink_method_lookup_dependency(block);
yjit_block_assumptions_free(block);
// Remove this block from the predecessor's targets
rb_darray_for(block->incoming, incoming_idx) {
// Branch from the predecessor to us
branch_t* pred_branch = rb_darray_get(block->incoming, incoming_idx);
// If this is us, nullify the target block
for (size_t succ_idx = 0; succ_idx < 2; succ_idx++) {
if (pred_branch->blocks[succ_idx] == block) {
pred_branch->blocks[succ_idx] = NULL;
}
}
}
// For each outgoing branch
rb_darray_for(block->outgoing, branch_idx) {
branch_t* out_branch = rb_darray_get(block->outgoing, branch_idx);