-
Notifications
You must be signed in to change notification settings - Fork 749
Closed
Description
Motivation
In current design, when the hw bound check feature is enabled (enabled by default for linux/darwin/macos/windows 64-bit), the wasm linear memory access boundary check with hardware trap support and native stack access boundary check with hardware trap support are both enabled by default, which improves the performance, but lacks the accurate control for the native thread's stack:
- It requires to set the guard pages for the native stack and touch the whole native stack's pages firstly, which previously writes the stack memory, and increases the RSS memory usage .
- Normally the main thread's stack size is 8MB and the child thread's stack size is 1MB.
In some environment we hope to reduce the memory usage, and disable the native stack hw bound check feature and keep the linear memory hw bound check feature.
The main changes
To achieve the goal, we will add new options to control the native stack hw bound check feature:
- The linear memory hw bound check and stack hw bound check can work independently. And if the former is set, the latter will be enabled by default if the option isn't set by user, so as to keep the compatibility with current version.
- Besides the original option
cmake -DWAMR_DISABLE_HW_BOUND_CHECK=1/0, add a new cmake variablecmake -DWAMR_DISABLE_STACK_HW_BOUND_CHECK=1/0. - Besides the original option
--bounds-checks=1, add new option--stack-bounds-checks=1for wamrc.
Metadata
Metadata
Assignees
Labels
No labels