Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[jiterp] Adjust jiterpreter thresholds to exercise it more on CI #82476

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 25 additions & 0 deletions src/mono/mono/mini/interp/jiterpreter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1281,6 +1281,31 @@ mono_jiterp_get_member_offset (int member) {
}
}

#define JITERP_NUMBER_MODE_U32 0
#define JITERP_NUMBER_MODE_I32 1
#define JITERP_NUMBER_MODE_F32 2
#define JITERP_NUMBER_MODE_F64 3

EMSCRIPTEN_KEEPALIVE void
mono_jiterp_write_number_unaligned (void *dest, double value, int mode) {
switch (mode) {
case JITERP_NUMBER_MODE_U32:
*((uint32_t *)dest) = (uint32_t)value;
return;
case JITERP_NUMBER_MODE_I32:
*((int32_t *)dest) = (int32_t)value;
return;
case JITERP_NUMBER_MODE_F32:
*((float *)dest) = (float)value;
return;
case JITERP_NUMBER_MODE_F64:
*((double *)dest) = value;
return;
default:
g_assert_not_reached();
}
}

// HACK: fix C4206
EMSCRIPTEN_KEEPALIVE
#endif // HOST_BROWSER
Expand Down
4 changes: 2 additions & 2 deletions src/mono/mono/utils/options-def.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ DEFINE_BOOL(jiterpreter_call_resume_enabled, "jiterpreter-call-resume-enabled",
// stats for options like estimateHeat, but raises overhead.
DEFINE_BOOL(jiterpreter_disable_heuristic, "jiterpreter-disable-heuristic", FALSE, "Always insert trace entry points for more accurate statistics")
// Automatically prints stats at app exit or when jiterpreter_dump_stats is called
DEFINE_BOOL(jiterpreter_stats_enabled, "jiterpreter-stats-enabled", FALSE, "Automatically print jiterpreter statistics")
DEFINE_BOOL(jiterpreter_stats_enabled, "jiterpreter-stats-enabled", TRUE, "Automatically print jiterpreter statistics")
// Continue counting hits for traces that fail to compile and use it to estimate
// the relative importance of the opcode that caused them to abort
DEFINE_BOOL(jiterpreter_estimate_heat, "jiterpreter-estimate-heat", FALSE, "Maintain accurate hit count for all trace entry points")
Expand All @@ -118,7 +118,7 @@ DEFINE_INT(jiterpreter_minimum_trace_length, "jiterpreter-minimum-trace-length",
// ensure that we don't create trace entry points too close together
DEFINE_INT(jiterpreter_minimum_distance_between_traces, "jiterpreter-minimum-distance-between-traces", 4, "Don't insert entry points closer together than this")
// once a trace entry point is inserted, we only actually JIT code for it once it's been hit this many times
DEFINE_INT(jiterpreter_minimum_trace_hit_count, "jiterpreter-minimum-trace-hit-count", 5000, "JIT trace entry points once they are hit this many times")
DEFINE_INT(jiterpreter_minimum_trace_hit_count, "jiterpreter-minimum-trace-hit-count", 10, "JIT trace entry points once they are hit this many times")
// After a do_jit_call call site is hit this many times, we will queue it to be jitted
DEFINE_INT(jiterpreter_jit_call_trampoline_hit_count, "jiterpreter-jit-call-hit-count", 1000, "Queue specialized do_jit_call trampoline for JIT after this many hits")
// After a do_jit_call call site is hit this many times without being jitted, we will flush the JIT queue
Expand Down
2 changes: 2 additions & 0 deletions src/mono/wasm/runtime/cwraps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ const fn_signatures: SigLine[] = [
[false, "mono_jiterp_encode_leb52", "number", ["number", "number", "number"]],
[false, "mono_jiterp_encode_leb64_ref", "number", ["number", "number", "number"]],
[false, "mono_jiterp_encode_leb_signed_boundary", "number", ["number", "number", "number"]],
[false, "mono_jiterp_write_number_unaligned", "void", ["number", "number", "number"]],
[true, "mono_jiterp_type_is_byref", "number", ["number"]],
[true, "mono_jiterp_get_size_of_stackval", "number", []],
[true, "mono_jiterp_parse_option", "number", ["string"]],
Expand Down Expand Up @@ -234,6 +235,7 @@ export interface t_Cwraps {
mono_jiterp_debug_count(): number;
mono_jiterp_get_trace_hit_count(traceIndex: number): number;
mono_jiterp_get_polling_required_address(): Int32Ptr;
mono_jiterp_write_number_unaligned(destination: VoidPtr, value: number, mode: number): void;
}

const wrapped_c_functions: t_Cwraps = <any>{};
Expand Down