Skip to content

Commit c362b4c

Browse files
remove now-unnecessary debug statements
1 parent 5a34c9a commit c362b4c

3 files changed

Lines changed: 4 additions & 36 deletions

File tree

src/instance.rs

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -444,14 +444,9 @@ impl Instance {
444444
// Apply element segments now that data segments have been validated
445445
if let Some(collected) = collected_elements {
446446
let table_rc = inst.table.as_ref().ok_or(Error::Link(UNKNOWN_TABLE))?.clone();
447-
#[cfg(feature = "wasm_debug")]
448-
{
449-
let sz = table_rc.borrow().size();
450-
crate::debug_println!("[elem] table size={} segments={} ", sz, collected.len());
451-
}
452447
for (offset, indices) in collected.iter() {
453-
for (j, idx_fn) in indices.iter().enumerate() {
454-
let func_idx = *idx_fn as usize;
448+
for (j, idx) in indices.iter().enumerate() {
449+
let func_idx = *idx as usize;
455450
let f = inst.functions[func_idx].clone();
456451
let (owner_id, owner_func_idx) = if let (Some(weak_owner), Some(owner_idx)) = (f.owner.clone(), f.owner_idx) {
457452
if let Some(owner_rc) = weak_owner.upgrade() { (owner_rc.id, owner_idx as u32) } else { (inst.id, func_idx as u32) }
@@ -895,10 +890,7 @@ impl Instance {
895890
0x01 | 0xbc | 0xbd | 0xbe | 0xbf => {} // nop and reinterprets (no-op on raw bits)
896891
0x02 => { // block
897892
let sig = Signature::read(&self.module.types, bytes, &mut pc)?;
898-
crate::debug_println!("[ctrl] enter block: pc_after_bt={} (0x{:x})", pc, pc);
899-
debug_assert!(self.module.block_ends.contains_key(&pc), "missing block end mapping for key {}", pc);
900893
let block_end = *self.module.block_ends.get(&pc).unwrap();
901-
crate::debug_println!("[ctrl] block_end={} (0x{:x})", block_end, block_end);
902894
control.push(ControlFrame {
903895
stack_len: stack.len() - sig.params.len(),
904896
dest_pc: block_end,
@@ -909,7 +901,6 @@ impl Instance {
909901
0x03 => { // loop
910902
let loop_op_pc = pc - 1;
911903
let sig = Signature::read(&self.module.types, bytes, &mut pc)?;
912-
crate::debug_println!("[ctrl] enter loop: loop_op_pc={} (0x{:x}) pc_after_bt={} (0x{:x})", loop_op_pc, loop_op_pc, pc, pc);
913904
control.push(ControlFrame {
914905
stack_len: stack.len() - sig.params.len(),
915906
dest_pc: loop_op_pc,
@@ -920,10 +911,7 @@ impl Instance {
920911
0x04 => { // if
921912
let sig = Signature::read(&self.module.types, bytes, &mut pc)?;
922913
let cond = pop_val!().as_u32();
923-
crate::debug_println!("[ctrl] enter if: pc_after_bt={} (0x{:x}) cond={}", pc, pc, cond);
924-
debug_assert!(self.module.if_jumps.contains_key(&pc), "missing if jump mapping for key {}", pc);
925914
let if_jump = self.module.if_jumps.get(&pc).unwrap();
926-
crate::debug_println!("[ctrl] else_offset={} (0x{:x}) end_offset={} (0x{:x})", if_jump.else_offset, if_jump.else_offset, if_jump.end_offset, if_jump.end_offset);
927915
control.push(ControlFrame {
928916
stack_len: stack.len() - sig.params.len(),
929917
dest_pc: if_jump.end_offset,
@@ -933,12 +921,9 @@ impl Instance {
933921
if cond == 0 { pc = if_jump.else_offset; }
934922
}
935923
0x05 => { // else
936-
crate::debug_println!("[ctrl] else: simulating br depth 0");
937924
let _ = Instance::branch(&mut pc, stack, control, 0);
938925
}
939926
0x0b => { // end
940-
crate::debug_println!("[ctrl] end: control_depth={}", control.len());
941-
942927
// Check if we're at a function boundary
943928
if let Some(&frame_idx) = ctrl_bases.last() {
944929
if frame_idx == control.len().saturating_sub(1) {

src/lib.rs

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,4 @@ pub use validator::Validator;
2424
pub use wasm_memory::WasmMemory;
2525

2626
// Utility types
27-
pub use error::Error;
28-
29-
// Debug macro that only prints when wasm_debug feature is enabled
30-
#[cfg(feature = "wasm_debug")]
31-
macro_rules! debug_println {
32-
($($arg:tt)*) => {
33-
eprintln!($($arg)*);
34-
};
35-
}
36-
37-
#[cfg(not(feature = "wasm_debug"))]
38-
macro_rules! debug_println {
39-
($($arg:tt)*) => {};
40-
}
41-
42-
pub(crate) use debug_println;
27+
pub use error::Error;

tests/spec_tests.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -375,8 +375,7 @@ fn run_test_file(json_path: &Path, wast_name: &str) -> Result<(u32, u32, u32), S
375375
Ok(()) => passes += 1,
376376
Err(e) if e.starts_with("message mismatch") => {
377377
message_mismatches += 1;
378-
// Always print details for debugging
379-
eprintln!("[{}:{}] {}", wast_name,
378+
eprintln!("[{}:{}] {}", wast_name,
380379
match cmd {
381380
TestCmd::Module { line, .. } => line,
382381
TestCmd::Register { line, .. } => line,
@@ -489,7 +488,6 @@ fn run_spec_tests() {
489488
total_passes += passes;
490489
total_mismatches += message_mismatches;
491490
total_failures += failures;
492-
// Always show stats for each test file
493491
println!(" {} passed, {} had error message mismatch, {} failed", passes, message_mismatches, failures);
494492
}
495493
Err(e) => {

0 commit comments

Comments
 (0)