Stream: git-wasmtime

Topic: wasmtime / PR #10817 x64: Fix panic compiling 16-bit mult...


view this post on Zulip Wasmtime GitHub notifications bot (May 20 2025 at 19:34):

alexcrichton requested cfallin for a review on PR #10817.

view this post on Zulip Wasmtime GitHub notifications bot (May 20 2025 at 19:34):

alexcrichton opened PR #10817 from alexcrichton:fix-imul-fuzz to bytecodealliance:main:

This commit fixes a minor regression from #10782 found via fuzzing. The regression is 16-bit immediates were forced to fit from an i32 value into a u16 for 16-bit multiplication. This meant though that negative numbers failed this conversion which meant that ISLE would panic due to the value not being matched. This fixes the logic to first fit the i32 into an i16 and then cast that to a u16 where the first phase should hit all the constants that are possible in Cranelift.

<!--
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 (May 20 2025 at 19:34):

alexcrichton requested wasmtime-compiler-reviewers for a review on PR #10817.

view this post on Zulip Wasmtime GitHub notifications bot (May 20 2025 at 19:34):

alexcrichton requested dicej for a review on PR #10817.

view this post on Zulip Wasmtime GitHub notifications bot (May 20 2025 at 19:34):

alexcrichton requested wasmtime-core-reviewers for a review on PR #10817.

view this post on Zulip Wasmtime GitHub notifications bot (May 20 2025 at 19:36):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (May 20 2025 at 19:36):

alexcrichton created PR review comment:

I'll admit this is testing the limits of my CLIF knowledge. This will fail when the i32 value fits in a u16, but not an i16, meaning that we'll still panic during instruction selection from that. I don't know whether that's possible in CLIF though, or if iconst values are always sign-extended from their type.

view this post on Zulip Wasmtime GitHub notifications bot (May 20 2025 at 19:36):

cfallin submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (May 20 2025 at 19:36):

cfallin has enabled auto merge for PR #10817.

view this post on Zulip Wasmtime GitHub notifications bot (May 20 2025 at 19:52):

cfallin created PR review comment:

Oh, missed that, sorry -- unfortunately we've standardized on zero extension instead (it keeps the majority of cases simpler). Fortunately if this extractor returns None then the rule just doesn't match -- no runtime panic unless there's not another fallback? Let's (i) add a test case with a value in that range (say 40000) and (ii) verify there is...

view this post on Zulip Wasmtime GitHub notifications bot (May 20 2025 at 19:52):

cfallin submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (May 20 2025 at 21:17):

alexcrichton updated PR #10817.

view this post on Zulip Wasmtime GitHub notifications bot (May 20 2025 at 21:19):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (May 20 2025 at 21:19):

alexcrichton created PR review comment:

Ok I've added a few CLIF tests for this and it looks like things are actually working as intended. Looks like when accessing the constant in ISLE it gets sign-extended based on the type of the constant itself, which is why this ended up working out. Yay!

view this post on Zulip Wasmtime GitHub notifications bot (May 20 2025 at 21:19):

alexcrichton has enabled auto merge for PR #10817.

view this post on Zulip Wasmtime GitHub notifications bot (May 20 2025 at 21:52):

alexcrichton merged PR #10817.


Last updated: Dec 06 2025 at 07:03 UTC