Stream: git-wasmtime

Topic: wasmtime / PR #10609 Cranelift: move exception-handler me...


view this post on Zulip Wasmtime GitHub notifications bot (Apr 17 2025 at 17:39):

cfallin requested fitzgen for a review on PR #10609.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 17 2025 at 17:39):

cfallin opened PR #10609 from cfallin:exceptions-at-call-sites to bytecodealliance:main:

This PR starts with a cherry-pick of @bjorn3's work at [1], which switches exception-handler metadata from a separate list of records (of callsite offset, tag, handler offset tuples) to per-callsite (tag, handler) tuples. This is cleaner for both the native-code use-case and for our planned Wasmtime use-case: in both cases one knows the specific callsite in each frame and wants to look at handlers only for that callsite. The old representation was designed for fast emission and flat storage, but we can get flat storage with this semantic structure as well...

... with the second commit, in which I've updated @bjorn3's implementation to keep a separate vector of handler tuples in the MachBuffer, and refer to ranges in this vector in the callsite metadata. It also provides an iterator that yields per-callsite information in a safe way.

No functional change in-tree (because Cranelift and Wasmtime both do not use this metadata yet) but should enable cg_clif to use our exception support for native unwind.

Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com>

[1]: https://github.com/bjorn3/wasmtime/commit/72c68f2c68ee3fe3159e203c6277d5322844ad37#diff-f9524bac9108c13ddfe351160d287ab858d4e815181a867e56fa5382e5bd564e

view this post on Zulip Wasmtime GitHub notifications bot (Apr 17 2025 at 17:39):

cfallin requested wasmtime-compiler-reviewers for a review on PR #10609.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 17 2025 at 18:08):

bjorn3 submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 17 2025 at 18:08):

bjorn3 created PR review comment:

This doesn't need to be a separate type anymore as MachCallSite no longer contains MachLabels.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 17 2025 at 18:13):

bjorn3 submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 17 2025 at 18:13):

bjorn3 created PR review comment:

Or actually, maybe we should store MachCallSite and have buffer.call_sites() return owned FInalizedMachCallSite<'a> values with the exception_handler_range field replaced by exception_handler: &'a [(PackedOption<ir::ExceptionTag>, CodeOffset)]?

view this post on Zulip Wasmtime GitHub notifications bot (Apr 17 2025 at 18:13):

bjorn3 edited PR review comment.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 17 2025 at 18:30):

bjorn3 submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 17 2025 at 18:30):

bjorn3 created PR review comment:

Looks like line 2525 needs to be changed to buf.reserve_labels_for_blocks(3);.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 17 2025 at 18:38):

cfallin updated PR #10609.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 17 2025 at 18:38):

cfallin submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 17 2025 at 18:38):

cfallin created PR review comment:

Yep, that explains the failures in CI, thanks!

view this post on Zulip Wasmtime GitHub notifications bot (Apr 17 2025 at 18:38):

cfallin submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 17 2025 at 18:38):

cfallin created PR review comment:

Ah, yes, I like the latter option a lot -- updated, thanks!

view this post on Zulip Wasmtime GitHub notifications bot (Apr 17 2025 at 18:39):

cfallin updated PR #10609.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 17 2025 at 18:45):

bjorn3 submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 17 2025 at 18:45):

bjorn3 created PR review comment:

Shouldn't these all say "relative to the containing function"? There can be multiple functions in a single section.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 17 2025 at 18:51):

bjorn3 submitted PR review:

Tested with cg_clif.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 17 2025 at 18:54):

cfallin updated PR #10609.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 17 2025 at 18:54):

cfallin submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 17 2025 at 18:54):

cfallin created PR review comment:

I think the existing wording with "section" was added when we began using the MachBuffer to fix up calls between functions in a module as well. I suspect "buffer" is probably the neutral word here -- they are offsets into whatever the MachBuffer is representing. Updated!

view this post on Zulip Wasmtime GitHub notifications bot (Apr 18 2025 at 17:06):

fitzgen submitted PR review:

Nice!

view this post on Zulip Wasmtime GitHub notifications bot (Apr 18 2025 at 17:30):

fitzgen merged PR #10609.


Last updated: Dec 06 2025 at 07:03 UTC