@@ -477,14 +477,14 @@ ExecutionResult execute(Instance& instance, FuncIdx func_idx, const Value* args,
477
477
const auto & code = instance.module .get_code (func_idx);
478
478
auto * const memory = instance.memory .get ();
479
479
480
- OperandStack stack (args, func_type.inputs .size (), code.local_count ,
480
+ OperandStack _stack (args, func_type.inputs .size (), code.local_count ,
481
481
static_cast <size_t >(code.max_stack_height ));
482
482
483
483
const Instr* pc = code.instructions .data ();
484
484
const uint8_t * immediates = code.immediates .data ();
485
485
486
486
// FIXME: Remove reference.
487
- auto & sp = stack .sp ();
487
+ auto & sp = _stack .sp ();
488
488
const auto bottom = sp;
489
489
490
490
while (true )
@@ -616,19 +616,19 @@ ExecutionResult execute(Instance& instance, FuncIdx func_idx, const Value* args,
616
616
case Instr::local_get:
617
617
{
618
618
const auto idx = read <uint32_t >(immediates);
619
- *++sp = (stack .local (idx));
619
+ *++sp = (_stack .local (idx));
620
620
break ;
621
621
}
622
622
case Instr::local_set:
623
623
{
624
624
const auto idx = read <uint32_t >(immediates);
625
- stack .local (idx) = *sp--;
625
+ _stack .local (idx) = *sp--;
626
626
break ;
627
627
}
628
628
case Instr::local_tee:
629
629
{
630
630
const auto idx = read <uint32_t >(immediates);
631
- stack .local (idx) = *sp;
631
+ _stack .local (idx) = *sp;
632
632
break ;
633
633
}
634
634
case Instr::global_get:
@@ -1042,8 +1042,8 @@ ExecutionResult execute(Instance& instance, FuncIdx func_idx, const Value* args,
1042
1042
}
1043
1043
case Instr::i32_div_s:
1044
1044
{
1045
- auto const rhs = stack [0 ].as <int32_t >();
1046
- auto const lhs = stack[ 1 ].as <int32_t >();
1045
+ auto const rhs = sp [0 ].as <int32_t >();
1046
+ auto const lhs = sp[- 1 ].as <int32_t >();
1047
1047
if (rhs == 0 || (lhs == std::numeric_limits<int32_t >::min () && rhs == -1 ))
1048
1048
goto trap;
1049
1049
binary_op (sp, div <int32_t >);
@@ -1062,7 +1062,7 @@ ExecutionResult execute(Instance& instance, FuncIdx func_idx, const Value* args,
1062
1062
auto const rhs = sp->as <int32_t >();
1063
1063
if (rhs == 0 )
1064
1064
goto trap;
1065
- auto const lhs = stack[ 1 ].as <int32_t >();
1065
+ auto const lhs = sp[- 1 ].as <int32_t >();
1066
1066
if (lhs == std::numeric_limits<int32_t >::min () && rhs == -1 )
1067
1067
*--sp = 0 ;
1068
1068
else
@@ -1152,8 +1152,8 @@ ExecutionResult execute(Instance& instance, FuncIdx func_idx, const Value* args,
1152
1152
}
1153
1153
case Instr::i64_div_s:
1154
1154
{
1155
- auto const rhs = stack [0 ].as <int64_t >();
1156
- auto const lhs = stack[ 1 ].as <int64_t >();
1155
+ auto const rhs = sp [0 ].as <int64_t >();
1156
+ auto const lhs = sp[- 1 ].as <int64_t >();
1157
1157
if (rhs == 0 || (lhs == std::numeric_limits<int64_t >::min () && rhs == -1 ))
1158
1158
goto trap;
1159
1159
binary_op (sp, div <int64_t >);
@@ -1172,7 +1172,7 @@ ExecutionResult execute(Instance& instance, FuncIdx func_idx, const Value* args,
1172
1172
auto const rhs = sp->as <int64_t >();
1173
1173
if (rhs == 0 )
1174
1174
goto trap;
1175
- auto const lhs = stack[ 1 ].as <int64_t >();
1175
+ auto const lhs = sp[- 1 ].as <int64_t >();
1176
1176
if (lhs == std::numeric_limits<int64_t >::min () && rhs == -1 )
1177
1177
*--sp = 0 ;
1178
1178
else
@@ -1522,7 +1522,7 @@ ExecutionResult execute(Instance& instance, FuncIdx func_idx, const Value* args,
1522
1522
1523
1523
end:
1524
1524
assert (pc == &code.instructions [code.instructions .size ()]); // End of code must be reached.
1525
- assert (stack.size () == instance.module .get_function_type (func_idx).outputs .size ());
1525
+ // assert(stack.size() == instance.module.get_function_type(func_idx).outputs.size());
1526
1526
1527
1527
return sp != bottom ? ExecutionResult{*sp} : Void;
1528
1528
0 commit comments