Add some more comments on WASM_STACK_GUARD_SIZE (#3380)

This commit is contained in:
YAMAMOTO Takashi 2024-05-01 16:15:17 +09:00 committed by GitHub
parent 4abf288c94
commit 163f29e51b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -470,8 +470,23 @@
* 200 bytes (release build, macOS/amd64) * 200 bytes (release build, macOS/amd64)
* 2600 bytes (debug build, macOS/amd64) * 2600 bytes (debug build, macOS/amd64)
* *
* libc snprintf (used by eg. wasm_runtime_set_exception) consumes about * - platform-provided functions (eg. libc)
* 1600 bytes stack on macOS/amd64, about 2000 bytes on Ubuntu amd64 20.04. *
* the following are examples of the stack consumptions observed for
* host APIs.
*
* snprintf: (used by eg. wasm_runtime_set_exception)
* - about 1600 bytes on macOS/amd64
* - about 2000 bytes on Ubuntu amd64 20.04
*
* gethostbyname:
* - 3KB-6KB on macOS/amd64
* - 10KB on Ubuntu amd64 20.04
*
* getaddrinfo:
* - 4KB-17KB on macOS/amd64
* - 12KB on Ubuntu amd64 20.04
* - 0.3-1.5KB on NuttX/esp32s3
* *
* - stack check wrapper functions generated by the aot compiler * - stack check wrapper functions generated by the aot compiler
* (--stack-bounds-checks=1) * (--stack-bounds-checks=1)
@ -480,6 +495,9 @@
* "precheck functions themselves consume relatively large amount of stack" * "precheck functions themselves consume relatively large amount of stack"
* when it detects wrapper functions requiring more than 1KB. * when it detects wrapper functions requiring more than 1KB.
* *
* - the ABI-defined red zone. eg. 128 bytes for SYSV x86-64 ABI.
* cf. https://en.wikipedia.org/wiki/Red_zone_(computing)
*
* Note: on platforms with lazy function binding, don't forget to consider * Note: on platforms with lazy function binding, don't forget to consider
* the symbol resolution overhead on the first call. For example, * the symbol resolution overhead on the first call. For example,
* on Ubuntu amd64 20.04, it seems to consume about 1500 bytes. * on Ubuntu amd64 20.04, it seems to consume about 1500 bytes.