Hello! Following up on this because I am experiencing some unusual behavior when trying to actually use stringrefs after enabling them. So I've enabled stringref by calling v8::V8::SetFlagsFromString("--experimental-wasm-stringref"), which seems to do the trick because now I'm able to compile and run modules that have a stringref table in them. My issue arises when I try to actually use a stringref to do anything. Even a simple hello world function seems to be throwing with an unreachable error.
For example, the following WASM module:
(module
(type $0 (func (result stringref)))
(memory $0 1 10)
(table $ThetaStringRefs 1000 100000000 stringref)
(export "memory" (memory $0))
(export "main0" (func $main0))
(func $main0 (result stringref)
(string.const "Hello, world!")
)
)
errors out with the following stacktrace:
==== C stack trace ===============================
0 CodegenTest 0x000000010491e643 v8::base::debug::StackTrace::StackTrace() + 19
1 CodegenTest 0x00000001049250cb v8::platform::(anonymous namespace)::PrintStackTrace() + 27
2 CodegenTest 0x0000000104910e1d V8_Fatal(char const*, ...) + 365
3 CodegenTest 0x00000001048fd726 wasm::(anonymous namespace)::FunctionSigToFuncType(v8::internal::Signature<v8::internal::wasm::ValueType> const*) + 838
4 CodegenTest 0x00000001048fae9e wasm::(anonymous namespace)::GetImportExportType(v8::internal::wasm::WasmModule const*, v8::internal::wasm::ImportExportKindCode, unsigned int) + 62
5 CodegenTest 0x00000001048fb39f wasm::ExportsImpl(v8::internal::Handle<v8::internal::WasmModuleObject>) + 527
6 CodegenTest 0x00000001048fb4ed wasm::Module::exports() const + 61
7 CodegenTest 0x00000001047077e1 Theta::Runtime::execute(std::__1::vector<char, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) + 593
8 CodegenTest 0x000000010470656b CodeGenTest::setup(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) + 1531
9 CodegenTest 0x00000001046ff5d6 (anonymous namespace)::CATCH2_INTERNAL_TEST_0::test() + 7574
10 CodegenTest 0x000000010474b4de Catch::TestInvokerAsMethod<(anonymous namespace)::CATCH2_INTERNAL_TEST_0>::invoke() const + 158
11 CodegenTest 0x0000000104827009 Catch::TestCaseHandle::invoke() const + 25
12 CodegenTest 0x0000000104826e41 Catch::RunContext::invokeActiveTestCase() + 49
13 CodegenTest 0x0000000104824c79 Catch::RunContext::runCurrentTest(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) + 1129
14 CodegenTest 0x0000000104823f88 Catch::RunContext::runTest(Catch::TestCaseHandle const&) + 632
15 CodegenTest 0x000000010480f025 Catch::(anonymous namespace)::TestGroup::execute() + 181
16 CodegenTest 0x000000010480e106 Catch::Session::runInternal() + 1062
17 CodegenTest 0x000000010480dc77 Catch::Session::run() + 87
18 CodegenTest 0x00000001048203ca int Catch::Session::run<char>(int, char const* const*) + 90
19 CodegenTest 0x000000010482030f main + 63
20 dyld 0x0000000207ffe52e start + 462
21 dyld 0x0000000207ff9000 dyld + 0
Trace/BPT trap: 5
It seems that v8 is having some issue with creating the exports for this function that has a stringref as its return type.
Any pointers would be greatly appreciated.
Cheers,
Alex