Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
16 changes: 15 additions & 1 deletion core/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,27 +286,41 @@
#define WASM_THREAD_AUX_STACK_SIZE_MIN (256)

/* Default/min/max 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
#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
#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
#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
4 changes: 2 additions & 2 deletions core/shared/platform/android/platform_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ typedef pthread_t korp_thread;

#define bh_socket_t int

#if WASM_DISABLE_HW_BOUND_CHECK == 0
#if WASM_DISABLE_HW_BOUND_CHECK == 0 && WASM_ENABLE_AOT != 0
#if defined(BUILD_TARGET_X86_64) || defined(BUILD_TARGET_AMD_64) \
|| defined(BUILD_TARGET_AARCH64) || defined(BUILD_TARGET_RISCV64_LP64D) \
|| defined(BUILD_TARGET_RISCV64_LP64)
Expand Down Expand Up @@ -94,7 +94,7 @@ os_signal_unmask();
void
os_sigreturn();
#endif /* end of BUILD_TARGET_X86_64/AMD_64/AARCH64/RISCV64 */
#endif /* end of WASM_DISABLE_HW_BOUND_CHECK */
#endif /* end of WASM_DISABLE_HW_BOUND_CHECK == 0 && WASM_ENABLE_AOT != 0 */

typedef long int __syscall_slong_t;

Expand Down
4 changes: 2 additions & 2 deletions core/shared/platform/darwin/platform_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ typedef pthread_t korp_thread;

#define bh_socket_t int

#if WASM_DISABLE_HW_BOUND_CHECK == 0
#if WASM_DISABLE_HW_BOUND_CHECK == 0 && WASM_ENABLE_AOT != 0
#if defined(BUILD_TARGET_X86_64) || defined(BUILD_TARGET_AMD_64) \
|| defined(BUILD_TARGET_AARCH64) || defined(BUILD_TARGET_RISCV64_LP64D) \
|| defined(BUILD_TARGET_RISCV64_LP64)
Expand Down Expand Up @@ -95,7 +95,7 @@ os_signal_unmask();
void
os_sigreturn();
#endif /* end of BUILD_TARGET_X86_64/AMD_64/AARCH64/RISCV64 */
#endif /* end of WASM_DISABLE_HW_BOUND_CHECK */
#endif /* end of WASM_DISABLE_HW_BOUND_CHECK == 0 && WASM_ENABLE_AOT != 0 */

#ifdef __cplusplus
}
Expand Down
4 changes: 2 additions & 2 deletions core/shared/platform/linux/platform_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ typedef pthread_t korp_thread;

#define bh_socket_t int

#if WASM_DISABLE_HW_BOUND_CHECK == 0
#if WASM_DISABLE_HW_BOUND_CHECK == 0 && WASM_ENABLE_AOT != 0
#if defined(BUILD_TARGET_X86_64) || defined(BUILD_TARGET_AMD_64) \
|| defined(BUILD_TARGET_AARCH64) || defined(BUILD_TARGET_RISCV64_LP64D) \
|| defined(BUILD_TARGET_RISCV64_LP64)
Expand Down Expand Up @@ -94,7 +94,7 @@ os_signal_unmask();
void
os_sigreturn();
#endif /* end of BUILD_TARGET_X86_64/AMD_64/AARCH64/RISCV64 */
#endif /* end of WASM_DISABLE_HW_BOUND_CHECK */
#endif /* end of WASM_DISABLE_HW_BOUND_CHECK == 0 && WASM_ENABLE_AOT != 0 */

#ifdef __cplusplus
}
Expand Down
2 changes: 1 addition & 1 deletion core/shared/platform/vxworks/platform_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ typedef pthread_t korp_thread;

#define os_thread_local_attribute __thread

#if WASM_DISABLE_HW_BOUND_CHECK == 0
#if WASM_DISABLE_HW_BOUND_CHECK == 0 && WASM_ENABLE_AOT != 0
#if defined(BUILD_TARGET_X86_64) || defined(BUILD_TARGET_AMD_64) \
|| defined(BUILD_TARGET_AARCH64)

Expand Down
4 changes: 2 additions & 2 deletions core/shared/platform/windows/platform_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ os_mem_decommit(void *ptr, size_t size);
#define strncasecmp _strnicmp
#define strcasecmp _stricmp

#if WASM_DISABLE_HW_BOUND_CHECK == 0
#if WASM_DISABLE_HW_BOUND_CHECK == 0 && WASM_ENABLE_AOT != 0
#if defined(BUILD_TARGET_X86_64) || defined(BUILD_TARGET_AMD_64)

#include <setjmp.h>
Expand All @@ -102,7 +102,7 @@ os_thread_signal_inited();
#define os_sigreturn() (void)0

#endif /* end of BUILD_TARGET_X86_64/AMD_64 */
#endif /* end of WASM_DISABLE_HW_BOUND_CHECK */
#endif /* end of WASM_DISABLE_HW_BOUND_CHECK == 0 && WASM_ENABLE_AOT != 0 */

#ifdef __cplusplus
}
Expand Down