Description
Hey!
I have a relatively big wasm. Without changing any params in the .h files, I get the same issue as mentioned here:
#29
Setting # define d_m3MaxFunctionStackHeight 2000 // max: 32768
to a higher value like 32768 in m3_config.h fixes this issue.
However, then during compiling, I get a wasm3 functionStackOverflow error. I tried setting d_m3MaxFunctionStackHeight, d_m3CodePageAlignSize, d_m3MaxLinearMemoryPages, d_m3MaxFunctionSlots to higher values, also tried increasing DEFAULT_STACK_SIZE_IN_BYTES in index.tsx quite significantly but still could not fix this.
When setting d_m3MaxFunctionStackHeight or d_m3MaxFunctionSlots to too high values, the app crashes with:
Stack trace
Translated Report (Full Report Below)
Incident Identifier: 7F0995AD-D31C-405F-9769-05FDBFCF6B8D
CrashReporter Key: 12E4CBAE-C844-3BC8-4E8E-71727398DB3D
Hardware Model: Mac15,11
Process: NewArchWasmTest [89849]
Path: /Users/USER/Library/Developer/CoreSimulator/Devices/E78ADD59-8336-4D55-820C-982660BB495F/data/Containers/Bundle/Application/D7284E21-5314-4DFC-B91C-49A049D0AE8A/NewArchWasmTest.app/NewArchWasmTest
Identifier: org.reactjs.native.example.NewArchWasmTest
Version: 1.0 (1)
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd_sim [38767]
Coalition: com.apple.CoreSimulator.SimDevice.E78ADD59-8336-4D55-820C-982660BB495F [188543]
Responsible Process: SimulatorTrampoline [9556]
Date/Time: 2024-09-26 12:15:06.2842 +0100
Launch Time: 2024-09-26 12:14:59.5711 +0100
OS Version: macOS 14.1 (23B2073)
Release Type: User
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Subtype: KERN_PROTECTION_FAILURE at 0x000000016f474000
Exception Codes: 0x0000000000000002, 0x000000016f474000
VM Region Info: 0x16f474000 is in 0x16f474000-0x16f478000; bytes after start: 0 bytes before end: 16383
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
Stack 16f3ec000-16f474000 [ 544K] rw-/rwx SM=PRV thread 7
---> STACK GUARD 16f474000-16f478000 [ 16K] ---/rwx SM=NUL ... for thread 5
Stack 16f478000-16f500000 [ 544K] rw-/rwx SM=PRV thread 5
Termination Reason: SIGNAL 10 Bus error: 10
Terminating Process: exc handler [89849]
Triggered by Thread: 7
Thread 0:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x1043bcc10 mach_msg2_trap + 8
1 libsystem_kernel.dylib 0x1043cdda4 mach_msg2_internal + 76
2 libsystem_kernel.dylib 0x1043c4e34 mach_msg_overwrite + 532
3 libsystem_kernel.dylib 0x1043bcf88 mach_msg + 20
4 CoreFoundation 0x1803f1754 __CFRunLoopServiceMachPort + 156
5 CoreFoundation 0x1803ebe34 __CFRunLoopRun + 1148
6 CoreFoundation 0x1803eb5a4 CFRunLoopRunSpecific + 572
7 GraphicsServices 0x18e9fbae4 GSEventRunModal + 160
8 UIKitCore 0x1852f02e4 -[UIApplication _run] + 868
9 UIKitCore 0x1852f3f5c UIApplicationMain + 124
10 NewArchWasmTest 0x100bc152c main + 96 (main.m:8)
11 dyld_sim 0x103425544 start_sim + 20
12 dyld 0x1034de0e0 start + 2360
Thread 1:
0 libsystem_pthread.dylib 0x1042d66dc start_wqthread + 0
Thread 2:
0 libsystem_pthread.dylib 0x1042d66dc start_wqthread + 0
Thread 3:
0 libsystem_pthread.dylib 0x1042d66dc start_wqthread + 0
Thread 4:: com.apple.uikit.eventfetch-thread
0 libsystem_kernel.dylib 0x1043bcc10 mach_msg2_trap + 8
1 libsystem_kernel.dylib 0x1043cdda4 mach_msg2_internal + 76
Thread 5:
0 libsystem_pthread.dylib 0x1042d66dc start_wqthread + 0
Thread 6:
0 libsystem_pthread.dylib 0x1042d66dc start_wqthread + 0
Thread 7 Crashed:: com.facebook.react.runtime.JavaScript
0 libsystem_platform.dylib 0x1034af4c4 __bzero + 68
1 NewArchWasmTest 0x10151703c Parse_InitExpr + 88 (m3_parse.c:297)
2 NewArchWasmTest 0x1015178e8 ParseSection_Global + 460 (m3_parse.c:469)
3 NewArchWasmTest 0x101517de4 ParseModuleSection + 152 (m3_parse.c:580)
4 NewArchWasmTest 0x101518110 m3_ParseModule + 784 (m3_parse.c:634)
5 NewArchWasmTest 0x101523970 wasm3::module::parse(M3Environment*, unsigned char const*, unsigned long) + 60 (wasm3_cpp.h:302)
6 NewArchWasmTest 0x1015237f8 wasm3::module::module(std::__1::shared_ptr const&, unsigned char const*, unsigned long) + 196 (wasm3_cpp.h:297)
7 NewArchWasmTest 0x101523724 wasm3::module::module(std::__1::shared_ptr const&, unsigned char const*, unsigned long) + 52 (wasm3_cpp.h:295)
8 NewArchWasmTest 0x1015217fc wasm3::environment::parse_module(unsigned char const*, unsigned long) + 60 (wasm3_cpp.h:466)
9 NewArchWasmTest 0x101520e7c webassembly::install(facebook::jsi::Runtime&)::$_0::operator()(facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long) const + 616 (react-native-webassembly.cpp:379)
10 NewArchWasmTest 0x101520c08 decltype(std::declvalwebassembly::install(facebook::jsi::Runtime&)::$_0&()(std::declvalfacebook::jsi::Runtime&(), std::declval<facebook::jsi::Value const&>(), std::declval<facebook::jsi::Value const*>(), std::declval())) std::__1::__invoke[abi:ue170006]<webassembly::install(facebook::jsi::Runtime&)::$_0&, facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long>(webassembly::install(facebook::jsi::Runtime&)::$_0&, facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*&&, unsigned long&&) + 72 (invoke.h:340)
11 NewArchWasmTest 0x101520b90 facebook::jsi::Value std::__1::__invoke_void_return_wrapper<facebook::jsi::Value, false>::__call[abi:ue170006]<webassembly::install(facebook::jsi::Runtime&)::$_0&, facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long>(webassembly::install(facebook::jsi::Runtime&)::$_0&, facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*&&, unsigned long&&) + 64 (invoke.h:407)
12 NewArchWasmTest 0x101520b44 std::__1::__function::__alloc_func<webassembly::install(facebook::jsi::Runtime&)::$_0, std::__1::allocatorwebassembly::install(facebook::jsi::Runtime&)::$_0, facebook::jsi::Value (facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long)>::operator()[abi:ue170006](facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*&&, unsigned long&&) + 72 (function.h:193)
13 NewArchWasmTest 0x10151f98c std::__1::__function::__func<webassembly::install(facebook::jsi::Runtime&)::$_0, std::__1::allocatorwebassembly::install(facebook::jsi::Runtime&)::$_0, facebook::jsi::Value (facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long)>::operator()(facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*&&, unsigned long&&) + 68 (function.h:364)
14 NewArchWasmTest 0x1012bfe34 std::__1::__function::__value_func<facebook::jsi::Value (facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long)>::operator()[abi:ue170006](facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*&&, unsigned long&&) const + 112 (function.h:518)
15 NewArchWasmTest 0x1012bfda0 std::__1::function<facebook::jsi::Value (facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long)>::operator()(facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long) const + 72 (function.h:1169)
16 NewArchWasmTest 0x1012bfd4c facebook::jsi::DecoratedHostFunction::operator()(facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long) + 84 (decorator.h:36)
17 NewArchWasmTest 0x1012bfcec decltype(std::declvalfacebook::jsi::DecoratedHostFunction&()(std::declvalfacebook::jsi::Runtime&(), std::declval<facebook::jsi::Value const&>(), std::declval<facebook::jsi::Value const*>(), std::declval())) std::__1::__invoke[abi:ue170006]<facebook::jsi::DecoratedHostFunction&, facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long>(facebook::jsi::DecoratedHostFunction&, facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*&&, unsigned long&&) + 72 (invoke.h:340)
18 NewArchWasmTest 0x1012bfc74 facebook::jsi::Value std::__1::__invoke_void_return_wrapper<facebook::jsi::Value, false>::__call[abi:ue170006]<facebook::jsi::DecoratedHostFunction&, facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long>(facebook::jsi::DecoratedHostFunction&, facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*&&, unsigned long&&) + 64 (invoke.h:407)
19 NewArchWasmTest 0x1012bfc28 std::__1::__function::__alloc_func<facebook::jsi::DecoratedHostFunction, std::__1::allocatorfacebook::jsi::DecoratedHostFunction, facebook::jsi::Value (facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long)>::operator()[abi:ue170006](facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*&&, unsigned long&&) + 72 (function.h:193)
20 NewArchWasmTest 0x1012be854 std::__1::__function::__func<facebook::jsi::DecoratedHostFunction, std::__1::allocatorfacebook::jsi::DecoratedHostFunction, facebook::jsi::V
Activity