Skip to content

Commit 51e25ef

Browse files
fast-interp: Fix frame_offset pop order (#3101)
The issue was reported in #3062.
1 parent 5a99866 commit 51e25ef

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

core/iwasm/interpreter/wasm_loader.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -8231,11 +8231,11 @@ wasm_loader_prepare_bytecode(WASMModule *module, WASMFunction *func,
82318231
idx--) {
82328232
ret_type = *(func->func_type->types
82338233
+ func->func_type->param_count + idx);
8234-
POP_TYPE(ret_type);
82358234
#if WASM_ENABLE_FAST_INTERP != 0
82368235
/* emit the offset after return opcode */
82378236
POP_OFFSET_TYPE(ret_type);
82388237
#endif
8238+
POP_TYPE(ret_type);
82398239
}
82408240

82418241
RESET_STACK();
@@ -8275,10 +8275,10 @@ wasm_loader_prepare_bytecode(WASMModule *module, WASMFunction *func,
82758275
if (func_type->param_count > 0) {
82768276
for (idx = (int32)(func_type->param_count - 1); idx >= 0;
82778277
idx--) {
8278-
POP_TYPE(func_type->types[idx]);
82798278
#if WASM_ENABLE_FAST_INTERP != 0
82808279
POP_OFFSET_TYPE(func_type->types[idx]);
82818280
#endif
8281+
POP_TYPE(func_type->types[idx]);
82828282
}
82838283
}
82848284

@@ -8376,10 +8376,10 @@ wasm_loader_prepare_bytecode(WASMModule *module, WASMFunction *func,
83768376
if (func_type->param_count > 0) {
83778377
for (idx = (int32)(func_type->param_count - 1); idx >= 0;
83788378
idx--) {
8379-
POP_TYPE(func_type->types[idx]);
83808379
#if WASM_ENABLE_FAST_INTERP != 0
83818380
POP_OFFSET_TYPE(func_type->types[idx]);
83828381
#endif
8382+
POP_TYPE(func_type->types[idx]);
83838383
}
83848384
}
83858385

core/iwasm/interpreter/wasm_mini_loader.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -6028,11 +6028,11 @@ wasm_loader_prepare_bytecode(WASMModule *module, WASMFunction *func,
60286028
idx--) {
60296029
ret_type = *(func->func_type->types
60306030
+ func->func_type->param_count + idx);
6031-
POP_TYPE(ret_type);
60326031
#if WASM_ENABLE_FAST_INTERP != 0
60336032
/* emit the offset after return opcode */
60346033
POP_OFFSET_TYPE(ret_type);
60356034
#endif
6035+
POP_TYPE(ret_type);
60366036
}
60376037

60386038
RESET_STACK();
@@ -6071,10 +6071,10 @@ wasm_loader_prepare_bytecode(WASMModule *module, WASMFunction *func,
60716071
if (func_type->param_count > 0) {
60726072
for (idx = (int32)(func_type->param_count - 1); idx >= 0;
60736073
idx--) {
6074-
POP_TYPE(func_type->types[idx]);
60756074
#if WASM_ENABLE_FAST_INTERP != 0
60766075
POP_OFFSET_TYPE(func_type->types[idx]);
60776076
#endif
6077+
POP_TYPE(func_type->types[idx]);
60786078
}
60796079
}
60806080

@@ -6152,10 +6152,10 @@ wasm_loader_prepare_bytecode(WASMModule *module, WASMFunction *func,
61526152
if (func_type->param_count > 0) {
61536153
for (idx = (int32)(func_type->param_count - 1); idx >= 0;
61546154
idx--) {
6155-
POP_TYPE(func_type->types[idx]);
61566155
#if WASM_ENABLE_FAST_INTERP != 0
61576156
POP_OFFSET_TYPE(func_type->types[idx]);
61586157
#endif
6158+
POP_TYPE(func_type->types[idx]);
61596159
}
61606160
}
61616161

0 commit comments

Comments
 (0)