Stream: git-wasmtime

Topic: wasmtime / issue #2405 MachInst backend: use fallthrough ...


view this post on Zulip Wasmtime GitHub notifications bot (Feb 09 2023 at 08:51):

bjorn3 commented on issue #2405:

The fallthrough instruction no longer exists. This can be closed.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 09 2023 at 08:53):

cfallin closed issue #2405:

In the new backend's BlockLoweringOrder algorithm, we do a DFS to determine the order in which basic blocks should be codegen'd into machine code. The algorithm does a pretty good job of placing edge-blocks appropriately, but does not use hints from the CLIF where it could.

In particular, the fallthrough instruction currently is defined to act like a jump, except that its target must come next in the function block order. It was mostly used in old backends' optimization passes to replace jumps to subsequent blocks, but can also be used by code generators (e.g., Lucet in #2395).

Following #2395, we correctly generate code for fallthrough by just treating it like a jump: thus we accept a superset of codegen behavior that the old backend does, and generate correct code even when blocks are reordered; but we lose the block-ordering hint.

Instead, we should take into account when blocks end in fallthrough and alter the DFS logic in BlockLoweringOrder to prefer fallthrough blocks whenever possible. This will result in better block ordering when the frontend is explicit about it.


Last updated: Dec 23 2024 at 12:05 UTC