mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Fix stack size check for ctx_get_opnd_type
Previously all stack operands would become unknown once the stack grew beyond a certain size. This worked, but unnecessarily hid available information.
This commit is contained in:
parent
48dca3348a
commit
6d852e847e
1 changed files with 6 additions and 3 deletions
|
@ -135,11 +135,14 @@ ctx_get_opnd_type(const ctx_t* ctx, insn_opnd_t opnd)
|
||||||
if (opnd.is_self)
|
if (opnd.is_self)
|
||||||
return ctx->self_type;
|
return ctx->self_type;
|
||||||
|
|
||||||
if (ctx->stack_size >= MAX_TEMP_TYPES)
|
RUBY_ASSERT(opnd.idx < ctx->stack_size);
|
||||||
|
int stack_idx = ctx->stack_size - 1 - opnd.idx;
|
||||||
|
|
||||||
|
// If outside of tracked range, do nothing
|
||||||
|
if (stack_idx >= MAX_TEMP_TYPES)
|
||||||
return TYPE_UNKNOWN;
|
return TYPE_UNKNOWN;
|
||||||
|
|
||||||
RUBY_ASSERT(opnd.idx < ctx->stack_size);
|
temp_mapping_t mapping = ctx->temp_mapping[stack_idx];
|
||||||
temp_mapping_t mapping = ctx->temp_mapping[ctx->stack_size - 1 - opnd.idx];
|
|
||||||
|
|
||||||
switch (mapping.kind)
|
switch (mapping.kind)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue