Repository: bytecodealliance/wasmtime
Pull request #8906 (2024-07-07 00:19:23)

Add more documentation to `ArgumentPurpose::StructArgument`
I was a bit unclear on what exactly it was for. I thought the u32 field
could also use some documentation to clarify its meaning.

cc #8852
cc https://bytecodealliance.zulipchat.com/#narrow/stream/217117-cranelift/topic/docs.20for.20StructArgument.2FStructReturn


camelid: Please of course let me know if I misunderstood the purpose of `StructArgument`, or if you have suggestions for more details to add.

Patch:
diff --git a/.github/actions/build-adapter-provider/action.yml b/.github/actions/build-adapter-provider/action.yml
new file mode 100644
index 000000000..60b9d08a3
--- /dev/null
+++ b/.github/actions/build-adapter-provider/action.yml
@@ -0,0 +1,25 @@
+name: 'Build wasi component adapter provider'
+description: 'Build the wasi-preview1-component-adapter provider using the adapter artefacts'
+
+inputs:
+  run-id:
+    description: 'run id of the main.yml action that produced the adapter artefacts'
+    required: true
+
+runs:
+  using: composite
+  steps:
+    - uses: actions/download-artifact@v4
+      with:
+        name: bins-wasi-preview1-component-adapter
+        path: crates/wasi-preview1-component-adapter/provider/artefacts
+        github-token: ${{ github.token }}
+        run-id: ${{ inputs.run-id }}
+
+    - name: Install required Rust components
+      shell: bash
+      run: rustup component add rustfmt clippy
+
+    - name: Build and checl the adapter provider
+      shell: bash
+      run: ./ci/build-wasi-preview1-component-adapter-provider.sh
diff --git a/.github/actions/fetch-run-id/action.yml b/.github/actions/fetch-run-id/action.yml
new file mode 100644
index 000000000..614f2e37c
--- /dev/null
+++ b/.github/actions/fetch-run-id/action.yml
@@ -0,0 +1,18 @@
+name: 'Fetch run id for commit'
+description: 'Fetch the main.yml run id for the current commit'
+
+runs:
+  using: composite
+  steps:
+    - name: Fetch run id
+      shell: bash
+      run: |
+        run_id=$(
+          gh api -H 'Accept: application/vnd.github+json' \
+              /repos/${{ github.repository }}/actions/workflows/main.yml/runs\?exclude_pull_requests=true \
+              | jq '.workflow_runs' \
+              | jq "map(select(.head_commit.id == \"${{ github.sha }}\"))[0].id" \
+        )
+        echo COMMIT_RUN_ID=${run_id} >> "$GITHUB_ENV"
+      env:
+        GH_TOKEN: ${{ github.token }}
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 42ba5f770..8a1f38fe5 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -813,6 +813,26 @@ jobs:
         path: target/wasm32-unknown-unknown/release/wasi_snapshot_preview1.*.wasm
 
 
+    # common logic to cancel the entire run if this job fails
+    - run: gh run cancel ${{ github.run_id }}
+      if: failure() && github.event_name != 'pull_request'
+      env:
+        GH_TOKEN: ${{ github.token }}
+  
+  build-preview1-component-adapter-provider:
+    name: Build wasi-preview1-component-adapter-provider
+    needs: build-preview1-component-adapter
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v4
+      with:
+        submodules: true
+    - uses: ./.github/actions/install-rust
+    - uses: ./.github/actions/build-adapter-provider
+      with:
+        run-id: ${{ github.run_id }}
+    
+
     # common logic to cancel the entire run if this job fails
     - run: gh run cancel ${{ github.run_id }}
       if: failure() && github.event_name != 'pull_request'
@@ -1080,6 +1100,7 @@ jobs:
       - determine
       - miri
       - build-preview1-component-adapter
+      - build-preview1-component-adapter-provider
       - build-wasmtime-target-wasm32
       - test-min-platform-example
       - check_js
diff --git a/.github/workflows/publish-artifacts.yml b/.github/workflows/publish-artifacts.yml
index 9ef7e2bcb..4a108ff08 100644
--- a/.github/workflows/publish-artifacts.yml
+++ b/.github/workflows/publish-artifacts.yml
@@ -14,15 +14,9 @@ jobs:
     if: github.repository == 'bytecodealliance/wasmtime'
     steps:
     - uses: actions/checkout@v4
+    - uses: ./.github/actions/fetch-run-id
     - run: |
-        sha=${{ github.sha }}
-        run_id=$(
-          gh api -H 'Accept: application/vnd.github+json' \
-              /repos/${{ github.repository }}/actions/workflows/main.yml/runs\?exclude_pull_requests=true \
-              | jq '.workflow_runs' \
-              | jq "map(select(.head_commit.id == \"$sha\"))[0].id" \
-        )
-        gh run download $run_id
+        gh run download ${COMMIT_RUN_ID}
         ls
         find bins-*
       env:
diff --git a/.github/workflows/publish-to-cratesio.yml b/.github/workflows/publish-to-cratesio.yml
index 23af15a85..46d3611a3 100644
--- a/.github/workflows/publish-to-cratesio.yml
+++ b/.github/workflows/publish-to-cratesio.yml
@@ -23,3 +23,12 @@ jobs:
         ./publish publish
       env:
         CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
+    
+    # Manifest and publish the wasi-preview1-component-adapter-provider
+    - uses: ./.github/actions/fetch-run-id
+    - uses: ./.github/actions/build-adapter-provider
+      with:
+        run-id: ${{ env.COMMIT_RUN_ID }}
+    - run: cargo publish -p wasi-preview1-component-adapter-provider --allow-dirty
+      env:
+        CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
diff --git a/Cargo.lock b/Cargo.lock
index 1ba02895f..d431f5789 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -841,7 +841,7 @@ dependencies = [
  "serde_derive",
  "smallvec",
  "target-lexicon",
- "wasmparser 0.211.1",
+ "wasmparser",
  "wasmtime-types",
  "wat",
 ]
