Stream: git-wasmtime

Topic: wasmtime / PR #7974 winch: Overhaul the internal ABI


view this post on Zulip Wasmtime GitHub notifications bot (Feb 21 2024 at 16:04):

saulecabrera opened PR #7974 from saulecabrera:winch-overhaul-abi to bytecodealliance:main:

This change overhauls Winch's ABI. This means that as part of this change, the default ABI now closely resembles Cranelift's ABI, particularly on the treatment of the VMContext. This change also fixes many wrong assumptions about trampolines, which are tied to how the previous ABI operated.

The main motivation behind this change is:

The previous implementation had the following characteristics, and wrong assumptions):

This change introduces the following changes, which fix the previous assumptions and bugs:

Finally, given that this change also enables the imports.wast test suite, it also includes a fix to global.{get, set} instructions which didn't account entirely for imported globals.

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (Feb 21 2024 at 16:04):

saulecabrera requested wasmtime-default-reviewers for a review on PR #7974.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 21 2024 at 16:04):

saulecabrera requested cfallin for a review on PR #7974.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 21 2024 at 16:04):

saulecabrera requested wasmtime-compiler-reviewers for a review on PR #7974.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 21 2024 at 16:07):

saulecabrera submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 21 2024 at 16:07):

saulecabrera created PR review comment:

This change is fairly large already, so I opted to just introduce this macro and use it in a couple of places that are updated by this change. My plan is to follow up with a general replace after landing this change (but I can do so here too if preferred).

view this post on Zulip Wasmtime GitHub notifications bot (Feb 21 2024 at 16:09):

saulecabrera edited PR #7974:

This change overhauls Winch's ABI. This means that as part of this change, the default ABI now closely resembles Cranelift's ABI, particularly on the treatment of the VMContext. This change also fixes many wrong assumptions about trampolines, which are tied to how the previous ABI operated.

The main motivation behind this change is:

The previous implementation had the following characteristics, and wrong assumptions):

This change introduces the following changes, which fix the previous assumptions and bugs:

Finally, given that this change also enables the imports.wast test suite, it also includes a fix to global.{get, set} instructions which didn't account entirely for imported globals.

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (Feb 21 2024 at 16:25):

saulecabrera edited PR #7974:

This change overhauls Winch's ABI. This means that as part of this change, the default ABI now closely resembles Cranelift's ABI, particularly on the treatment of the VMContext. This change also fixes many wrong assumptions about trampolines, which are tied to how the previous ABI operated.

The main motivation behind this change is:

The previous implementation had the following characteristics, and wrong assumptions):

This change introduces the following changes, which fix the previous assumptions and bugs:

Finally, given that this change also enables the imports.wast test suite, it also includes a fix to global.{get, set} instructions which didn't account entirely for imported globals.

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (Feb 21 2024 at 16:25):

saulecabrera edited PR #7974:

This change overhauls Winch's ABI. This means that as part of this change, the default ABI now closely resembles Cranelift's ABI, particularly on the treatment of the VMContext. This change also fixes many wrong assumptions about trampolines, which are tied to how the previous ABI operated.

The main motivation behind this change is:

The previous implementation had the following characteristics, and wrong assumptions:

This change introduces the following changes, which fix the previous assumptions and bugs:

Finally, given that this change also enables the imports.wast test suite, it also includes a fix to global.{get, set} instructions which didn't account entirely for imported globals.

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (Feb 21 2024 at 16:26):

saulecabrera edited PR #7974:

This change overhauls Winch's ABI. This means that as part of this change, the default ABI now closely resembles Cranelift's ABI, particularly on the treatment of the VMContext. This change also fixes many wrong assumptions about trampolines, which are tied to how the previous ABI operated.

The main motivation behind this change is:

The previous implementation had the following characteristics, and wrong assumptions:

This change introduces the following changes, which fix the previous assumptions and bugs:

Finally, given that this change also enables the imports.wast test suite, it also includes a fix to global.{get, set} instructions which didn't account entirely for imported globals.

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (Feb 21 2024 at 17:47):

cfallin submitted PR review:

Overall looks great, thanks! Just a few nits below.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 21 2024 at 17:47):

cfallin submitted PR review:

Overall looks great, thanks! Just a few nits below.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 21 2024 at 17:47):

cfallin created PR review comment:

s/the the/the/

view this post on Zulip Wasmtime GitHub notifications bot (Feb 21 2024 at 17:47):

cfallin created PR review comment:

s/paramters/parameters/

view this post on Zulip Wasmtime GitHub notifications bot (Feb 21 2024 at 17:47):

cfallin created PR review comment:

Rather than unchecked, which to me implies lack of a bounds check or similar, can we name this in a way that indicates the index-space is shifted relative to above? E.g. perhaps the above get_local becomes get_wasm_local and get_local_unchecked becomes get_raw_local?

Alternately, avoid exposing get_local_unchecked at all and have two separate methods get_callee_local() / get_caller_local()?

view this post on Zulip Wasmtime GitHub notifications bot (Feb 21 2024 at 17:47):

cfallin created PR review comment:

here and perhaps elsewhere, can we have a constant (maybe an associated constant of ContextArgs) indicating how many args we expect? Basically it'd be nice to tie this to other definitions so that we don't miss it if we ever add, e.g., a third context arg.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 21 2024 at 20:45):

github-actions[bot] commented on PR #7974:

Subscribe to Label Action

cc @saulecabrera

<details>
This issue or pull request has been labeled: "winch"

Thus the following users have been cc'd because of the following labels:

To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.

Learn more.
</details>

view this post on Zulip Wasmtime GitHub notifications bot (Feb 21 2024 at 21:15):

saulecabrera requested wasmtime-fuzz-reviewers for a review on PR #7974.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 21 2024 at 21:15):

saulecabrera requested wasmtime-core-reviewers for a review on PR #7974.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 21 2024 at 21:15):

saulecabrera requested fitzgen for a review on PR #7974.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 21 2024 at 21:15):

saulecabrera updated PR #7974.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 21 2024 at 21:16):

saulecabrera commented on PR #7974:

Oh bad rebase -- sorry about that. Fixing it now.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 21 2024 at 21:20):

saulecabrera updated PR #7974.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 21 2024 at 21:54):

saulecabrera updated PR #7974.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 21 2024 at 21:54):

saulecabrera submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 21 2024 at 21:54):

saulecabrera created PR review comment:

Fixed, thanks!

view this post on Zulip Wasmtime GitHub notifications bot (Feb 21 2024 at 21:54):

saulecabrera submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 21 2024 at 21:54):

saulecabrera created PR review comment:

Fixed!

view this post on Zulip Wasmtime GitHub notifications bot (Feb 21 2024 at 21:55):

saulecabrera submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 21 2024 at 21:55):

saulecabrera created PR review comment:

Thanks for the suggestion -- I ended up with get_frame_local and get_wasm_local to be able to distinguish one from another.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 21 2024 at 21:56):

saulecabrera submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 21 2024 at 21:56):

saulecabrera created PR review comment:

Good catch -- I introduced MAX_CONTEXT_ARGS near the ContextArgs definition, which is used in the trampoline. In the non-trampoline case (normal function calls), the expected number of context arguments is already parametrized through ContextArgs::len

view this post on Zulip Wasmtime GitHub notifications bot (Feb 21 2024 at 23:15):

saulecabrera merged PR #7974.


Last updated: Oct 23 2024 at 20:03 UTC