Bug 168264 - WebAssembly: make code position independent
Summary: WebAssembly: make code position independent
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Saam Barati
URL:
Keywords: InRadar
Depends on: 169611 169773 170207 170210 170261 170312 170488 170573 170632
Blocks: 166480 166481
  Show dependency treegraph
 
Reported: 2017-02-13 16:14 PST by JF Bastien
Modified: 2017-04-13 19:12 PDT (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description JF Bastien 2017-02-13 16:14:09 PST
We'll want to be able to save a WebAssembly.Module's code in IndexDB (#166481) and postMessage (#166480) the WebAssembly.Module cheaply to other workers without having to patch pointers and duplicate physical pages used for code. This allows us to instantiate the same module waaayyy better.

Right now our implementation has some pointers baked in: &VM.topInstance, and functions for back traces. We'll want to do away with this.

The easiest and fastest thing is probably to store the topInstance in a TLS slot, and then change it when entering js->wasm, doing wasm->wasm calls, and when in a worker (nothing to do here really, it's the same mechanism).
Comment 1 JF Bastien 2017-03-13 13:59:17 PDT
There's also code in the trap handling which needs to be updated. It has ([codebegin, codeend) + VM) structures, and the signal handlers have thunks.
Comment 2 Radar WebKit Bug Importer 2017-03-29 17:23:38 PDT
<rdar://problem/31335594>
Comment 3 Saam Barati 2017-04-13 19:12:02 PDT
This is done as of:
https://trac.webkit.org/changeset/215353/webkit