|
475 | 475 | * 200 bytes (release build, macOS/amd64)
|
476 | 476 | * 2600 bytes (debug build, macOS/amd64)
|
477 | 477 | *
|
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 |
480 | 495 | *
|
481 | 496 | * - stack check wrapper functions generated by the aot compiler
|
482 | 497 | * (--stack-bounds-checks=1)
|
|
485 | 500 | * "precheck functions themselves consume relatively large amount of stack"
|
486 | 501 | * when it detects wrapper functions requiring more than 1KB.
|
487 | 502 | *
|
| 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 | + * |
488 | 506 | * Note: on platforms with lazy function binding, don't forget to consider
|
489 | 507 | * the symbol resolution overhead on the first call. For example,
|
490 | 508 | * on Ubuntu amd64 20.04, it seems to consume about 1500 bytes.
|
|
0 commit comments