RESOLVED FIXED 184600
[WebAssembly][Modules] Prototype wasm import
https://bugs.webkit.org/show_bug.cgi?id=184600
Summary [WebAssembly][Modules] Prototype wasm import
Attachments
Patch (48.46 KB, patch)
2018-04-14 15:06 PDT, Yusuke Suzuki
no flags
Patch (48.52 KB, patch)
2018-04-14 15:19 PDT, Yusuke Suzuki
no flags
Patch (48.51 KB, patch)
2018-04-14 15:23 PDT, Yusuke Suzuki
no flags
Patch (61.48 KB, patch)
2018-04-16 04:33 PDT, Yusuke Suzuki
jfbastien: review+
Yusuke Suzuki
Comment 1 2018-04-14 15:06:53 PDT
Yusuke Suzuki
Comment 2 2018-04-14 15:09:01 PDT
Initial WIP patch. It does not handle well `import` right now. But module pipeline and `export` Just Work (TM). The test like, JS: wasm.js import {sum} from "./sum.wasm" print(sum(2, 3)); WASM: sum.rs => sum.wasm (compiled by nightly rust wasm backend) #[no_mangle] pub fn sum(a: i32, b: i32) -> i32 { a + b } Then, you can run jsc -m wasm.js And it works :D
Yusuke Suzuki
Comment 3 2018-04-14 15:19:56 PDT
Yusuke Suzuki
Comment 4 2018-04-14 15:23:23 PDT
Yusuke Suzuki
Comment 5 2018-04-16 04:33:49 PDT
JF Bastien
Comment 6 2018-04-16 11:23:18 PDT
Comment on attachment 337993 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=337993&action=review Very cool! No need for a runtime flag because this only works in the shell, right? r=me otherwise > Source/JavaScriptCore/jsc.cpp:978 > + Vector<uint8_t> utf8; Rename it to something else than utf8, since it's just bytes in wasm. > Source/JavaScriptCore/runtime/AbstractModuleRecord.cpp:795 > +} lol "virtual" ;-)
Yusuke Suzuki
Comment 7 2018-04-16 19:37:50 PDT
Comment on attachment 337993 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=337993&action=review Yes. Since WebAssemblySourceProvider is only used in the jsc shell, this is only enabled under the jsc shell right now :) >> Source/JavaScriptCore/jsc.cpp:978 >> + Vector<uint8_t> utf8; > > Rename it to something else than utf8, since it's just bytes in wasm. Yeah, fixed. >> Source/JavaScriptCore/runtime/AbstractModuleRecord.cpp:795 >> +} > > lol "virtual" ;-) ;)
Yusuke Suzuki
Comment 8 2018-04-16 19:39:05 PDT
Radar WebKit Bug Importer
Comment 9 2018-04-16 19:40:35 PDT
Matt Lewis
Comment 10 2018-04-17 16:23:51 PDT
This revision caused many failures on the Sierra Debug Test262 tester: https://build.webkit.org/builders/Apple%20Sierra%20Debug%20Test262%20%28Tests%29/builds/1696/steps/test262-test/logs/stdio https://build.webkit.org/builders/Apple%20Sierra%20Debug%20Test262%20%28Tests%29/builds/1696 Most of the failures are running into assertion failures such as: ASSERTION FAILED: !m_needExceptionCheck ./runtime/VM.cpp(1134) : void JSC::VM::verifyExceptionCheckNeedIsSatisfied(unsigned int, JSC::ExceptionEventLocation &)
WebKit Commit Bot
Comment 11 2018-04-17 17:01:30 PDT
Re-opened since this is blocked by bug 184717
Yusuke Suzuki
Comment 12 2018-04-18 02:47:24 PDT
Ryan Haddad
Comment 13 2018-04-18 15:51:35 PDT
There are still crashes on the Debug JSC bot after re-landing: https://build.webkit.org/builders/Apple%20High%20Sierra%20Debug%20JSC%20%28Tests%29/builds/899 Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 jsc 0x00000001034e18dc JSC::JSGlobalObject::vm() const + 12 1 jsc 0x0000000103520401 checkException(JSC::ExecState*, GlobalObject*, bool, bool, JSC::JSValue, CommandLine&, bool&) + 65 2 jsc 0x0000000103527074 runWithOptions(GlobalObject*, CommandLine&)::$_8::operator()(JSC::ExecState*) const + 132 3 jsc 0x0000000103526fe0 long long std::__1::__invoke_void_return_wrapper<long long>::__call<runWithOptions(GlobalObject*, CommandLine&)::$_8&, JSC::ExecState*>(runWithOptions(GlobalObject*, CommandLine&)::$_8&&&, JSC::ExecState*&&) + 80 4 jsc 0x0000000103526f69 std::__1::__function::__func<runWithOptions(GlobalObject*, CommandLine&)::$_8, std::__1::allocator<runWithOptions(GlobalObject*, CommandLine&)::$_8>, long long (JSC::ExecState*)>::operator()(JSC::ExecState*&&) + 57 5 com.apple.JavaScriptCore 0x00000001048bf7e3 std::__1::function<long long (JSC::ExecState*)>::operator()(JSC::ExecState*) const + 83 (functional:1921) 6 com.apple.JavaScriptCore 0x00000001048a4ee2 JSC::runStdFunction(JSC::ExecState*) + 114 (JSNativeStdFunction.cpp:64) 7 ??? 0x000001851edb5185 0 + 1671259967877 8 com.apple.JavaScriptCore 0x00000001036da058 llint_entry + 34231 9 com.apple.JavaScriptCore 0x00000001036d1882 vmEntryToJavaScript + 343 10 com.apple.JavaScriptCore 0x000000010453bc6a JSC::JITCode::execute(JSC::VM*, JSC::ProtoCallFrame*) + 186 (JITCode.cpp:75) 11 com.apple.JavaScriptCore 0x00000001044dc958 JSC::Interpreter::executeCall(JSC::ExecState*, JSC::JSObject*, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) + 1272 (Interpreter.cpp:1028) 12 com.apple.JavaScriptCore 0x000000010475964a JSC::call(JSC::ExecState*, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) + 202 (CallData.cpp:41) 13 com.apple.JavaScriptCore 0x00000001047598da JSC::profiledCall(JSC::ExecState*, JSC::ProfilingReason, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) + 106 (CallData.cpp:61) 14 com.apple.JavaScriptCore 0x0000000104896c47 JSC::JSJobMicrotask::run(JSC::ExecState*) + 647 (JSJob.cpp:81) 15 com.apple.JavaScriptCore 0x0000000104a17673 JSC::QueuedTask::run() + 83 (VM.cpp:1059) 16 com.apple.JavaScriptCore 0x0000000104a17257 JSC::VM::drainMicrotasks() + 135 (VM.cpp:1053) 17 com.apple.JavaScriptCore 0x0000000104978730 JSC::PromiseDeferredTimer::doWork() + 1184 (PromiseDeferredTimer.cpp:71) 18 com.apple.JavaScriptCore 0x00000001048d132e JSC::JSRunLoopTimer::timerDidFire() + 174 (JSRunLoopTimer.cpp:65) 19 com.apple.JavaScriptCore 0x00000001048d176c JSC::JSRunLoopTimer::timerDidFireCallback(__CFRunLoopTimer*, void*) + 28 (JSRunLoopTimer.cpp:105) 20 com.apple.CoreFoundation 0x00007fff46495704 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20 21 com.apple.CoreFoundation 0x00007fff46495384 __CFRunLoopDoTimer + 1108 22 com.apple.CoreFoundation 0x00007fff46494e7a __CFRunLoopDoTimers + 346 23 com.apple.CoreFoundation 0x00007fff4648c61b __CFRunLoopRun + 2427 24 com.apple.CoreFoundation 0x00007fff4648ba07 CFRunLoopRunSpecific + 487 25 com.apple.CoreFoundation 0x00007fff464c9e73 CFRunLoopRun + 99 26 com.apple.JavaScriptCore 0x0000000104978a12 JSC::PromiseDeferredTimer::runRunLoop() + 210 (PromiseDeferredTimer.cpp:100) 27 jsc 0x00000001034e54e4 int runJSC<jscmain(int, char**)::$_3>(CommandLine, bool, jscmain(int, char**)::$_3 const&) + 1508 28 jsc 0x00000001034e3f5f jscmain(int, char**) + 143 29 jsc 0x00000001034e3ebe main + 46 30 libdyld.dylib 0x00007fff6e830015 start + 1
Yusuke Suzuki
Comment 14 2018-04-19 05:35:45 PDT
Note You need to log in before you can comment on or make changes to this bug.