Closed Bug 1909224 Opened 1 year ago Closed 1 year ago

Unify Wasm and JIT exception handlers more

Categories

(Core :: JavaScript: WebAssembly, task)

task

Tracking

()

RESOLVED FIXED
130 Branch
Tracking Status
firefox130 --- fixed

People

(Reporter: jandem, Assigned: jandem)

References

Details

Attachments

(3 files)

When unwinding for an exception, we currently return to trampoline code whenever we have a JS JIT <=> Wasm boundary and then re-enter the other side's exception handler code. We can restructure this a bit to support unwinding these frames directly.

We can also share more code between GenerateThrowStub and the JIT exception handler trampoline.

This also lets us remove a branch (on FailInstanceReg) on the JIT => Wasm call path.

The next patch will use this to jump here from the Wasm throw stub.

If there's no JS or Wasm catch handler on the stack, this patch lets us unwind
all the way to the entry frame in all cases, instead of resuming to the JIT entry
stub and then calling the JS JIT exception handler again.

This means we now have to handle all ResumeFromException::Kind values in
GenerateThrowStub. This patch supports that by jumping to the JS JIT exception
handler trampoline code after calling WasmHandleThrow. This should also shrink
the size of the Wasm throw stub.

Because we now unwind JS JIT frames after unwinding Wasm frames, we no longer
return to the JIT => Wasm entry code from the exception handler.

To make this a bit clearer, the patch renames FailInstanceReg to InterpFailInstanceReg
and ExceptionResumeKind::Wasm to ExceptionResumeKind::WasmInterpEntry.

Pushed by jdemooij@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d8768f163b46 part 1 - Record location of return value check in JIT exception handler trampoline. r=rhunt https://hg.mozilla.org/integration/autoland/rev/6eb32b942a04 part 2 - Unify Wasm and JS exception handling code more. r=rhunt https://hg.mozilla.org/integration/autoland/rev/364d4e24bc13 part 3 - Remove checks for FailInstanceReg on JIT => Wasm call path. r=rhunt
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 130 Branch
Regressions: 1910880
Blocks: 1911242
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: