Skip to content

Commit a2464ad

Browse files
yamtvictoryang00
authored andcommitted
Add some more comments on WASM_STACK_GUARD_SIZE (#3380)
1 parent 9592515 commit a2464ad

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

core/config.h

+20-2
Original file line numberDiff line numberDiff line change
@@ -475,8 +475,23 @@
475475
* 200 bytes (release build, macOS/amd64)
476476
* 2600 bytes (debug build, macOS/amd64)
477477
*
478-
* libc snprintf (used by eg. wasm_runtime_set_exception) consumes about
479-
* 1600 bytes stack on macOS/amd64, about 2000 bytes on Ubuntu amd64 20.04.
478+
* - platform-provided functions (eg. libc)
479+
*
480+
* the following are examples of the stack consumptions observed for
481+
* host APIs.
482+
*
483+
* snprintf: (used by eg. wasm_runtime_set_exception)
484+
* - about 1600 bytes on macOS/amd64
485+
* - about 2000 bytes on Ubuntu amd64 20.04
486+
*
487+
* gethostbyname:
488+
* - 3KB-6KB on macOS/amd64
489+
* - 10KB on Ubuntu amd64 20.04
490+
*
491+
* getaddrinfo:
492+
* - 4KB-17KB on macOS/amd64
493+
* - 12KB on Ubuntu amd64 20.04
494+
* - 0.3-1.5KB on NuttX/esp32s3
480495
*
481496
* - stack check wrapper functions generated by the aot compiler
482497
* (--stack-bounds-checks=1)
@@ -485,6 +500,9 @@
485500
* "precheck functions themselves consume relatively large amount of stack"
486501
* when it detects wrapper functions requiring more than 1KB.
487502
*
503+
* - the ABI-defined red zone. eg. 128 bytes for SYSV x86-64 ABI.
504+
* cf. https://en.wikipedia.org/wiki/Red_zone_(computing)
505+
*
488506
* Note: on platforms with lazy function binding, don't forget to consider
489507
* the symbol resolution overhead on the first call. For example,
490508
* on Ubuntu amd64 20.04, it seems to consume about 1500 bytes.

0 commit comments

Comments
 (0)