move assert. opnd.idx doesn't make sense for OPND_SELF

This commit is contained in:
Alan Wu 2021-04-09 12:16:56 -04:00
Родитель 4ea2e753f6
Коммит 4442029ec4
2 изменённых файлов: 3 добавлений и 4 удалений

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

@ -726,7 +726,7 @@ enum {
// Preconditions: // Preconditions:
// - receiver is in REG0 // - receiver is in REG0
// - receiver has the same class as CLASS_OF(comptime_receiver) // - receiver has the same class as CLASS_OF(comptime_receiver)
// - ctx has not been modified since entry to the codegen of the instruction being compiled // - no stack push or pops to ctx since the entry to the codegen of the instruction being compiled
static codegen_status_t static codegen_status_t
gen_get_ivar(jitstate_t *jit, ctx_t *ctx, const int max_chain_depth, VALUE comptime_receiver, ID ivar_name, bool pop_receiver, uint8_t *side_exit) gen_get_ivar(jitstate_t *jit, ctx_t *ctx, const int max_chain_depth, VALUE comptime_receiver, ID ivar_name, bool pop_receiver, uint8_t *side_exit)
{ {
@ -781,7 +781,7 @@ gen_get_ivar(jitstate_t *jit, ctx_t *ctx, const int max_chain_depth, VALUE compt
mov(cb, out_opnd, REG1); mov(cb, out_opnd, REG1);
} }
else { else {
// Compile value is *not* embeded. // Compile time value is *not* embeded.
// Guard that value is *not* embedded // Guard that value is *not* embedded
// See ROBJECT_IVPTR() from include/ruby/internal/core/robject.h // See ROBJECT_IVPTR() from include/ruby/internal/core/robject.h

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

@ -137,14 +137,13 @@ Get the type of an instruction operand
val_type_t val_type_t
ctx_get_opnd_type(const ctx_t* ctx, insn_opnd_t opnd) ctx_get_opnd_type(const ctx_t* ctx, insn_opnd_t opnd)
{ {
RUBY_ASSERT(opnd.idx < ctx->stack_size);
if (opnd.is_self) if (opnd.is_self)
return ctx->self_type; return ctx->self_type;
if (ctx->stack_size > MAX_TEMP_TYPES) if (ctx->stack_size > MAX_TEMP_TYPES)
return TYPE_UNKNOWN; return TYPE_UNKNOWN;
RUBY_ASSERT(opnd.idx < ctx->stack_size);
temp_mapping_t mapping = ctx->temp_mapping[ctx->stack_size - 1 - opnd.idx]; temp_mapping_t mapping = ctx->temp_mapping[ctx->stack_size - 1 - opnd.idx];
switch (mapping.kind) switch (mapping.kind)