log the remaining unoptimised conditionals

This commit is contained in:
Fabian 2022-11-05 15:14:27 -06:00
parent e9a3fc5b00
commit 6989ba001a
3 changed files with 30 additions and 4 deletions

View file

@ -59,6 +59,9 @@ const print_stats = {
"LOOP_SAFETY",
"CONDITION_OPTIMISED",
"CONDITION_UNOPTIMISED",
"CONDITION_UNOPTIMISED_PF",
"CONDITION_UNOPTIMISED_UNHANDLED_L",
"CONDITION_UNOPTIMISED_UNHANDLED_LE",
"FAILED_PAGE_CHANGE",
"SAFE_READ_FAST",
"SAFE_READ_SLOW_PAGE_CROSSED",

View file

@ -2170,8 +2170,14 @@ pub fn gen_test_l(ctx: &mut JitContext, negate: ConditionNegate) {
gen_profiler_stat_increment(ctx.builder, profiler::stat::CONDITION_OPTIMISED);
gen_getsf(ctx, negate);
},
_ => {
&Instruction::Other | Instruction::Add { .. } => {
gen_profiler_stat_increment(ctx.builder, profiler::stat::CONDITION_UNOPTIMISED);
if let Instruction::Add { .. } = ctx.previous_instruction {
gen_profiler_stat_increment(
ctx.builder,
profiler::stat::CONDITION_UNOPTIMISED_UNHANDLED_L,
);
}
gen_getsf(ctx, ConditionNegate::False);
ctx.builder.eqz_i32();
gen_getof(ctx);
@ -2294,8 +2300,14 @@ pub fn gen_test_le(ctx: &mut JitContext, negate: ConditionNegate) {
ctx.builder.eqz_i32();
}
},
_ => {
Instruction::Other | Instruction::Add { .. } => {
gen_profiler_stat_increment(ctx.builder, profiler::stat::CONDITION_UNOPTIMISED);
if let Instruction::Add { .. } = ctx.previous_instruction {
gen_profiler_stat_increment(
ctx.builder,
profiler::stat::CONDITION_UNOPTIMISED_UNHANDLED_LE,
);
}
gen_test_l(ctx, ConditionNegate::False);
gen_getzf(ctx, ConditionNegate::False);
ctx.builder.or_i32();
@ -2473,8 +2485,16 @@ pub fn gen_condition_fn(ctx: &mut JitContext, condition: u8) {
0x9 => {
gen_getsf(ctx, ConditionNegate::True);
},
0xA => ctx.builder.call_fn0_ret("test_p"),
0xB => ctx.builder.call_fn0_ret("test_np"),
0xA => {
gen_profiler_stat_increment(ctx.builder, profiler::stat::CONDITION_UNOPTIMISED);
gen_profiler_stat_increment(ctx.builder, profiler::stat::CONDITION_UNOPTIMISED_PF);
ctx.builder.call_fn0_ret("test_p");
},
0xB => {
gen_profiler_stat_increment(ctx.builder, profiler::stat::CONDITION_UNOPTIMISED);
gen_profiler_stat_increment(ctx.builder, profiler::stat::CONDITION_UNOPTIMISED_PF);
ctx.builder.call_fn0_ret("test_np");
},
0xC => {
gen_test_l(ctx, ConditionNegate::False);
},

View file

@ -48,6 +48,9 @@ pub enum stat {
CONDITION_OPTIMISED,
CONDITION_UNOPTIMISED,
CONDITION_UNOPTIMISED_PF,
CONDITION_UNOPTIMISED_UNHANDLED_L,
CONDITION_UNOPTIMISED_UNHANDLED_LE,
FAILED_PAGE_CHANGE,