Skip to content

Commit 50f2849

Browse files
authored
Remove a few hardcoded spec test knowledge from the core library (#3648)
Tweak the stack sizes in the spec test runner instead.
1 parent b05fdfd commit 50f2849

3 files changed

Lines changed: 14 additions & 26 deletions

File tree

core/iwasm/aot/aot_runtime.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1748,16 +1748,7 @@ aot_instantiate(AOTModule *module, AOTModuleInstance *parent,
17481748
/* Initialize the thread related data */
17491749
if (stack_size == 0)
17501750
stack_size = DEFAULT_WASM_STACK_SIZE;
1751-
#if WASM_ENABLE_SPEC_TEST != 0
1752-
#if WASM_ENABLE_TAIL_CALL == 0
1753-
if (stack_size < 128 * 1024)
1754-
stack_size = 128 * 1024;
1755-
#else
1756-
/* Some tail-call cases require large operand stack */
1757-
if (stack_size < 10 * 1024 * 1024)
1758-
stack_size = 10 * 1024 * 1024;
1759-
#endif
1760-
#endif
1751+
17611752
module_inst->default_wasm_stack_size = stack_size;
17621753

17631754
extra->stack_sizes =

core/iwasm/interpreter/wasm_runtime.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2990,16 +2990,7 @@ wasm_instantiate(WASMModule *module, WASMModuleInstance *parent,
29902990
/* Initialize the thread related data */
29912991
if (stack_size == 0)
29922992
stack_size = DEFAULT_WASM_STACK_SIZE;
2993-
#if WASM_ENABLE_SPEC_TEST != 0
2994-
#if WASM_ENABLE_TAIL_CALL == 0
2995-
if (stack_size < 128 * 1024)
2996-
stack_size = 128 * 1024;
2997-
#else
2998-
/* Some tail-call cases require large operand stack */
2999-
if (stack_size < 10 * 1024 * 1024)
3000-
stack_size = 10 * 1024 * 1024;
3001-
#endif
3002-
#endif
2993+
30032994
module_inst->default_wasm_stack_size = stack_size;
30042995

30052996
if (module->malloc_function != (uint32)-1) {

tests/wamr-test-suites/spec-test-script/runtest.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,13 +1161,19 @@ def run_wasm_with_repl(wasm_tempfile, aot_tempfile, opts, r):
11611161
if opts.qemu:
11621162
tmpfile = f"/tmp/{os.path.basename(tmpfile)}"
11631163

1164-
if opts.verbose:
1165-
cmd_iwasm = [opts.interpreter, "--heap-size=0", "-v=5", "--repl", tmpfile]
1166-
else:
1167-
cmd_iwasm = [opts.interpreter, "--heap-size=0", "--repl", tmpfile]
1168-
1164+
cmd_iwasm = [opts.interpreter, "--heap-size=0", "--repl"]
11691165
if opts.multi_module:
1170-
cmd_iwasm.insert(1, "--module-path=" + (tempfile.gettempdir() if not opts.qemu else "/tmp" ))
1166+
cmd_iwasm.append("--module-path=" + (tempfile.gettempdir() if not opts.qemu else "/tmp" ))
1167+
if opts.gc:
1168+
# our tail-call implementation is known broken.
1169+
# work it around by using a huge stack.
1170+
# cf. https://github.com/bytecodealliance/wasm-micro-runtime/issues/2231
1171+
cmd_iwasm.append("--stack-size=10485760") # 10MB (!)
1172+
else:
1173+
cmd_iwasm.append("--stack-size=131072") # 128KB
1174+
if opts.verbose:
1175+
cmd_iwasm.append("-v=5")
1176+
cmd_iwasm.append(tmpfile)
11711177

11721178
if opts.qemu:
11731179
if opts.qemu_firmware == '':

0 commit comments

Comments
 (0)