alexcrichton opened PR #9794 from alexcrichton:pulley-condition-refactor
to bytecodealliance:main
:
This commit first fixed an issue with table access codegen to disable
spectre mitigations on Pulley targets like how spectre is disabled for
memory accesses as well. This unblocked many tests related to tables
which then led to a different error about atrapnz
with an 8-bit value
not being supported.In fixing
trapnz
with 8-bit values this PR went ahead and did a
general-purpose refactoring for how conditional branches are managed.
Previously conditional traps and conditional branches had some
duplicated logic and the goal was to unify everything. There is now a
singleCond
which represents the condition of a conditional jump which
is used uniformly for all locations such asselect
,brif
, and
trap[n]z
. This new type represents all the sorts of conditional
branches that can be done in Pulley, for example integer comparisons and
whether or not a register is zero. ThisCond
type has various helpers
for printing it, inverting it, collecting operands, emission, etc.The end result is that it's a bit wordy to work with
Cond
right now
due to the size of the variants but all locations working with
conditional traps are deduplicated and now it's just repetitive logic
rather than duplicated logic.Putting all of this together gets a large batch of spec tests working.
I'll note that this does remove a feature where
trapnz
was turned into
nothing or an unconditional trap if the argument was a constant, but
that feels like an optimization perhaps best left for the middle-end
rather than doing it in the backend.
alexcrichton requested cfallin for a review on PR #9794.
alexcrichton requested wasmtime-compiler-reviewers for a review on PR #9794.
alexcrichton requested wasmtime-core-reviewers for a review on PR #9794.
alexcrichton requested fitzgen for a review on PR #9794.
alexcrichton requested wasmtime-default-reviewers for a review on PR #9794.
alexcrichton commented on PR #9794:
Note this is currently based on https://github.com/bytecodealliance/wasmtime/pull/9793
github-actions[bot] commented on PR #9794:
Subscribe to Label Action
cc @cfallin, @fitzgen
<details>
This issue or pull request has been labeled: "cranelift", "isle", "pulley", "wasmtime:api"Thus the following users have been cc'd because of the following labels:
- cfallin: isle
- fitzgen: isle, pulley
To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.
Learn more.
</details>
alexcrichton updated PR #9794.
alexcrichton edited a comment on PR #9794:
~~Note this is currently based on https://github.com/bytecodealliance/wasmtime/pull/9793~~
fitzgen commented on PR #9794:
I'll note that this does remove a feature where
trapnz
was turned into
nothing or an unconditional trap if the argument was a constant, but
that feels like an optimization perhaps best left for the middle-end
rather than doing it in the backend.Agreed that ideally that would happen in the mid-end, but FWIW the mid-end doesn't have the power to do that currently. I think it is ultimately fine to remove this now tho, and if it is ever an issue in the future we can address it again at that point.
fitzgen submitted PR review.
fitzgen merged PR #9794.
Last updated: Dec 23 2024 at 12:05 UTC