File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 450450 * WASM_STACK_GUARD_SIZE needs to be large enough for:
451451 *
452452 * - native functions
453+ *
453454 * w/o hw bound check, the overhead (aot_call_function etc) + the native
454455 * function itself. as of writing this, the former is about 1000 bytes
455456 * on macOS amd64.
457+ *
456458 * with hw bound check, theoretically, only needs to cover the logic to
457459 * set up the jmp_buf stack.
458460 *
461463 *
462464 * - w/o hw bound check, the intepreter loop
463465 *
466+ * the classic interpreter wasm_interp_call_func_bytecode alone
467+ * seems to consume about 2600 bytes stack.
468+ * (with the default configuration for macOS/amd64)
469+ *
470+ * libc snprintf (used by eg. wasm_runtime_set_exception) consumes about
471+ * 1600 bytes stack on macOS/amd64, about 2000 bytes on Ubuntu amd64 20.04.
472+ *
464473 * - stack check wrapper functions generated by the aot compiler
465474 * (--stack-bounds-checks=1)
466475 *
476+ * wamrc issues a warning
477+ * "precheck functions themselves consume relatively large amount of stack"
478+ * when it detects wrapper functions requiring more than 1KB.
479+ *
467480 * Note: on platforms with lazy function binding, don't forget to consider
468481 * the symbol resolution overhead on the first call. For example,
469482 * on Ubuntu amd64 20.04, it seems to consume about 1500 bytes.
You can’t perform that action at this time.
0 commit comments