@@ -530,14 +530,14 @@ ExecutionResult execute(Instance& instance, FuncIdx func_idx, const Value* args,
530530 const auto & code = instance.module ->get_code (func_idx);
531531 auto * const memory = instance.memory .get ();
532532
533- OperandStack stack (args, func_type.inputs .size (), code.local_count ,
533+ OperandStack _stack (args, func_type.inputs .size (), code.local_count ,
534534 static_cast <size_t >(code.max_stack_height ));
535535
536536 const Instr* pc = code.instructions .data ();
537537 const uint8_t * immediates = code.immediates .data ();
538538
539539 // FIXME: Remove reference.
540- auto & sp = stack .sp ();
540+ auto & sp = _stack .sp ();
541541 const auto bottom = sp;
542542
543543 while (true )
@@ -669,19 +669,19 @@ ExecutionResult execute(Instance& instance, FuncIdx func_idx, const Value* args,
669669 case Instr::local_get:
670670 {
671671 const auto idx = read<uint32_t >(immediates);
672- *++sp = (stack .local (idx));
672+ *++sp = (_stack .local (idx));
673673 break ;
674674 }
675675 case Instr::local_set:
676676 {
677677 const auto idx = read<uint32_t >(immediates);
678- stack .local (idx) = *sp--;
678+ _stack .local (idx) = *sp--;
679679 break ;
680680 }
681681 case Instr::local_tee:
682682 {
683683 const auto idx = read<uint32_t >(immediates);
684- stack .local (idx) = *sp;
684+ _stack .local (idx) = *sp;
685685 break ;
686686 }
687687 case Instr::global_get:
@@ -1094,28 +1094,28 @@ ExecutionResult execute(Instance& instance, FuncIdx func_idx, const Value* args,
10941094 }
10951095 case Instr::i32_div_s:
10961096 {
1097- const auto rhs = stack. pop (). as <int32_t >();
1098- const auto lhs = stack. top (). as <int32_t >();
1097+ const auto rhs = sp---> as <int32_t >();
1098+ const auto lhs = sp-> as <int32_t >();
10991099 if (rhs == 0 || (lhs == std::numeric_limits<int32_t >::min () && rhs == -1 ))
11001100 goto trap;
11011101 *sp = div (lhs, rhs);
11021102 break ;
11031103 }
11041104 case Instr::i32_div_u:
11051105 {
1106- const auto rhs = stack. pop (). as <uint32_t >();
1106+ const auto rhs = sp---> as <uint32_t >();
11071107 if (rhs == 0 )
11081108 goto trap;
1109- const auto lhs = stack. top (). as <uint32_t >();
1109+ const auto lhs = sp-> as <uint32_t >();
11101110 *sp = div (lhs, rhs);
11111111 break ;
11121112 }
11131113 case Instr::i32_rem_s:
11141114 {
1115- const auto rhs = stack. pop (). as <int32_t >();
1115+ const auto rhs = sp---> as <int32_t >();
11161116 if (rhs == 0 )
11171117 goto trap;
1118- const auto lhs = stack. top (). as <int32_t >();
1118+ const auto lhs = sp-> as <int32_t >();
11191119 if (lhs == std::numeric_limits<int32_t >::min () && rhs == -1 )
11201120 *sp = 0 ;
11211121 else
@@ -1124,10 +1124,10 @@ ExecutionResult execute(Instance& instance, FuncIdx func_idx, const Value* args,
11241124 }
11251125 case Instr::i32_rem_u:
11261126 {
1127- const auto rhs = stack. pop (). as <uint32_t >();
1127+ const auto rhs = sp---> as <uint32_t >();
11281128 if (rhs == 0 )
11291129 goto trap;
1130- const auto lhs = stack. top (). as <uint32_t >();
1130+ const auto lhs = sp-> as <uint32_t >();
11311131 *sp = rem (lhs, rhs);
11321132 break ;
11331133 }
@@ -1206,28 +1206,28 @@ ExecutionResult execute(Instance& instance, FuncIdx func_idx, const Value* args,
12061206 }
12071207 case Instr::i64_div_s:
12081208 {
1209- const auto rhs = stack. pop (). as <int64_t >();
1210- const auto lhs = stack. top (). as <int64_t >();
1209+ const auto rhs = sp---> as <int64_t >();
1210+ const auto lhs = sp-> as <int64_t >();
12111211 if (rhs == 0 || (lhs == std::numeric_limits<int64_t >::min () && rhs == -1 ))
12121212 goto trap;
12131213 *sp = div (lhs, rhs);
12141214 break ;
12151215 }
12161216 case Instr::i64_div_u:
12171217 {
1218- const auto rhs = stack. pop (). i64 ;
1218+ const auto rhs = sp---> i64 ;
12191219 if (rhs == 0 )
12201220 goto trap;
1221- const auto lhs = stack. top (). i64 ;
1221+ const auto lhs = sp-> i64 ;
12221222 *sp = div (lhs, rhs);
12231223 break ;
12241224 }
12251225 case Instr::i64_rem_s:
12261226 {
1227- const auto rhs = stack. pop (). as <int64_t >();
1227+ const auto rhs = sp---> as <int64_t >();
12281228 if (rhs == 0 )
12291229 goto trap;
1230- const auto lhs = stack. top (). as <int64_t >();
1230+ const auto lhs = sp-> as <int64_t >();
12311231 if (lhs == std::numeric_limits<int64_t >::min () && rhs == -1 )
12321232 *sp = 0 ;
12331233 else
@@ -1236,10 +1236,10 @@ ExecutionResult execute(Instance& instance, FuncIdx func_idx, const Value* args,
12361236 }
12371237 case Instr::i64_rem_u:
12381238 {
1239- const auto rhs = stack. pop (). i64 ;
1239+ const auto rhs = sp---> i64 ;
12401240 if (rhs == 0 )
12411241 goto trap;
1242- const auto lhs = stack. top (). i64 ;
1242+ const auto lhs = sp-> i64 ;
12431243 *sp = rem (lhs, rhs);
12441244 break ;
12451245 }
@@ -1570,7 +1570,7 @@ ExecutionResult execute(Instance& instance, FuncIdx func_idx, const Value* args,
15701570
15711571end:
15721572 assert (pc == &code.instructions [code.instructions .size ()]); // End of code must be reached.
1573- assert (stack.size () == instance.module ->get_function_type (func_idx).outputs .size ());
1573+ // assert(stack.size() == instance.module->get_function_type(func_idx).outputs.size());
15741574
15751575 return sp != bottom ? ExecutionResult{*sp} : Void;
15761576
0 commit comments