Stream: git-wasmtime

Topic: wasmtime / PR #14149 winch: throw exceptions


view this post on Zulip Wasmtime GitHub notifications bot (Aug 18 2026 at 09:25):

macovedj opened PR #14149 from macovedj:winch-throw-exceptions to bytecodealliance:main:

This PR adds implementations for visit_throw and visit_throw_ref rather than trapping.

The gc_alloc_raw builtin supports the only DRC and copying collectors, so I also added
an inline allocation path for the null collector, following Cranelift's pattern.

Reference fields in a newly allocated exception have no old value to
release, so I add a DRC initialization barrier that retains the new
reference before storing it.

This PR restricts reference-typed exception payloads to funcref and
externref, which are the heap types Winch currently supports.
Other reference heap types are reported as unsupported

view this post on Zulip Wasmtime GitHub notifications bot (Aug 18 2026 at 09:25):

macovedj requested fitzgen for a review on PR #14149.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 18 2026 at 09:25):

macovedj requested wasmtime-compiler-reviewers for a review on PR #14149.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 18 2026 at 09:25):

macovedj requested wasmtime-core-reviewers for a review on PR #14149.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 18 2026 at 10:24):

macovedj updated PR #14149.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 18 2026 at 13:01):

github-actions[bot] added the label winch on PR #14149.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 18 2026 at 13:01):

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

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 (Aug 19 2026 at 12:23):

saulecabrera requested saulecabrera for a review on PR #14149.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 19 2026 at 12:23):

saulecabrera unassigned fitzgen from PR #14149 winch: throw exceptions.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 19 2026 at 13:15):

:memo: saulecabrera submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 19 2026 at 13:15):

:speech_balloon: saulecabrera created PR review comment:

Could we add disassembly tests for -C collector=drc as well?

view this post on Zulip Wasmtime GitHub notifications bot (Aug 19 2026 at 13:15):

:speech_balloon: saulecabrera created PR review comment:

Similar here as in https://github.com/bytecodealliance/wasmtime/pull/14149/changes#r3812945374

view this post on Zulip Wasmtime GitHub notifications bot (Aug 19 2026 at 13:15):

:speech_balloon: saulecabrera created PR review comment:

I would have expected this to be another type of error? Seems like a configuration error more than a type error? Also, could we move this check higher in the compilation call chain? Else we'd probably have to do a similar check in other places where the layout is needed?

view this post on Zulip Wasmtime GitHub notifications bot (Aug 19 2026 at 13:15):

:speech_balloon: saulecabrera created PR review comment:

Can we pass &Layout here instead? Without a dedicated type it becomes easier for a caller to inverse them, which might cause bugs down the line.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 19 2026 at 13:15):

:speech_balloon: saulecabrera created PR review comment:

Can we use assert_eq here instead? I think we want this to be reported in release builds as well in case lengths do no match.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 19 2026 at 13:15):

:speech_balloon: saulecabrera created PR review comment:

It looks like this piece is similar to emit_drc_write_barrier, I wonder if we could refactor these pieces to be called from both methods so that they cannot drift? I'm particularly concerned about the usage of literal offsets on both. Aside from the refactoring can we make the header extend addend (+8) a constant and add some documentation to it?

view this post on Zulip Wasmtime GitHub notifications bot (Aug 19 2026 at 13:15):

:speech_balloon: saulecabrera created PR review comment:

I wonder if there would be a way to extract this such that it can be called from within emit_exception_payload_fields rather than passing the &field_types to that method? The reason I bring this up is that I see that inside emit_exception_payload_fields we have a catch-all arm, that depends on the validation above (r.heap_type == WasmHeapType::Func || r.heap_type == WasmHeapType::Extern); if this condition is relaxed, which I think it will in the future, the codegen for the catch-all arm in emit_exception_payload_fields will potentially be incorrect.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 19 2026 at 13:15):

:speech_balloon: saulecabrera created PR review comment:

Would it make sense to ensure that the value fits in the unused bits:

ensure!(
    VMGcKind::value_fits_in_unused_bits(size),
    // New: we would have to introduce this error.
    CodeGenError::allocation_too_large()
);

view this post on Zulip Wasmtime GitHub notifications bot (Aug 19 2026 at 13:15):

:speech_balloon: saulecabrera created PR review comment:

This is duplicated above as well, I wonder if we could move this to the FuncEnv?

view this post on Zulip Wasmtime GitHub notifications bot (Aug 19 2026 at 13:15):

:speech_balloon: saulecabrera created PR review comment:

I think in general we only have coverage for the other two? (null and copying)

view this post on Zulip Wasmtime GitHub notifications bot (Aug 19 2026 at 15:42):

macovedj updated PR #14149.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 19 2026 at 15:53):

macovedj updated PR #14149.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 20 2026 at 14:25):

:thumbs_up: saulecabrera submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 20 2026 at 14:25):

saulecabrera added PR #14149 winch: throw exceptions to the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 20 2026 at 14:51):

:check: saulecabrera merged PR #14149.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 20 2026 at 14:51):

saulecabrera removed PR #14149 winch: throw exceptions from the merge queue.


Last updated: Aug 30 2026 at 09:07 UTC