mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-02-06 15:05:19 +00:00
Add some more comments on WASM_STACK_GUARD_SIZE (#3341)
This commit is contained in:
parent
18d363029c
commit
7bdea3c2ae
|
@ -450,9 +450,11 @@
|
|||
* WASM_STACK_GUARD_SIZE needs to be large enough for:
|
||||
*
|
||||
* - native functions
|
||||
*
|
||||
* w/o hw bound check, the overhead (aot_call_function etc) + the native
|
||||
* function itself. as of writing this, the former is about 1000 bytes
|
||||
* on macOS amd64.
|
||||
*
|
||||
* with hw bound check, theoretically, only needs to cover the logic to
|
||||
* set up the jmp_buf stack.
|
||||
*
|
||||
|
@ -461,9 +463,20 @@
|
|||
*
|
||||
* - w/o hw bound check, the intepreter loop
|
||||
*
|
||||
* the classic interpreter wasm_interp_call_func_bytecode alone
|
||||
* seems to consume about 2600 bytes stack.
|
||||
* (with the default configuration for macOS/amd64)
|
||||
*
|
||||
* libc snprintf (used by eg. wasm_runtime_set_exception) consumes about
|
||||
* 1600 bytes stack on macOS/amd64, about 2000 bytes on Ubuntu amd64 20.04.
|
||||
*
|
||||
* - stack check wrapper functions generated by the aot compiler
|
||||
* (--stack-bounds-checks=1)
|
||||
*
|
||||
* wamrc issues a warning
|
||||
* "precheck functions themselves consume relatively large amount of stack"
|
||||
* when it detects wrapper functions requiring more than 1KB.
|
||||
*
|
||||
* Note: on platforms with lazy function binding, don't forget to consider
|
||||
* the symbol resolution overhead on the first call. For example,
|
||||
* on Ubuntu amd64 20.04, it seems to consume about 1500 bytes.
|
||||
|
|
Loading…
Reference in New Issue
Block a user