Fixed formatting and removed print debug statement

This commit is contained in:
Syrus
2019-02-07 11:37:15 -08:00
parent dbea7b3abe
commit 14806cb604
2 changed files with 14 additions and 14 deletions

View File

@ -41,7 +41,11 @@ pub struct HandlerData {
} }
impl HandlerData { impl HandlerData {
pub fn new(trap_data: TrapSink, exec_buffer_ptr: *const c_void, exec_buffer_size: usize) -> Self { pub fn new(
trap_data: TrapSink,
exec_buffer_ptr: *const c_void,
exec_buffer_size: usize,
) -> Self {
Self { Self {
trap_data, trap_data,
exec_buffer_ptr, exec_buffer_ptr,
@ -89,12 +93,10 @@ pub fn call_protected<T>(handler_data: &HandlerData, f: impl FnOnce() -> T) -> R
TrapCode::IndirectCallToNull => RuntimeError::IndirectCallToNull { TrapCode::IndirectCallToNull => RuntimeError::IndirectCallToNull {
table: TableIndex::new(0), table: TableIndex::new(0),
}, },
TrapCode::HeapOutOfBounds => { TrapCode::HeapOutOfBounds => RuntimeError::OutOfBoundsAccess {
RuntimeError::OutOfBoundsAccess { memory: MemoryIndex::new(0),
memory: MemoryIndex::new(0), addr: 0,
addr: 0, },
}
}
TrapCode::TableOutOfBounds => RuntimeError::TableOutOfBounds { TrapCode::TableOutOfBounds => RuntimeError::TableOutOfBounds {
table: TableIndex::new(0), table: TableIndex::new(0),
}, },
@ -102,12 +104,10 @@ pub fn call_protected<T>(handler_data: &HandlerData, f: impl FnOnce() -> T) -> R
msg: "unknown trap".to_string(), msg: "unknown trap".to_string(),
}, },
}, },
Ok(SIGSEGV) | Ok(SIGBUS) => { Ok(SIGSEGV) | Ok(SIGBUS) => RuntimeError::OutOfBoundsAccess {
RuntimeError::OutOfBoundsAccess { memory: MemoryIndex::new(0),
memory: MemoryIndex::new(0), addr: 0,
addr: 0, },
}
}
Ok(SIGFPE) => RuntimeError::IllegalArithmeticOperation, Ok(SIGFPE) => RuntimeError::IllegalArithmeticOperation,
_ => unimplemented!(), _ => unimplemented!(),
} }

View File

@ -144,7 +144,7 @@ pub fn run_emscripten_instance(
instance.call("___emscripten_environ_constructor", &[])?; instance.call("___emscripten_environ_constructor", &[])?;
} }
println!("running emscripten instance"); // println!("running emscripten instance");
let main_func = instance.dyn_func("_main")?; let main_func = instance.dyn_func("_main")?;
let num_params = main_func.signature().params().len(); let num_params = main_func.signature().params().len();