@@ -2094,9 +2094,9 @@ dependencies = [
 
 [[package]]
 name = "prettyplease"
-version = "0.2.19"
+version = "0.2.20"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5ac2cf0f2e4f42b49f5ffd07dae8d746508ef7526c13940e5f524012ae6c6550"
+checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e"
 dependencies = [
  "proc-macro2",
  "syn 2.0.60",
@@ -2752,7 +2752,7 @@ dependencies = [
  "cargo_metadata",
  "heck 0.4.0",
  "wasmtime",
- "wit-component 0.211.1",
+ "wit-component",
 ]
 
 [[package]]
@@ -3082,7 +3082,7 @@ name = "verify-component-adapter"
 version = "24.0.0"
 dependencies = [
  "anyhow",
- "wasmparser 0.211.1",
+ "wasmparser",
  "wat",
 ]
 
@@ -3175,7 +3175,7 @@ dependencies = [
  "byte-array-literals",
  "object 0.36.0",
  "wasi",
- "wasm-encoder 0.211.1",
+ "wasm-encoder",
  "wit-bindgen-rust-macro",
 ]
 
@@ -3235,28 +3235,19 @@ checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1"
 
 [[package]]
 name = "wasm-encoder"
-version = "0.209.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7b4a05336882dae732ce6bd48b7e11fe597293cb72c13da4f35d7d5f8d53b2a7"
-dependencies = [
- "leb128",
-]
-
-[[package]]
-name = "wasm-encoder"
-version = "0.211.1"
+version = "0.212.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5e7d931a1120ef357f32b74547646b6fa68ea25e377772b72874b131a9ed70d4"
+checksum = "501940df4418b8929eb6d52f1aade1fdd15a5b86c92453cb696e3c906bd3fc33"
 dependencies = [
  "leb128",
- "wasmparser 0.211.1",
+ "wasmparser",
 ]
 
 [[package]]
 name = "wasm-metadata"
-version = "0.209.1"
+version = "0.212.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4d32029ce424f6d3c2b39b4419fb45a0e2d84fb0751e0c0a32b7ce8bd5d97f46"
+checksum = "8a1849fac257fd76c43268555e73d74848c8dff23975c238c2cbad61cffe5045"
 dependencies = [
  "anyhow",
  "indexmap 2.2.6",
@@ -3264,52 +3255,36 @@ dependencies = [
  "serde_derive",
  "serde_json",
  "spdx",
- "wasm-encoder 0.209.1",
- "wasmparser 0.209.1",
-]
-
-[[package]]
-name = "wasm-metadata"
-version = "0.211.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7f56bad1c68558c44e7f60be865117dc9d8c3a066bcf3b2232cb9a9858965fd5"
-dependencies = [
- "anyhow",
- "indexmap 2.2.6",
- "serde",
- "serde_derive",
- "serde_json",
- "spdx",
- "wasm-encoder 0.211.1",
- "wasmparser 0.211.1",
+ "wasm-encoder",
+ "wasmparser",
 ]
 
 [[package]]
 name = "wasm-mutate"
-version = "0.211.1"
+version = "0.212.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b4281d9c72b0a3c47eec052755ad98cb854309e3a40edf9887aa8f3ed939f7ab"
+checksum = "ff58202fe6f3750ba930d160a2451087973d902e09a2632b9a78ab7c86150a59"
 dependencies = [
  "egg",
  "log",
  "rand",
  "thiserror",
- "wasm-encoder 0.211.1",
- "wasmparser 0.211.1",
+ "wasm-encoder",
+ "wasmparser",
 ]
 
 [[package]]
 name = "wasm-smith"
-version = "0.211.1"
+version = "0.212.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "94ae0d1bd7d17e7ae175f9e3cf646d9b39b7115240ed8d40141c4670bab49f96"
+checksum = "a8185faf41a5630ec7cf301fa1f63bb757f4c267a057f8b6b56bde0cba1144c1"
 dependencies = [
  "anyhow",
  "arbitrary",
  "flagset",
  "indexmap 2.2.6",
  "leb128",
- "wasm-encoder 0.211.1",
+ "wasm-encoder",
 ]
 
 [[package]]
@@ -3354,22 +3329,9 @@ dependencies = [
 
 [[package]]
 name = "wasmparser"
-version = "0.209.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "07035cc9a9b41e62d3bb3a3815a66ab87c993c06fe1cf6b2a3f2a18499d937db"
-dependencies = [
- "ahash",
- "bitflags 2.4.1",
- "hashbrown 0.14.3",
- "indexmap 2.2.6",
- "semver",
-]
-
-[[package]]
-name = "wasmparser"
-version = "0.211.1"
+version = "0.212.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3189cc8a91f547390e2f043ca3b3e3fe0892f7d581767fd4e4b7f3dc3fe8e561"
+checksum = "8d28bc49ba1e5c5b61ffa7a2eace10820443c4b7d1c0b144109261d14570fdf8"
 dependencies = [
  "ahash",
  "bitflags 2.4.1",
@@ -3390,13 +3352,13 @@ dependencies = [
 
 [[package]]
 name = "wasmprinter"
-version = "0.211.1"
+version = "0.212.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "23708dd7a986bd9b12fca26eff525bbc3659a336e947fd9ed9fdf79086825aec"
+checksum = "dfac65326cc561112af88c3028f6dfdb140acff67ede33a8e86be2dc6b8956f7"
 dependencies = [
  "anyhow",
  "termcolor",
- "wasmparser 0.211.1",
+ "wasmparser",
 ]
 
 [[package]]
@@ -3440,8 +3402,8 @@ dependencies = [
  "target-lexicon",
  "tempfile",
  "wasi-common",
- "wasm-encoder 0.211.1",
- "wasmparser 0.211.1",
+ "wasm-encoder",
+ "wasmparser",
  "wasmtime-asm-macros",
  "wasmtime-cache",
  "wasmtime-component-macro",
@@ -3583,7 +3545,7 @@ dependencies = [
  "tracing",
  "walkdir",
  "wasi-common",
- "wasmparser 0.211.1",
+ "wasmparser",
  "wasmtime",
  "wasmtime-cache",
  "wasmtime-cli-flags",
@@ -3597,10 +3559,10 @@ dependencies = [
  "wasmtime-wasi-nn",
  "wasmtime-wasi-threads",
  "wasmtime-wast",
- "wast 211.0.1",
+ "wast 212.0.0",
  "wat",
  "windows-sys 0.52.0",
- "wit-component 0.211.1",
+ "wit-component",
 ]
 
 [[package]]
@@ -3633,7 +3595,7 @@ dependencies = [
  "wasmtime",
  "wasmtime-component-util",
  "wasmtime-wit-bindgen",
- "wit-parser 0.211.1",
+ "wit-parser",
 ]
 
 [[package]]
@@ -3657,7 +3619,7 @@ dependencies = [
  "object 0.36.0",
  "target-lexicon",
  "thiserror",
- "wasmparser 0.211.1",
+ "wasmparser",
  "wasmtime-environ",
  "wasmtime-versioned-export-macros",
 ]
@@ -3682,8 +3644,8 @@ dependencies = [
  "serde",
  "serde_derive",
  "target-lexicon",
- "wasm-encoder 0.211.1",
- "wasmparser 0.211.1",
+ "wasm-encoder",
+ "wasmparser",
  "wasmprinter",
  "wasmtime-component-util",
  "wasmtime-types",
@@ -3698,7 +3660,7 @@ dependencies = [
  "component-fuzz-util",
  "env_logger",
  "libfuzzer-sys",
- "wasmparser 0.211.1",
+ "wasmparser",
  "wasmprinter",
  "wasmtime-environ",
  "wat",
@@ -3756,7 +3718,7 @@ dependencies = [
  "rand",
  "smallvec",
  "target-lexicon",
- "wasmparser 0.211.1",
+ "wasmparser",
  "wasmtime",
  "wasmtime-fuzzing",
 ]
@@ -3777,12 +3739,12 @@ dependencies = [
  "target-lexicon",
  "tempfile",
  "v8",
- "wasm-encoder 0.211.1",
+ "wasm-encoder",
  "wasm-mutate",
  "wasm-smith",
  "wasm-spec-interpreter",
  "wasmi",
- "wasmparser 0.211.1",
+ "wasmparser",
  "wasmprinter",
  "wasmtime",
  "wasmtime-wast",
@@ -3832,7 +3794,7 @@ dependencies = [
  "serde",
  "serde_derive",
  "smallvec",
- "wasmparser 0.211.1",
+ "wasmparser",
 ]
 
 [[package]]
@@ -3941,7 +3903,7 @@ dependencies = [
  "anyhow",
  "log",
  "wasmtime",
- "wast 211.0.1",
+ "wast 212.0.0",
 ]
 
 [[package]]
@@ -3953,7 +3915,7 @@ dependencies = [
  "gimli",
  "object 0.36.0",
  "target-lexicon",
- "wasmparser 0.211.1",
+ "wasmparser",
  "wasmtime-cranelift",
  "wasmtime-environ",
  "winch-codegen",
@@ -3966,7 +3928,7 @@ dependencies = [
  "anyhow",
  "heck 0.4.0",
  "indexmap 2.2.6",
- "wit-parser 0.211.1",
+ "wit-parser",
 ]
 
 [[package]]
@@ -3984,24 +3946,24 @@ dependencies = [
 
 [[package]]
 name = "wast"
-version = "211.0.1"
+version = "212.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b25506dd82d00da6b14a87436b3d52b1d264083fa79cdb72a0d1b04a8595ccaa"
+checksum = "4606a05fb0aae5d11dd7d8280a640d88a63ee019360ba9be552da3d294b8d1f5"
 dependencies = [
  "bumpalo",
  "leb128",
  "memchr",
  "unicode-width",
- "wasm-encoder 0.211.1",
+ "wasm-encoder",
 ]
 
 [[package]]
 name = "wat"
-version = "1.211.1"
+version = "1.212.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eb716ca6c86eecac2d82541ffc39860118fc0af9309c4f2670637bea2e1bdd7d"
+checksum = "c74ca7f93f11a5d6eed8499f2a8daaad6e225cab0151bc25a091fff3b987532f"
 dependencies = [
- "wast 211.0.1",
+ "wast 212.0.0",
 ]
 
 [[package]]
@@ -4131,7 +4093,7 @@ dependencies = [
  "regalloc2",
  "smallvec",
  "target-lexicon",
- "wasmparser 0.211.1",
+ "wasmparser",
  "wasmtime-cranelift",
  "wasmtime-environ",
 ]
@@ -4308,9 +4270,9 @@ dependencies = [
 
 [[package]]
 name = "wit-bindgen"
-version = "0.26.0"
+version = "0.27.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a84376ff4f74ed07674a1157c0bd19e6627ab01fc90952a27ccefb52a24530f0"
+checksum = "fabce76bbb8938536c437da0c3e1d4dda9065453f72a68f797c0cb3d67356a28"
 dependencies = [
  "wit-bindgen-rt",
  "wit-bindgen-rust-macro",
@@ -4318,45 +4280,48 @@ dependencies = [
 
 [[package]]
 name = "wit-bindgen-core"
-version = "0.26.0"
+version = "0.27.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "36d4706efb67fadfbbde77955b299b111dd096e6776d8c6561d92f6147941880"
+checksum = "1b43fbdd3497c471bbfb6973b1fb9ffe6949f158248cb43171d6f1cf3de7eaa3"
 dependencies = [
  "anyhow",
  "heck 0.5.0",
- "wit-parser 0.209.1",
+ "wit-parser",
 ]
 
 [[package]]
 name = "wit-bindgen-rt"
-version = "0.26.0"
+version = "0.27.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "29c7526379ace8709ee9ab9f2bb50f112d95581063a59ef3097d9c10153886c9"
+checksum = "75956ff0a04a87ca0526b07199ce3b9baee899f2e4723b5b63aa296ab172ec52"
 dependencies = [
  "bitflags 2.4.1",
 ]
 
 [[package]]
 name = "wit-bindgen-rust"
-version = "0.26.0"
+version = "0.27.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "514295193d1a2f42e6a948cd7d9fd81e2b8fadc319667dcf19fd7aceaf2113a2"
+checksum = "bf509c4ef97b18ec0218741c8318706ac30ff16bc1731f990319a42bbbcfe8e3"
 dependencies = [
  "anyhow",
  "heck 0.5.0",
  "indexmap 2.2.6",
- "wasm-metadata 0.209.1",
+ "prettyplease",
+ "syn 2.0.60",
+ "wasm-metadata",
  "wit-bindgen-core",
- "wit-component 0.209.1",
+ "wit-component",
 ]
 
 [[package]]
 name = "wit-bindgen-rust-macro"
-version = "0.26.0"
+version = "0.27.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f0409a3356ca02599aff78f717968fd7f12df4bf879f325e2a97b45c84c90fff"
+checksum = "88d6f2e025e38395d71fc1bf064e581b2ad275ce322d6f8d87ddc5e76a7b8c42"
 dependencies = [
  "anyhow",
+ "prettyplease",
  "proc-macro2",
  "quote",
  "syn 2.0.60",
@@ -4366,28 +4331,9 @@ dependencies = [
 
 [[package]]
 name = "wit-component"
-version = "0.209.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "25a2bb5b039f9cb03425e1d5a6e54b441ca4ca1b1d4fa6a0924db67a55168f99"
-dependencies = [
- "anyhow",
- "bitflags 2.4.1",
- "indexmap 2.2.6",
- "log",
- "serde",
- "serde_derive",
- "serde_json",
- "wasm-encoder 0.209.1",
- "wasm-metadata 0.209.1",
- "wasmparser 0.209.1",
- "wit-parser 0.209.1",
-]
-
-[[package]]
-name = "wit-component"
-version = "0.211.1"
+version = "0.212.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "079a38b7d679867424bf2bcbdd553a2acf364525307e43dfb910fa4a2c6fd9f2"
+checksum = "8ed5b0f9fc3d6424787d2a49e1142bf954ae4f26ee891992c144f0cfd68c4b7f"
 dependencies = [
  "anyhow",
  "bitflags 2.4.1",
@@ -4396,35 +4342,17 @@ dependencies = [
  "serde",
  "serde_derive",
  "serde_json",
- "wasm-encoder 0.211.1",
- "wasm-metadata 0.211.1",
- "wasmparser 0.211.1",
- "wit-parser 0.211.1",
-]
-
-[[package]]
-name = "wit-parser"
-version = "0.209.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3e79b9e3c0b6bb589dec46317e645851e0db2734c44e2be5e251b03ff4a51269"
-dependencies = [
- "anyhow",
- "id-arena",
- "indexmap 2.2.6",
- "log",
- "semver",
- "serde",
- "serde_derive",
- "serde_json",
- "unicode-xid",
- "wasmparser 0.209.1",
+ "wasm-encoder",
+ "wasm-metadata",
+ "wasmparser",
+ "wit-parser",
 ]
 
 [[package]]
 name = "wit-parser"
-version = "0.211.1"
+version = "0.212.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a3cc90c50c7ec8a824b5d2cddddff13b2dc12b7a96bf8684d11474223c2ea22f"
+checksum = "ceeb0424aa8679f3fcf2d6e3cfa381f3d6fa6179976a2c05a6249dd2bb426716"
 dependencies = [
  "anyhow",
  "id-arena",
@@ -4435,7 +4363,7 @@ dependencies = [
  "serde_derive",
  "serde_json",
  "unicode-xid",
- "wasmparser 0.211.1",
+ "wasmparser",
 ]
 
 [[package]]
diff --git a/Cargo.toml b/Cargo.toml
index a378a02ec..3043a9320 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -249,19 +249,19 @@ io-lifetimes = { version = "2.0.3", default-features = false }
 io-extras = "0.18.1"
 rustix = "0.38.31"
 # wit-bindgen:
-wit-bindgen = { version = "0.26.0", default-features = false }
-wit-bindgen-rust-macro = { version = "0.26.0", default-features = false }
+wit-bindgen = { version = "0.27.0", default-features = false }
+wit-bindgen-rust-macro = { version = "0.27.0", default-features = false }
 
 # wasm-tools family:
-wasmparser = { version = "0.211.1", default-features = false }
-wat = "1.211.1"
-wast = "211.0.1"
-wasmprinter = "0.211.1"
-wasm-encoder = "0.211.1"
-wasm-smith = "0.211.1"
-wasm-mutate = "0.211.1"
-wit-parser = "0.211.1"
-wit-component = "0.211.1"
+wasmparser = { version = "0.212.0", default-features = false }
+wat = "1.212.0"
+wast = "212.0.0"
+wasmprinter = "0.212.0"
+wasm-encoder = "0.212.0"
+wasm-smith = "0.212.0"
+wasm-mutate = "0.212.0"
+wit-parser = "0.212.0"
+wit-component = "0.212.0"
 
 # Non-Bytecode Alliance maintained dependencies:
 # --------------------------
diff --git a/ci/build-wasi-preview1-component-adapter-provider.sh b/ci/build-wasi-preview1-component-adapter-provider.sh
new file mode 100755
index 000000000..c8c2bf4d2
--- /dev/null
+++ b/ci/build-wasi-preview1-component-adapter-provider.sh
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+set -ex
+
+# Manifest the adapter provider into the workspace
+cp crates/wasi-preview1-component-adapter/provider/Cargo.toml.in crates/wasi-preview1-component-adapter/provider/Cargo.toml
+sed -i '/"crates\/wasi-preview1-component-adapter",/a\ \ "crates\/wasi-preview1-component-adapter\/provider",' Cargo.toml
+
+# Check the adapter provider's code formatting and style
+cargo fmt -p wasi-preview1-component-adapter-provider -- --check
+cargo check -p wasi-preview1-component-adapter-provider
+cargo clippy -p wasi-preview1-component-adapter-provider
+
+# Check that publishing the adapter provider should work
+cargo publish -p wasi-preview1-component-adapter-provider --dry-run --allow-dirty
diff --git a/ci/build-wasi-preview1-component-adapter.sh b/ci/build-wasi-preview1-component-adapter.sh
index 76dcbc1c1..545a4e06f 100755
--- a/ci/build-wasi-preview1-component-adapter.sh
+++ b/ci/build-wasi-preview1-component-adapter.sh
@@ -15,24 +15,28 @@ release="target/wasm32-unknown-unknown/release/wasi_snapshot_preview1.wasm"
 $build_adapter
 $verify $debug
 
+build() {
+  input=$1
+  flavor=$2
+  $verify $input
+  name=wasi_snapshot_preview1.$flavor.wasm
+  dst=$(dirname $input)/$name
+  wasm-tools metadata add --name "wasi_preview1_component_adapter.$flavor.adapter" $input \
+    -o $dst
+}
+
 # Debug build, command
 $build_adapter --no-default-features --features command
 $verify $debug
 
 # Release build, command
 $build_adapter --release --no-default-features --features command
-$verify $release
-wasm-tools metadata add --name "wasi_preview1_component_adapter.command.adapter:${VERSION}" $release \
-  -o target/wasm32-unknown-unknown/release/wasi_snapshot_preview1.command.wasm
+build $release command
 
 # Release build, default features (reactor)
 $build_adapter --release
-$verify $release
-wasm-tools metadata add --name "wasi_preview1_component_adapter.reactor.adapter:${VERSION}" $release \
-  -o target/wasm32-unknown-unknown/release/wasi_snapshot_preview1.reactor.wasm
+build $release reactor
 
 # Release build, proxy
 $build_adapter --release --no-default-features --features proxy
-$verify $release
-wasm-tools metadata add --name "wasi_preview1_component_adapter.proxy.adapter:${VERSION}" $release \
-  -o target/wasm32-unknown-unknown/release/wasi_snapshot_preview1.proxy.wasm
+build $release proxy
diff --git a/cranelift/codegen/src/ir/extfunc.rs b/cranelift/codegen/src/ir/extfunc.rs
index c4721eb13..7300b9828 100644
--- a/cranelift/codegen/src/ir/extfunc.rs
+++ b/cranelift/codegen/src/ir/extfunc.rs
@@ -233,7 +233,13 @@ pub enum ArgumentPurpose {
     Normal,
 
     /// A C struct passed as argument.
-    StructArgument(u32),
+    ///
+    /// Note that this should only be used when interacting with code following
+    /// a C ABI which is expecting a struct passed *by value*.
+    StructArgument(
+        /// The size, in bytes, of the struct.
+        u32,
+    ),
 
     /// Struct return pointer.
     ///
diff --git a/cranelift/src/bugpoint.rs b/cranelift/src/bugpoint.rs
index 862664b11..7670c58d9 100644
--- a/cranelift/src/bugpoint.rs
+++ b/cranelift/src/bugpoint.rs
@@ -831,6 +831,15 @@ fn try_resolve_aliases(context: &mut CrashCheckContext, func: &mut Function) {
     }
 }
 
+/// Remove sourcelocs if the function still crashes after they are removed, to make the reduced clif IR easier to read.
+fn try_remove_srclocs(context: &mut CrashCheckContext, func: &mut Function) {
+    let mut func_with_removed_sourcelocs = func.clone();
+    func_with_removed_sourcelocs.srclocs.clear();
+    if let CheckResult::Crash(_) = context.check_for_crash(&func_with_removed_sourcelocs) {
+        *func = func_with_removed_sourcelocs;
+    }
+}
+
 fn reduce(isa: &dyn TargetIsa, mut func: Function, verbose: bool) -> Result<(Function, String)> {
     let mut context = CrashCheckContext::new(isa);
 
@@ -839,6 +848,7 @@ fn reduce(isa: &dyn TargetIsa, mut func: Function, verbose: bool) -> Result<(Fun
     }
 
     try_resolve_aliases(&mut context, &mut func);
+    try_remove_srclocs(&mut context, &mut func);
 
     let progress_bar = ProgressBar::with_draw_target(0, ProgressDrawTarget::stdout());
     progress_bar.set_style(
diff --git a/crates/c-api/README.md b/crates/c-api/README.md
index 3c7361616..370be40e6 100644
--- a/crates/c-api/README.md
+++ b/crates/c-api/README.md
@@ -8,7 +8,7 @@ For more information you can find the documentation for this library
 To use Wasmtime from a C or C++ project, you can use Cargo to build the Wasmtime C bindings. From the root of the Wasmtime repository, run the following command:
 
 ```
-cargo build --release wasmtime-c-api
+cargo build --release -p wasmtime-c-api
 ```
 
 This will create static and dynamic libraries called `libwasmtime` in the `target/release` directory.
diff --git a/crates/c-api/include/wasmtime/engine.h b/crates/c-api/include/wasmtime/engine.h
index d68cf4e8f..6b666bf5f 100644
--- a/crates/c-api/include/wasmtime/engine.h
+++ b/crates/c-api/include/wasmtime/engine.h
@@ -13,6 +13,14 @@
 extern "C" {
 #endif
 
+/**
+ * \brief Create a new reference to the same underlying engine.
+ *
+ * This function clones the reference-counted pointer to the internal object,
+ * and must be freed using #wasm_engine_delete.
+ */
+WASM_API_EXTERN wasm_engine_t *wasmtime_engine_clone(wasm_engine_t *engine);
+
 /**
  * \brief Increments the engine-local epoch variable.
  *
diff --git a/crates/c-api/src/engine.rs b/crates/c-api/src/engine.rs
index 06a2b1b3f..e8cea19e7 100644
--- a/crates/c-api/src/engine.rs
+++ b/crates/c-api/src/engine.rs
@@ -29,12 +29,20 @@ pub extern "C" fn wasm_engine_new() -> Box<wasm_engine_t> {
 
 #[no_mangle]
 pub extern "C" fn wasm_engine_new_with_config(c: Box<wasm_config_t>) -> Box<wasm_engine_t> {
+    #[cfg(feature = "logging")]
+    drop(env_logger::try_init());
+
     let config = c.config;
     Box::new(wasm_engine_t {
         engine: Engine::new(&config).unwrap(),
     })
 }
 
+#[no_mangle]
+pub extern "C" fn wasmtime_engine_clone(engine: &wasm_engine_t) -> Box<wasm_engine_t> {
+    Box::new(engine.clone())
+}
+
 #[no_mangle]
 pub extern "C" fn wasmtime_engine_increment_epoch(engine: &wasm_engine_t) {
     engine.engine.increment_epoch();
diff --git a/crates/cli-flags/src/lib.rs b/crates/cli-flags/src/lib.rs
index 8aafa447b..33249451c 100644
--- a/crates/cli-flags/src/lib.rs
+++ b/crates/cli-flags/src/lib.rs
@@ -254,10 +254,14 @@ wasmtime_option_group! {
         pub memory64: Option<bool>,
         /// Configure support for the component-model proposal.
         pub component_model: Option<bool>,
+        /// Configure support for 33+ flags in the component model.
+        pub component_model_more_flags: Option<bool>,
         /// Configure support for the function-references proposal.
         pub function_references: Option<bool>,
         /// Configure support for the GC proposal.
         pub gc: Option<bool>,
+        /// Configure support for the custom-page-sizes proposal.
+        pub custom_page_sizes: Option<bool>,
     }
 
     enum Wasm {
@@ -658,6 +662,9 @@ impl CommonOptions {
         if let Some(enable) = self.wasm.memory64.or(all) {
             config.wasm_memory64(enable);
         }
+        if let Some(enable) = self.wasm.custom_page_sizes.or(all) {
+            config.wasm_custom_page_sizes(enable);
+        }
 
         macro_rules! handle_conditionally_compiled {
             ($(($feature:tt, $field:tt, $method:tt))*) => ($(
@@ -674,6 +681,7 @@ impl CommonOptions {
 
         handle_conditionally_compiled! {
             ("component-model", component_model, wasm_component_model)
+            ("component-model", component_model_more_flags, wasm_component_model_more_flags)
             ("threads", threads, wasm_threads)
             ("gc", gc, wasm_gc)
             ("gc", reference_types, wasm_reference_types)
diff --git a/crates/cranelift/src/debug/transform/attr.rs b/crates/cranelift/src/debug/transform/attr.rs
index 543b24a51..a6cb979fc 100644
--- a/crates/cranelift/src/debug/transform/attr.rs
+++ b/crates/cranelift/src/debug/transform/attr.rs
@@ -116,7 +116,15 @@ where
                     ..
                 } = file_context
                 {
-                    write::AttributeValue::FileIndex(Some(file_map[(i - file_index_base) as usize]))
+                    let index = usize::try_from(i - file_index_base)
+                        .ok()
+                        .and_then(|i| file_map.get(i).copied());
+                    match index {
+                        Some(index) => write::AttributeValue::FileIndex(Some(index)),
+                        // This was seen to be invalid in #8884 and #8904 so
+                        // ignore this seemingly invalid DWARF from LLVM
+                        None => continue,
+                    }
                 } else {
                     return Err(TransformError("unexpected file index attribute").into());
                 }
diff --git a/crates/jit-debug/src/perf_jitdump.rs b/crates/jit-debug/src/perf_jitdump.rs
index 6d6856e8d..4592318c0 100644
--- a/crates/jit-debug/src/perf_jitdump.rs
+++ b/crates/jit-debug/src/perf_jitdump.rs
@@ -252,8 +252,7 @@ impl JitDumpFile {
     pub fn dump_code_load_record(
         &mut self,
         method_name: &str,
-        addr: *const u8,
-        len: usize,
+        code: &[u8],
         timestamp: u64,
         pid: u32,
         tid: u32,
@@ -263,7 +262,7 @@ impl JitDumpFile {
 
         let rh = RecordHeader {
             id: RecordId::JitCodeLoad as u32,
-            record_size: size_limit as u32 + name_len as u32 + len as u32,
+            record_size: size_limit as u32 + name_len as u32 + code.len() as u32,
             timestamp,
         };
 
@@ -271,16 +270,13 @@ impl JitDumpFile {
             header: rh,
             pid,
             tid,
-            virtual_address: addr as u64,
-            address: addr as u64,
-            size: len as u64,
+            virtual_address: code.as_ptr() as u64,
+            address: code.as_ptr() as u64,
+            size: code.len() as u64,
             index: self.next_code_index(),
         };
 
-        unsafe {
-            let code_buffer: &[u8] = std::slice::from_raw_parts(addr, len);
-            self.write_code_load_record(method_name, clr, code_buffer)
-        }
+        self.write_code_load_record(method_name, clr, code)
     }
 }
 
diff --git a/crates/wasi-common/Cargo.toml b/crates/wasi-common/Cargo.toml
index d15c02994..579d92f9f 100644
--- a/crates/wasi-common/Cargo.toml
+++ b/crates/wasi-common/Cargo.toml
@@ -79,7 +79,6 @@ wasmtime = [
 # This feature enables an implementation of the Wasi traits for a
 # synchronous wasmtime embedding.
 sync = [
-    "wasmtime",
     "dep:cap-fs-ext",
     "dep:cap-time-ext",
     "dep:fs-set-times",
diff --git a/crates/wasi-preview1-component-adapter/provider/.gitignore b/crates/wasi-preview1-component-adapter/provider/.gitignore
new file mode 100644
index 000000000..1ae47fad8
--- /dev/null
+++ b/crates/wasi-preview1-component-adapter/provider/.gitignore
@@ -0,0 +1,1 @@
+/Cargo.toml
diff --git a/crates/wasi-preview1-component-adapter/provider/Cargo.toml.in b/crates/wasi-preview1-component-adapter/provider/Cargo.toml.in
new file mode 100644
index 000000000..9f0ea47c7
--- /dev/null
+++ b/crates/wasi-preview1-component-adapter/provider/Cargo.toml.in
@@ -0,0 +1,19 @@
+[package]
+name = "wasi-preview1-component-adapter-provider"
+version.workspace = true
+authors.workspace = true
+description = "Embedded wasi-preview1-component-adapter binaries"
+license = "Apache-2.0 WITH LLVM-exception"
+repository = "https://github.com/bytecodealliance/wasmtime"
+documentation = "https://docs.rs/wasi-preview1-component-adapter-provider/"
+categories = ["wasm"]
+keywords = ["webassembly", "wasm"]
+edition.workspace = true
+
+[lints]
+workspace = true
+
+[package.metadata.docs.rs]
+all-features = true
+
+[dependencies]
diff --git a/crates/wasi-preview1-component-adapter/provider/artefacts/.gitignore b/crates/wasi-preview1-component-adapter/provider/artefacts/.gitignore
new file mode 100644
index 000000000..46be8eadb
--- /dev/null
+++ b/crates/wasi-preview1-component-adapter/provider/artefacts/.gitignore
@@ -0,0 +1,3 @@
+/wasi_snapshot_preview1.reactor.wasm
+/wasi_snapshot_preview1.command.wasm
+/wasi_snapshot_preview1.proxy.wasm
diff --git a/crates/wasi-preview1-component-adapter/provider/src/lib.rs b/crates/wasi-preview1-component-adapter/provider/src/lib.rs
new file mode 100644
index 000000000..0783c93bd
--- /dev/null
+++ b/crates/wasi-preview1-component-adapter/provider/src/lib.rs
@@ -0,0 +1,51 @@
+//! This crate contains the binaries of three WebAssembly modules:
+//!
+//! - [`WASI_SNAPSHOT_PREVIEW1_REACTOR_ADAPTER`]
+//! - [`WASI_SNAPSHOT_PREVIEW1_COMMAND_ADAPTER`]
+//! - [`WASI_SNAPSHOT_PREVIEW1_PROXY_ADAPTER`]
+//!
+//! These three modules bridge the wasip1 ABI to the wasip2 ABI of the component
+//! model.
+//!
+//! They can be given to the [`wit_component::ComponentEncoder::adapter`]
+//! method, using the [`WASI_SNAPSHOT_PREVIEW1_ADAPTER_NAME`], to translate a
+//! module from the historical WASM ABI to the canonical ABI.
+//!
+//! [`wit_component::ComponentEncoder::adapter`]: https://docs.rs/wit-component/latest/wit_component/struct.ComponentEncoder.html#method.adapter
+
+/// The name of the adapters in this crate, which may be provided to
+/// [`wit_component::ComponentEncoder::adapter`].
+///
+/// [`wit_component::ComponentEncoder::adapter`]: https://docs.rs/wit-component/latest/wit_component/struct.ComponentEncoder.html#method.adapter
+pub const WASI_SNAPSHOT_PREVIEW1_ADAPTER_NAME: &str = "wasi_snapshot_preview1";
+
+/// The "reactor" adapter provides the default adaptation from preview1 to
+/// preview2.
+///
+/// This adapter implements the [`wasi:cli/imports`] world.
+///
+/// [`wasi:cli/imports`]: https://github.com/WebAssembly/WASI/blob/01bb90d8b66cbc1d50349aaaab9ac5b143c9c98c/preview2/cli/imports.wit
+pub const WASI_SNAPSHOT_PREVIEW1_REACTOR_ADAPTER: &[u8] =
+    include_bytes!("../artefacts/wasi_snapshot_preview1.reactor.wasm");
+
+/// The "command" adapter extends the ["reactor" adapter] and additionally
+/// exports a `run` function entrypoint.
+///
+/// This adapter implements the [`wasi:cli/command`] world.
+///
+/// ["reactor" adapter]: WASI_SNAPSHOT_PREVIEW1_REACTOR_ADAPTER
+/// [`wasi:cli/command`]: https://github.com/WebAssembly/WASI/blob/01bb90d8b66cbc1d50349aaaab9ac5b143c9c98c/preview2/cli/command.wit
+pub const WASI_SNAPSHOT_PREVIEW1_COMMAND_ADAPTER: &[u8] =
+    include_bytes!("../artefacts/wasi_snapshot_preview1.command.wasm");
+
+/// The "proxy" adapter provides implements a HTTP proxy which is more
+/// restricted than the ["reactor" adapter] adapter, as it lacks filesystem,
+/// socket, environment, exit, and terminal support, but includes HTTP handlers
+/// for incoming and outgoing requests.
+///
+/// This adapter implements the [`wasi:http/proxy`] world.
+///
+/// ["reactor" adapter]: WASI_SNAPSHOT_PREVIEW1_REACTOR_ADAPTER
+/// [`wasi:http/proxy`]: https://github.com/WebAssembly/WASI/blob/01bb90d8b66cbc1d50349aaaab9ac5b143c9c98c/preview2/http/proxy.wit
+pub const WASI_SNAPSHOT_PREVIEW1_PROXY_ADAPTER: &[u8] =
+    include_bytes!("../artefacts/wasi_snapshot_preview1.proxy.wasm");
diff --git a/crates/wasi-preview1-component-adapter/src/lib.rs b/crates/wasi-preview1-component-adapter/src/lib.rs
index 83b0475a2..56d1f6e70 100644
--- a/crates/wasi-preview1-component-adapter/src/lib.rs
+++ b/crates/wasi-preview1-component-adapter/src/lib.rs
@@ -62,6 +62,7 @@ pub mod bindings {
         // Instead, we manually define the bindings for these functions in
         // terms of raw pointers.
         skip: ["run", "get-environment", "poll"],
+        generate_all,
     });
 
     #[cfg(feature = "reactor")]
@@ -78,6 +79,7 @@ pub mod bindings {
         // Instead, we manually define the bindings for these functions in
         // terms of raw pointers.
         skip: ["get-environment", "poll"],
+        generate_all,
     });
 
     #[cfg(feature = "proxy")]
@@ -99,6 +101,7 @@ pub mod bindings {
         raw_strings,
         runtime_path: "crate::bindings::wit_bindgen_rt_shim",
         skip: ["poll"],
+        generate_all,
     });
 
     pub mod wit_bindgen_rt_shim {
diff --git a/crates/wasmtime/src/config.rs b/crates/wasmtime/src/config.rs
index 3c4e49b00..841f56448 100644
--- a/crates/wasmtime/src/config.rs
+++ b/crates/wasmtime/src/config.rs
@@ -984,6 +984,18 @@ impl Config {
         self
     }
 
+    /// Configures whether components support more than 32 flags in each `flags`
+    /// type.
+    ///
+    /// This is part of the transition plan in
+    /// https://github.com/WebAssembly/component-model/issues/370.
+    #[cfg(feature = "component-model")]
+    pub fn wasm_component_model_more_flags(&mut self, enable: bool) -> &mut Self {
+        self.features
+            .set(WasmFeatures::COMPONENT_MODEL_MORE_FLAGS, enable);
+        self
+    }
+
     /// Configures which compilation strategy will be used for wasm modules.
     ///
     /// This method can be used to configure which compiler is used for wasm
diff --git a/crates/wasmtime/src/engine/serialization.rs b/crates/wasmtime/src/engine/serialization.rs
index f350f9286..c9e86cdb0 100644
--- a/crates/wasmtime/src/engine/serialization.rs
+++ b/crates/wasmtime/src/engine/serialization.rs
@@ -202,6 +202,7 @@ struct WasmFeatures {
     function_references: bool,
     gc: bool,
     custom_page_sizes: bool,
+    component_model_more_flags: bool,
 }
 
 impl Metadata<'_> {
@@ -227,6 +228,7 @@ impl Metadata<'_> {
             shared_everything_threads,
             component_model_values,
             component_model_nested_names,
+            component_model_more_flags,
 
             // Always on; we don't currently have knobs for these.
             mutable_global: _,
@@ -264,6 +266,7 @@ impl Metadata<'_> {
                 function_references,
                 gc,
                 custom_page_sizes,
+                component_model_more_flags,
             },
         }
     }
@@ -469,6 +472,7 @@ impl Metadata<'_> {
             function_references,
             gc,
             custom_page_sizes,
+            component_model_more_flags,
         } = self.features;
 
         use wasmparser::WasmFeatures as F;
@@ -550,6 +554,11 @@ impl Metadata<'_> {
             other.contains(F::CUSTOM_PAGE_SIZES),
             "WebAssembly custom-page-sizes support",
         )?;
+        Self::check_bool(
+            component_model_more_flags,
+            other.contains(F::COMPONENT_MODEL_MORE_FLAGS),
+            "WebAssembly component model support for more than 32 flags",
+        )?;
 
         Ok(())
     }
diff --git a/crates/wasmtime/src/profiling_agent.rs b/crates/wasmtime/src/profiling_agent.rs
index b32b84619..50480a624 100644
--- a/crates/wasmtime/src/profiling_agent.rs
+++ b/crates/wasmtime/src/profiling_agent.rs
@@ -45,7 +45,7 @@ cfg_if::cfg_if! {
 
 /// Common interface for profiling tools.
 pub trait ProfilingAgent: Send + Sync + 'static {
-    fn register_function(&self, name: &str, addr: *const u8, size: usize);
+    fn register_function(&self, name: &str, code: &[u8]);
 
     fn register_module(&self, code: &[u8], custom_name: &dyn Fn(usize) -> Option<String>) {
         use object::{File, Object as _, ObjectSection, ObjectSymbol, SectionKind, SymbolKind};
@@ -55,9 +55,9 @@ pub trait ProfilingAgent: Send + Sync + 'static {
             Err(_) => return,
         };
 
-        let text_base = match image.sections().find(|s| s.kind() == SectionKind::Text) {
+        let text = match image.sections().find(|s| s.kind() == SectionKind::Text) {
             Some(section) => match section.data() {
-                Ok(data) => data.as_ptr() as usize,
+                Ok(data) => data,
                 Err(_) => return,
             },
             None => return,
@@ -76,7 +76,6 @@ pub trait ProfilingAgent: Send + Sync + 'static {
                 continue;
             }
             if let Ok(name) = sym.name() {
-                let addr = text_base + address as usize;
                 let owned;
                 let name = match custom_name(address as usize) {
                     Some(name) => {
@@ -85,7 +84,8 @@ pub trait ProfilingAgent: Send + Sync + 'static {
                     }
                     None => name,
                 };
-                self.register_function(name, addr as *const u8, size as usize);
+                let code = &text[address as usize..][..size as usize];
+                self.register_function(name, code)
             }
         }
     }
@@ -99,6 +99,6 @@ pub fn new_null() -> Box<dyn ProfilingAgent> {
 struct NullProfilerAgent;
 
 impl ProfilingAgent for NullProfilerAgent {
-    fn register_function(&self, _name: &str, _addr: *const u8, _size: usize) {}
+    fn register_function(&self, _name: &str, _code: &[u8]) {}
     fn register_module(&self, _code: &[u8], _custom_name: &dyn Fn(usize) -> Option<String>) {}
 }
diff --git a/crates/wasmtime/src/profiling_agent/jitdump.rs b/crates/wasmtime/src/profiling_agent/jitdump.rs
index 5de53984f..cb8a49ece 100644
--- a/crates/wasmtime/src/profiling_agent/jitdump.rs
+++ b/crates/wasmtime/src/profiling_agent/jitdump.rs
@@ -50,14 +50,13 @@ pub fn new() -> Result<Box<dyn ProfilingAgent>> {
 }
 
 impl ProfilingAgent for JitDumpAgent {
-    fn register_function(&self, name: &str, addr: *const u8, size: usize) {
+    fn register_function(&self, name: &str, code: &[u8]) {
         let mut jitdump_file = JITDUMP_FILE.lock().unwrap();
         let jitdump_file = jitdump_file.as_mut().unwrap();
         let timestamp = jitdump_file.get_time_stamp();
         #[allow(trivial_numeric_casts)]
         let tid = rustix::thread::gettid().as_raw_nonzero().get() as u32;
-        if let Err(err) =
-            jitdump_file.dump_code_load_record(&name, addr, size, timestamp, self.pid, tid)
+        if let Err(err) = jitdump_file.dump_code_load_record(&name, code, timestamp, self.pid, tid)
         {
             println!("Jitdump: write_code_load_failed_record failed: {:?}\n", err);
         }
diff --git a/crates/wasmtime/src/profiling_agent/perfmap.rs b/crates/wasmtime/src/profiling_agent/perfmap.rs
index c60a28440..8ed7fc892 100644
--- a/crates/wasmtime/src/profiling_agent/perfmap.rs
+++ b/crates/wasmtime/src/profiling_agent/perfmap.rs
@@ -21,26 +21,27 @@ pub fn new() -> Result<Box<dyn ProfilingAgent>> {
 }
 
 impl PerfMapAgent {
-    fn make_line(
-        writer: &mut dyn Write,
-        name: &str,
-        addr: *const u8,
-        len: usize,
-    ) -> io::Result<()> {
+    fn make_line(writer: &mut dyn Write, name: &str, code: &[u8]) -> io::Result<()> {
         // Format is documented here: https://github.com/torvalds/linux/blob/master/tools/perf/Documentation/jit-interface.txt
         // Try our best to sanitize the name, since wasm allows for any utf8 string in there.
         let sanitized_name = name.replace('\n', "_").replace('\r', "_");
-        write!(writer, "{:x} {:x} {}\n", addr as usize, len, sanitized_name)?;
+        write!(
+            writer,
+            "{:p} {:x} {}\n",
+            code.as_ptr(),
+            code.len(),
+            sanitized_name
+        )?;
         writer.flush()?;
         Ok(())
     }
 }
 
 impl ProfilingAgent for PerfMapAgent {
-    fn register_function(&self, name: &str, addr: *const u8, size: usize) {
+    fn register_function(&self, name: &str, code: &[u8]) {
         let mut file = PERFMAP_FILE.lock().unwrap();
         let file = file.as_mut().unwrap();
-        if let Err(err) = Self::make_line(file, name, addr, size) {
+        if let Err(err) = Self::make_line(file, name, code) {
             eprintln!("Error when writing import trampoline info to the perf map file: {err}");
         }
     }
diff --git a/crates/wasmtime/src/profiling_agent/vtune.rs b/crates/wasmtime/src/profiling_agent/vtune.rs
index 159792401..cbf7f5d7b 100644
--- a/crates/wasmtime/src/profiling_agent/vtune.rs
+++ b/crates/wasmtime/src/profiling_agent/vtune.rs
@@ -47,10 +47,10 @@ impl Drop for VTuneAgent {
 
 impl State {
     /// Notify vtune about a newly tracked code region.
-    fn notify_code(&mut self, module_name: &str, method_name: &str, addr: *const u8, len: usize) {
+    fn notify_code(&mut self, module_name: &str, method_name: &str, code: &[u8]) {
         self.vtune
             .load_method(
-                MethodLoadBuilder::new(method_name.to_owned(), addr, len)
+                MethodLoadBuilder::new(method_name.to_owned(), code.as_ptr(), code.len())
                     .class_file_name(module_name.to_owned())
                     .source_file_name("<unknown wasm filename>".to_owned()),
             )
@@ -65,16 +65,13 @@ impl State {
 }
 
 impl ProfilingAgent for VTuneAgent {
-    fn register_function(&self, name: &str, addr: *const u8, size: usize) {
-        self.state
-            .lock()
-            .unwrap()
-            .register_function(name, addr, size);
+    fn register_function(&self, name: &str, code: &[u8]) {
+        self.state.lock().unwrap().register_function(name, code);
     }
 }
 
 impl State {
-    fn register_function(&mut self, name: &str, addr: *const u8, size: usize) {
-        self.notify_code("wasmtime", name, addr, size);
+    fn register_function(&mut self, name: &str, code: &[u8]) {
+        self.notify_code("wasmtime", name, code);
     }
 }
diff --git a/crates/wasmtime/src/runtime/gc/disabled/rooting.rs b/crates/wasmtime/src/runtime/gc/disabled/rooting.rs
index a63a65126..7c3065265 100644
--- a/crates/wasmtime/src/runtime/gc/disabled/rooting.rs
+++ b/crates/wasmtime/src/runtime/gc/disabled/rooting.rs
@@ -45,7 +45,7 @@ impl RootSet {
         usize::MAX
     }
 
-    pub(crate) fn exit_lifo_scope(&mut self, _gc_store: &mut GcStore, _scope: usize) {}
+    pub(crate) fn exit_lifo_scope(&mut self, _gc_store: Option<&mut GcStore>, _scope: usize) {}
 
     pub(crate) fn with_lifo_scope<T>(
         store: &mut StoreOpaque,
diff --git a/crates/wasmtime/src/runtime/gc/enabled/rooting.rs b/crates/wasmtime/src/runtime/gc/enabled/rooting.rs
index 74fe5be87..632ee02f2 100644
--- a/crates/wasmtime/src/runtime/gc/enabled/rooting.rs
+++ b/crates/wasmtime/src/runtime/gc/enabled/rooting.rs
@@ -417,7 +417,7 @@ impl RootSet {
     ///
     /// Calls to `{enter,exit}_lifo_scope` must happen in a strict LIFO order.
     #[inline]
-    pub(crate) fn exit_lifo_scope(&mut self, gc_store: &mut GcStore, scope: usize) {
+    pub(crate) fn exit_lifo_scope(&mut self, gc_store: Option<&mut GcStore>, scope: usize) {
         debug_assert!(self.lifo_roots.len() >= scope);
 
         // If we actually have roots to unroot, call an out-of-line slow path.
@@ -428,7 +428,7 @@ impl RootSet {
 
     #[inline(never)]
     #[cold]
-    fn exit_lifo_scope_slow(&mut self, gc_store: &mut GcStore, scope: usize) {
+    fn exit_lifo_scope_slow(&mut self, mut gc_store: Option<&mut GcStore>, scope: usize) {
         self.lifo_generation += 1;
 
         // TODO: In the case where we have a tracing GC that doesn't need to
@@ -438,7 +438,13 @@ impl RootSet {
 
         let mut lifo_roots = mem::take(&mut self.lifo_roots);
         for root in lifo_roots.drain(scope..) {
-            gc_store.drop_gc_ref(root.gc_ref);
+            // Only drop the GC reference if we actually have a GC store. How
+            // can we have a GC reference but not a GC store? If we've only
+            // create `i31refs`, we never force a GC store's allocation. This is
+            // fine because `i31ref`s never need drop barriers.
+            if let Some(gc_store) = &mut gc_store {
+                gc_store.drop_gc_ref(root.gc_ref);
+            }
         }
         self.lifo_roots = lifo_roots;
     }
diff --git a/crates/wasmtime/src/runtime/store.rs b/crates/wasmtime/src/runtime/store.rs
index 16eb424d2..944cca644 100644
--- a/crates/wasmtime/src/runtime/store.rs
+++ b/crates/wasmtime/src/runtime/store.rs
@@ -1584,9 +1584,7 @@ impl StoreOpaque {
 
     #[inline]
     pub(crate) fn exit_gc_lifo_scope(&mut self, scope: usize) {
-        if let Some(gc_store) = self.gc_store.as_mut() {
-            self.gc_roots.exit_lifo_scope(gc_store, scope);
-        }
+        self.gc_roots.exit_lifo_scope(self.gc_store.as_mut(), scope);
     }
 
     #[cfg(feature = "gc")]
diff --git a/supply-chain/imports.lock b/supply-chain/imports.lock
index 9b3083041..b304b8781 100644
--- a/supply-chain/imports.lock
+++ b/supply-chain/imports.lock
@@ -1770,6 +1770,13 @@ user-id = 3618
 user-login = "dtolnay"
 user-name = "David Tolnay"
 
+[[publisher.prettyplease]]
+version = "0.2.20"
+when = "2024-05-07"
+user-id = 3618
+user-login = "dtolnay"
+user-name = "David Tolnay"
+
 [[publisher.proc-macro2]]
 version = "1.0.81"
 when = "2024-04-17"
@@ -2132,6 +2139,12 @@ when = "2024-06-19"
 user-id = 73222
 user-login = "wasmtime-publish"
 
+[[publisher.wasm-encoder]]
+version = "0.212.0"
+when = "2024-06-27"
+user-id = 73222
+user-login = "wasmtime-publish"
+
 [[publisher.wasm-metadata]]
 version = "0.201.0"
 when = "2024-02-27"
@@ -2192,6 +2205,12 @@ when = "2024-06-19"
 user-id = 73222
 user-login = "wasmtime-publish"
 
+[[publisher.wasm-metadata]]
+version = "0.212.0"
+when = "2024-06-27"
+user-id = 73222
+user-login = "wasmtime-publish"
+
 [[publisher.wasm-mutate]]
 version = "0.201.0"
 when = "2024-02-27"
@@ -2324,6 +2343,12 @@ when = "2024-06-19"
 user-id = 73222
 user-login = "wasmtime-publish"
 
+[[publisher.wasmparser]]
+version = "0.212.0"
+when = "2024-06-27"
+user-id = 73222
+user-login = "wasmtime-publish"
+
 [[publisher.wasmprinter]]
 version = "0.201.0"
 when = "2024-02-27"
@@ -2384,6 +2409,12 @@ when = "2024-06-19"
 user-id = 73222
 user-login = "wasmtime-publish"
 
+[[publisher.wasmprinter]]
+version = "0.212.0"
+when = "2024-06-27"
+user-id = 73222
+user-login = "wasmtime-publish"
+
 [[publisher.wasmtime]]
 version = "18.0.2"
 when = "2024-02-28"
@@ -3134,6 +3165,12 @@ when = "2024-06-19"
 user-id = 73222
 user-login = "wasmtime-publish"
 
+[[publisher.wast]]
+version = "212.0.0"
+when = "2024-06-27"
+user-id = 73222
+user-login = "wasmtime-publish"
+
 [[publisher.wat]]
 version = "1.201.0"
 when = "2024-02-27"
@@ -3194,6 +3231,12 @@ when = "2024-06-19"
 user-id = 73222
 user-login = "wasmtime-publish"
 
+[[publisher.wat]]
+version = "1.212.0"
+when = "2024-06-27"
+user-id = 73222
+user-login = "wasmtime-publish"
+
 [[publisher.wiggle]]
 version = "18.0.2"
 when = "2024-02-28"
@@ -3506,6 +3549,12 @@ when = "2024-05-30"
 user-id = 73222
 user-login = "wasmtime-publish"
 
+[[publisher.wit-bindgen]]
+version = "0.27.0"
+when = "2024-06-28"
+user-id = 73222
+user-login = "wasmtime-publish"
+
 [[publisher.wit-bindgen-core]]
 version = "0.20.0"
 when = "2024-02-29"
@@ -3530,6 +3579,12 @@ when = "2024-05-30"
 user-id = 73222
 user-login = "wasmtime-publish"
 
+[[publisher.wit-bindgen-core]]
+version = "0.27.0"
+when = "2024-06-28"
+user-id = 73222
+user-login = "wasmtime-publish"
+
 [[publisher.wit-bindgen-rt]]
 version = "0.22.0"
 when = "2024-03-11"
@@ -3548,6 +3603,12 @@ when = "2024-05-30"
 user-id = 73222
 user-login = "wasmtime-publish"
 
+[[publisher.wit-bindgen-rt]]
+version = "0.27.0"
+when = "2024-06-28"
+user-id = 73222
+user-login = "wasmtime-publish"
+
 [[publisher.wit-bindgen-rust]]
 version = "0.20.0"
 when = "2024-02-29"
@@ -3572,6 +3633,12 @@ when = "2024-05-30"
 user-id = 73222
 user-login = "wasmtime-publish"
 
+[[publisher.wit-bindgen-rust]]
+version = "0.27.0"
+when = "2024-06-28"
+user-id = 73222
+user-login = "wasmtime-publish"
+
 [[publisher.wit-bindgen-rust-macro]]
 version = "0.20.0"
 when = "2024-02-29"
@@ -3596,6 +3663,12 @@ when = "2024-05-30"
 user-id = 73222
 user-login = "wasmtime-publish"
 
+[[publisher.wit-bindgen-rust-macro]]
+version = "0.27.0"
+when = "2024-06-28"
+user-id = 73222
+user-login = "wasmtime-publish"
+
 [[publisher.wit-component]]
 version = "0.201.0"
 when = "2024-02-27"
@@ -3656,6 +3729,12 @@ when = "2024-06-19"
 user-id = 73222
 user-login = "wasmtime-publish"
 
+[[publisher.wit-component]]
+version = "0.212.0"
+when = "2024-06-27"
+user-id = 73222
+user-login = "wasmtime-publish"
+
 [[publisher.wit-parser]]
 version = "0.201.0"
 when = "2024-02-27"
@@ -3716,6 +3795,12 @@ when = "2024-06-19"
 user-id = 73222
 user-login = "wasmtime-publish"
 
+[[publisher.wit-parser]]
+version = "0.212.0"
+when = "2024-06-27"
+user-id = 73222
+user-login = "wasmtime-publish"
+
 [[publisher.witx]]
 version = "0.9.1"
 when = "2021-06-22"


Test patch:
diff --git a/cranelift/tests/bugpoint_test.clif b/cranelift/tests/bugpoint_test.clif
index 47bcb734a..757bdfc2b 100644
--- a/cranelift/tests/bugpoint_test.clif
+++ b/cranelift/tests/bugpoint_test.clif
@@ -300,12 +300,12 @@ block0(v0: i64, v1: i64, v2: i64):
     v241 -> v1
     v256 -> v1
     v262 -> v1
-    v3 = imul v0, v1
+    @0001 v3 = imul v0, v1
     v4 = imul v1, v2
     store aligned v4, v3
     v5 = load.i64 aligned v2+8
     store aligned v5, v3+8
-    v6 = stack_addr.i64 ss1
+    @0002 v6 = stack_addr.i64 ss1
     v7 = stack_addr.i64 ss2
     v8 = stack_addr.i64 ss3
     v9 = stack_addr.i64 ss4
@@ -366,7 +366,7 @@ block0(v0: i64, v1: i64, v2: i64):
     v64 = stack_addr.i64 ss59
     v65 = stack_addr.i64 ss60
     v66 = stack_addr.i64 ss61
-    v67 = stack_addr.i64 ss62
+    @0003 v67 = stack_addr.i64 ss62
     v68 = stack_addr.i64 ss63
     v69 = stack_addr.i64 ss64
     v70 = stack_addr.i64 ss65
diff --git a/crates/test-programs/src/bin/api_reactor.rs b/crates/test-programs/src/bin/api_reactor.rs
index 7695dc0aa..ae8ecf9f9 100644
--- a/crates/test-programs/src/bin/api_reactor.rs
+++ b/crates/test-programs/src/bin/api_reactor.rs
@@ -1,6 +1,7 @@
 wit_bindgen::generate!({
     world: "test-reactor",
     path: "../wasi/wit",
+    generate_all,
 });
 
 struct T;
diff --git a/crates/test-programs/src/lib.rs b/crates/test-programs/src/lib.rs
index dfa4541a8..2ed2dcb8f 100644
--- a/crates/test-programs/src/lib.rs
+++ b/crates/test-programs/src/lib.rs
@@ -3,7 +3,11 @@ pub mod nn;
 pub mod preview1;
 pub mod sockets;
 
-wit_bindgen::generate!("test-command" in "../wasi/wit");
+wit_bindgen::generate!({
+    world: "test-command",
+    path: "../wasi/wit",
+    generate_all,
+});
 
 pub mod proxy {
     wit_bindgen::generate!({
@@ -14,6 +18,15 @@ pub mod proxy {
         with: {
             "wasi:http/types@0.2.0": crate::wasi::http::types,
             "wasi:http/outgoing-handler@0.2.0": crate::wasi::http::outgoing_handler,
+            "wasi:random/random@0.2.0": crate::wasi::random::random,
+            "wasi:io/error@0.2.0": crate::wasi::io::error,
+            "wasi:io/poll@0.2.0": crate::wasi::io::poll,
+            "wasi:io/streams@0.2.0": crate::wasi::io::streams,
+            "wasi:cli/stdout@0.2.0": crate::wasi::cli::stdout,
+            "wasi:cli/stderr@0.2.0": crate::wasi::cli::stderr,
+            "wasi:cli/stdin@0.2.0": crate::wasi::cli::stdin,
+            "wasi:clocks/monotonic-clock@0.2.0": crate::wasi::clocks::monotonic_clock,
+            "wasi:clocks/wall-clock@0.2.0": crate::wasi::clocks::wall_clock,
         },
     });
 }
diff --git a/tests/all/component_model/macros.rs b/tests/all/component_model/macros.rs
index cf59adb48..d2112be87 100644
--- a/tests/all/component_model/macros.rs
+++ b/tests/all/component_model/macros.rs
@@ -4,7 +4,7 @@ use super::{make_echo_component, TypedFuncExt};
 use anyhow::Result;
 use component_macro_test::{add_variants, flags_test};
 use wasmtime::component::{Component, ComponentType, Lift, Linker, Lower};
-use wasmtime::Store;
+use wasmtime::{Engine, Store};
 
 #[test]
 fn record_derive() -> Result<()> {
@@ -337,7 +337,9 @@ fn enum_derive() -> Result<()> {
 
 #[test]
 fn flags() -> Result<()> {
-    let engine = super::engine();
+    let mut config = component_test_util::config();
+    config.wasm_component_model_more_flags(true);
+    let engine = Engine::new(&config)?;
     let mut store = Store::new(&engine, ());
 
     // Simple 8-bit flags
diff --git a/tests/all/i31ref.rs b/tests/all/i31ref.rs
new file mode 100644
index 000000000..de5308f24
--- /dev/null
+++ b/tests/all/i31ref.rs
@@ -0,0 +1,21 @@
+use wasmtime::*;
+
+#[test]
+fn always_pop_i31ref_lifo_roots() -> Result<()> {
+    let mut config = Config::new();
+    config.wasm_function_references(true);
+    config.wasm_gc(true);
+
+    let engine = Engine::new(&config)?;
+    let mut store = Store::new(&engine, ());
+
+    let anyref = {
+        let mut scope = RootScope::new(&mut store);
+        AnyRef::from_i31(&mut scope, I31::wrapping_u32(42))
+    };
+
+    // The anyref has left its rooting scope and been unrooted.
+    assert!(anyref.is_i31(&store).is_err());
+
+    Ok(())
+}
diff --git a/tests/all/main.rs b/tests/all/main.rs
index 85eb3ea84..b9f2c4b66 100644
--- a/tests/all/main.rs
+++ b/tests/all/main.rs
@@ -16,6 +16,7 @@ mod funcref;
 mod gc;
 mod globals;
 mod host_funcs;
+mod i31ref;
 mod iloop;
 mod import_calling_export;
 mod import_indexes;
diff --git a/tests/wast.rs b/tests/wast.rs
index 076a6ccb3..789ab1cb7 100644
--- a/tests/wast.rs
+++ b/tests/wast.rs
@@ -254,7 +254,9 @@ fn run_wast(wast: &Path, strategy: Strategy, pooling: bool) -> anyhow::Result<()
         cfg.cranelift_debug_verifier(true);
     }
 
-    cfg.wasm_component_model(feature_found(wast, "component-model"));
+    let component_model = feature_found(wast, "component-model");
+    cfg.wasm_component_model(component_model)
+        .wasm_component_model_more_flags(component_model);
 
     if feature_found(wast, "canonicalize-nan") && is_cranelift {
         cfg.cranelift_nan_canonicalization(true);