Remove calls to dbg_trace from release builds

This commit is contained in:
Fabian 2020-12-31 19:14:31 -06:00
parent 3c15b72f7c
commit 596ac268b8
3 changed files with 16 additions and 5 deletions

View file

@ -113,9 +113,6 @@ function V86Starter(options)
"logop": function(eip, op) { return cpu.debug.logop(eip, op); },
"microtick": v86.microtick,
"get_rand_int": function() { return v86util.get_rand_int(); },
"dbg_trace": function() {
dbg_trace();
},
"pic_acknowledge": function() { cpu.pic_acknowledge(); },
@ -164,6 +161,9 @@ function V86Starter(options)
const str = v86util.read_sized_string_from_mem(wasm_memory, offset, len);
console.error(str);
},
"dbg_trace_from_wasm": function() {
dbg_trace();
},
"codegen_finalize": (wasm_table_index, start, end, first_opcode, state_flags) => {
cpu.codegen_finalize(wasm_table_index, start, end, first_opcode, state_flags);

View file

@ -5,8 +5,6 @@ extern "C" {
fn cpu_exception_hook(interrupt: i32) -> bool;
#[no_mangle]
fn do_task_switch(selector: i32, has_error_code: bool, error_code: i32);
#[no_mangle]
pub fn dbg_trace();
//#[no_mangle]
//fn logop(addr: i32, op: i32);
#[no_mangle]
@ -35,6 +33,7 @@ use paging::OrPageFault;
use profiler;
use profiler::stat::*;
use state_flags::CachedStateFlags;
pub use util::dbg_trace;
/// The offset for our generated functions in the wasm table. Every index less than this is
/// reserved for rustc's indirect functions

View file

@ -81,6 +81,10 @@ extern "C" {
pub fn abort();
}
extern "C" {
pub fn dbg_trace_from_wasm();
}
#[cfg(target_arch = "wasm32")]
use std::string::ToString;
@ -101,3 +105,11 @@ pub fn console_log_to_js_console<T: ToString>(s: T) {
console_log_from_wasm(s.as_bytes().as_ptr(), len);
}
}
pub fn dbg_trace() {
if DEBUG {
unsafe {
dbg_trace_from_wasm();
}
}
}