Repository: bytecodealliance/wasmtime
Pull request #3893 (2022-03-07 17:48:48)

cli: Add documentation for the `--fuel` option
<!--

Please ensure that the following steps are all taken care of before submitting
the PR.

- [ ] This has been discussed in issue #..., or if not, please tell us why
  here.
- [ ] A short description of what this does, why it is needed; if the
  description becomes long, the matter should probably be discussed in an issue
  first.
- [ ] This PR contains test cases, if meaningful.
- [ ] A reviewer from the core maintainer team has been assigned for this PR.
  If you don't know who could review this, please indicate so. The list of
  suggested reviewers on the right can help you.

Please ensure all communication adheres to the [code of
conduct](https://github.com/bytecodealliance/wasmtime/blob/master/CODE_OF_CONDUCT.md).
-->



Patch:
diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml
index 6f265eb6f..a162d3c40 100644
--- a/.github/workflows/bump-version.yml
+++ b/.github/workflows/bump-version.yml
@@ -60,7 +60,7 @@ jobs:
       - name: Push to remote
         run: |
           git remote set-url origin https://git:${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/${{ github.repository }}
-          git push origin HEAD:ci/bump-version -f
+          git push origin HEAD:ci/bump-to-${{ steps.bump.outputs.version }} -f
 
       - name: Make a PR
         # Note that the syntax here is kinda funky, and the general gist is that
@@ -91,7 +91,7 @@ jobs:
             --header "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \
             --data @- << EOF
           {
-            "head": "ci/bump-version",
+            "head": "ci/bump-to-${{ steps.bump.outputs.version }}",
             "base": "${{ github.ref_name }}",
             "title": "Release Wasmtime ${{ steps.bump.outputs.version }}",
             "body": $body,
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 7fb800c42..7e834ffd6 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -360,8 +360,8 @@ jobs:
     - run: rustup target add wasm32-wasi
     - name: Install Rust
       run: rustup update stable && rustup default stable
-    - run: cargo bench
-    - run: cargo bench --features uffd
+    - run: cargo test --benches --release
+    - run: cargo test --benches --release --features uffd
 
   # Verify that cranelift's code generation is deterministic
   meta_determinist_check:
diff --git a/Cargo.lock b/Cargo.lock
index cce701b9e..5e7257c12 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -501,7 +501,7 @@ dependencies = [
 
 [[package]]
 name = "cranelift"
-version = "0.81.0"
+version = "0.82.0"
 dependencies = [
  "cranelift-codegen",
  "cranelift-frontend",
@@ -509,14 +509,14 @@ dependencies = [
 
 [[package]]
 name = "cranelift-bforest"
-version = "0.81.0"
+version = "0.82.0"
 dependencies = [
  "cranelift-entity",
 ]
 
 [[package]]
 name = "cranelift-codegen"
-version = "0.81.0"
+version = "0.82.0"
 dependencies = [
  "bincode",
  "cranelift-bforest",
@@ -538,18 +538,18 @@ dependencies = [
 
 [[package]]
 name = "cranelift-codegen-meta"
-version = "0.81.0"
+version = "0.82.0"
 dependencies = [
  "cranelift-codegen-shared",
 ]
 
 [[package]]
 name = "cranelift-codegen-shared"
-version = "0.81.0"
+version = "0.82.0"
 
 [[package]]
 name = "cranelift-entity"
-version = "0.81.0"
+version = "0.82.0"
 dependencies = [
  "serde",
 ]
@@ -577,7 +577,7 @@ dependencies = [
 
 [[package]]
 name = "cranelift-frontend"
-version = "0.81.0"
+version = "0.82.0"
 dependencies = [
  "cranelift-codegen",
  "hashbrown 0.9.1",
@@ -597,7 +597,7 @@ dependencies = [
 
 [[package]]
 name = "cranelift-interpreter"
-version = "0.81.0"
+version = "0.82.0"
 dependencies = [
  "cranelift-codegen",
  "cranelift-entity",
@@ -610,7 +610,7 @@ dependencies = [
 
 [[package]]
 name = "cranelift-isle"
-version = "0.81.0"
+version = "0.82.0"
 dependencies = [
  "log",
  "miette",
@@ -620,7 +620,7 @@ dependencies = [
 
 [[package]]
 name = "cranelift-jit"
-version = "0.81.0"
+version = "0.82.0"
 dependencies = [
  "anyhow",
  "cranelift",
@@ -639,7 +639,7 @@ dependencies = [
 
 [[package]]
 name = "cranelift-module"
-version = "0.81.0"
+version = "0.82.0"
 dependencies = [
  "anyhow",
  "cranelift-codegen",
@@ -648,7 +648,7 @@ dependencies = [
 
 [[package]]
 name = "cranelift-native"
-version = "0.81.0"
+version = "0.82.0"
 dependencies = [
  "cranelift-codegen",
  "libc",
@@ -657,7 +657,7 @@ dependencies = [
 
 [[package]]
 name = "cranelift-object"
-version = "0.81.0"
+version = "0.82.0"
 dependencies = [
  "anyhow",
  "cranelift-codegen",
@@ -671,14 +671,14 @@ dependencies = [
 
 [[package]]
 name = "cranelift-preopt"
-version = "0.81.0"
+version = "0.82.0"
 dependencies = [
  "cranelift-codegen",
 ]
 
 [[package]]
 name = "cranelift-reader"
-version = "0.81.0"
+version = "0.82.0"
 dependencies = [
  "cranelift-codegen",
  "smallvec",
@@ -687,7 +687,7 @@ dependencies = [
 
 [[package]]
 name = "cranelift-serde"
-version = "0.81.0"
+version = "0.82.0"
 dependencies = [
  "clap",
  "cranelift-codegen",
@@ -731,7 +731,7 @@ dependencies = [
 
 [[package]]
 name = "cranelift-wasm"
-version = "0.81.0"
+version = "0.82.0"
 dependencies = [
  "cranelift-codegen",
  "cranelift-entity",
@@ -3175,7 +3175,7 @@ checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
 
 [[package]]
 name = "wasi-cap-std-sync"
-version = "0.34.0"
+version = "0.35.0"
 dependencies = [
  "anyhow",
  "async-trait",
@@ -3198,7 +3198,7 @@ dependencies = [
 
 [[package]]
 name = "wasi-common"
-version = "0.34.0"
+version = "0.35.0"
 dependencies = [
  "anyhow",
  "bitflags",
@@ -3242,7 +3242,7 @@ dependencies = [
 
 [[package]]
 name = "wasi-tokio"
-version = "0.34.0"
+version = "0.35.0"
 dependencies = [
  "anyhow",
  "cap-std",
@@ -3400,7 +3400,7 @@ dependencies = [
 
 [[package]]
 name = "wasmtime"
-version = "0.34.0"
+version = "0.35.0"
 dependencies = [
  "anyhow",
  "async-trait",
@@ -3473,7 +3473,7 @@ dependencies = [
 
 [[package]]
 name = "wasmtime-cache"
-version = "0.34.0"
+version = "0.35.0"
 dependencies = [
  "anyhow",
  "base64",
@@ -3496,7 +3496,7 @@ dependencies = [
 
 [[package]]
 name = "wasmtime-cli"
-version = "0.34.0"
+version = "0.35.0"
 dependencies = [
  "anyhow",
  "async-trait",
@@ -3538,7 +3538,7 @@ dependencies = [
 
 [[package]]
 name = "wasmtime-cranelift"
-version = "0.34.0"
+version = "0.35.0"
 dependencies = [
  "anyhow",
  "cranelift-codegen",
@@ -3558,7 +3558,7 @@ dependencies = [
 
 [[package]]
 name = "wasmtime-environ"
-version = "0.34.0"
+version = "0.35.0"
 dependencies = [
  "anyhow",
  "cranelift-entity",
@@ -3576,7 +3576,7 @@ dependencies = [
 
 [[package]]
 name = "wasmtime-fiber"
-version = "0.34.0"
+version = "0.35.0"
 dependencies = [
  "backtrace",
  "cc",
@@ -3626,7 +3626,7 @@ dependencies = [
 
 [[package]]
 name = "wasmtime-jit"
-version = "0.34.0"
+version = "0.35.0"
 dependencies = [
  "addr2line",
  "anyhow",
@@ -3651,7 +3651,7 @@ dependencies = [
 
 [[package]]
 name = "wasmtime-jit-debug"
-version = "0.34.0"
+version = "0.35.0"
 dependencies = [
  "lazy_static",
  "object",
@@ -3660,7 +3660,7 @@ dependencies = [
 
 [[package]]
 name = "wasmtime-runtime"
-version = "0.34.0"
+version = "0.35.0"
 dependencies = [
  "anyhow",
  "backtrace",
@@ -3686,7 +3686,7 @@ dependencies = [
 
 [[package]]
 name = "wasmtime-types"
-version = "0.34.0"
+version = "0.35.0"
 dependencies = [
  "cranelift-entity",
  "serde",
@@ -3696,7 +3696,7 @@ dependencies = [
 
 [[package]]
 name = "wasmtime-wasi"
-version = "0.34.0"
+version = "0.35.0"
 dependencies = [
  "anyhow",
  "wasi-cap-std-sync",
@@ -3708,7 +3708,7 @@ dependencies = [
 
 [[package]]
 name = "wasmtime-wasi-crypto"
-version = "0.34.0"
+version = "0.35.0"
 dependencies = [
  "anyhow",
  "wasi-crypto",
@@ -3718,7 +3718,7 @@ dependencies = [
 
 [[package]]
 name = "wasmtime-wasi-nn"
-version = "0.34.0"
+version = "0.35.0"
 dependencies = [
  "anyhow",
  "openvino",
@@ -3729,7 +3729,7 @@ dependencies = [
 
 [[package]]
 name = "wasmtime-wast"
-version = "0.34.0"
+version = "0.35.0"
 dependencies = [
  "anyhow",
  "wasmtime",
@@ -3788,7 +3788,7 @@ dependencies = [
 
 [[package]]
 name = "wiggle"
-version = "0.34.0"
+version = "0.35.0"
 dependencies = [
  "anyhow",
  "async-trait",
@@ -3805,7 +3805,7 @@ dependencies = [
 
 [[package]]
 name = "wiggle-generate"
-version = "0.34.0"
+version = "0.35.0"
 dependencies = [
  "anyhow",
  "heck",
@@ -3818,7 +3818,7 @@ dependencies = [
 
 [[package]]
 name = "wiggle-macro"
-version = "0.34.0"
+version = "0.35.0"
 dependencies = [
  "proc-macro2",
  "quote",
diff --git a/Cargo.toml b/Cargo.toml
index ff9f9ae48..0ba738d8f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasmtime-cli"
-version = "0.34.0"
+version = "0.35.0"
 authors = ["The Wasmtime Project Developers"]
 description = "Command-line interface for Wasmtime"
 license = "Apache-2.0 WITH LLVM-exception"
@@ -21,14 +21,14 @@ path = "src/bin/wasmtime.rs"
 doc = false
 
 [dependencies]
-wasmtime = { path = "crates/wasmtime", version = "0.34.0", default-features = false, features = ['cache', 'cranelift'] }
-wasmtime-cache = { path = "crates/cache", version = "=0.34.0" }
-wasmtime-cranelift = { path = "crates/cranelift", version = "=0.34.0" }
-wasmtime-environ = { path = "crates/environ", version = "=0.34.0" }
-wasmtime-wast = { path = "crates/wast", version = "=0.34.0" }
-wasmtime-wasi = { path = "crates/wasi", version = "0.34.0" }
-wasmtime-wasi-crypto = { path = "crates/wasi-crypto", version = "0.34.0", optional = true }
-wasmtime-wasi-nn = { path = "crates/wasi-nn", version = "0.34.0", optional = true }
+wasmtime = { path = "crates/wasmtime", version = "0.35.0", default-features = false, features = ['cache', 'cranelift'] }
+wasmtime-cache = { path = "crates/cache", version = "=0.35.0" }
+wasmtime-cranelift = { path = "crates/cranelift", version = "=0.35.0" }
+wasmtime-environ = { path = "crates/environ", version = "=0.35.0" }
+wasmtime-wast = { path = "crates/wast", version = "=0.35.0" }
+wasmtime-wasi = { path = "crates/wasi", version = "0.35.0" }
+wasmtime-wasi-crypto = { path = "crates/wasi-crypto", version = "0.35.0", optional = true }
+wasmtime-wasi-nn = { path = "crates/wasi-nn", version = "0.35.0", optional = true }
 structopt = { version = "0.3.5", features = ["color", "suggestions"] }
 anyhow = "1.0.19"
 target-lexicon = { version = "0.12.0", default-features = false }
@@ -46,7 +46,7 @@ rustix = "0.33.0"
 
 [dev-dependencies]
 # depend again on wasmtime to activate its default features for tests
-wasmtime = { path = "crates/wasmtime", version = "0.34.0" }
+wasmtime = { path = "crates/wasmtime", version = "0.35.0" }
 env_logger = "0.8.1"
 filecheck = "0.5.0"
 more-asserts = "0.2.1"
diff --git a/RELEASES.md b/RELEASES.md
index 1b0522be1..9b24a63ee 100644
--- a/RELEASES.md
+++ b/RELEASES.md
@@ -2,6 +2,17 @@
 
 --------------------------------------------------------------------------------
 
+## 0.35.1
+
+Released 2022-03-09.
+
+### Fixed
+
+* Fixed a bug in the x86-64 lowering of the `uextend` opcode for narrow (`i8`,
+  `i16`) integer sources when the value is produced by one of several
+  arithmetic instructions.
+  [#3906](https://github.com/bytecodealliance/wasmtime/pull/3906)
+
 ## 0.35.0
 
 Released 2022-03-07.
diff --git a/benches/instantiation.rs b/benches/instantiation.rs
index 2e919c4d8..8ad3d2da2 100644
--- a/benches/instantiation.rs
+++ b/benches/instantiation.rs
@@ -86,7 +86,7 @@ fn bench_parallel(c: &mut Criterion, path: &Path) {
             (engine, pre)
         });
 
-        for threads in 1..=num_cpus::get_physical() {
+        for threads in 1..=num_cpus::get_physical().min(16) {
             let name = format!(
                 "{}: with {} thread{}",
                 path.file_name().unwrap().to_str().unwrap(),
diff --git a/cranelift/Cargo.toml b/cranelift/Cargo.toml
index f7335a819..c6522bef2 100644
--- a/cranelift/Cargo.toml
+++ b/cranelift/Cargo.toml
@@ -15,19 +15,19 @@ path = "src/clif-util.rs"
 
 [dependencies]
 cfg-if = "1.0"
-cranelift-codegen = { path = "codegen", version = "0.81.0" }
-cranelift-entity = { path = "entity", version = "0.81.0" }
-cranelift-interpreter = { path = "interpreter", version = "0.81.0" }
-cranelift-reader = { path = "reader", version = "0.81.0" }
-cranelift-frontend = { path = "frontend", version = "0.81.0" }
-cranelift-wasm = { path = "wasm", version = "0.81.0", optional = true }
-cranelift-native = { path = "native", version = "0.81.0" }
+cranelift-codegen = { path = "codegen", version = "0.82.0" }
+cranelift-entity = { path = "entity", version = "0.82.0" }
+cranelift-interpreter = { path = "interpreter", version = "0.82.0" }
+cranelift-reader = { path = "reader", version = "0.82.0" }
+cranelift-frontend = { path = "frontend", version = "0.82.0" }
+cranelift-wasm = { path = "wasm", version = "0.82.0", optional = true }
+cranelift-native = { path = "native", version = "0.82.0" }
 cranelift-filetests = { path = "filetests", version = "0.73.0" }
-cranelift-module = { path = "module", version = "0.81.0" }
-cranelift-object = { path = "object", version = "0.81.0" }
-cranelift-jit = { path = "jit", version = "0.81.0" }
-cranelift-preopt = { path = "preopt", version = "0.81.0" }
-cranelift = { path = "umbrella", version = "0.81.0" }
+cranelift-module = { path = "module", version = "0.82.0" }
+cranelift-object = { path = "object", version = "0.82.0" }
+cranelift-jit = { path = "jit", version = "0.82.0" }
+cranelift-preopt = { path = "preopt", version = "0.82.0" }
+cranelift = { path = "umbrella", version = "0.82.0" }
 filecheck = "0.5.0"
 log = "0.4.8"
 termcolor = "1.1.2"
diff --git a/cranelift/bforest/Cargo.toml b/cranelift/bforest/Cargo.toml
index 187ff8a44..552102afc 100644
--- a/cranelift/bforest/Cargo.toml
+++ b/cranelift/bforest/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 authors = ["The Cranelift Project Developers"]
 name = "cranelift-bforest"
-version = "0.81.0"
+version = "0.82.0"
 description = "A forest of B+-trees"
 license = "Apache-2.0 WITH LLVM-exception"
 documentation = "https://docs.rs/cranelift-bforest"
@@ -12,7 +12,7 @@ keywords = ["btree", "forest", "set", "map"]
 edition = "2018"
 
 [dependencies]
-cranelift-entity = { path = "../entity", version = "0.81.0", default-features = false }
+cranelift-entity = { path = "../entity", version = "0.82.0", default-features = false }
 
 [badges]
 maintenance = { status = "experimental" }
diff --git a/cranelift/codegen/Cargo.toml b/cranelift/codegen/Cargo.toml
index 4003ee8b7..757d9dd12 100644
--- a/cranelift/codegen/Cargo.toml
+++ b/cranelift/codegen/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 authors = ["The Cranelift Project Developers"]
 name = "cranelift-codegen"
-version = "0.81.0"
+version = "0.82.0"
 description = "Low-level code generator library"
 license = "Apache-2.0 WITH LLVM-exception"
 documentation = "https://docs.rs/cranelift-codegen"
@@ -13,9 +13,9 @@ build = "build.rs"
 edition = "2018"
 
 [dependencies]
-cranelift-codegen-shared = { path = "./shared", version = "0.81.0" }
-cranelift-entity = { path = "../entity", version = "0.81.0" }
-cranelift-bforest = { path = "../bforest", version = "0.81.0" }
+cranelift-codegen-shared = { path = "./shared", version = "0.82.0" }
+cranelift-entity = { path = "../entity", version = "0.82.0" }
+cranelift-bforest = { path = "../bforest", version = "0.82.0" }
 hashbrown = { version = "0.9.1", optional = true }
 target-lexicon = "0.12"
 log = { version = "0.4.6", default-features = false }
@@ -34,8 +34,8 @@ souper-ir = { version = "2.1.0", optional = true }
 criterion = "0.3"
 
 [build-dependencies]
-cranelift-codegen-meta = { path = "meta", version = "0.81.0" }
-cranelift-isle = { path = "../isle/isle", version = "=0.81.0", optional = true }
+cranelift-codegen-meta = { path = "meta", version = "0.82.0" }
+cranelift-isle = { path = "../isle/isle", version = "=0.82.0", optional = true }
 miette = { version = "3", features = ["fancy"], optional = true }
 
 [features]
diff --git a/cranelift/codegen/meta/Cargo.toml b/cranelift/codegen/meta/Cargo.toml
index 32b1722a1..bb7c0efff 100644
--- a/cranelift/codegen/meta/Cargo.toml
+++ b/cranelift/codegen/meta/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 name = "cranelift-codegen-meta"
 authors = ["The Cranelift Project Developers"]
-version = "0.81.0"
+version = "0.82.0"
 description = "Metaprogram for cranelift-codegen code generator library"
 license = "Apache-2.0 WITH LLVM-exception"
 repository = "https://github.com/bytecodealliance/wasmtime"
@@ -13,7 +13,7 @@ edition = "2018"
 # rustdoc-args = [ "--document-private-items" ]
 
 [dependencies]
-cranelift-codegen-shared = { path = "../shared", version = "0.81.0" }
+cranelift-codegen-shared = { path = "../shared", version = "0.82.0" }
 
 [badges]
 maintenance = { status = "experimental" }
diff --git a/cranelift/codegen/shared/Cargo.toml b/cranelift/codegen/shared/Cargo.toml
index 5c4de819a..64b3ca6b7 100644
--- a/cranelift/codegen/shared/Cargo.toml
+++ b/cranelift/codegen/shared/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 authors = ["The Cranelift Project Developers"]
 name = "cranelift-codegen-shared"
-version = "0.81.0"
+version = "0.82.0"
 description = "For code shared between cranelift-codegen-meta and cranelift-codegen"
 license = "Apache-2.0 WITH LLVM-exception"
 repository = "https://github.com/bytecodealliance/wasmtime"
diff --git a/cranelift/codegen/src/isa/x64/lower.isle b/cranelift/codegen/src/isa/x64/lower.isle
index d082fda8e..cb7636939 100644
--- a/cranelift/codegen/src/isa/x64/lower.isle
+++ b/cranelift/codegen/src/isa/x64/lower.isle
@@ -1894,34 +1894,34 @@
 ;; keep these here than write an external extractor containing bits of
 ;; the instruction pattern.s)
 (rule (lower (has_type $I64
-                       (uextend src @ (iadd _ _))))
+                       (uextend src @ (has_type $I32 (iadd _ _)))))
       src)
 (rule (lower (has_type $I64
-                       (uextend src @ (iadd_ifcout _ _))))
+                       (uextend src @ (has_type $I32 (iadd_ifcout _ _)))))
       src)
 (rule (lower (has_type $I64
-                       (uextend src @ (isub _ _))))
+                       (uextend src @ (has_type $I32 (isub _ _)))))
       src)
 (rule (lower (has_type $I64
-                       (uextend src @ (imul _ _))))
+                       (uextend src @ (has_type $I32 (imul _ _)))))
       src)
 (rule (lower (has_type $I64
-                       (uextend src @ (band _ _))))
+                       (uextend src @ (has_type $I32 (band _ _)))))
       src)
 (rule (lower (has_type $I64
-                       (uextend src @ (bor _ _))))
+                       (uextend src @ (has_type $I32 (bor _ _)))))
       src)
 (rule (lower (has_type $I64
-                       (uextend src @ (bxor _ _))))
+                       (uextend src @ (has_type $I32 (bxor _ _)))))
       src)
 (rule (lower (has_type $I64
-                       (uextend src @ (ishl _ _))))
+                       (uextend src @ (has_type $I32 (ishl _ _)))))
       src)
 (rule (lower (has_type $I64
-                       (uextend src @ (ushr _ _))))
+                       (uextend src @ (has_type $I32 (ushr _ _)))))
       src)
 (rule (lower (has_type $I64
-                       (uextend src @ (uload32 _ _ _))))
+                       (uextend src @ (has_type $I32 (uload32 _ _ _)))))
       src)
 
 ;; Rules for `sextend` / `bextend` ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
diff --git a/cranelift/codegen/src/isa/x64/lower/isle/generated_code.manifest b/cranelift/codegen/src/isa/x64/lower/isle/generated_code.manifest
index b1f03e50d..ebb1176c9 100644
--- a/cranelift/codegen/src/isa/x64/lower/isle/generated_code.manifest
+++ b/cranelift/codegen/src/isa/x64/lower/isle/generated_code.manifest
@@ -1,4 +1,4 @@
 src/clif.isle 9ea75a6f790b5c03
 src/prelude.isle b2bc986bcbbbb77
 src/isa/x64/inst.isle 40f495d3ca5ae547
-src/isa/x64/lower.isle faa2a07bba48a813
+src/isa/x64/lower.isle c049f7d36db0e0fb
diff --git a/cranelift/codegen/src/isa/x64/lower/isle/generated_code.rs b/cranelift/codegen/src/isa/x64/lower/isle/generated_code.rs
index b409fad5c..ab52c9cad 100644
--- a/cranelift/codegen/src/isa/x64/lower/isle/generated_code.rs
+++ b/cranelift/codegen/src/isa/x64/lower/isle/generated_code.rs
@@ -4665,101 +4665,107 @@ pub fn constructor_lower<C: Context>(ctx: &mut C, arg0: Inst) -> Option<InstOutp
                     }
                     &Opcode::Uextend => {
                         if let Some(pattern7_0) = C::def_inst(ctx, pattern5_1) {
-                            let pattern8_0 = C::inst_data(ctx, pattern7_0);
-                            match &pattern8_0 {
-                                &InstructionData::Binary {
-                                    opcode: ref pattern9_0,
-                                    args: ref pattern9_1,
-                                } => {
-                                    match pattern9_0 {
-                                        &Opcode::Iadd => {
-                                            let (pattern11_0, pattern11_1) =
-                                                C::unpack_value_array_2(ctx, pattern9_1);
-                                            // Rule at src/isa/x64/lower.isle line 1896.
-                                            let expr0_0 =
-                                                constructor_output_value(ctx, pattern5_1)?;
-                                            return Some(expr0_0);
-                                        }
-                                        &Opcode::Isub => {
-                                            let (pattern11_0, pattern11_1) =
-                                                C::unpack_value_array_2(ctx, pattern9_1);
-                                            // Rule at src/isa/x64/lower.isle line 1902.
-                                            let expr0_0 =
-                                                constructor_output_value(ctx, pattern5_1)?;
-                                            return Some(expr0_0);
-                                        }
-                                        &Opcode::Imul => {
-                                            let (pattern11_0, pattern11_1) =
-                                                C::unpack_value_array_2(ctx, pattern9_1);
-                                            // Rule at src/isa/x64/lower.isle line 1905.
-                                            let expr0_0 =
-                                                constructor_output_value(ctx, pattern5_1)?;
-                                            return Some(expr0_0);
-                                        }
-                                        &Opcode::IaddIfcout => {
-                                            let (pattern11_0, pattern11_1) =
-                                                C::unpack_value_array_2(ctx, pattern9_1);
-                                            // Rule at src/isa/x64/lower.isle line 1899.
-                                            let expr0_0 =
-                                                constructor_output_value(ctx, pattern5_1)?;
-                                            return Some(expr0_0);
-                                        }
-                                        &Opcode::Band => {
-                                            let (pattern11_0, pattern11_1) =
-                                                C::unpack_value_array_2(ctx, pattern9_1);
-                                            // Rule at src/isa/x64/lower.isle line 1908.
-                                            let expr0_0 =
-                                                constructor_output_value(ctx, pattern5_1)?;
-                                            return Some(expr0_0);
-                                        }
-                                        &Opcode::Bor => {
-                                            let (pattern11_0, pattern11_1) =
-                                                C::unpack_value_array_2(ctx, pattern9_1);
-                                            // Rule at src/isa/x64/lower.isle line 1911.
-                                            let expr0_0 =
-                                                constructor_output_value(ctx, pattern5_1)?;
-                                            return Some(expr0_0);
-                                        }
-                                        &Opcode::Bxor => {
-                                            let (pattern11_0, pattern11_1) =
-                                                C::unpack_value_array_2(ctx, pattern9_1);
-                                            // Rule at src/isa/x64/lower.isle line 1914.
-                                            let expr0_0 =
-                                                constructor_output_value(ctx, pattern5_1)?;
-                                            return Some(expr0_0);
-                                        }
-                                        &Opcode::Ishl => {
-                                            let (pattern11_0, pattern11_1) =
-                                                C::unpack_value_array_2(ctx, pattern9_1);
-                                            // Rule at src/isa/x64/lower.isle line 1917.
-                                            let expr0_0 =
-                                                constructor_output_value(ctx, pattern5_1)?;
-                                            return Some(expr0_0);
+                            if let Some(pattern8_0) = C::first_result(ctx, pattern7_0) {
+                                let pattern9_0 = C::value_type(ctx, pattern8_0);
+                                if pattern9_0 == I32 {
+                                    let pattern11_0 = C::inst_data(ctx, pattern7_0);
+                                    match &pattern11_0 {
+                                        &InstructionData::Binary {
+                                            opcode: ref pattern12_0,
+                                            args: ref pattern12_1,
+                                        } => {
+                                            match pattern12_0 {
+                                                &Opcode::Iadd => {
+                                                    let (pattern14_0, pattern14_1) =
+                                                        C::unpack_value_array_2(ctx, pattern12_1);
+                                                    // Rule at src/isa/x64/lower.isle line 1896.
+                                                    let expr0_0 =
+                                                        constructor_output_value(ctx, pattern5_1)?;
+                                                    return Some(expr0_0);
+                                                }
+                                                &Opcode::Isub => {
+                                                    let (pattern14_0, pattern14_1) =
+                                                        C::unpack_value_array_2(ctx, pattern12_1);
+                                                    // Rule at src/isa/x64/lower.isle line 1902.
+                                                    let expr0_0 =
+                                                        constructor_output_value(ctx, pattern5_1)?;
+                                                    return Some(expr0_0);
+                                                }
+                                                &Opcode::Imul => {
+                                                    let (pattern14_0, pattern14_1) =
+                                                        C::unpack_value_array_2(ctx, pattern12_1);
+                                                    // Rule at src/isa/x64/lower.isle line 1905.
+                                                    let expr0_0 =
+                                                        constructor_output_value(ctx, pattern5_1)?;
+                                                    return Some(expr0_0);
+                                                }
+                                                &Opcode::IaddIfcout => {
+                                                    let (pattern14_0, pattern14_1) =
+                                                        C::unpack_value_array_2(ctx, pattern12_1);
+                                                    // Rule at src/isa/x64/lower.isle line 1899.
+                                                    let expr0_0 =
+                                                        constructor_output_value(ctx, pattern5_1)?;
+                                                    return Some(expr0_0);
+                                                }
+                                                &Opcode::Band => {
+                                                    let (pattern14_0, pattern14_1) =
+                                                        C::unpack_value_array_2(ctx, pattern12_1);
+                                                    // Rule at src/isa/x64/lower.isle line 1908.
+                                                    let expr0_0 =
+                                                        constructor_output_value(ctx, pattern5_1)?;
+                                                    return Some(expr0_0);
+                                                }
+                                                &Opcode::Bor => {
+                                                    let (pattern14_0, pattern14_1) =
+                                                        C::unpack_value_array_2(ctx, pattern12_1);
+                                                    // Rule at src/isa/x64/lower.isle line 1911.
+                                                    let expr0_0 =
+                                                        constructor_output_value(ctx, pattern5_1)?;
+                                                    return Some(expr0_0);
+                                                }
+                                                &Opcode::Bxor => {
+                                                    let (pattern14_0, pattern14_1) =
+                                                        C::unpack_value_array_2(ctx, pattern12_1);
+                                                    // Rule at src/isa/x64/lower.isle line 1914.
+                                                    let expr0_0 =
+                                                        constructor_output_value(ctx, pattern5_1)?;
+                                                    return Some(expr0_0);
+                                                }
+                                                &Opcode::Ishl => {
+                                                    let (pattern14_0, pattern14_1) =
+                                                        C::unpack_value_array_2(ctx, pattern12_1);
+                                                    // Rule at src/isa/x64/lower.isle line 1917.
+                                                    let expr0_0 =
+                                                        constructor_output_value(ctx, pattern5_1)?;
+                                                    return Some(expr0_0);
+                                                }
+                                                &Opcode::Ushr => {
+                                                    let (pattern14_0, pattern14_1) =
+                                                        C::unpack_value_array_2(ctx, pattern12_1);
+                                                    // Rule at src/isa/x64/lower.isle line 1920.
+                                                    let expr0_0 =
+                                                        constructor_output_value(ctx, pattern5_1)?;
+                                                    return Some(expr0_0);
+                                                }
+                                                _ => {}
+                                            }
                                         }
-                                        &Opcode::Ushr => {
-                                            let (pattern11_0, pattern11_1) =
-                                                C::unpack_value_array_2(ctx, pattern9_1);
-                                            // Rule at src/isa/x64/lower.isle line 1920.
-                                            let expr0_0 =
-                                                constructor_output_value(ctx, pattern5_1)?;
-                                            return Some(expr0_0);
+                                        &InstructionData::Load {
+                                            opcode: ref pattern12_0,
+                                            arg: pattern12_1,
+                                            flags: pattern12_2,
+                                            offset: pattern12_3,
+                                        } => {
+                                            if let &Opcode::Uload32 = pattern12_0 {
+                                                // Rule at src/isa/x64/lower.isle line 1923.
+                                                let expr0_0 =
+                                                    constructor_output_value(ctx, pattern5_1)?;
+                                                return Some(expr0_0);
+                                            }
                                         }
                                         _ => {}
                                     }
                                 }
-                                &InstructionData::Load {
-                                    opcode: ref pattern9_0,
-                                    arg: pattern9_1,
-                                    flags: pattern9_2,
-                                    offset: pattern9_3,
-                                } => {
-                                    if let &Opcode::Uload32 = pattern9_0 {
-                                        // Rule at src/isa/x64/lower.isle line 1923.
-                                        let expr0_0 = constructor_output_value(ctx, pattern5_1)?;
-                                        return Some(expr0_0);
-                                    }
-                                }
-                                _ => {}
                             }
                         }
                         let pattern7_0 = C::value_type(ctx, pattern5_1);
diff --git a/cranelift/codegen/src/machinst/buffer.rs b/cranelift/codegen/src/machinst/buffer.rs
index 7091d880d..ffc96c1ab 100644
--- a/cranelift/codegen/src/machinst/buffer.rs
+++ b/cranelift/codegen/src/machinst/buffer.rs
@@ -1616,7 +1616,7 @@ impl<I: VCodeInst> MachTextSectionBuilder<I> {
 }
 
 impl<I: VCodeInst> TextSectionBuilder for MachTextSectionBuilder<I> {
-    fn append(&mut self, named: bool, func: &[u8], align: u32) -> u64 {
+    fn append(&mut self, named: bool, func: &[u8], align: Option<u32>) -> u64 {
         // Conditionally emit an island if it's necessary to resolve jumps
         // between functions which are too far away.
         let size = func.len() as u32;
@@ -1624,7 +1624,7 @@ impl<I: VCodeInst> TextSectionBuilder for MachTextSectionBuilder<I> {
             self.buf.emit_island_maybe_forced(self.force_veneers, size);
         }
 
-        self.buf.align_to(align);
+        self.buf.align_to(align.unwrap_or(I::LabelUse::ALIGN));
         let pos = self.buf.cur_offset();
         if named {
             self.buf.bind_label(MachLabel::from_block(self.next_func));
diff --git a/cranelift/codegen/src/machinst/mod.rs b/cranelift/codegen/src/machinst/mod.rs
index e16dcce9a..c2cdb4e32 100644
--- a/cranelift/codegen/src/machinst/mod.rs
+++ b/cranelift/codegen/src/machinst/mod.rs
@@ -370,7 +370,7 @@ pub trait TextSectionBuilder {
     ///
     /// This function returns the offset at which the data was placed in the
     /// text section.
-    fn append(&mut self, labeled: bool, data: &[u8], align: u32) -> u64;
+    fn append(&mut self, labeled: bool, data: &[u8], align: Option<u32>) -> u64;
 
     /// Attempts to resolve a relocation for this function.
     ///
diff --git a/cranelift/entity/Cargo.toml b/cranelift/entity/Cargo.toml
index 612a46c9d..fc530d7ca 100644
--- a/cranelift/entity/Cargo.toml
+++ b/cranelift/entity/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 authors = ["The Cranelift Project Developers"]
 name = "cranelift-entity"
-version = "0.81.0"
+version = "0.82.0"
 description = "Data structures using entity references as mapping keys"
 license = "Apache-2.0 WITH LLVM-exception"
 documentation = "https://docs.rs/cranelift-entity"
diff --git a/cranelift/frontend/Cargo.toml b/cranelift/frontend/Cargo.toml
index c45f60679..f108866f5 100644
--- a/cranelift/frontend/Cargo.toml
+++ b/cranelift/frontend/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 authors = ["The Cranelift Project Developers"]
 name = "cranelift-frontend"
-version = "0.81.0"
+version = "0.82.0"
 description = "Cranelift IR builder helper"
 license = "Apache-2.0 WITH LLVM-exception"
 documentation = "https://docs.rs/cranelift-frontend"
@@ -11,7 +11,7 @@ readme = "README.md"
 edition = "2018"
 
 [dependencies]
-cranelift-codegen = { path = "../codegen", version = "0.81.0", default-features = false }
+cranelift-codegen = { path = "../codegen", version = "0.82.0", default-features = false }
 target-lexicon = "0.12"
 log = { version = "0.4.6", default-features = false }
 hashbrown = { version = "0.9.1", optional = true }
diff --git a/cranelift/fuzzgen/Cargo.toml b/cranelift/fuzzgen/Cargo.toml
index f955ed8e7..cd5d2be20 100644
--- a/cranelift/fuzzgen/Cargo.toml
+++ b/cranelift/fuzzgen/Cargo.toml
@@ -11,7 +11,7 @@ publish = false
 
 
 [dependencies]
-cranelift = { path = "../umbrella", version = "0.81.0" }
+cranelift = { path = "../umbrella", version = "0.82.0" }
 
 anyhow = "1.0.19"
 arbitrary = "1.0.0"
diff --git a/cranelift/interpreter/Cargo.toml b/cranelift/interpreter/Cargo.toml
index cea2946f6..6cf4adbd1 100644
--- a/cranelift/interpreter/Cargo.toml
+++ b/cranelift/interpreter/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "cranelift-interpreter"
-version = "0.81.0"
+version = "0.82.0"
 authors = ["The Cranelift Project Developers"]
 description = "Interpret Cranelift IR"
 repository = "https://github.com/bytecodealliance/wasmtime"
@@ -11,15 +11,15 @@ readme = "README.md"
 edition = "2018"
 
 [dependencies]
-cranelift-codegen = { path = "../codegen", version = "0.81.0" }
-cranelift-entity = { path = "../entity", version = "0.81.0" }
+cranelift-codegen = { path = "../codegen", version = "0.82.0" }
+cranelift-entity = { path = "../entity", version = "0.82.0" }
 log = { version = "0.4.8", default-features = false }
 smallvec = "1.6.1"
 thiserror = "1.0.15"
 
 [dev-dependencies]
-cranelift-frontend = { path = "../frontend", version = "0.81.0" }
-cranelift-reader = { path = "../reader", version = "0.81.0" }
+cranelift-frontend = { path = "../frontend", version = "0.82.0" }
+cranelift-reader = { path = "../reader", version = "0.82.0" }
 
 [badges]
 maintenance = { status = "experimental" }
diff --git a/cranelift/isle/isle/Cargo.toml b/cranelift/isle/isle/Cargo.toml
index fab0c3587..b29318f0e 100644
--- a/cranelift/isle/isle/Cargo.toml
+++ b/cranelift/isle/isle/Cargo.toml
@@ -6,7 +6,7 @@ license = "Apache-2.0 WITH LLVM-exception"
 name = "cranelift-isle"
 readme = "../README.md"
 repository = "https://github.com/bytecodealliance/wasmtime/tree/main/cranelift/isle"
-version = "0.81.0"
+version = "0.82.0"
 
 [dependencies]
 log = "0.4"
diff --git a/cranelift/jit/Cargo.toml b/cranelift/jit/Cargo.toml
index 64a3e9424..467bed437 100644
--- a/cranelift/jit/Cargo.toml
+++ b/cranelift/jit/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "cranelift-jit"
-version = "0.81.0"
+version = "0.82.0"
 authors = ["The Cranelift Project Developers"]
 description = "A JIT library backed by Cranelift"
 repository = "https://github.com/bytecodealliance/wasmtime"
@@ -10,10 +10,10 @@ readme = "README.md"
 edition = "2018"
 
 [dependencies]
-cranelift-module = { path = "../module", version = "0.81.0" }
-cranelift-native = { path = "../native", version = "0.81.0" }
-cranelift-codegen = { path = "../codegen", version = "0.81.0", default-features = false, features = ["std"] }
-cranelift-entity = { path = "../entity", version = "0.81.0" }
+cranelift-module = { path = "../module", version = "0.82.0" }
+cranelift-native = { path = "../native", version = "0.82.0" }
+cranelift-codegen = { path = "../codegen", version = "0.82.0", default-features = false, features = ["std"] }
+cranelift-entity = { path = "../entity", version = "0.82.0" }
 anyhow = "1.0"
 region = "2.2.0"
 libc = { version = "0.2.42" }
@@ -29,9 +29,9 @@ selinux-fix = ['memmap2']
 default = []
 
 [dev-dependencies]
-cranelift = { path = "../umbrella", version = "0.81.0" }
-cranelift-frontend = { path = "../frontend", version = "0.81.0" }
-cranelift-entity = { path = "../entity", version = "0.81.0" }
+cranelift = { path = "../umbrella", version = "0.82.0" }
+cranelift-frontend = { path = "../frontend", version = "0.82.0" }
+cranelift-entity = { path = "../entity", version = "0.82.0" }
 
 [badges]
 maintenance = { status = "experimental" }
diff --git a/cranelift/module/Cargo.toml b/cranelift/module/Cargo.toml
index a511a849f..a4807b45a 100644
--- a/cranelift/module/Cargo.toml
+++ b/cranelift/module/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "cranelift-module"
-version = "0.81.0"
+version = "0.82.0"
 authors = ["The Cranelift Project Developers"]
 description = "Support for linking functions and data with Cranelift"
 repository = "https://github.com/bytecodealliance/wasmtime"
@@ -11,7 +11,7 @@ readme = "README.md"
 edition = "2018"
 
 [dependencies]
-cranelift-codegen = { path = "../codegen", version = "0.81.0", default-features = false }
+cranelift-codegen = { path = "../codegen", version = "0.82.0", default-features = false }
 hashbrown = { version = "0.9.1", optional = true }
 anyhow = "1.0"
 
diff --git a/cranelift/native/Cargo.toml b/cranelift/native/Cargo.toml
index 303b2defd..89d330bc8 100644
--- a/cranelift/native/Cargo.toml
+++ b/cranelift/native/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "cranelift-native"
-version = "0.81.0"
+version = "0.82.0"
 authors = ["The Cranelift Project Developers"]
 description = "Support for targeting the host with Cranelift"
 documentation = "https://docs.rs/cranelift-native"
@@ -11,7 +11,7 @@ readme = "README.md"
 edition = "2018"
 
 [dependencies]
-cranelift-codegen = { path = "../codegen", version = "0.81.0", default-features = false }
+cranelift-codegen = { path = "../codegen", version = "0.82.0", default-features = false }
 target-lexicon = "0.12"
 
 [target.'cfg(target_arch = "s390x")'.dependencies]
diff --git a/cranelift/object/Cargo.toml b/cranelift/object/Cargo.toml
index 386079a6e..c01af135d 100644
--- a/cranelift/object/Cargo.toml
+++ b/cranelift/object/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "cranelift-object"
-version = "0.81.0"
+version = "0.82.0"
 authors = ["The Cranelift Project Developers"]
 description = "Emit Cranelift output to native object files with `object`"
 repository = "https://github.com/bytecodealliance/wasmtime"
@@ -10,16 +10,16 @@ readme = "README.md"
 edition = "2018"
 
 [dependencies]
-cranelift-module = { path = "../module", version = "0.81.0" }
-cranelift-codegen = { path = "../codegen", version = "0.81.0", default-features = false, features = ["std"] }
+cranelift-module = { path = "../module", version = "0.82.0" }
+cranelift-codegen = { path = "../codegen", version = "0.82.0", default-features = false, features = ["std"] }
 object = { version = "0.27.0", default-features = false, features = ["write"] }
 target-lexicon = "0.12"
 anyhow = "1.0"
 log = { version = "0.4.6", default-features = false }
 
 [dev-dependencies]
-cranelift-frontend = { path = "../frontend", version = "0.81.0" }
-cranelift-entity = { path = "../entity", version = "0.81.0" }
+cranelift-frontend = { path = "../frontend", version = "0.82.0" }
+cranelift-entity = { path = "../entity", version = "0.82.0" }
 
 [badges]
 maintenance = { status = "experimental" }
diff --git a/cranelift/preopt/Cargo.toml b/cranelift/preopt/Cargo.toml
index a27b109ff..05f955e9a 100644
--- a/cranelift/preopt/Cargo.toml
+++ b/cranelift/preopt/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 authors = ["The Cranelift Project Developers"]
 name = "cranelift-preopt"
-version = "0.81.0"
+version = "0.82.0"
 description = "Support for optimizations in Cranelift"
 license = "Apache-2.0 WITH LLVM-exception"
 documentation = "https://docs.rs/cranelift-preopt"
@@ -12,7 +12,7 @@ keywords = ["optimize", "compile", "compiler", "jit"]
 edition = "2018"
 
 [dependencies]
-cranelift-codegen = { path = "../codegen", version = "0.81.0", default-features = false }
+cranelift-codegen = { path = "../codegen", version = "0.82.0", default-features = false }
 # This is commented out because it doesn't build on Rust 1.25.0, which
 # cranelift currently supports.
 # rustc_apfloat = { version = "0.1.2", default-features = false }
diff --git a/cranelift/reader/Cargo.toml b/cranelift/reader/Cargo.toml
index e3f7094c6..c9c3fc053 100644
--- a/cranelift/reader/Cargo.toml
+++ b/cranelift/reader/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 authors = ["The Cranelift Project Developers"]
 name = "cranelift-reader"
-version = "0.81.0"
+version = "0.82.0"
 description = "Cranelift textual IR reader"
 license = "Apache-2.0 WITH LLVM-exception"
 documentation = "https://docs.rs/cranelift-reader"
@@ -10,7 +10,7 @@ readme = "README.md"
 edition = "2018"
 
 [dependencies]
-cranelift-codegen = { path = "../codegen", version = "0.81.0" }
+cranelift-codegen = { path = "../codegen", version = "0.82.0" }
 smallvec = "1.6.1"
 target-lexicon = "0.12"
 
diff --git a/cranelift/serde/Cargo.toml b/cranelift/serde/Cargo.toml
index 94cd4af56..918688ab4 100644
--- a/cranelift/serde/Cargo.toml
+++ b/cranelift/serde/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "cranelift-serde"
-version = "0.81.0"
+version = "0.82.0"
 authors = ["The Cranelift Project Developers"]
 description = "Serializer/Deserializer for Cranelift IR"
 repository = "https://github.com/bytecodealliance/wasmtime"
@@ -16,8 +16,8 @@ path = "src/clif-json.rs"
 [dependencies]
 clap = "2.32.0"
 serde_json = "1.0.26"
-cranelift-codegen = { path = "../codegen", version = "0.81.0", features = ["enable-serde"] }
-cranelift-reader = { path = "../reader", version = "0.81.0" }
+cranelift-codegen = { path = "../codegen", version = "0.82.0", features = ["enable-serde"] }
+cranelift-reader = { path = "../reader", version = "0.82.0" }
 
 [badges]
 maintenance = { status = "experimental" }
diff --git a/cranelift/umbrella/Cargo.toml b/cranelift/umbrella/Cargo.toml
index fac9c9106..ef3f939ad 100644
--- a/cranelift/umbrella/Cargo.toml
+++ b/cranelift/umbrella/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 authors = ["The Cranelift Project Developers"]
 name = "cranelift"
-version = "0.81.0"
+version = "0.82.0"
 description = "Umbrella for commonly-used cranelift crates"
 license = "Apache-2.0 WITH LLVM-exception"
 documentation = "https://docs.rs/cranelift"
@@ -12,8 +12,8 @@ keywords = ["compile", "compiler", "jit"]
 edition = "2018"
 
 [dependencies]
-cranelift-codegen = { path = "../codegen", version = "0.81.0", default-features = false }
-cranelift-frontend = { path = "../frontend", version = "0.81.0", default-features = false }
+cranelift-codegen = { path = "../codegen", version = "0.82.0", default-features = false }
+cranelift-frontend = { path = "../frontend", version = "0.82.0", default-features = false }
 
 [features]
 default = ["std"]
diff --git a/cranelift/wasm/Cargo.toml b/cranelift/wasm/Cargo.toml
index 8ac7c36ba..0cee3c070 100644
--- a/cranelift/wasm/Cargo.toml
+++ b/cranelift/wasm/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "cranelift-wasm"
-version = "0.81.0"
+version = "0.82.0"
 authors = ["The Cranelift Project Developers"]
 description = "Translator from WebAssembly to Cranelift IR"
 documentation = "https://docs.rs/cranelift-wasm"
@@ -13,10 +13,10 @@ edition = "2018"
 
 [dependencies]
 wasmparser = { version = "0.83.0", default-features = false }
-cranelift-codegen = { path = "../codegen", version = "0.81.0", default-features = false }
-cranelift-entity = { path = "../entity", version = "0.81.0" }
-cranelift-frontend = { path = "../frontend", version = "0.81.0", default-features = false }
-wasmtime-types = { path = "../../crates/types", version = "0.34.0" }
+cranelift-codegen = { path = "../codegen", version = "0.82.0", default-features = false }
+cranelift-entity = { path = "../entity", version = "0.82.0" }
+cranelift-frontend = { path = "../frontend", version = "0.82.0", default-features = false }
+wasmtime-types = { path = "../../crates/types", version = "0.35.0" }
 hashbrown = { version = "0.9.1", optional = true }
 itertools = "0.10.0"
 log = { version = "0.4.6", default-features = false }
@@ -26,7 +26,7 @@ smallvec = "1.6.1"
 [dev-dependencies]
 wat = "1.0.37"
 target-lexicon = "0.12"
-cranelift-codegen = { path = "../codegen", version = "0.81.0", default-features = false }
+cranelift-codegen = { path = "../codegen", version = "0.82.0", default-features = false }
 
 [features]
 default = ["std"]
diff --git a/crates/cache/Cargo.toml b/crates/cache/Cargo.toml
index f92af65c8..7b8014e37 100644
--- a/crates/cache/Cargo.toml
+++ b/crates/cache/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasmtime-cache"
-version = "0.34.0"
+version = "0.35.0"
 authors = ["The Wasmtime Project Developers"]
 description = "Support for automatic module caching with Wasmtime"
 license = "Apache-2.0 WITH LLVM-exception"
diff --git a/crates/cranelift/Cargo.toml b/crates/cranelift/Cargo.toml
index 053624462..a337bcfe3 100644
--- a/crates/cranelift/Cargo.toml
+++ b/crates/cranelift/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasmtime-cranelift"
-version = "0.34.0"
+version = "0.35.0"
 authors = ["The Wasmtime Project Developers"]
 description = "Integration between Cranelift and Wasmtime"
 license = "Apache-2.0 WITH LLVM-exception"
@@ -8,17 +8,17 @@ repository = "https://github.com/bytecodealliance/wasmtime"
 documentation = "https://docs.rs/wasmtime-cranelift/"
 categories = ["wasm"]
 keywords = ["webassembly", "wasm"]
-edition = "2018"
+edition = "2021"
 
 [dependencies]
 anyhow = "1.0"
 log = "0.4"
-wasmtime-environ = { path = "../environ", version = "=0.34.0" }
-cranelift-wasm = { path = "../../cranelift/wasm", version = "0.81.0" }
-cranelift-codegen = { path = "../../cranelift/codegen", version = "0.81.0" }
-cranelift-frontend = { path = "../../cranelift/frontend", version = "0.81.0" }
-cranelift-entity = { path = "../../cranelift/entity", version = "0.81.0" }
-cranelift-native = { path = "../../cranelift/native", version = "0.81.0" }
+wasmtime-environ = { path = "../environ", version = "=0.35.0" }
+cranelift-wasm = { path = "../../cranelift/wasm", version = "0.82.0" }
+cranelift-codegen = { path = "../../cranelift/codegen", version = "0.82.0" }
+cranelift-frontend = { path = "../../cranelift/frontend", version = "0.82.0" }
+cranelift-entity = { path = "../../cranelift/entity", version = "0.82.0" }
+cranelift-native = { path = "../../cranelift/native", version = "0.82.0" }
 wasmparser = "0.83.0"
 target-lexicon = "0.12"
 gimli = { version = "0.26.0", default-features = false, features = ['read', 'std'] }
diff --git a/crates/cranelift/src/compiler.rs b/crates/cranelift/src/compiler.rs
index fd41e2e66..a67790bb3 100644
--- a/crates/cranelift/src/compiler.rs
+++ b/crates/cranelift/src/compiler.rs
@@ -264,9 +264,11 @@ impl wasmtime_environ::Compiler for Compiler {
             traps.push(range.clone(), &func.traps);
             func_starts.push(range.start);
             if self.linkopts.padding_between_functions > 0 {
-                builder
-                    .text
-                    .append(false, &vec![0; self.linkopts.padding_between_functions], 1);
+                builder.text.append(
+                    false,
+                    &vec![0; self.linkopts.padding_between_functions],
+                    Some(1),
+                );
             }
         }
 
@@ -547,36 +549,22 @@ impl Compiler {
         isa: &dyn TargetIsa,
     ) -> Result<CompiledFunction, CompileError> {
         let mut code_buf = Vec::new();
-        let mut relocs = Vec::new();
         context
             .compile_and_emit(isa, &mut code_buf)
             .map_err(|error| CompileError::Codegen(pretty_error(&context.func, error)))?;
 
-        for &MachReloc {
-            offset,
-            srcloc: _,
-            kind,
-            ref name,
-            addend,
-        } in context
+        // Processing relocations isn't the hardest thing in the world here but
+        // no trampoline should currently generate a relocation, so assert that
+        // they're all empty and if this ever trips in the future then handling
+        // will need to be added here to ensure they make their way into the
+        // `CompiledFunction` below.
+        assert!(context
             .mach_compile_result
             .as_ref()
             .unwrap()
             .buffer
             .relocs()
-        {
-            let reloc_target = if let ir::ExternalName::LibCall(libcall) = *name {
-                RelocationTarget::LibCall(libcall)
-            } else {
-                panic!("unrecognized external name")
-            };
-            relocs.push(Relocation {
-                reloc: kind,
-                reloc_target,
-                offset,
-                addend,
-            });
-        }
+            .is_empty());
 
         let unwind_info = context
             .create_unwind_info(isa)
@@ -585,7 +573,7 @@ impl Compiler {
         Ok(CompiledFunction {
             body: code_buf,
             unwind_info,
-            relocations: relocs,
+            relocations: Vec::new(),
             stack_slots: Default::default(),
             value_labels_ranges: Default::default(),
             info: Default::default(),
diff --git a/crates/cranelift/src/obj.rs b/crates/cranelift/src/obj.rs
index 62c7ed9ba..05bde6d7f 100644
--- a/crates/cranelift/src/obj.rs
+++ b/crates/cranelift/src/obj.rs
@@ -17,7 +17,6 @@ use crate::debug::{DwarfSection, DwarfSectionRelocTarget};
 use crate::{CompiledFunction, Relocation, RelocationTarget};
 use anyhow::Result;
 use cranelift_codegen::binemit::Reloc;
-use cranelift_codegen::ir::LibCall;
 use cranelift_codegen::isa::{
     unwind::{systemv, UnwindInfo},
     TargetIsa,
@@ -69,30 +68,6 @@ macro_rules! for_each_libcall {
     };
 }
 
-fn write_libcall_symbols(obj: &mut Object) -> HashMap<LibCall, SymbolId> {
-    let mut libcalls = HashMap::new();
-    macro_rules! add_libcall_symbol {
-        [$(($libcall:ident, $export:ident)),*] => {{
-            $(
-                let symbol_id = obj.add_symbol(Symbol {
-                    name: stringify!($export).as_bytes().to_vec(),
-                    value: 0,
-                    size: 0,
-                    kind: SymbolKind::Text,
-                    scope: SymbolScope::Linkage,
-                    weak: true,
-                    section: SymbolSection::Undefined,
-                    flags: SymbolFlags::None,
-                });
-                libcalls.insert(LibCall::$libcall, symbol_id);
-            )+
-        }};
-    }
-    for_each_libcall!(add_libcall_symbol);
-
-    libcalls
-}
-
 /// A helper structure used to assemble the final text section of an exectuable,
 /// plus unwinding information and other related details.
 ///
@@ -110,10 +85,6 @@ pub struct ObjectBuilder<'a> {
     /// The WebAssembly module we're generating code for.
     module: &'a Module,
 
-    /// Map of injected symbols for all possible libcalls, used whenever there's
-    /// a relocation against a libcall.
-    libcalls: HashMap<LibCall, SymbolId>,
-
     windows_unwind_info_id: Option<SectionId>,
 
     /// Packed form of windows unwind tables which, if present, will get emitted
@@ -190,15 +161,12 @@ impl<'a> ObjectBuilder<'a> {
             func_symbols.push(symbol_id);
         }
 
-        let libcalls = write_libcall_symbols(obj);
-
         Self {
             isa,
             obj,
             module,
             text_section,
             func_symbols,
-            libcalls,
             windows_unwind_info_id: None,
             windows_unwind_info: Vec::new(),
             systemv_unwind_info_id: None,
@@ -216,12 +184,12 @@ impl<'a> ObjectBuilder<'a> {
     /// that the function resides within the text section.
     fn append_func(
         &mut self,
-        wat: bool,
+        labeled: bool,
         name: Vec<u8>,
         func: &'a CompiledFunction,
     ) -> (SymbolId, Range<u64>) {
         let body_len = func.body.len() as u64;
-        let off = self.text.append(wat, &func.body, 1);
+        let off = self.text.append(labeled, &func.body, None);
 
         let symbol_id = self.obj.add_symbol(Symbol {
             name,
@@ -247,7 +215,7 @@ impl<'a> ObjectBuilder<'a> {
                 let unwind_size = info.emit_size();
                 let mut unwind_info = vec![0; unwind_size];
                 info.emit(&mut unwind_info);
-                let unwind_off = self.text.append(false, &unwind_info, 4);
+                let unwind_off = self.text.append(false, &unwind_info, Some(4));
                 self.windows_unwind_info.push(RUNTIME_FUNCTION {
                     begin: u32::try_from(off).unwrap(),
                     end: u32::try_from(off + body_len).unwrap(),
@@ -266,7 +234,7 @@ impl<'a> ObjectBuilder<'a> {
         }
 
         for r in func.relocations.iter() {
-            let (symbol, symbol_offset) = match r.reloc_target {
+            match r.reloc_target {
                 // Relocations against user-defined functions means that this is
                 // a relocation against a module-local function, typically a
                 // call between functions. The `text` field is given priority to
@@ -284,43 +252,27 @@ impl<'a> ObjectBuilder<'a> {
                         continue;
                     }
 
-                    // FIXME(#3009) once the old backend is removed all
-                    // inter-function relocations should be handled by
-                    // `self.text`. This can become `unreachable!()` in that
-                    // case.
-                    self.relocations.push((r, off));
-                    continue;
+                    // At this time it's expected that all relocations are
+                    // handled by `text.resolve_reloc`, and anything that isn't
+                    // handled is a bug in `text.resolve_reloc` or something
+                    // transitively there. If truly necessary, though, then this
+                    // loop could also be updated to forward the relocation to
+                    // the final object file as well.
+                    panic!(
+                        "unresolved relocation could not be procesed against \
+                         {index:?}: {r:?}"
+                    );
                 }
 
-                // These relocations, unlike against user funcs above, typically
-                // involve absolute addresses and need to get resolved at load
-                // time. These are persisted immediately into the object file.
-                //
-                // FIXME: these, like user-defined-functions, should probably
-                // use relative jumps and avoid absolute relocations. They don't
-                // seem too common though so aren't necessarily that important
-                // to optimize.
-                RelocationTarget::LibCall(call) => (self.libcalls[&call], 0),
-            };
-            let (kind, encoding, size) = match r.reloc {
-                Reloc::Abs4 => (RelocationKind::Absolute, RelocationEncoding::Generic, 32),
-                Reloc::Abs8 => (RelocationKind::Absolute, RelocationEncoding::Generic, 64),
-
-                other => unimplemented!("Unimplemented relocation {:?}", other),
+                // At this time it's not expected that any libcall relocations
+                // are generated. Ideally we don't want relocations against
+                // libcalls anyway as libcalls should go through indirect
+                // `VMContext` tables to avoid needing to apply relocations at
+                // module-load time as well.
+                RelocationTarget::LibCall(call) => {
+                    unimplemented!("cannot generate relocation against libcall {call:?}");
+                }
             };
-            self.obj
-                .add_relocation(
-                    self.text_section,
-                    ObjectRelocation {
-                        offset: off + r.offset as u64,
-                        size,
-                        kind,
-                        encoding,
-                        symbol,
-                        addend: r.addend.wrapping_add(symbol_offset as i64),
-                    },
-                )
-                .unwrap();
         }
         (symbol_id, off..off + body_len)
     }
diff --git a/crates/environ/Cargo.toml b/crates/environ/Cargo.toml
index 408478c47..74c5bd909 100644
--- a/crates/environ/Cargo.toml
+++ b/crates/environ/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasmtime-environ"
-version = "0.34.0"
+version = "0.35.0"
 authors = ["The Wasmtime Project Developers"]
 description = "Standalone environment support for WebAsssembly code in Cranelift"
 license = "Apache-2.0 WITH LLVM-exception"
@@ -12,8 +12,8 @@ edition = "2018"
 
 [dependencies]
 anyhow = "1.0"
-cranelift-entity = { path = "../../cranelift/entity", version = "0.81.0" }
-wasmtime-types = { path = "../types", version = "0.34.0" }
+cranelift-entity = { path = "../../cranelift/entity", version = "0.82.0" }
+wasmtime-types = { path = "../types", version = "0.35.0" }
 wasmparser = "0.83.0"
 indexmap = { version = "1.0.2", features = ["serde-1"] }
 thiserror = "1.0.4"
diff --git a/crates/environ/src/compilation.rs b/crates/environ/src/compilation.rs
index d091024e6..3ec65cb4f 100644
--- a/crates/environ/src/compilation.rs
+++ b/crates/environ/src/compilation.rs
@@ -235,7 +235,7 @@ pub trait Compiler: Send + Sync {
 }
 
 /// Value of a configured setting for a [`Compiler`]
-#[derive(Serialize, Deserialize, Hash, Eq, PartialEq)]
+#[derive(Serialize, Deserialize, Hash, Eq, PartialEq, Debug)]
 pub enum FlagValue {
     /// Name of the value that has been configured for this setting.
     Enum(Cow<'static, str>),
diff --git a/crates/fiber/Cargo.toml b/crates/fiber/Cargo.toml
index bd8a9f9d2..dd0aed397 100644
--- a/crates/fiber/Cargo.toml
+++ b/crates/fiber/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasmtime-fiber"
-version = "0.34.0"
+version = "0.35.0"
 authors = ["The Wasmtime Project Developers"]
 description = "Fiber support for Wasmtime"
 license = "Apache-2.0 WITH LLVM-exception"
diff --git a/crates/fuzzing/src/generators.rs b/crates/fuzzing/src/generators.rs
index 7f9bfbcbe..c91cf1f9b 100644
--- a/crates/fuzzing/src/generators.rs
+++ b/crates/fuzzing/src/generators.rs
@@ -211,6 +211,8 @@ pub struct WasmtimeConfig {
     /// Configuration for the instance allocation strategy to use.
     pub strategy: InstanceAllocationStrategy,
     codegen: CodegenSettings,
+    padding_between_functions: Option<u16>,
+    generate_address_map: bool,
 }
 
 /// Configuration for linear memories in Wasmtime.
@@ -355,9 +357,9 @@ impl Config {
             limits.memories = 1;
             limits.tables = 5;
             limits.table_elements = 1_000;
-            // Set a lower bound of 10 pages as the spec tests define memories with at
+            // Set a lower bound of as the spec tests define memories with at
             // least a few pages and some tests do memory grow operations.
-            limits.memory_pages = std::cmp::max(limits.memory_pages, 10);
+            limits.memory_pages = std::cmp::max(limits.memory_pages, 900);
 
             match &mut self.wasmtime.memory_config {
                 MemoryConfig::Normal(config) => {
@@ -393,7 +395,8 @@ impl Config {
                 16 << 20,
                 self.wasmtime.memory_guaranteed_dense_image_size,
             ))
-            .allocation_strategy(self.wasmtime.strategy.to_wasmtime());
+            .allocation_strategy(self.wasmtime.strategy.to_wasmtime())
+            .generate_address_map(self.wasmtime.generate_address_map);
 
         self.wasmtime.codegen.configure(&mut cfg);
 
@@ -418,6 +421,16 @@ impl Config {
             }
         }
 
+        if let Some(pad) = self.wasmtime.padding_between_functions {
+            unsafe {
+                cfg.cranelift_flag_set(
+                    "wasmtime_linkopt_padding_between_functions",
+                    &pad.to_string(),
+                )
+                .unwrap();
+            }
+        }
+
         match &self.wasmtime.memory_config {
             MemoryConfig::Normal(memory_config) => {
                 cfg.static_memory_maximum_size(
diff --git a/crates/jit-debug/Cargo.toml b/crates/jit-debug/Cargo.toml
index 1de216cac..bb0800b25 100644
--- a/crates/jit-debug/Cargo.toml
+++ b/crates/jit-debug/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasmtime-jit-debug"
-version = "0.34.0"
+version = "0.35.0"
 authors = ["The Wasmtime Project Developers"]
 description = "JIT debug interfaces support for Wasmtime"
 license = "Apache-2.0 WITH LLVM-exception"
diff --git a/crates/jit/Cargo.toml b/crates/jit/Cargo.toml
index d65ef3a7e..c8d22230f 100644
--- a/crates/jit/Cargo.toml
+++ b/crates/jit/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasmtime-jit"
-version = "0.34.0"
+version = "0.35.0"
 authors = ["The Wasmtime Project Developers"]
 description = "JIT-style execution for WebAsssembly code in Cranelift"
 documentation = "https://docs.rs/wasmtime-jit"
@@ -11,9 +11,9 @@ repository = "https://github.com/bytecodealliance/wasmtime"
 edition = "2018"
 
 [dependencies]
-wasmtime-environ = { path = "../environ", version = "=0.34.0" }
-wasmtime-jit-debug = { path = "../jit-debug", version = "=0.34.0", features = ["perf_jitdump"], optional = true }
-wasmtime-runtime = { path = "../runtime", version = "=0.34.0" }
+wasmtime-environ = { path = "../environ", version = "=0.35.0" }
+wasmtime-jit-debug = { path = "../jit-debug", version = "=0.35.0", features = ["perf_jitdump"], optional = true }
+wasmtime-runtime = { path = "../runtime", version = "=0.35.0" }
 region = "2.2.0"
 thiserror = "1.0.4"
 target-lexicon = { version = "0.12.0", default-features = false }
diff --git a/crates/jit/src/code_memory.rs b/crates/jit/src/code_memory.rs
index c4797c461..5dfe1a111 100644
--- a/crates/jit/src/code_memory.rs
+++ b/crates/jit/src/code_memory.rs
@@ -148,18 +148,12 @@ impl CodeMemory {
                 std::slice::from_raw_parts_mut(ret.text.as_ptr() as *mut u8, ret.text.len());
             let text_offset = ret.text.as_ptr() as usize - ret.mmap.as_ptr() as usize;
             let text_range = text_offset..text_offset + text_mut.len();
-            let mut text_section_readwrite = false;
-            for (offset, r) in text.relocations() {
-                // If the text section was mapped at readonly we need to make it
-                // briefly read/write here as we apply relocations.
-                if !text_section_readwrite && self.mmap.is_readonly() {
-                    self.mmap
-                        .make_writable(text_range.clone())
-                        .expect("unable to make memory writable");
-                    text_section_readwrite = true;
-                }
-                crate::link::apply_reloc(&ret.obj, text_mut, offset, r);
-            }
+
+            // Double-check there are no relocations in the text section. At
+            // this time relocations are not expected at all from loaded code
+            // since everything should be resolved at compile time. Handling
+            // must be added here, though, if relocations pop up.
+            assert!(text.relocations().count() == 0);
 
             // Switch the executable portion from read/write to
             // read/execute, notably not using read/write/execute to prevent
diff --git a/crates/jit/src/lib.rs b/crates/jit/src/lib.rs
index 4152f56c7..07d93c0b2 100644
--- a/crates/jit/src/lib.rs
+++ b/crates/jit/src/lib.rs
@@ -24,7 +24,6 @@ mod code_memory;
 mod debug;
 mod demangling;
 mod instantiate;
-mod link;
 mod profiling;
 mod unwind;
 
diff --git a/crates/jit/src/link.rs b/crates/jit/src/link.rs
deleted file mode 100644
index 08f0cbf73..000000000
--- a/crates/jit/src/link.rs
+++ /dev/null
@@ -1,89 +0,0 @@
-//! Linking for JIT-compiled code.
-
-use object::read::{Object, Relocation, RelocationTarget};
-use object::{File, NativeEndian as NE, ObjectSymbol, RelocationEncoding, RelocationKind};
-use std::convert::TryFrom;
-use wasmtime_runtime::libcalls;
-
-type I32 = object::I32Bytes<NE>;
-type U64 = object::U64Bytes<NE>;
-
-/// Applies the relocation `r` at `offset` within `code`, according to the
-/// symbols found in `obj`.
-///
-/// This method is used at runtime to resolve relocations in ELF images,
-/// typically with respect to where the memory was placed in the final address
-/// in memory.
-pub fn apply_reloc(obj: &File, code: &mut [u8], offset: u64, r: Relocation) {
-    let target_func_address: usize = match r.target() {
-        RelocationTarget::Symbol(i) => {
-            // Processing relocation target is a named symbols that is compiled
-            // wasm function or runtime libcall.
-            let sym = obj.symbol_by_index(i).unwrap();
-            if sym.is_local() {
-                &code[sym.address() as usize] as *const u8 as usize
-            } else {
-                match sym.name() {
-                    Ok(name) => {
-                        if let Some(addr) = to_libcall_address(name) {
-                            addr
-                        } else {
-                            panic!("unknown function to link: {}", name);
-                        }
-                    }
-                    Err(_) => panic!("unexpected relocation target: not a symbol"),
-                }
-            }
-        }
-        _ => panic!("unexpected relocation target: not a symbol"),
-    };
-
-    match (r.kind(), r.encoding(), r.size()) {
-        (RelocationKind::Absolute, RelocationEncoding::Generic, 64) => {
-            let reloc_address = reloc_address::<U64>(code, offset);
-            let reloc_abs = (target_func_address as u64)
-                .checked_add(r.addend() as u64)
-                .unwrap();
-            reloc_address.set(NE, reloc_abs);
-        }
-
-        // FIXME(#3009) after the old backend is removed this won't ever show up
-        // again so it can be removed.
-        (RelocationKind::Relative, RelocationEncoding::Generic, 32) => {
-            let reloc_address = reloc_address::<I32>(code, offset);
-            let val = (target_func_address as i64)
-                .wrapping_add(r.addend())
-                .wrapping_sub(reloc_address as *const _ as i64);
-            reloc_address.set(NE, i32::try_from(val).expect("relocation out-of-bounds"));
-        }
-
-        other => panic!("unsupported reloc kind: {:?}", other),
-    }
-}
-
-fn reloc_address<T: object::Pod>(code: &mut [u8], offset: u64) -> &mut T {
-    let (reloc, _rest) = usize::try_from(offset)
-        .ok()
-        .and_then(move |offset| code.get_mut(offset..))
-        .and_then(|range| object::from_bytes_mut(range).ok())
-        .expect("invalid reloc offset");
-    reloc
-}
-
-fn to_libcall_address(name: &str) -> Option<usize> {
-    use self::libcalls::*;
-    use wasmtime_environ::for_each_libcall;
-    macro_rules! add_libcall_symbol {
-        [$(($libcall:ident, $export:ident)),*] => {
-            Some(match name {
-                $(
-                    stringify!($export) => $export as usize,
-                )+
-                _ => {
-                    return None;
-                }
-            })
-        };
-    }
-    for_each_libcall!(add_libcall_symbol)
-}
diff --git a/crates/runtime/Cargo.toml b/crates/runtime/Cargo.toml
index 50f94fac6..1ef8bb563 100644
--- a/crates/runtime/Cargo.toml
+++ b/crates/runtime/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasmtime-runtime"
-version = "0.34.0"
+version = "0.35.0"
 authors = ["The Wasmtime Project Developers"]
 description = "Runtime library support for Wasmtime"
 documentation = "https://docs.rs/wasmtime-runtime"
@@ -11,9 +11,9 @@ repository = "https://github.com/bytecodealliance/wasmtime"
 edition = "2018"
 
 [dependencies]
-wasmtime-environ = { path = "../environ", version = "=0.34.0" }
-wasmtime-fiber = { path = "../fiber", version = "=0.34.0", optional = true }
-wasmtime-jit-debug = { path = "../jit-debug", version = "=0.34.0", features = ["gdb_jit_int"] }
+wasmtime-environ = { path = "../environ", version = "=0.35.0" }
+wasmtime-fiber = { path = "../fiber", version = "=0.35.0", optional = true }
+wasmtime-jit-debug = { path = "../jit-debug", version = "=0.35.0", features = ["gdb_jit_int"] }
 region = "2.1.0"
 libc = { version = "0.2.112", default-features = false }
 log = "0.4.8"
diff --git a/crates/types/Cargo.toml b/crates/types/Cargo.toml
index a5ac9d1f3..dd257c1b1 100644
--- a/crates/types/Cargo.toml
+++ b/crates/types/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasmtime-types"
-version = "0.34.0"
+version = "0.35.0"
 authors = ["The Wasmtime Project Developers"]
 description = "WebAssembly type definitions for Cranelift"
 license = "Apache-2.0 WITH LLVM-exception"
@@ -9,7 +9,7 @@ documentation = "https://docs.rs/wasmtime-types"
 edition = "2018"
 
 [dependencies]
-cranelift-entity = { path = "../../cranelift/entity", version = "0.81.0", features = ['enable-serde'] }
+cranelift-entity = { path = "../../cranelift/entity", version = "0.82.0", features = ['enable-serde'] }
 serde = { version = "1.0.94", features = ["derive"] }
 thiserror = "1.0.4"
 wasmparser = { version = "0.83.0", default-features = false }
diff --git a/crates/wasi-common/Cargo.toml b/crates/wasi-common/Cargo.toml
index b22d9d959..0b3a7d173 100644
--- a/crates/wasi-common/Cargo.toml
+++ b/crates/wasi-common/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasi-common"
-version = "0.34.0"
+version = "0.35.0"
 authors = ["The Wasmtime Project Developers"]
 description = "WASI implementation in Rust"
 license = "Apache-2.0 WITH LLVM-exception"
@@ -20,7 +20,7 @@ links = "wasi-common-19"
 [dependencies]
 anyhow = "1.0"
 thiserror = "1.0"
-wiggle = { path = "../wiggle", default-features = false, version = "=0.34.0" }
+wiggle = { path = "../wiggle", default-features = false, version = "=0.35.0" }
 tracing = "0.1.19"
 cap-std = "0.24.1"
 cap-rand = "0.24.1"
diff --git a/crates/wasi-common/cap-std-sync/Cargo.toml b/crates/wasi-common/cap-std-sync/Cargo.toml
index eb9bb9edb..241d029db 100644
--- a/crates/wasi-common/cap-std-sync/Cargo.toml
+++ b/crates/wasi-common/cap-std-sync/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasi-cap-std-sync"
-version = "0.34.0"
+version = "0.35.0"
 authors = ["The Wasmtime Project Developers"]
 description = "WASI implementation in Rust"
 license = "Apache-2.0 WITH LLVM-exception"
@@ -12,7 +12,7 @@ edition = "2018"
 include = ["src/**/*", "README.md", "LICENSE" ]
 
 [dependencies]
-wasi-common = { path = "../", version = "=0.34.0" }
+wasi-common = { path = "../", version = "=0.35.0" }
 async-trait = "0.1"
 anyhow = "1.0"
 cap-std = "0.24.1"
diff --git a/crates/wasi-common/tokio/Cargo.toml b/crates/wasi-common/tokio/Cargo.toml
index faea76ebf..16fe6ac74 100644
--- a/crates/wasi-common/tokio/Cargo.toml
+++ b/crates/wasi-common/tokio/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasi-tokio"
-version = "0.34.0"
+version = "0.35.0"
 authors = ["The Wasmtime Project Developers"]
 description = "WASI implementation in Rust"
 license = "Apache-2.0 WITH LLVM-exception"
@@ -11,9 +11,9 @@ edition = "2018"
 include = ["src/**/*", "LICENSE" ]
 
 [dependencies]
-wasi-common = { path = "../", version = "=0.34.0" }
-wasi-cap-std-sync = { path = "../cap-std-sync", version = "=0.34.0" }
-wiggle = { path = "../../wiggle", version = "=0.34.0" }
+wasi-common = { path = "../", version = "=0.35.0" }
+wasi-cap-std-sync = { path = "../cap-std-sync", version = "=0.35.0" }
+wiggle = { path = "../../wiggle", version = "=0.35.0" }
 tokio = { version = "1.8.0", features = [ "rt", "fs", "time", "io-util", "net", "io-std", "rt-multi-thread"] }
 cap-std = "0.24.1"
 anyhow = "1"
diff --git a/crates/wasi-crypto/Cargo.toml b/crates/wasi-crypto/Cargo.toml
index 738434f73..ff95acaeb 100644
--- a/crates/wasi-crypto/Cargo.toml
+++ b/crates/wasi-crypto/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasmtime-wasi-crypto"
-version = "0.34.0"
+version = "0.35.0"
 authors = ["The Wasmtime Project Developers"]
 description = "Wasmtime implementation of the wasi-crypto API"
 documentation = "https://docs.rs/wasmtime-wasi-crypto"
@@ -14,8 +14,8 @@ edition = "2018"
 [dependencies]
 anyhow = "1.0"
 wasi-crypto = { path = "spec/implementations/hostcalls/rust", version = "0.1.5" }
-wasmtime = { path = "../wasmtime", version = "0.34.0", default-features = false }
-wiggle = { path = "../wiggle", version = "=0.34.0" }
+wasmtime = { path = "../wasmtime", version = "0.35.0", default-features = false }
+wiggle = { path = "../wiggle", version = "=0.35.0" }
 
 [badges]
 maintenance = { status = "experimental" }
diff --git a/crates/wasi-nn/Cargo.toml b/crates/wasi-nn/Cargo.toml
index b7d3ca325..bd0c8b726 100644
--- a/crates/wasi-nn/Cargo.toml
+++ b/crates/wasi-nn/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasmtime-wasi-nn"
-version = "0.34.0"
+version = "0.35.0"
 authors = ["The Wasmtime Project Developers"]
 description = "Wasmtime implementation of the wasi-nn API"
 documentation = "https://docs.rs/wasmtime-wasi-nn"
@@ -14,7 +14,7 @@ edition = "2018"
 [dependencies]
 # These dependencies are necessary for the witx-generation macros to work:
 anyhow = "1.0"
-wiggle = { path = "../wiggle", version = "=0.34.0" }
+wiggle = { path = "../wiggle", version = "=0.35.0" }
 
 # These dependencies are necessary for the wasi-nn implementation:
 openvino = { version = "0.3.1", features = ["runtime-linking"] }
diff --git a/crates/wasi/Cargo.toml b/crates/wasi/Cargo.toml
index 868f9fbcb..58fb01854 100644
--- a/crates/wasi/Cargo.toml
+++ b/crates/wasi/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasmtime-wasi"
-version = "0.34.0"
+version = "0.35.0"
 authors = ["The Wasmtime Project Developers"]
 description = "WASI implementation in Rust"
 license = "Apache-2.0 WITH LLVM-exception"
@@ -13,11 +13,11 @@ include = ["src/**/*", "README.md", "LICENSE", "build.rs"]
 build = "build.rs"
 
 [dependencies]
-wasi-common = { path = "../wasi-common", version = "=0.34.0" }
-wasi-cap-std-sync = { path = "../wasi-common/cap-std-sync", version = "=0.34.0", optional = true }
-wasi-tokio = { path = "../wasi-common/tokio", version = "=0.34.0", optional = true }
-wiggle = { path = "../wiggle", default-features = false, version = "=0.34.0", features = ["wasmtime_integration"] }
-wasmtime = { path = "../wasmtime", default-features = false, version = "0.34.0" }
+wasi-common = { path = "../wasi-common", version = "=0.35.0" }
+wasi-cap-std-sync = { path = "../wasi-common/cap-std-sync", version = "=0.35.0", optional = true }
+wasi-tokio = { path = "../wasi-common/tokio", version = "=0.35.0", optional = true }
+wiggle = { path = "../wiggle", default-features = false, version = "=0.35.0", features = ["wasmtime_integration"] }
+wasmtime = { path = "../wasmtime", default-features = false, version = "0.35.0" }
 anyhow = "1.0"
 
 [features]
diff --git a/crates/wasi/src/lib.rs b/crates/wasi/src/lib.rs
index 91fd9b6c3..177442397 100644
--- a/crates/wasi/src/lib.rs
+++ b/crates/wasi/src/lib.rs
@@ -42,11 +42,16 @@ macro_rules! define_wasi {
 
 use wasmtime::Linker;
 
-pub fn add_to_linker<T>(
+pub fn add_to_linker<T, U>(
     linker: &mut Linker<T>,
-    get_cx: impl Fn(&mut T) -> &mut crate::WasiCtx + Send + Sync + Copy + 'static,
+    get_cx: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static,
 ) -> anyhow::Result<()>
-    where $($bounds)*
+    where U: Send
+            + wasi_common::snapshots::preview_0::wasi_unstable::WasiUnstable
+            + wasi_common::snapshots::preview_0::types::UserErrorConversion
+            + wasi_common::snapshots::preview_1::wasi_snapshot_preview1::WasiSnapshotPreview1
+            + wasi_common::snapshots::preview_1::types::UserErrorConversion,
+        $($bounds)*
 {
     snapshots::preview_1::add_wasi_snapshot_preview1_to_linker(linker, get_cx)?;
     snapshots::preview_0::add_wasi_unstable_to_linker(linker, get_cx)?;
diff --git a/crates/wasmtime/Cargo.toml b/crates/wasmtime/Cargo.toml
index 5a5c8682d..e0981952a 100644
--- a/crates/wasmtime/Cargo.toml
+++ b/crates/wasmtime/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasmtime"
-version = "0.34.0"
+version = "0.35.0"
 authors = ["The Wasmtime Project Developers"]
 description = "High-level API to expose the Wasmtime runtime"
 documentation = "https://docs.rs/wasmtime"
@@ -13,12 +13,12 @@ edition = "2018"
 rustdoc-args = ["--cfg", "nightlydoc"]
 
 [dependencies]
-wasmtime-runtime = { path = "../runtime", version = "=0.34.0" }
-wasmtime-environ = { path = "../environ", version = "=0.34.0" }
-wasmtime-jit = { path = "../jit", version = "=0.34.0" }
-wasmtime-cache = { path = "../cache", version = "=0.34.0", optional = true }
-wasmtime-fiber = { path = "../fiber", version = "=0.34.0", optional = true }
-wasmtime-cranelift = { path = "../cranelift", version = "=0.34.0", optional = true }
+wasmtime-runtime = { path = "../runtime", version = "=0.35.0" }
+wasmtime-environ = { path = "../environ", version = "=0.35.0" }
+wasmtime-jit = { path = "../jit", version = "=0.35.0" }
+wasmtime-cache = { path = "../cache", version = "=0.35.0", optional = true }
+wasmtime-fiber = { path = "../fiber", version = "=0.35.0", optional = true }
+wasmtime-cranelift = { path = "../cranelift", version = "=0.35.0", optional = true }
 target-lexicon = { version = "0.12.0", default-features = false }
 wasmparser = "0.83.0"
 anyhow = "1.0.19"
diff --git a/crates/wasmtime/src/engine.rs b/crates/wasmtime/src/engine.rs
index 835923d9d..c74c06706 100644
--- a/crates/wasmtime/src/engine.rs
+++ b/crates/wasmtime/src/engine.rs
@@ -1,12 +1,14 @@
 use crate::signatures::SignatureRegistry;
 use crate::{Config, Trap};
 use anyhow::Result;
+use once_cell::sync::OnceCell;
 #[cfg(feature = "parallel-compilation")]
 use rayon::prelude::*;
 use std::sync::atomic::{AtomicU64, Ordering};
 use std::sync::Arc;
 #[cfg(feature = "cache")]
 use wasmtime_cache::CacheConfig;
+use wasmtime_environ::FlagValue;
 use wasmtime_runtime::{debug_builtins, CompiledModuleIdAllocator, InstanceAllocator};
 
 /// An `Engine` which is a global context for compilation and management of wasm
@@ -44,6 +46,10 @@ struct EngineInner {
     signatures: SignatureRegistry,
     epoch: AtomicU64,
     unique_id_allocator: CompiledModuleIdAllocator,
+
+    // One-time check of whether the compiler's settings, if present, are
+    // compatible with the native host.
+    compatible_with_native_host: OnceCell<Result<(), String>>,
 }
 
 impl Engine {
@@ -70,6 +76,7 @@ impl Engine {
                 signatures: registry,
                 epoch: AtomicU64::new(0),
                 unique_id_allocator: CompiledModuleIdAllocator::new(),
+                compatible_with_native_host: OnceCell::new(),
             }),
         })
     }
@@ -217,6 +224,211 @@ impl Engine {
             .map(|a| f(a))
             .collect::<Result<Vec<B>, E>>()
     }
+
+    /// Returns the target triple which this engine is compiling code for
+    /// and/or running code for.
+    pub(crate) fn target(&self) -> target_lexicon::Triple {
+        // If a compiler is configured, use that target.
+        #[cfg(compiler)]
+        return self.compiler().triple().clone();
+
+        // ... otherwise it's the native target
+        #[cfg(not(compiler))]
+        return target_lexicon::Triple::host();
+    }
+
+    /// Verify that this engine's configuration is compatible with loading
+    /// modules onto the native host platform.
+    ///
+    /// This method is used as part of `Module::new` to ensure that this
+    /// engine can indeed load modules for the configured compiler (if any).
+    /// Note that if cranelift is disabled this trivially returns `Ok` because
+    /// loaded serialized modules are checked separately.
+    pub(crate) fn check_compatible_with_native_host(&self) -> Result<()> {
+        self.inner
+            .compatible_with_native_host
+            .get_or_init(|| self._check_compatible_with_native_host())
+            .clone()
+            .map_err(anyhow::Error::msg)
+    }
+    fn _check_compatible_with_native_host(&self) -> Result<(), String> {
+        #[cfg(compiler)]
+        {
+            let compiler = self.compiler();
+
+            // Check to see that the config's target matches the host
+            let target = compiler.triple();
+            if *target != target_lexicon::Triple::host() {
+                return Err(format!(
+                    "target '{}' specified in the configuration does not match the host",
+                    target
+                ));
+            }
+
+            // Also double-check all compiler settings
+            for (key, value) in compiler.flags().iter() {
+                self.check_compatible_with_shared_flag(key, value)?;
+            }
+            for (key, value) in compiler.isa_flags().iter() {
+                self.check_compatible_with_isa_flag(key, value)?;
+            }
+        }
+        Ok(())
+    }
+
+    /// Checks to see whether the "shared flag", something enabled for
+    /// individual compilers, is compatible with the native host platform.
+    ///
+    /// This is used both when validating an engine's compilation settings are
+    /// compatible with the host as well as when deserializing modules from
+    /// disk to ensure they're compatible with the current host.
+    ///
+    /// Note that most of the settings here are not configured by users that
+    /// often. While theoretically possible via `Config` methods the more
+    /// interesting flags are the ISA ones below. Typically the values here
+    /// represent global configuration for wasm features. Settings here
+    /// currently rely on the compiler informing us of all settings, including
+    /// those disabled. Settings then fall in a few buckets:
+    ///
+    /// * Some settings must be enabled, such as `avoid_div_traps`.
+    /// * Some settings must have a particular value, such as
+    ///   `libcall_call_conv`.
+    /// * Some settings do not matter as to their value, such as `opt_level`.
+    pub(crate) fn check_compatible_with_shared_flag(
+        &self,
+        flag: &str,
+        value: &FlagValue,
+    ) -> Result<(), String> {
+        let ok = match flag {
+            // These settings must all have be enabled, since their value
+            // can affect the way the generated code performs or behaves at
+            // runtime.
+            "avoid_div_traps" => *value == FlagValue::Bool(true),
+            "unwind_info" => *value == FlagValue::Bool(true),
+            "libcall_call_conv" => *value == FlagValue::Enum("isa_default".into()),
+
+            // Features wasmtime doesn't use should all be disabled, since
+            // otherwise if they are enabled it could change the behavior of
+            // generated code.
+            "baldrdash_prologue_words" => *value == FlagValue::Num(0),
+            "enable_llvm_abi_extensions" => *value == FlagValue::Bool(false),
+            "emit_all_ones_funcaddrs" => *value == FlagValue::Bool(false),
+            "enable_pinned_reg" => *value == FlagValue::Bool(false),
+            "enable_probestack" => *value == FlagValue::Bool(false),
+            "use_colocated_libcalls" => *value == FlagValue::Bool(false),
+            "use_pinned_reg_as_heap_base" => *value == FlagValue::Bool(false),
+
+            // If reference types are enabled this must be enabled, otherwise
+            // this setting can have any value.
+            "enable_safepoints" => {
+                if self.config().features.reference_types {
+                    *value == FlagValue::Bool(true)
+                } else {
+                    return Ok(())
+                }
+            }
+
+            // These settings don't affect the interface or functionality of
+            // the module itself, so their configuration values shouldn't
+            // matter.
+            "enable_heap_access_spectre_mitigation"
+            | "enable_nan_canonicalization"
+            | "enable_jump_tables"
+            | "enable_float"
+            | "enable_simd"
+            | "enable_verifier"
+            | "is_pic"
+            | "machine_code_cfg_info"
+            | "tls_model" // wasmtime doesn't use tls right now
+            | "opt_level" // opt level doesn't change semantics
+            | "probestack_func_adjusts_sp" // probestack above asserted disabled
+            | "probestack_size_log2" // probestack above asserted disabled
+            | "regalloc" // shouldn't change semantics
+            | "enable_atomics" => return Ok(()),
+
+            // Everything else is unknown and needs to be added somewhere to
+            // this list if encountered.
+            _ => {
+                return Err(format!("unknown shared setting {:?} configured to {:?}", flag, value))
+            }
+        };
+
+        if !ok {
+            return Err(format!(
+                "setting {:?} is configured to {:?} which is not supported",
+                flag, value,
+            ));
+        }
+        Ok(())
+    }
+
+    /// Same as `check_compatible_with_native_host` except used for ISA-specific
+    /// flags. This is used to test whether a configured ISA flag is indeed
+    /// available on the host platform itself.
+    pub(crate) fn check_compatible_with_isa_flag(
+        &self,
+        flag: &str,
+        value: &FlagValue,
+    ) -> Result<(), String> {
+        match value {
+            // ISA flags are used for things like CPU features, so if they're
+            // disabled then it's compatible with the native host.
+            FlagValue::Bool(false) => return Ok(()),
+
+            // Fall through below where we test at runtime that features are
+            // available.
+            FlagValue::Bool(true) => {}
+
+            // Only `bool` values are supported right now, other settings would
+            // need more support here.
+            _ => {
+                return Err(format!(
+                    "isa-specific feature {:?} configured to unknown value {:?}",
+                    flag, value
+                ))
+            }
+        }
+        #[cfg(target_arch = "x86_64")]
+        {
+            let enabled = match flag {
+                "has_sse3" => Some(std::is_x86_feature_detected!("sse3")),
+                "has_ssse3" => Some(std::is_x86_feature_detected!("ssse3")),
+                "has_sse41" => Some(std::is_x86_feature_detected!("sse4.1")),
+                "has_sse42" => Some(std::is_x86_feature_detected!("sse4.2")),
+                "has_popcnt" => Some(std::is_x86_feature_detected!("popcnt")),
+                "has_avx" => Some(std::is_x86_feature_detected!("avx")),
+                "has_avx2" => Some(std::is_x86_feature_detected!("avx2")),
+                "has_bmi1" => Some(std::is_x86_feature_detected!("bmi1")),
+                "has_bmi2" => Some(std::is_x86_feature_detected!("bmi2")),
+                "has_avx512bitalg" => Some(std::is_x86_feature_detected!("avx512bitalg")),
+                "has_avx512dq" => Some(std::is_x86_feature_detected!("avx512dq")),
+                "has_avx512f" => Some(std::is_x86_feature_detected!("avx512f")),
+                "has_avx512vl" => Some(std::is_x86_feature_detected!("avx512vl")),
+                "has_avx512vbmi" => Some(std::is_x86_feature_detected!("avx512vbmi")),
+                "has_lzcnt" => Some(std::is_x86_feature_detected!("lzcnt")),
+
+                // fall through to the very bottom to indicate that support is
+                // not enabled to test whether this feature is enabled on the
+                // host.
+                _ => None,
+            };
+            match enabled {
+                Some(true) => return Ok(()),
+                Some(false) => {
+                    return Err(format!(
+                        "compilation setting {:?} is enabled but not available on the host",
+                        flag
+                    ))
+                }
+                // fall through
+                None => {}
+            }
+        }
+        Err(format!(
+            "cannot test if target-specific flag {:?} is available at runtime",
+            flag
+        ))
+    }
 }
 
 impl Default for Engine {
diff --git a/crates/wasmtime/src/module.rs b/crates/wasmtime/src/module.rs
index d31c3a471..01520f9ee 100644
--- a/crates/wasmtime/src/module.rs
+++ b/crates/wasmtime/src/module.rs
@@ -295,18 +295,9 @@ impl Module {
     #[cfg(compiler)]
     #[cfg_attr(nightlydoc, doc(cfg(feature = "cranelift")))] // see build.rs
     pub fn from_binary(engine: &Engine, binary: &[u8]) -> Result<Module> {
-        // Check to see that the config's target matches the host
-        let target = engine.compiler().triple();
-        if *target != target_lexicon::Triple::host() {
-            bail!(
-                "target '{}' specified in the configuration does not match the host",
-                target
-            );
-        }
-
-        // FIXME: we may want to validate that the ISA flags in the config match those that
-        // would be inferred for the host, otherwise the JIT might produce unrunnable code
-        // for the features the host's CPU actually has.
+        engine
+            .check_compatible_with_native_host()
+            .context("compilation settings are not compatible with the native host")?;
 
         cfg_if::cfg_if! {
             if #[cfg(feature = "cache")] {
diff --git a/crates/wasmtime/src/module/serialization.rs b/crates/wasmtime/src/module/serialization.rs
index 93c1a49b6..5d34b784c 100644
--- a/crates/wasmtime/src/module/serialization.rs
+++ b/crates/wasmtime/src/module/serialization.rs
@@ -58,7 +58,7 @@ use std::convert::TryFrom;
 use std::path::Path;
 use std::str::FromStr;
 use std::sync::Arc;
-use wasmtime_environ::{Compiler, FlagValue, Tunables};
+use wasmtime_environ::{FlagValue, Tunables};
 use wasmtime_jit::{subslice_range, CompiledModule, CompiledModuleInfo, TypeTables};
 use wasmtime_runtime::MmapVec;
 
@@ -306,25 +306,11 @@ impl<'a> SerializedModule<'a> {
         TypeTables,
         Vec<SerializedModuleUpvar>,
     )> {
-        // Verify that the module we're loading matches the triple that `engine`
-        // is configured for. If compilation is disabled within engine then the
-        // assumed triple is the host itself.
-        #[cfg(compiler)]
-        let engine_triple = engine.compiler().triple();
-        #[cfg(not(compiler))]
-        let engine_triple = &target_lexicon::Triple::host();
-        self.check_triple(engine_triple)?;
-
-        // FIXME: Similar to `Module::from_binary` it should likely be validated
-        // here that when `cfg(not(compiler))` is true the isa/shared flags
-        // enabled for this precompiled module are compatible with the host
-        // itself, which `engine` is assumed to be running code for.
-        #[cfg(compiler)]
-        {
-            let compiler = engine.compiler();
-            self.check_shared_flags(compiler)?;
-            self.check_isa_flags(compiler)?;
-        }
+        // Verify that the compilation settings in the engine match the
+        // compilation settings of the module that's being loaded.
+        self.check_triple(engine)?;
+        self.check_shared_flags(engine)?;
+        self.check_isa_flags(engine)?;
 
         self.check_tunables(&engine.config().tunables)?;
         self.check_features(&engine.config().features)?;
@@ -501,80 +487,45 @@ impl<'a> SerializedModule<'a> {
         }
     }
 
-    fn check_triple(&self, other: &target_lexicon::Triple) -> Result<()> {
-        let triple =
+    fn check_triple(&self, engine: &Engine) -> Result<()> {
+        let engine_target = engine.target();
+        let module_target =
             target_lexicon::Triple::from_str(&self.metadata.target).map_err(|e| anyhow!(e))?;
 
-        if triple.architecture != other.architecture {
+        if module_target.architecture != engine_target.architecture {
             bail!(
                 "Module was compiled for architecture '{}'",
-                triple.architecture
+                module_target.architecture
             );
         }
 
-        if triple.operating_system != other.operating_system {
+        if module_target.operating_system != engine_target.operating_system {
             bail!(
                 "Module was compiled for operating system '{}'",
-                triple.operating_system
+                module_target.operating_system
             );
         }
 
         Ok(())
     }
 
-    fn check_shared_flags(&mut self, compiler: &dyn Compiler) -> Result<()> {
-        let mut shared_flags = std::mem::take(&mut self.metadata.shared_flags);
-        for (name, host) in compiler.flags() {
-            match shared_flags.remove(&name) {
-                Some(v) => {
-                    if v != host {
-                        bail!("Module was compiled with a different '{}' setting: expected '{}' but host has '{}'", name, v, host);
-                    }
-                }
-                None => bail!("Module was compiled without setting '{}'", name),
-            }
+    fn check_shared_flags(&mut self, engine: &Engine) -> Result<()> {
+        for (name, val) in self.metadata.shared_flags.iter() {
+            engine
+                .check_compatible_with_shared_flag(name, val)
+                .map_err(|s| anyhow::Error::msg(s))
+                .context("compilation settings of module incompatible with native host")?;
         }
-
-        for (name, _) in shared_flags {
-            bail!(
-                "Module was compiled with setting '{}' but it is not present for the host",
-                name
-            );
-        }
-
         Ok(())
     }
 
-    fn check_isa_flags(&mut self, compiler: &dyn Compiler) -> Result<()> {
-        let mut isa_flags = std::mem::take(&mut self.metadata.isa_flags);
-        for (name, host) in compiler.isa_flags() {
-            match isa_flags.remove(&name) {
-                Some(v) => match (&v, &host) {
-                    (FlagValue::Bool(v), FlagValue::Bool(host)) => {
-                        // ISA flags represent CPU features; for boolean values, only
-                        // treat it as an error if the module was compiled with the setting enabled
-                        // but the host does not have it enabled.
-                        if *v && !*host {
-                            bail!("Module was compiled with setting '{}' enabled but the host does not support it", name);
-                        }
-                    }
-                    _ => {
-                        if v != host {
-                            bail!("Module was compiled with a different '{}' setting: expected '{}' but host has '{}'", name, v, host);
-                        }
-                    }
-                },
-                None => bail!("Module was compiled without setting '{}'", name),
-            }
+    fn check_isa_flags(&mut self, engine: &Engine) -> Result<()> {
+        for (name, val) in self.metadata.isa_flags.iter() {
+            engine
+                .check_compatible_with_isa_flag(name, val)
+                .map_err(|s| anyhow::Error::msg(s))
+                .context("compilation settings of module incompatible with native host")?;
         }
-
-        for (name, _) in isa_flags {
-            bail!(
-                "Module was compiled with setting '{}' but it is not present for the host",
-                name
-            );
-        }
-
         Ok(())
     }
 
@@ -758,7 +709,6 @@ fn align_to(val: usize, align: usize) -> usize {
 mod test {
     use super::*;
     use crate::Config;
-    use std::borrow::Cow;
 
     #[test]
     fn test_architecture_mismatch() -> Result<()> {
@@ -807,16 +757,20 @@ mod test {
         let module = Module::new(&engine, "(module)")?;
 
         let mut serialized = SerializedModule::new(&module);
-        serialized.metadata.shared_flags.insert(
-            "opt_level".to_string(),
-            FlagValue::Enum(Cow::Borrowed("none")),
-        );
+        serialized
+            .metadata
+            .shared_flags
+            .insert("avoid_div_traps".to_string(), FlagValue::Bool(false));
 
         match serialized.into_module(&engine) {
             Ok(_) => unreachable!(),
             Err(e) => assert_eq!(
-                e.to_string(),
-                "Module was compiled with a different 'opt_level' setting: expected 'none' but host has 'speed'"
+                format!("{:?}", e),
+                "\
+compilation settings of module incompatible with native host
+
+Caused by:
+    setting \"avoid_div_traps\" is configured to Bool(false) which is not supported"
             ),
         }
 
@@ -838,8 +792,12 @@ mod test {
         match serialized.into_module(&engine) {
             Ok(_) => unreachable!(),
             Err(e) => assert_eq!(
-                e.to_string(),
-                "Module was compiled with setting 'not_a_flag' but it is not present for the host",
+                format!("{:?}", e),
+                "\
+compilation settings of module incompatible with native host
+
+Caused by:
+    cannot test if target-specific flag \"not_a_flag\" is available at runtime",
             ),
         }
 
diff --git a/crates/wast/Cargo.toml b/crates/wast/Cargo.toml
index ea48e4ef8..cedfc2949 100644
--- a/crates/wast/Cargo.toml
+++ b/crates/wast/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasmtime-wast"
-version = "0.34.0"
+version = "0.35.0"
 authors = ["The Wasmtime Project Developers"]
 description = "wast testing support for wasmtime"
 license = "Apache-2.0 WITH LLVM-exception"
@@ -11,7 +11,7 @@ edition = "2018"
 
 [dependencies]
 anyhow = "1.0.19"
-wasmtime = { path = "../wasmtime", version = "0.34.0", default-features = false, features = ['cranelift'] }
+wasmtime = { path = "../wasmtime", version = "0.35.0", default-features = false, features = ['cranelift'] }
 wast = "39.0.0"
 
 [badges]
diff --git a/crates/wiggle/Cargo.toml b/crates/wiggle/Cargo.toml
index d0e79b1a4..95516f88b 100644
--- a/crates/wiggle/Cargo.toml
+++ b/crates/wiggle/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wiggle"
-version = "0.34.0"
+version = "0.35.0"
 authors = ["Pat Hickey <phickey@fastly.com>", "Jakub Konka <kubkonk@jakubkonka.com>", "Alex Crichton <alex@alexcrichton.com>"]
 edition = "2018"
 license = "Apache-2.0 WITH LLVM-exception"
@@ -13,11 +13,11 @@ include = ["src/**/*", "README.md", "LICENSE"]
 [dependencies]
 thiserror = "1"
 witx = { path = "../wasi-common/WASI/tools/witx", version = "0.9.1", optional = true }
-wiggle-macro = { path = "macro", version = "=0.34.0" }
+wiggle-macro = { path = "macro", version = "=0.35.0" }
 tracing = "0.1.26"
 bitflags = "1.2"
 async-trait = "0.1.42"
-wasmtime = { path = "../wasmtime", version = "0.34.0", optional = true, default-features = false }
+wasmtime = { path = "../wasmtime", version = "0.35.0", optional = true, default-features = false }
 anyhow = "1.0"
 
 [badges]
diff --git a/crates/wiggle/generate/Cargo.toml b/crates/wiggle/generate/Cargo.toml
index 6939227f3..ab419e447 100644
--- a/crates/wiggle/generate/Cargo.toml
+++ b/crates/wiggle/generate/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wiggle-generate"
-version = "0.34.0"
+version = "0.35.0"
 authors = ["Pat Hickey <phickey@fastly.com>", "Jakub Konka <kubkon@jakubkonka.com>", "Alex Crichton <alex@alexcrichton.com>"]
 license = "Apache-2.0 WITH LLVM-exception"
 edition = "2018"
diff --git a/crates/wiggle/macro/Cargo.toml b/crates/wiggle/macro/Cargo.toml
index f3be28b83..46fb57bd2 100644
--- a/crates/wiggle/macro/Cargo.toml
+++ b/crates/wiggle/macro/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wiggle-macro"
-version = "0.34.0"
+version = "0.35.0"
 authors = ["Pat Hickey <phickey@fastly.com>", "Jakub Konka <kubkon@jakubkonka.com>", "Alex Crichton <alex@alexcrichton.com>"]
 edition = "2018"
 license = "Apache-2.0 WITH LLVM-exception"
@@ -21,7 +21,7 @@ test = false
 doctest = false
 
 [dependencies]
-wiggle-generate = { path = "../generate", version = "=0.34.0" }
+wiggle-generate = { path = "../generate", version = "=0.35.0" }
 quote = "1.0"
 syn = { version = "1.0", features = ["full"] }
 proc-macro2 = "1.0"
diff --git a/docs/examples-profiling-vtune.md b/docs/examples-profiling-vtune.md
index ff945a899..9e15d57f8 100644
--- a/docs/examples-profiling-vtune.md
+++ b/docs/examples-profiling-vtune.md
@@ -1,4 +1,4 @@
-# Using `VTune` on Linux
+# Using `VTune`
 
 [VTune][help] is a popular performance profiling tool that targets both 32-bit
 and 64-bit x86 architectures. The tool collects profiling data during runtime
@@ -6,9 +6,7 @@ and then, either through the command line or GUI, provides a variety of options
 for viewing and analyzing that data. VTune Profiler is available in both
 commerical and free options. The free, downloadable version is available
 [here][download] and is backed by a community forum for support. This version is
-appropriate for detailed analysis of your Wasm program. Note that for JIT
-support, Wasmtime only supports VTune profiling on Linux platforms but other
-platforms are expected to be enabled in the future.
+appropriate for detailed analysis of your Wasm program.
 
 VTune support in Wasmtime is provided through the JIT profiling APIs from the
 [`ittapi`] library. This library provides code generators (or the runtimes that
@@ -24,7 +22,7 @@ For more information on VTune and the analysis tools it provides see its
 
 [help]: https://software.intel.com/en-us/vtune-help
 [download]: https://software.intel.com/en-us/vtune/choose-download#standalone
-[documentations]: https://software.intel.com/en-us/vtune-help
+[documentation]: https://software.intel.com/en-us/vtune-help
 [`ittapi`]: https://github.com/intel/ittapi
 [`ittapi-rs`]: https://crates.io/crates/ittapi-rs
 
diff --git a/fuzz/fuzz_targets/instantiate-many.rs b/fuzz/fuzz_targets/instantiate-many.rs
index 351da977e..a562abe37 100644
--- a/fuzz/fuzz_targets/instantiate-many.rs
+++ b/fuzz/fuzz_targets/instantiate-many.rs
@@ -24,6 +24,16 @@ fn run(data: &[u8]) -> Result<()> {
     // use timeouts or ensure that the generated wasm code will terminate.
     config.module_config.config.allow_start_export = false;
 
+    // Wasm linear memories take roughly ~8gb of virtual address space. Down
+    // below we could instantiate up to 300 modules. Conservatively estimating
+    // that we have 46 bits of address space to work with (technically 48 on
+    // x86_64, but take some out for kernel stuff and some for asan stuff) that
+    // gives us a budget of ~27 memories per instance. Reduce that a bit further
+    // and make sure that no instance has more than 10 linear memories to ensure
+    // that even if the maximum were created it should still fit in the linear
+    // address space.
+    config.module_config.config.max_memories = config.module_config.config.max_memories.min(10);
+
     // Create the modules to instantiate
     let modules = (0..u.int_in_range(1..=MAX_MODULES)?)
         .map(|_| Ok(config.generate(&mut u, None)?.to_bytes()))
diff --git a/meetings/cranelift/2022/cranelift-03-07.md b/meetings/cranelift/2022/cranelift-03-07.md
index 97c6950e5..8c859e068 100644
--- a/meetings/cranelift/2022/cranelift-03-07.md
+++ b/meetings/cranelift/2022/cranelift-03-07.md
@@ -16,5 +16,62 @@
 ## Notes
 
 ### Attendees
+- uweigand
+- cfallin
+- avanhatt
+- abrown
+- fitzgen
+- jlbirch
+- Fraser Brown
+- bjorn3
+- bnjbvr
+- kulakowski-wasm
+- akirilov
+- Adrian Sampson
 
 ### Notes
+
+- Verification annotation syntax (avanhatt)
+    - quick presentation
+        - Syntax proposal for annotations
+	        - Comments for individual isle turns
+	        - Verification will use annotations if they exist
+    	    - Can reuse and infer types, or require a new explicit syntax for types and variable bindings
+    	- Common assumptions specify return values, more sophisticated ones can handle e.g. failiable operations
+    	- Assumptions passed through to the verification IR, which is slightly higher level than SMT per se
+    - fitzgen: Are these always applied to extractors or constructors
+    - avanhatt: Applied to both
+    - cfallin: I would expect it to be the same for extractors or constructors, it aligns with the goals of rewriting engines
+    - fitzgen: Re not repeating ourselves: I think it makes sense to infer types from ISLE parameter types
+    - cfallin: I would refine that and say: 1 place and not 0 places. There should be a declaration somewhere
+    - fitzgen: Right, I think on the type declarations
+    - bjorn3: It would be nice if this was in ISLE instead of comments
+    - avanhatt: At what point do we merge this prototype? Maybe it makes sense then to transition from special comments to real ISLE syntax
+    - cfallin: Feel free to hack up our parser in your branch, and we could take a change for general annotation syntax out of it too.
+    - fitzgen: I dunno how much we want to really copy that, I find it a bit over-engineered. But we could have arbitrary S-expression tags
+    - cfallin: I had a question about fallibility on the conceptual level. Is it that : `assumption` encodes the postcondition if the match succeeds? Or is it encoding the condition for the match to succeed at all? I’d expect the first
+    - avanhatt: Yes, the first.
+    - cfallin: One thing that would be nice to reason about with fallibility is coverage, knowing that our conditions actually cover all cases. Is there a plan to have that?
+    - avanhatt: Set up for it and have talked about it, no actual plan for it. Dovetails with multi rule reasoning
+    - cfallin: Is there a mechanism for abstraction? “Helper functions” for similar operations
+    - avanhatt: Yeah, I think we should. In particular there’s lots of noops. I think we should, but there’s no concrete proposal for it yet.
+    - fitzgen: I think we talked about this on Zulip, but the representation for bitwidth is the same on both left and right hand sides? So we don’t have the ability to represent undefined bits in eg lowering registered width
+    - avanhatt: Would be cool to do, aren’t doing it yet, can extend to do it.
+    - cfallin: Would prefer to not special case things, I’d rather have an S-expression syntax
+    - bjorn3: Also need to think about branches and jumps, take variable amounts of arguments
+
+- Standups
+    - cfallin
+	    - I have been working on ISLE translations. Week before last, was deep in the x64 backend translating arithmetic ops into ISLE. I plan to keep pushing on that when I don’t have other cranelift related tasks as a background thing. I realized that this ISLE translation is not actually on the critical path to regalloc2, as far as I can see: 1 earlier version of regalloc2 which I tried porting Cranelift to only accepted SSA and 2 regalloc2 now has shims for non-ssa code. Can combine with the x64 mov mitosis mechanism for the 2-operand form, and actually land regalloc2 and get rid of lots of movs on the way. Several kilo-lines of code diff, but should be a perf win in compilation time and runtime
+    - uweigand
+	    - Merged 2 bits of s390 infrastructure, for variable number of arguments and of return values. Both prereqs for calls and returns, and some other variadic operations. Patch outstanding does now work. Would appreciate feedback on this ISLE-driven approach and where all the knowledge about ABI lives (cfallin will take a closer look soon)
+        - Also looking at SIMD support, and fixing up ABI support for eg callee saved fp-and-vector registers (cfallin: look at aarch64 which has a similar property re clobbers). Also a big discussion on backwards compatible vector register extensions
+    - abrown
+	    - Worked on ISLE select lowering, was good and educational. Was going to do integer comparisons and felt it was taking too long around i128. Wondering if we should do it later and focus now on more ordinary register operations.
+	        - fitzgen and cfallin: yeah fine as long as we are in working states along the way.
+    - akirilov
+	    - Pointer verification (mostly) landed in rust, and I kept working on my proposal to align it with what’s in the rust compiler, and hope to have something to land in the next few days.
+    - jlbirch
+	    - Worked on CI integration, acritchon had a bunch of suggestions around ACLs etc.
+    - fitzgen, kulakowski-wasm, Adrian, Fraser, avanhatt, bnjbvr
+	    - No other updates
diff --git a/src/lib.rs b/src/lib.rs
index b94d6862d..1de3ec4fa 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -234,7 +234,14 @@ struct CommonOptions {
     #[structopt(long)]
     enable_cranelift_nan_canonicalization: bool,
 
-    #[structopt(long)]
+    /// Enable execution fuel with N units fuel, where execution will trap after
+    /// running out of fuel.
+    ///
+    /// Most WebAssembly instructions consume 1 unit of fuel. Some instructions,
+    /// such as `nop`, `drop`, `block`, and `loop`, consume 0 units, as any
+    /// execution cost associated with them involves other instructions which do
+    /// consume fuel.
+    #[structopt(long, value_name = "N")]
     fuel: Option<u64>,
 
     /// Executing wasm code will yield when a global epoch counter


Test patch:
diff --git a/cranelift/filetests/Cargo.toml b/cranelift/filetests/Cargo.toml
index 72e5375ce..8c4550e84 100644
--- a/cranelift/filetests/Cargo.toml
+++ b/cranelift/filetests/Cargo.toml
@@ -10,12 +10,12 @@ publish = false
 edition = "2018"
 
 [dependencies]
-cranelift-codegen = { path = "../codegen", version = "0.81.0", features = ["testing_hooks"] }
-cranelift-frontend = { path = "../frontend", version = "0.81.0" }
-cranelift-interpreter = { path = "../interpreter", version = "0.81.0" }
-cranelift-native = { path = "../native", version = "0.81.0" }
-cranelift-reader = { path = "../reader", version = "0.81.0" }
-cranelift-preopt = { path = "../preopt", version = "0.81.0" }
+cranelift-codegen = { path = "../codegen", version = "0.82.0", features = ["testing_hooks"] }
+cranelift-frontend = { path = "../frontend", version = "0.82.0" }
+cranelift-interpreter = { path = "../interpreter", version = "0.82.0" }
+cranelift-native = { path = "../native", version = "0.82.0" }
+cranelift-reader = { path = "../reader", version = "0.82.0" }
+cranelift-preopt = { path = "../preopt", version = "0.82.0" }
 file-per-thread-logger = "0.1.2"
 filecheck = "0.5.0"
 gimli = { version = "0.26.0", default-features = false, features = ["read"] }
diff --git a/cranelift/filetests/filetests/runtests/extend.clif b/cranelift/filetests/filetests/runtests/extend.clif
index 524177de1..42e77f7f0 100644
--- a/cranelift/filetests/filetests/runtests/extend.clif
+++ b/cranelift/filetests/filetests/runtests/extend.clif
@@ -1,23 +1,213 @@
 test run
 target aarch64
-target arm
 target s390x
 target x86_64
 
-function %uextend() -> b1 {
-block0:
-    v0 = iconst.i32 0xffff_ee00
+;;;; basic uextend
+
+function %uextend8_16(i8) -> i16 {
+block0(v0: i8):
+    v1 = uextend.i16 v0
+    return v1
+}
+; run: %uextend8_16(0xfe) == 0xfe
+; run: %uextend8_16(0x7e) == 0x7e
+
+function %uextend8_32(i8) -> i32 {
+block0(v0: i8):
+    v1 = uextend.i32 v0
+    return v1
+}
+; run: %uextend8_32(0xfe) == 0xfe
+; run: %uextend8_32(0x7e) == 0x7e
+
+function %uextend16_32(i16) -> i32 {
+block0(v0: i16):
+    v1 = uextend.i32 v0
+    return v1
+}
+; run: %uextend16_32(0xfe00) == 0xfe00
+; run: %uextend16_32(0x7e00) == 0x7e00
+
+function %uextend8_64(i8) -> i64 {
+block0(v0: i8):
     v1 = uextend.i64 v0
-    v2 = icmp_imm eq v1, 0xffff_ee00
-    return v2
+    return v1
 }
-; run
+; run: %uextend8_64(0xfe) == 0xfe
+; run: %uextend8_64(0x7e) == 0x7e
+
+function %uextend16_64(i16) -> i64 {
+block0(v0: i16):
+    v1 = uextend.i64 v0
+    return v1
+}
+; run: %uextend16_64(0xfe00) == 0xfe00
+; run: %uextend16_64(0x7e00) == 0x7e00
+
+function %uextend32_64(i32) -> i64 {
+block0(v0: i32):
+    v1 = uextend.i64 v0
+    return v1
+}
+; run: %uextend32_64(0xffff_ee00) == 0xffff_ee00
+; run: %uextend32_64(0x7fff_ee00) == 0x7fff_ee00
+
+;;;; basic sextend
 
-function %sextend() -> b1 {
-block0:
-    v0 = iconst.i32 0xffff_ee00
+function %sextend8_16(i8) -> i16 {
+block0(v0: i8):
+    v1 = sextend.i16 v0
+    return v1
+}
+; run: %sextend8_16(0xff) == 0xffff
+; run: %sextend8_16(0x7f) == 0x7f
+
+function %sextend8_32(i8) -> i32 {
+block0(v0: i8):
+    v1 = sextend.i32 v0
+    return v1
+}
+; run: %sextend8_32(0xff) == 0xffff_ffff
+; run: %sextend8_32(0x7f) == 0x7f
+
+function %sextend16_32(i16) -> i32 {
+block0(v0: i16):
+    v1 = sextend.i32 v0
+    return v1
+}
+; run: %sextend16_32(0xfe00) == 0xffff_fe00
+; run: %sextend16_32(0x7e00) == 0x7e00
+
+function %sextend8_64(i8) -> i64 {
+block0(v0: i8):
     v1 = sextend.i64 v0
-    v2 = icmp_imm eq v1, 0xffff_ffff_ffff_ee00
-    return v2
+    return v1
 }
-; run
+; run: %sextend8_64(0xff) == 0xffff_ffff_ffff_ffff
+; run: %sextend8_64(0x7f) == 0x7f
+
+function %sextend16_64(i16) -> i64 {
+block0(v0: i16):
+    v1 = sextend.i64 v0
+    return v1
+}
+; run: %sextend16_64(0xfe00) == 0xffff_ffff_ffff_fe00
+; run: %sextend16_64(0x7e00) == 0x7e00
+
+function %sextend32_64(i32) -> i64 {
+block0(v0: i32):
+    v1 = sextend.i64 v0
+    return v1
+}
+; run: %sextend32_64(0xffff_ee00) == 0xffff_ffff_ffff_ee00
+; run: %sextend32_64(0x7fff_ee00) == 0x7fff_ee00
+
+;; uextend of an `add` that we know is likely to set undefined bits
+;; above the narrow value
+
+function %add_uextend8_16(i8, i8) -> i16 {
+block0(v0: i8, v1: i8):
+    v2 = iadd.i8 v0, v1
+    v3 = uextend.i16 v2
+    return v3
+}
+; run: %add_uextend8_16(0xfe, 0x03) == 0x0001
+
+function %add_uextend8_32(i8, i8) -> i32 {
+block0(v0: i8, v1: i8):
+    v2 = iadd.i8 v0, v1
+    v3 = uextend.i32 v2
+    return v3
+}
+; run: %add_uextend8_32(0xfe, 0x03) == 0x0000_0001
+
+function %add_uextend16_32(i16, i16) -> i32 {
+block0(v0: i16, v1: i16):
+    v2 = iadd.i16 v0, v1
+    v3 = uextend.i32 v2
+    return v3
+}
+; run: %add_uextend16_32(0xfe00, 0x302) == 0x0000_0102
+
+function %add_uextend8_64(i8, i8) -> i64 {
+block0(v0: i8, v1: i8):
+    v2 = iadd.i8 v0, v1
+    v3 = uextend.i64 v2
+    return v3
+}
+; run: %add_uextend8_64(0xfe, 0x03) == 0x0000_0000_0000_0001
+
+function %add_uextend16_64(i16, i16) -> i64 {
+block0(v0: i16, v1: i16):
+    v2 = iadd.i16 v0, v1
+    v3 = uextend.i64 v2
+    return v3
+}
+; run: %add_uextend16_64(0xfe00, 0x302) == 0x0000_0000_0000_0102
+
+function %add_uextend32_64(i32, i32) -> i64 {
+block0(v0: i32, v1: i32):
+    v2 = iadd.i32 v0, v1
+    v3 = uextend.i64 v2
+    return v3
+}
+; run: %add_uextend32_64(0xffff_ee00, 0x1000_0001) == 0x0000_0000_0fff_ee01
+
+;; sextend of an `add` that we know is likely to set undefined bits
+;; above the narrow value
+
+function %add_sextend8_16(i8, i8) -> i16 {
+block0(v0: i8, v1: i8):
+    v2 = iadd.i8 v0, v1
+    v3 = sextend.i16 v2
+    return v3
+}
+; run: %add_sextend8_16(0xfe, 0x03) == 0x0001
+; run: %add_sextend8_16(0xfe, 0x83) == 0xff81
+
+function %add_sextend8_32(i8, i8) -> i32 {
+block0(v0: i8, v1: i8):
+    v2 = iadd.i8 v0, v1
+    v3 = sextend.i32 v2
+    return v3
+}
+; run: %add_sextend8_32(0xfe, 0x03) == 0x0000_0001
+; run: %add_sextend8_32(0xfe, 0x83) == 0xffff_ff81
+
+function %add_sextend16_32(i16, i16) -> i32 {
+block0(v0: i16, v1: i16):
+    v2 = iadd.i16 v0, v1
+    v3 = sextend.i32 v2
+    return v3
+}
+; run: %add_sextend16_32(0xfe00, 0x302) == 0x0000_0102
+; run: %add_sextend16_32(0xfe00, 0x8302) == 0xffff_8102
+
+function %add_sextend8_64(i8, i8) -> i64 {
+block0(v0: i8, v1: i8):
+    v2 = iadd.i8 v0, v1
+    v3 = sextend.i64 v2
+    return v3
+}
+; run: %add_sextend8_64(0xfe, 0x03) == 0x0000_0000_0000_0001
+; run: %add_sextend8_64(0xfe, 0x83) == 0xffff_ffff_ffff_ff81
+
+function %add_sextend16_64(i16, i16) -> i64 {
+block0(v0: i16, v1: i16):
+    v2 = iadd.i16 v0, v1
+    v3 = sextend.i64 v2
+    return v3
+}
+; run: %add_sextend16_64(0xfe00, 0x302) == 0x0000_0000_0000_0102
+; run: %add_sextend16_64(0xfe00, 0x8302) == 0xffff_ffff_ffff_8102
+
+function %add_sextend32_64(i32, i32) -> i64 {
+block0(v0: i32, v1: i32):
+    v2 = iadd.i32 v0, v1
+    v3 = sextend.i64 v2
+    return v3
+}
+; run: %add_sextend32_64(0xffff_ee00, 0x1000_0001) == 0x0000_0000_0fff_ee01
+; run: %add_sextend32_64(0xffff_ee00, 0x9000_0001) == 0xffff_ffff_8fff_ee01
+
diff --git a/crates/test-programs/Cargo.toml b/crates/test-programs/Cargo.toml
index d9c1be1ba..598e3e5cf 100644
--- a/crates/test-programs/Cargo.toml
+++ b/crates/test-programs/Cargo.toml
@@ -11,10 +11,10 @@ license = "Apache-2.0 WITH LLVM-exception"
 cfg-if = "1.0"
 
 [dev-dependencies]
-wasi-common = { path = "../wasi-common", version = "0.34.0" }
-wasi-cap-std-sync = { path = "../wasi-common/cap-std-sync", version = "0.34.0" }
-wasmtime = { path = "../wasmtime", version = "0.34.0" }
-wasmtime-wasi = { path = "../wasi", version = "0.34.0", features = ["tokio"] }
+wasi-common = { path = "../wasi-common", version = "0.35.0" }
+wasi-cap-std-sync = { path = "../wasi-common/cap-std-sync", version = "0.35.0" }
+wasmtime = { path = "../wasmtime", version = "0.35.0" }
+wasmtime-wasi = { path = "../wasi", version = "0.35.0", features = ["tokio"] }
 target-lexicon = "0.12.0"
 pretty_env_logger = "0.4.0"
 tempfile = "3.1.0"
diff --git a/tests/all/module.rs b/tests/all/module.rs
index 73143ea00..76925462e 100644
--- a/tests/all/module.rs
+++ b/tests/all/module.rs
@@ -10,9 +10,11 @@ fn checks_incompatible_target() -> Result<()> {
         "(module)",
     ) {
         Ok(_) => unreachable!(),
-        Err(e) => assert!(e
-            .to_string()
-            .contains("configuration does not match the host")),
+        Err(e) => assert!(
+            format!("{:?}", e).contains("configuration does not match the host"),
+            "bad error: {:?}",
+            e
+        ),
     }
 
     Ok(())
@@ -31,33 +33,20 @@ fn caches_across_engines() {
         let res = Module::deserialize(&Engine::default(), &bytes);
         assert!(res.is_ok());
 
-        // differ in shared cranelift flags
+        // differ in runtime settings
         let res = Module::deserialize(
-            &Engine::new(Config::new().cranelift_nan_canonicalization(true)).unwrap(),
+            &Engine::new(Config::new().static_memory_maximum_size(0)).unwrap(),
             &bytes,
         );
         assert!(res.is_err());
 
-        // differ in cranelift settings
+        // differ in wasm features enabled (which can affect
+        // runtime/compilation settings)
         let res = Module::deserialize(
-            &Engine::new(Config::new().cranelift_opt_level(OptLevel::None)).unwrap(),
+            &Engine::new(Config::new().wasm_simd(false)).unwrap(),
             &bytes,
         );
         assert!(res.is_err());
-
-        // Missing required cpu flags
-        if cfg!(target_arch = "x86_64") {
-            let res = Module::deserialize(
-                &Engine::new(
-                    Config::new()
-                        .target(&target_lexicon::Triple::host().to_string())
-                        .unwrap(),
-                )
-                .unwrap(),
-                &bytes,
-            );
-            assert!(res.is_err());
-        }
     }
 }
 
diff --git a/tests/all/module_serialize.rs b/tests/all/module_serialize.rs
index 42aadc663..475b25699 100644
--- a/tests/all/module_serialize.rs
+++ b/tests/all/module_serialize.rs
@@ -66,7 +66,7 @@ fn test_module_serialize_fail() -> Result<()> {
     )?;
 
     let mut config = Config::new();
-    config.cranelift_opt_level(OptLevel::None);
+    config.static_memory_maximum_size(0);
     let mut store = Store::new(&Engine::new(&config)?, ());
     match unsafe { deserialize_and_instantiate(&mut store, &buffer) } {
         Ok(_) => bail!("expected failure at deserialization"),
diff --git a/tests/all/wast.rs b/tests/all/wast.rs
index 588400d0b..240a68fb7 100644
--- a/tests/all/wast.rs
+++ b/tests/all/wast.rs
@@ -12,6 +12,10 @@ include!(concat!(env!("OUT_DIR"), "/wast_testsuite_tests.rs"));
 // function which actually executes the `wast` test suite given the `strategy`
 // to compile it.
 fn run_wast(wast: &str, strategy: Strategy, pooling: bool) -> anyhow::Result<()> {
+    match strategy {
+        Strategy::Cranelift => {}
+        _ => unimplemented!(),
+    }
     let wast = Path::new(wast);
 
     let simd = feature_found(wast, "simd");
@@ -26,7 +30,6 @@ fn run_wast(wast: &str, strategy: Strategy, pooling: bool) -> anyhow::Result<()>
         .wasm_module_linking(module_linking)
         .wasm_threads(threads)
         .wasm_memory64(memory64)
-        .strategy(strategy)?
         .cranelift_debug_verifier(true);
 
     if feature_found(wast, "canonicalize-nan") {