Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions build-scripts/config_common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ endif ()
if (WAMR_DISABLE_HW_BOUND_CHECK EQUAL 1)
add_definitions (-DWASM_DISABLE_HW_BOUND_CHECK=1)
message (" Hardware boundary check disabled")
elseif (NOT WAMR_BUILD_AOT EQUAL 1)
# Enable memory access boundary check with hardware trap
# only when AOT/JIT is enabled
add_definitions (-DWASM_DISABLE_HW_BOUND_CHECK=1)
else ()
add_definitions (-DWASM_DISABLE_HW_BOUND_CHECK=0)
endif ()
Expand Down
23 changes: 21 additions & 2 deletions core/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,28 +285,47 @@
/* Min auxilliary stack size of each wasm thread */
#define WASM_THREAD_AUX_STACK_SIZE_MIN (256)

/* Default/min/max stack size of each app thread */
/* Default/min native stack size of each app thread */
#if !(defined(APP_THREAD_STACK_SIZE_DEFAULT) \
&& defined(APP_THREAD_STACK_SIZE_MIN))
#if defined(BH_PLATFORM_ZEPHYR) || defined(BH_PLATFORM_ALIOS_THINGS) \
|| defined(BH_PLATFORM_ESP_IDF) || defined(BH_PLATFORM_OPENRTOS)
#define APP_THREAD_STACK_SIZE_DEFAULT (6 * 1024)
#define APP_THREAD_STACK_SIZE_MIN (4 * 1024)
#elif defined(PTHREAD_STACK_DEFAULT) && defined(PTHREAD_STACK_MIN)
#define APP_THREAD_STACK_SIZE_DEFAULT PTHREAD_STACK_DEFAULT
#define APP_THREAD_STACK_SIZE_MIN PTHREAD_STACK_MIN
#elif WASM_ENABLE_UVWASI != 0
/* UVWASI requires larger native stack */
#define APP_THREAD_STACK_SIZE_DEFAULT (64 * 1024)
#define APP_THREAD_STACK_SIZE_MIN (48 * 1024)
#else
#define APP_THREAD_STACK_SIZE_DEFAULT (32 * 1024)
#define APP_THREAD_STACK_SIZE_MIN (24 * 1024)
#endif
#endif /* end of !(defined(APP_THREAD_STACK_SIZE_DEFAULT) \
&& defined(APP_THREAD_STACK_SIZE_MIN)) */

/* Max native stack size of each app thread */
#if !defined(APP_THREAD_STACK_SIZE_MAX)
#define APP_THREAD_STACK_SIZE_MAX (8 * 1024 * 1024)
#endif

/* Reserved bytes to the native thread stack boundary, throw native
stack overflow exception if the guard boudary is reached */
#define RESERVED_BYTES_TO_NATIVE_STACK_BOUNDARY (512)
#ifndef RESERVED_BYTES_TO_NATIVE_STACK_BOUNDARY
#if WASM_ENABLE_UVWASI != 0
/* UVWASI requires larger native stack */
#define RESERVED_BYTES_TO_NATIVE_STACK_BOUNDARY (4096 * 6)
#else
#define RESERVED_BYTES_TO_NATIVE_STACK_BOUNDARY (1024)
#endif
#endif

/* Guard page count for stack overflow check with hardware trap */
#ifndef STACK_OVERFLOW_CHECK_GUARD_PAGE_COUNT
#define STACK_OVERFLOW_CHECK_GUARD_PAGE_COUNT 3
#endif

/* Default wasm block address cache size and conflict list size */
#ifndef BLOCK_ADDR_CACHE_SIZE
Expand Down