From 51e25ef01ff42bcbd242a62ea35a1e32204c1e86 Mon Sep 17 00:00:00 2001 From: Xu Jun Date: Wed, 31 Jan 2024 19:26:27 +0800 Subject: [PATCH] fast-interp: Fix frame_offset pop order (#3101) The issue was reported in #3062. --- core/iwasm/interpreter/wasm_loader.c | 6 +++--- core/iwasm/interpreter/wasm_mini_loader.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/iwasm/interpreter/wasm_loader.c b/core/iwasm/interpreter/wasm_loader.c index 6b26b530..8f73e554 100644 --- a/core/iwasm/interpreter/wasm_loader.c +++ b/core/iwasm/interpreter/wasm_loader.c @@ -8231,11 +8231,11 @@ re_scan: idx--) { ret_type = *(func->func_type->types + func->func_type->param_count + idx); - POP_TYPE(ret_type); #if WASM_ENABLE_FAST_INTERP != 0 /* emit the offset after return opcode */ POP_OFFSET_TYPE(ret_type); #endif + POP_TYPE(ret_type); } RESET_STACK(); @@ -8275,10 +8275,10 @@ re_scan: if (func_type->param_count > 0) { for (idx = (int32)(func_type->param_count - 1); idx >= 0; idx--) { - POP_TYPE(func_type->types[idx]); #if WASM_ENABLE_FAST_INTERP != 0 POP_OFFSET_TYPE(func_type->types[idx]); #endif + POP_TYPE(func_type->types[idx]); } } @@ -8376,10 +8376,10 @@ re_scan: if (func_type->param_count > 0) { for (idx = (int32)(func_type->param_count - 1); idx >= 0; idx--) { - POP_TYPE(func_type->types[idx]); #if WASM_ENABLE_FAST_INTERP != 0 POP_OFFSET_TYPE(func_type->types[idx]); #endif + POP_TYPE(func_type->types[idx]); } } diff --git a/core/iwasm/interpreter/wasm_mini_loader.c b/core/iwasm/interpreter/wasm_mini_loader.c index 1e175dc4..c617e084 100644 --- a/core/iwasm/interpreter/wasm_mini_loader.c +++ b/core/iwasm/interpreter/wasm_mini_loader.c @@ -6028,11 +6028,11 @@ re_scan: idx--) { ret_type = *(func->func_type->types + func->func_type->param_count + idx); - POP_TYPE(ret_type); #if WASM_ENABLE_FAST_INTERP != 0 /* emit the offset after return opcode */ POP_OFFSET_TYPE(ret_type); #endif + POP_TYPE(ret_type); } RESET_STACK(); @@ -6071,10 +6071,10 @@ re_scan: if (func_type->param_count > 0) { for (idx = (int32)(func_type->param_count - 1); idx >= 0; idx--) { - POP_TYPE(func_type->types[idx]); #if WASM_ENABLE_FAST_INTERP != 0 POP_OFFSET_TYPE(func_type->types[idx]); #endif + POP_TYPE(func_type->types[idx]); } } @@ -6152,10 +6152,10 @@ re_scan: if (func_type->param_count > 0) { for (idx = (int32)(func_type->param_count - 1); idx >= 0; idx--) { - POP_TYPE(func_type->types[idx]); #if WASM_ENABLE_FAST_INTERP != 0 POP_OFFSET_TYPE(func_type->types[idx]); #endif + POP_TYPE(func_type->types[idx]); } }