Skip to content

Commit f176f2e

Browse files
cleanup(codegen): remove dead Codegen fields region_stack + bump_ptr (+ orphaned RegionInfo) (#250)
## Summary Per typed-wasm proposal 0001 Appendix B "Producer-readiness checklist" follow-up. Both fields in \`Codegen\` were marked \`#[allow(dead_code)]\` with the comment "reserved for future interpreter use" — declared, initialized in \`Codegen::new()\`, never read or written elsewhere in the crate. ## Removed - \`Codegen.region_stack: Vec<RegionInfo>\` 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 already \`#[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. ## Important disambiguation The wasm-side \`bump_ptr\` (a value stored in wasm linear memory at offset 0, real and load-bearing) is unrelated to the removed Rust \`Codegen.bump_ptr\` struct field of the same name. The struct field was a stale carry-over from an earlier design where the Codegen tracked it Rust-side; the actual implementation tracks it inside the emitted wasm. The naming collision is what kept the dead field camouflaged. ## Verification - \`cargo check -p ephapax-wasm\` — clean, no warnings - \`cargo test -p ephapax-wasm\` — 84/84 pass ## Carry-forward note This closes the dead-code item from typed-wasm proposal 0001 Appendix B. The access-sites codegen follow-up is filed at the ephapax counterpart to affinescript#462. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
1 parent 538957c commit f176f2e

1 file changed

Lines changed: 0 additions & 18 deletions

File tree

src/ephapax-wasm/src/lib.rs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -263,12 +263,6 @@ const CLOSURE_SIZE: u32 = 8; // 2 x i32
263263

264264
/// Code generator state.
265265
pub struct Codegen {
266-
/// Current bump pointer for allocations (reserved for future interpreter use)
267-
#[allow(dead_code)]
268-
bump_ptr: u32,
269-
/// Region stack for tracking active regions (reserved for future interpreter use)
270-
#[allow(dead_code)]
271-
region_stack: Vec<RegionInfo>,
272266
/// Generated WASM module
273267
module: WasmModule,
274268

@@ -387,16 +381,6 @@ struct LambdaInfo {
387381
body: Expr,
388382
}
389383

390-
#[derive(Debug, Clone)]
391-
struct RegionInfo {
392-
/// Region name
393-
#[allow(dead_code)]
394-
name: String,
395-
/// Start of region allocations
396-
#[allow(dead_code)]
397-
start_ptr: u32,
398-
}
399-
400384
impl Default for Codegen {
401385
fn default() -> Self {
402386
Self::new()
@@ -407,8 +391,6 @@ impl Codegen {
407391
/// Create a new code generator
408392
pub fn new() -> Self {
409393
Self {
410-
bump_ptr: REGION_HEADER_SIZE,
411-
region_stack: Vec::new(),
412394
module: WasmModule::new(),
413395
locals: LocalTracker::default(),
414396
data_entries: Vec::new(),

0 commit comments

Comments
 (0)