@@ -477,14 +477,14 @@ ExecutionResult execute(Instance& instance, FuncIdx func_idx, const Value* args,
477477 const auto & code = instance.module .get_code (func_idx);
478478 auto * const memory = instance.memory .get ();
479479
480- OperandStack stack (args, func_type.inputs .size (), code.local_count ,
480+ OperandStack _stack (args, func_type.inputs .size (), code.local_count ,
481481 static_cast <size_t >(code.max_stack_height ));
482482
483483 const Instr* pc = code.instructions .data ();
484484 const uint8_t * immediates = code.immediates .data ();
485485
486486 // FIXME: Remove reference.
487- auto & sp = stack .sp ();
487+ auto & sp = _stack .sp ();
488488 const auto bottom = sp;
489489
490490 while (true )
@@ -616,19 +616,19 @@ ExecutionResult execute(Instance& instance, FuncIdx func_idx, const Value* args,
616616 case Instr::local_get:
617617 {
618618 const auto idx = read<uint32_t >(immediates);
619- *++sp = (stack .local (idx));
619+ *++sp = (_stack .local (idx));
620620 break ;
621621 }
622622 case Instr::local_set:
623623 {
624624 const auto idx = read<uint32_t >(immediates);
625- stack .local (idx) = *sp--;
625+ _stack .local (idx) = *sp--;
626626 break ;
627627 }
628628 case Instr::local_tee:
629629 {
630630 const auto idx = read<uint32_t >(immediates);
631- stack .local (idx) = *sp;
631+ _stack .local (idx) = *sp;
632632 break ;
633633 }
634634 case Instr::global_get:
@@ -1042,8 +1042,8 @@ ExecutionResult execute(Instance& instance, FuncIdx func_idx, const Value* args,
10421042 }
10431043 case Instr::i32_div_s:
10441044 {
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 >();
10471047 if (rhs == 0 || (lhs == std::numeric_limits<int32_t >::min () && rhs == -1 ))
10481048 goto trap;
10491049 binary_op (sp, div<int32_t >);
@@ -1062,7 +1062,7 @@ ExecutionResult execute(Instance& instance, FuncIdx func_idx, const Value* args,
10621062 auto const rhs = sp->as <int32_t >();
10631063 if (rhs == 0 )
10641064 goto trap;
1065- auto const lhs = stack[ 1 ].as <int32_t >();
1065+ auto const lhs = sp[- 1 ].as <int32_t >();
10661066 if (lhs == std::numeric_limits<int32_t >::min () && rhs == -1 )
10671067 *--sp = 0 ;
10681068 else
@@ -1152,8 +1152,8 @@ ExecutionResult execute(Instance& instance, FuncIdx func_idx, const Value* args,
11521152 }
11531153 case Instr::i64_div_s:
11541154 {
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 >();
11571157 if (rhs == 0 || (lhs == std::numeric_limits<int64_t >::min () && rhs == -1 ))
11581158 goto trap;
11591159 binary_op (sp, div<int64_t >);
@@ -1172,7 +1172,7 @@ ExecutionResult execute(Instance& instance, FuncIdx func_idx, const Value* args,
11721172 auto const rhs = sp->as <int64_t >();
11731173 if (rhs == 0 )
11741174 goto trap;
1175- auto const lhs = stack[ 1 ].as <int64_t >();
1175+ auto const lhs = sp[- 1 ].as <int64_t >();
11761176 if (lhs == std::numeric_limits<int64_t >::min () && rhs == -1 )
11771177 *--sp = 0 ;
11781178 else
@@ -1522,7 +1522,7 @@ ExecutionResult execute(Instance& instance, FuncIdx func_idx, const Value* args,
15221522
15231523end:
15241524 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());
15261526
15271527 return sp != bottom ? ExecutionResult{*sp} : Void;
15281528
0 commit comments