Add config to profiling infos

This commit is contained in:
Fabian 2020-12-31 19:14:33 -06:00
parent 530aaba1ea
commit 59f0fdc1e8
3 changed files with 20 additions and 4 deletions

View file

@ -139,6 +139,11 @@ const print_stats = {
text += "do_many_cycles avg: " + (do_many_cycles_total / do_many_cycles_count || 0) + "\n";
text += "wasm memory size: " + (cpu.wasm_memory.buffer.byteLength >> 20) + "m\n";
text += "Config:\n";
text += "MAX_PAGES=" + cpu.wm.exports["get_config"](0) + "\n";
text += "JIT_ALWAYS_USE_LOOP_SAFETY=" + cpu.wm.exports["get_config"](1) + "\n";
text += "MAX_EXTRA_BASIC_BLOCKS=" + cpu.wm.exports["get_config"](2) + "\n";
return text;
},

View file

@ -1,7 +1,7 @@
use std::collections::{HashMap, HashSet};
use std::iter;
use jit::{BasicBlock, BasicBlockType};
use jit::{BasicBlock, BasicBlockType, MAX_EXTRA_BASIC_BLOCKS};
use profiler;
const ENTRY_NODE_ID: u32 = 0xffff_ffff;
@ -265,9 +265,7 @@ pub fn loopify(nodes: &Graph) -> Vec<WasmStructure> {
);
}
let max_extra_basic_blocks = 100;
if entries_to_group.len() * group.len() > max_extra_basic_blocks {
if entries_to_group.len() * group.len() > MAX_EXTRA_BASIC_BLOCKS {
let mut subgroup_edges: Graph = Graph::new();
for elem in group {
subgroup_edges.insert(

View file

@ -70,6 +70,8 @@ pub const JIT_ALWAYS_USE_LOOP_SAFETY: bool = true;
pub const JIT_THRESHOLD: u32 = 200 * 1000;
pub const MAX_EXTRA_BASIC_BLOCKS: usize = 100;
const MAX_INSTRUCTION_LENGTH: u32 = 16;
#[allow(non_upper_case_globals)]
@ -1956,3 +1958,14 @@ pub fn enter_basic_block(phys_eip: u32) {
panic!();
}
}
#[no_mangle]
#[cfg(feature = "profiler")]
pub fn get_config(index: u32) -> u32 {
match index {
0 => MAX_PAGES as u32,
1 => JIT_ALWAYS_USE_LOOP_SAFETY as u32,
2 => MAX_EXTRA_BASIC_BLOCKS as u32,
_ => 0,
}
}