Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wasm GC: Fix is-null-or-i31ref checks #10221

Merged
merged 1 commit into from
Feb 12, 2025

Conversation

fitzgen
Copy link
Member

@fitzgen fitzgen commented Feb 12, 2025

In the case where we need to check for either null or i31refs, we were attempting to fold the two checks together with a bitwise-and and a bitmask, but that was incorrect and buggy. We need to actually do the two separate checks and bitwise-or them together.

Fixes #10171

In the case where we need to check for either null or i31refs, we were
attempting to fold the two checks together with a bitwise-and and a bitmask, but
that was incorrect and buggy. We need to actually do the two separate checks and
bitwise-or them together.

Fixes bytecodealliance#10171
@fitzgen fitzgen requested a review from a team as a code owner February 12, 2025 07:49
@fitzgen fitzgen requested review from pchickey and removed request for a team February 12, 2025 07:49
@@ -25,10 +25,6 @@ use core::alloc::Layout;
/// Discriminant to check whether GC reference is an `i31ref` or not.
pub const I31_DISCRIMINANT: u64 = 1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curiosity: why is this typed u64? This discriminant is technically only for 32-bit values right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it was useful at some point but might not be useful anymore, I’d have to look at uses again

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there's no issue changing it to a u32, so I'll do that in a follow up

@github-actions github-actions bot added the wasmtime:ref-types Issues related to reference types and GC in Wasmtime label Feb 12, 2025
Copy link

Subscribe to Label Action

cc @fitzgen

This issue or pull request has been labeled: "wasmtime:ref-types"

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

  • fitzgen: wasmtime:ref-types

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

Learn more.

@fitzgen fitzgen added this pull request to the merge queue Feb 12, 2025
Merged via the queue into bytecodealliance:main with commit c6b4eaf Feb 12, 2025
39 checks passed
@fitzgen fitzgen deleted the issue-10171 branch February 12, 2025 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wasmtime:ref-types Issues related to reference types and GC in Wasmtime
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect ref.test result
3 participants