Make sure that there is always an index table entry for getivars
This commit is contained in:
parent
7f2828d1c8
commit
b3e993a64b
@ -1442,8 +1442,13 @@ gen_get_ivar(jitstate_t *jit, ctx_t *ctx, const int max_chain_depth, VALUE compt
|
|||||||
struct rb_iv_index_tbl_entry *ent;
|
struct rb_iv_index_tbl_entry *ent;
|
||||||
struct st_table *iv_index_tbl = ROBJECT_IV_INDEX_TBL(comptime_receiver);
|
struct st_table *iv_index_tbl = ROBJECT_IV_INDEX_TBL(comptime_receiver);
|
||||||
|
|
||||||
// Lookup index for the ivar the instruction loads
|
// Make sure there is a mapping for this ivar in the index table
|
||||||
if (iv_index_tbl && rb_iv_index_tbl_lookup(iv_index_tbl, id, &ent)) {
|
if (!iv_index_tbl || !rb_iv_index_tbl_lookup(iv_index_tbl, id, &ent)) {
|
||||||
|
rb_ivar_set(comptime_receiver, id, Qundef);
|
||||||
|
iv_index_tbl = ROBJECT_IV_INDEX_TBL(comptime_receiver);
|
||||||
|
RUBY_ASSERT(iv_index_tbl && rb_iv_index_tbl_lookup(iv_index_tbl, id, &ent));
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t ivar_index = ent->index;
|
uint32_t ivar_index = ent->index;
|
||||||
|
|
||||||
// Pop receiver if it's on the temp stack
|
// Pop receiver if it's on the temp stack
|
||||||
@ -1514,10 +1519,6 @@ gen_get_ivar(jitstate_t *jit, ctx_t *ctx, const int max_chain_depth, VALUE compt
|
|||||||
// Jump to next instruction. This allows guard chains to share the same successor.
|
// Jump to next instruction. This allows guard chains to share the same successor.
|
||||||
jit_jump_to_next_insn(jit, ctx);
|
jit_jump_to_next_insn(jit, ctx);
|
||||||
return YJIT_END_BLOCK;
|
return YJIT_END_BLOCK;
|
||||||
}
|
|
||||||
|
|
||||||
GEN_COUNTER_INC(cb, getivar_name_not_mapped);
|
|
||||||
return YJIT_CANT_COMPILE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static codegen_status_t
|
static codegen_status_t
|
||||||
|
@ -69,7 +69,6 @@ YJIT_DECLARE_COUNTERS(
|
|||||||
|
|
||||||
getivar_se_self_not_heap,
|
getivar_se_self_not_heap,
|
||||||
getivar_idx_out_of_range,
|
getivar_idx_out_of_range,
|
||||||
getivar_name_not_mapped,
|
|
||||||
|
|
||||||
setivar_se_self_not_heap,
|
setivar_se_self_not_heap,
|
||||||
setivar_idx_out_of_range,
|
setivar_idx_out_of_range,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user