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

Patch release 0.32.1. #3620

Merged
merged 6 commits into from
Dec 17, 2021
Merged

Conversation

cfallin
Copy link
Member

@cfallin cfallin commented Dec 17, 2021

This is a patch release (nominally Cranelift, though also for Wasmtime due to process limitations at the moment) with cherry-picks of these three PRs: #3610, #3617, #3619. This fixes codegen bugs in Cranelift that prevented it from being used by cg_clif, and possible other consumers; any codegen bug is worthy of a patch release.

This is our first time using the patch release process; the PR merges the cherrypicked commits and a RELEASES.md update to a release-0.32.1 branch in the main repo, and then we can trigger the version-bump/release workflow from there.

cfallin and others added 6 commits December 17, 2021 13:17
Uncovered by @bjorn3 (thanks!): 8- and 16-bit rotates were not working
properly in recent versions of Cranelift with part of the lowering
migrated to ISLE.

This PR fixes a few issues:

- 8- and 16-bit rotate-left needs to mask a constant amount, if any,
  because we use a 32-bit rotate instruction and so don't get the
  appropriate shift-amount masking for free from x86 semantics.

- `operand_size_from_type` was incorrect: it only handled 32- and 64-bit
  types and silently returned `OperandSize::Size32` for everything else.
  Now uses the `OperandSize::from_ty(ty)` helper as the pre-ISLE code
  did.

Our test coverage for narrow value types is not great; this PR adds some
runtests for rotl/rotr but more would always be better!
Fixes bytecodealliance#3609. It turns out that `sha2` is a nontrivial dependency for
Cranelift in many contexts, partly because it pulls in a number of other
crates as well.

One option is to remove the hash check under certain circumstances, as
implemented in bytecodealliance#3616. However, this is undesirable for other reasons:
having different dependency options in Wasmtime in particular for
crates.io vs. local builds is not really possible, and so either we
still have the higher build cost in Wasmtime, or we turn off the checks
by default, which goes against the original intent of ensuring developer
safety (no mysterious stale-source bugs).

This PR uses `SipHash` instead, which is built into the standard
library. `SipHash` is deprecated, but it's fixed and deterministic
(across runs and across Rust versions), which is what we need, unlike
the suggested replacement `std::collections::hash_map::DefaultHasher`.
The result is only 64 bits, and is not cryptographically secure, but we
never needed that; we just need a simple check to indicate when we
forget a `rebuild-isle`.
@github-actions github-actions bot added cranelift Issues related to the Cranelift code generator cranelift:area:machinst Issues related to instruction selection and the new MachInst backend. cranelift:area:aarch64 Issues related to AArch64 backend. cranelift:area:x64 Issues related to x64 codegen isle Related to the ISLE domain-specific language wasmtime:docs Issues related to Wasmtime's documentation labels Dec 17, 2021
@github-actions
Copy link

Subscribe to Label Action

cc @cfallin, @fitzgen

This issue or pull request has been labeled: "cranelift", "cranelift:area:aarch64", "cranelift:area:machinst", "cranelift:area:x64", "isle", "wasmtime:docs"

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

  • cfallin: isle
  • fitzgen: isle

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

Learn more.

Copy link
Member

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

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

👍

Looks good to me, some minor things:

  • Could the branch be called release-0.32.0 or release-0.32.x or something like that? In theory we could do 0.32.2 in the future and we won't need a branch-per-release, just a branch-per-major-version.
  • I think in theory there's a button on the GitHub UI where after this merges we can trigger the patch release which should send another PR to the repo for us to merge with version bumps.

@cfallin cfallin changed the base branch from release-0.32.1 to release-0.32.x December 17, 2021 21:58
@cfallin cfallin merged commit 8cccb47 into bytecodealliance:release-0.32.x Dec 17, 2021
@cfallin cfallin deleted the release-0.32.1 branch December 17, 2021 22:02
@cfallin
Copy link
Member Author

cfallin commented Dec 17, 2021

Cool, running the version-bump job now with bump-patch as an argument, let's see if this works...

@cfallin
Copy link
Member Author

cfallin commented Dec 17, 2021

OK, that job failed; I filed #3621 for the issue. It's probably a relatively simple fix, but not a one-liner, and might need some more debugging or run into other issues later in the process. I need to context-switch away to some other things before leaving for two weeks; so this patch release will have to wait (sorry @bjorn3) -- since the known consumer of Cranelift that runs into the 8/16-bit issues can pin to an earlier version for now, I don't think it's security-issue-level urgent.

@bjorn3
Copy link
Contributor

bjorn3 commented Dec 17, 2021

I understand. I will push a commit to cg_clif to revert back to the previous cranelift release.

Edit: done in bjorn3/rustc_codegen_cranelift@f505157

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cranelift:area:aarch64 Issues related to AArch64 backend. cranelift:area:machinst Issues related to instruction selection and the new MachInst backend. cranelift:area:x64 Issues related to x64 codegen cranelift Issues related to the Cranelift code generator isle Related to the ISLE domain-specific language wasmtime:docs Issues related to Wasmtime's documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants