Implement --zjit-call-threshold

As a preparation for introducing a profiling layer, we need to be able
to raise the threshold to run a few cycles for profiling.
This commit is contained in:
Takashi Kokubun 2025-02-14 17:35:45 -08:00
parent 06d875b979
commit 53bee25068
Notes: git 2025-04-18 13:48:36 +00:00
4 changed files with 16 additions and 3 deletions

3
vm.c
View file

@ -437,9 +437,10 @@ jit_compile(rb_execution_context_t *ec)
// Increment the ISEQ's call counter and trigger JIT compilation if not compiled
#if USE_ZJIT
extern bool rb_zjit_enabled_p;
extern uint64_t rb_zjit_call_threshold;
if (body->jit_entry == NULL && rb_zjit_enabled_p) {
body->jit_entry_calls++;
if (body->jit_entry_calls == 1) {
if (body->jit_entry_calls == rb_zjit_call_threshold) {
extern void rb_zjit_compile_iseq(const rb_iseq_t *iseq, rb_execution_context_t *ec, bool jit_exception);
rb_zjit_compile_iseq(iseq, ec, false);
}