Bug 253298 - Fix control flow with multiple exits on single-pass BBQ JIT
Summary: Fix control flow with multiple exits on single-pass BBQ JIT
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebAssembly (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: David Degazio
URL:
Keywords: InRadar
Depends on:
Blocks: 252209
  Show dependency treegraph
 
Reported: 2023-03-02 23:06 PST by David Degazio
Modified: 2023-03-03 01:03 PST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Degazio 2023-03-02 23:06:30 PST
rdar://106182518

Currently, in control flow instructions with multiple exits (namely br_if and br_table), we assume that the calling convention for each target’s block arguments will be the same. This is not the case universally though: 
 - When targeting the top level block, the results are allocated according to the WASM calling convention, not the block calling convention.
 - If we run out of registers to use for the block calling convention, we pass arguments through WASM canonical stack slots. But the stack height of these may vary between target blocks, even if they have the same signature.

To fix this, we need to modify the ControlData methods currently used to manage control flow blocks, to permit setting up for multiple distinct exit branches per block.
Comment 1 David Degazio 2023-03-02 23:19:51 PST
Pull request: https://github.com/WebKit/WebKit/pull/10988
Comment 2 EWS 2023-03-03 01:03:36 PST
Committed 261122@main (bc648d25c5aa): <https://commits.webkit.org/261122@main>

Reviewed commits have been landed. Closing PR #10988 and removing active labels.