From dc6d39103d2101fe8b1644b55d51fe84587b966f Mon Sep 17 00:00:00 2001 From: hyperpolymath <6759885+hyperpolymath@users.noreply.github.com> Date: Sat, 30 May 2026 17:31:45 +0100 Subject: [PATCH] cleanup(codegen): remove dead Codegen fields region_stack + bump_ptr (+ orphaned RegionInfo) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per typed-wasm proposal 0001 Appendix B "Producer-readiness checklist" follow-up. Both fields were marked `#[allow(dead_code)]` with comment "reserved for future interpreter use" — declared, initialized in `Codegen::new()`, never read or written elsewhere in the crate. Removed: - `Codegen.region_stack: Vec` field + its constructor init - `Codegen.bump_ptr: u32` field + its constructor init (adjacent dead code in the same struct, same "reserved" comment) - `RegionInfo` struct (only consumer was region_stack; orphaned after removal — its own fields were `#[allow(dead_code)]`) Retained: - `REGION_HEADER_SIZE` constant — `pub`, conceptually describes the linear-memory layout (used by comments at lines 28 + 76 + within the wasm-side memory-layout code at ~1506-1531 that manipulates the wasm-memory "bump_ptr" cell at offset 0). Removing the Rust- side dead struct field does not affect the wasm-side memory layout. The wasm-side `bump_ptr` (a value stored in wasm linear memory at offset 0) is unrelated to the removed Rust struct field of the same name; that one is real and continues to function. Verified: `cargo check -p ephapax-wasm` clean; `cargo test -p ephapax-wasm` 84/84 pass. --- src/ephapax-wasm/src/lib.rs | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/src/ephapax-wasm/src/lib.rs b/src/ephapax-wasm/src/lib.rs index 139feac..6590a85 100644 --- a/src/ephapax-wasm/src/lib.rs +++ b/src/ephapax-wasm/src/lib.rs @@ -263,12 +263,6 @@ const CLOSURE_SIZE: u32 = 8; // 2 x i32 /// Code generator state. pub struct Codegen { - /// Current bump pointer for allocations (reserved for future interpreter use) - #[allow(dead_code)] - bump_ptr: u32, - /// Region stack for tracking active regions (reserved for future interpreter use) - #[allow(dead_code)] - region_stack: Vec, /// Generated WASM module module: WasmModule, @@ -387,16 +381,6 @@ struct LambdaInfo { body: Expr, } -#[derive(Debug, Clone)] -struct RegionInfo { - /// Region name - #[allow(dead_code)] - name: String, - /// Start of region allocations - #[allow(dead_code)] - start_ptr: u32, -} - impl Default for Codegen { fn default() -> Self { Self::new() @@ -407,8 +391,6 @@ impl Codegen { /// Create a new code generator pub fn new() -> Self { Self { - bump_ptr: REGION_HEADER_SIZE, - region_stack: Vec::new(), module: WasmModule::new(), locals: LocalTracker::default(), data_entries: Vec::new(),