From 884b483fdfda51de95b4c9f094119560cc102c52 Mon Sep 17 00:00:00 2001 From: Ralf Anton Beier Date: Thu, 11 Jun 2026 07:30:40 +0200 Subject: [PATCH] fix(build): migrate to cranelift-isle 0.132.1 + wasmparser 0.251 so the tag builds (closes #198) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit v1.1.12's committed deps (cranelift-isle 0.132.1, wasmparser 0.251 — pulled by the wasmtime-45 bump) landed without the source migration, so the tag failed `cargo install` from a clean checkout (gale could not build the #196 fix). Earlier session builds only passed on a stale Cargo.lock. cranelift-isle 0.132.1: - build.rs CodegenOptions literal → add `..Default::default()` (grew fields) - types.isle → drop duplicate `(type u32 ...)` (prelude provides it now) - loom-shared/src/lib.rs → `extern crate alloc` (generated code emits alloc::) wasmparser 0.251: - import parsing → new `Imports` enum: handle `Single(usize, Import)`; the compact-import encodings (Compact1/Compact2) are NOT modeled, so parse_wasm returns Err on them and the caller keeps original bytes (fail-safe) - ComponentExternName: tuple `.0` → struct field `.name` - drop removed `cm_async_builtins` feature flag Verified: builds clean against committed deps; 395 lib + 85 integration pass; behavioral falcon gate unchanged (run-stabilization 0.023399856, run-position-hold 0.1317415 == original) — import-parse migration + #196 fail-safe both behaviorally correct. Bumps 1.1.12 -> 1.1.13. Closes #198. Trace: REQ-12 --- CHANGELOG.md | 32 +++++++++++++++++++++++++++++ Cargo.toml | 2 +- loom-core/src/component_executor.rs | 14 ++++++++++--- loom-core/src/lib.rs | 19 +++++++++++++++-- loom-shared/build.rs | 7 ++++++- loom-shared/isle/types.isle | 5 +++-- loom-shared/src/lib.rs | 4 ++++ 7 files changed, 74 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 23eb0c7..654be7d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,38 @@ All notable changes to LOOM will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.1.13] - 2026-06-11 + +**Build fix: the tag builds from a clean checkout again (#198).** v1.1.12's +committed dependency set (`cranelift-isle 0.132.1`, `wasmparser 0.251`, pulled +by the wasmtime-45 bump) had landed without the corresponding source migration, +so `cargo install` from the tag failed. Migrated the code to the new APIs. + +### Fixed + +- **cranelift-isle 0.132.1:** `loom-shared/build.rs` `CodegenOptions` literal now + uses `..Default::default()` (it grew fields); removed the duplicate `(type u32 + …)` from `types.isle` (the prelude now provides it); added `extern crate + alloc` so the generated code's `alloc::` paths resolve. +- **wasmparser 0.251:** migrated import parsing to the new `Imports` enum + (`Single(usize, Import)`; the compact-import encodings `Compact1`/`Compact2` + are *not* modeled — loom refuses to parse such a module rather than mis-record + its import table, falling back to original bytes); `ComponentExternName` is now + a struct (`.name`, was tuple `.0`); dropped the removed `cm_async_builtins` + feature flag. + +### Validation + +- Builds clean against the committed deps (isle codegen + workspace). 395 lib + + 85 integration tests pass. Behavioral falcon gate unchanged from v1.1.12 — + `run-stabilization` 0.023399856, `run-position-hold` 0.1317415 (matches the + original; the #196 fail-safe and the import-parse migration are both correct). + +### Note + +A committed `Cargo.lock` (or pinned deps) would prevent the from-tag +non-reproducibility this exposed; tracked separately. + ## [1.1.12] - 2026-06-10 **CRITICAL bug fix: stop silently miscompiling modules with indirect-call diff --git a/Cargo.toml b/Cargo.toml index 3640fef..54c0239 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ members = [ ] [workspace.package] -version = "1.1.12" +version = "1.1.13" authors = ["PulseEngine "] edition = "2024" license = "Apache-2.0" diff --git a/loom-core/src/component_executor.rs b/loom-core/src/component_executor.rs index 73f107b..12b7ca4 100644 --- a/loom-core/src/component_executor.rs +++ b/loom-core/src/component_executor.rs @@ -135,7 +135,9 @@ impl ComponentExecutor { for export in reader { let export = export.context("Failed to read component export")?; canonical_functions.push(CanonicalFunctionInfo { - name: export.name.0.to_string(), + // wasmparser 0.251: ComponentExternName is a struct + // with a `name` field (was a tuple `.0`) (#198). + name: export.name.name.to_string(), param_count: 0, return_count: 1, preserved: true, @@ -144,9 +146,15 @@ impl ComponentExecutor { } Payload::ImportSection(reader) => { for import in reader { - let import = import.context("Failed to read import")?; + // wasmparser 0.251 `Imports` enum (#198): only the + // classic `Single` import carries a name here; the + // compact encodings are skipped in this diagnostic view. + let name = match import.context("Failed to read import")? { + wasmparser::Imports::Single(_, import) => import.name, + _ => continue, + }; canonical_functions.push(CanonicalFunctionInfo { - name: format!("import_{}", import.name), + name: format!("import_{name}"), param_count: 0, return_count: 0, preserved: true, diff --git a/loom-core/src/lib.rs b/loom-core/src/lib.rs index 6ef1636..2cb2552 100644 --- a/loom-core/src/lib.rs +++ b/loom-core/src/lib.rs @@ -872,7 +872,8 @@ pub mod parse { let mut inflated = WasmFeatures::default().inflate(); inflated.cm_async = true; inflated.cm_async_stackful = true; - inflated.cm_async_builtins = true; + // `cm_async_builtins` was removed in wasmparser 0.251 (folded into the + // cm_async feature set); the two flags above cover it (#198). WasmFeatures::from_inflated(inflated) } @@ -922,7 +923,21 @@ pub mod parse { Payload::ImportSection(reader) => { // Capture imports (functions, globals, memories, tables) for import in reader.clone() { - let import = import?; + // wasmparser 0.251 yields `Imports` (an enum) per entry: + // `Single` is the classic (module, name, ty) import; + // `Compact1`/`Compact2` are the new compact-imports + // encoding. loom does not model compact imports, so it + // refuses to parse such a module rather than mis-record + // its import table — the caller then keeps the original + // bytes (fail-safe, #198). + let import = match import? { + wasmparser::Imports::Single(_, import) => import, + _ => { + return Err(anyhow!( + "compact import encoding (wasmparser 0.251) not supported" + )); + } + }; let kind = match import.ty { wasmparser::TypeRef::Func(type_idx) => ImportKind::Func(type_idx), wasmparser::TypeRef::Memory(mem_type) => ImportKind::Memory(Memory { diff --git a/loom-shared/build.rs b/loom-shared/build.rs index 12568a7..8380229 100644 --- a/loom-shared/build.rs +++ b/loom-shared/build.rs @@ -44,9 +44,14 @@ fn main() { } } - // Configure code generation options + // Configure code generation options. + // `..Default::default()` keeps this forward-compatible as cranelift-isle's + // CodegenOptions grows fields across versions (#198: 0.132.1 added + // emit_logging / match_arm_split_threshold / prefixes / … — an exhaustive + // literal broke the build from-tag). let options = isle::codegen::CodegenOptions { exclude_global_allow_pragmas: true, + ..Default::default() }; // Compile ISLE files to Rust code diff --git a/loom-shared/isle/types.isle b/loom-shared/isle/types.isle index 3a2976a..f5cf1c3 100644 --- a/loom-shared/isle/types.isle +++ b/loom-shared/isle/types.isle @@ -143,5 +143,6 @@ ;; This allows recursive structures without infinite size (type Value (primitive Value)) -;; Primitive types for local variable indices -(type u32 (primitive u32)) +;; `u32` is provided by the cranelift-isle prelude (since 0.132.1). We must NOT +;; redefine it here or ISLE errors with "Type with name 'u32' defined more than +;; once" (#198). Uses of `u32` below resolve to the prelude type. diff --git a/loom-shared/src/lib.rs b/loom-shared/src/lib.rs index 95662b4..b1d70bc 100644 --- a/loom-shared/src/lib.rs +++ b/loom-shared/src/lib.rs @@ -7,6 +7,10 @@ #![allow(dead_code)] #![allow(unused_variables)] +// cranelift-isle 0.132.1's generated code emits `alloc::` paths; bring the +// alloc crate into scope so the included ISLE output resolves them (#198). +extern crate alloc; + /// WebAssembly value types #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] pub enum ValueType {