[webkit-changes] [WebKit/WebKit] 46c40d: [JSC] Use DataOnlyCallLinkInfo in WasmToJS thunk

Yusuke Suzuki noreply at github.com
Fri May 24 09:29:50 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 46c40d49e8caf1419e909ba6bcebc2c8c68b0738
      https://github.com/WebKit/WebKit/commit/46c40d49e8caf1419e909ba6bcebc2c8c68b0738
  Author: Yusuke Suzuki <ysuzuki at apple.com>
  Date:   2024-05-24 (Fri, 24 May 2024)

  Changed paths:
    M Source/JavaScriptCore/heap/Heap.cpp
    M Source/JavaScriptCore/jit/JITInlines.h
    M Source/JavaScriptCore/wasm/WasmCallee.cpp
    M Source/JavaScriptCore/wasm/WasmCallee.h
    M Source/JavaScriptCore/wasm/WasmEntryPlan.cpp
    M Source/JavaScriptCore/wasm/WasmEntryPlan.h
    M Source/JavaScriptCore/wasm/WasmInstance.cpp
    M Source/JavaScriptCore/wasm/WasmInstance.h
    M Source/JavaScriptCore/wasm/WasmModule.cpp
    M Source/JavaScriptCore/wasm/WasmModule.h
    M Source/JavaScriptCore/wasm/js/JSWebAssemblyInstance.cpp
    M Source/JavaScriptCore/wasm/js/JSWebAssemblyInstance.h
    M Source/JavaScriptCore/wasm/js/JSWebAssemblyModule.cpp
    M Source/JavaScriptCore/wasm/js/JSWebAssemblyModule.h
    M Source/JavaScriptCore/wasm/js/WasmToJS.cpp
    M Source/JavaScriptCore/wasm/js/WasmToJS.h

  Log Message:
  -----------
  [JSC] Use DataOnlyCallLinkInfo in WasmToJS thunk
https://bugs.webkit.org/show_bug.cgi?id=274636
rdar://128663255

Reviewed by Justin Michaud.

This is preparation for offloading thunk generation from the main thread to the wasm compiler threads.
Now, we introduced DataOnlyCallLinkInfo. So we can use it in WasmToJS thunk. Previously, we were using
CallLinkInfo here, and since this is tied to each executing thread, we needed to generate code with CallLinkInfo
for each WasmModule instance in each thread (if there are multiple workers, they need to generate these thunks
with linked CallLinkInfo to each worker VM). But now, DataOnlyCallLinkInfo can decopule the code from the IC,
so now the patch makes the code independent from VM and IC. We generate thunk in WasmEntryPlan, and we instantiate
DataOnlyCallLinkInfo instances on Wasm::Instance. This design allows us to generate these thunks in wasm compiler thread
in the future, which can accelerate wasm startup time.

* Source/JavaScriptCore/heap/Heap.cpp:
(JSC::Heap::finalizeUnconditionalFinalizers):
(JSC::Heap::deleteAllCodeBlocks):
* Source/JavaScriptCore/jit/JITInlines.h:
(JSC::JIT::appendCallWithExceptionCheck):
* Source/JavaScriptCore/wasm/WasmCallee.cpp:
(JSC::Wasm::WasmToJSCallee::singleton):
* Source/JavaScriptCore/wasm/WasmCallee.h:
* Source/JavaScriptCore/wasm/WasmEntryPlan.cpp:
(JSC::Wasm::EntryPlan::prepare):
(JSC::Wasm::EntryPlan::generateWasmToWasmStubs):
(JSC::Wasm::EntryPlan::generateWasmToJSStubs):
* Source/JavaScriptCore/wasm/WasmEntryPlan.h:
(JSC::Wasm::EntryPlan::takeWasmToJSExitStubs):
* Source/JavaScriptCore/wasm/WasmInstance.cpp:
(JSC::Wasm::Instance::Instance):
(JSC::Wasm::Instance::~Instance):
* Source/JavaScriptCore/wasm/WasmInstance.h:
(JSC::Wasm::Instance::ImportFunctionInfo::offsetOfCallLinkInfo):
(JSC::Wasm::Instance::offsetOfCallLinkInfo):
* Source/JavaScriptCore/wasm/WasmModule.cpp:
(JSC::Wasm::Module::Module):
* Source/JavaScriptCore/wasm/WasmModule.h:
(JSC::Wasm::Module::importFunctionStub):
(JSC::Wasm::Module::wasmToJSCallee): Deleted.
* Source/JavaScriptCore/wasm/js/JSWebAssemblyInstance.cpp:
(JSC::JSWebAssemblyInstance::~JSWebAssemblyInstance):
(JSC::JSWebAssemblyInstance::finalizeCreation):
(JSC::JSWebAssemblyInstance::clearJSCallICs):
(JSC::JSWebAssemblyInstance::finalizeUnconditionally):
* Source/JavaScriptCore/wasm/js/JSWebAssemblyInstance.h:
* Source/JavaScriptCore/wasm/js/JSWebAssemblyModule.cpp:
(JSC::JSWebAssemblyModule::createStub):
(JSC::JSWebAssemblyModule::clearJSCallICs): Deleted.
(JSC::JSWebAssemblyModule::finalizeUnconditionally): Deleted.
(JSC::JSWebAssemblyModule::generateWasmToJSStubs): Deleted.
* Source/JavaScriptCore/wasm/js/JSWebAssemblyModule.h:
* Source/JavaScriptCore/wasm/js/WasmToJS.cpp:
(JSC::Wasm::wasmToJS):
(JSC::Wasm::emitThrowWasmToJSException):
* Source/JavaScriptCore/wasm/js/WasmToJS.h:

Canonical link: https://commits.webkit.org/279275@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list