Bug 261403 - WASM should not depend on JIT
Summary: WASM should not depend on JIT
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Ross Kirsling
URL:
Keywords: InRadar
Depends on: 267481
Blocks:
  Show dependency treegraph
 
Reported: 2023-09-11 04:18 PDT by Ross Kirsling
Modified: 2024-04-12 13:38 PDT (History)
3 users (show)

See Also:


Attachments
Minimal changes to build (without implementing replacement functionality) (23.60 KB, patch)
2023-09-11 04:34 PDT, Ross Kirsling
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ross Kirsling 2023-09-11 04:18:46 PDT
We need an actual interpreter, not a technicality.
Comment 1 Ross Kirsling 2023-09-11 04:34:20 PDT
Created attachment 467638 [details]
Minimal changes to build (without implementing replacement functionality)

Here's a patch showing what it takes to build with !ENABLE(JIT) && ENABLE(WEBASSEMBLY) at current HEAD.

Many of these changes really are places where we're assuming that ENABLE(WEBASSEMBLY) implies ENABLE(JIT) and thus could be landed separately if we wanted.
(Note that IPInt is presently WIP so I have nothing I can say about it.)

---

This patch is obviously not meant to be run; in order to make this actually work, we'll at a minimum need to migrate two JIT thunks to offlineasm:

1. "JS->WebAssembly entrypoint[i]" (which handles the args and result for each call) is the big daunting thing, since it amounts to all of JSToWasm.cpp.

2. "Wasm LLInt entry thunks" in LLIntPlan::didCompleteCompilation (a single thunk providing a jump label for each LLIntCallee) is much smaller to translate but less clear how to connect up.
Presumably we still make our vector of callees as usual in WasmLLIntPlan.cpp (no JIT involved there), but there's an llint op which references the appropriate callee (somehow), stores a pointer to it on the stack, and jumps to wasm_function_prologue?

There's also the IC stuff, but that can be safely postponed to a ticket beyond this one.
Comment 2 Radar WebKit Bug Importer 2023-09-18 04:19:13 PDT
<rdar://problem/115650978>
Comment 3 Justin Michaud 2024-04-12 13:36:53 PDT
This patch does the first step to making this work, and can run some simple wasm in the no jit case: https://bugs.webkit.org/show_bug.cgi?id=267481
Comment 4 Justin Michaud 2024-04-12 13:38:36 PDT
I have assigned this to you Ross, since I think you should be able to land much of this and have it run now without too much work