mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 08:33:58 +02:00
MicroJIT: compile after ten calls
This commit is contained in:
parent
ef9eb83cbe
commit
8bda11f690
4 changed files with 78 additions and 50 deletions
8
mjit.h
8
mjit.h
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include "debug_counter.h"
|
||||
#include "ruby.h"
|
||||
#include "ujit_compile.h"
|
||||
|
||||
// Special address values of a function generated from the
|
||||
// corresponding iseq by MJIT:
|
||||
|
@ -142,7 +143,7 @@ mjit_exec(rb_execution_context_t *ec)
|
|||
const rb_iseq_t *iseq;
|
||||
struct rb_iseq_constant_body *body;
|
||||
|
||||
if (!mjit_call_p)
|
||||
if (!mjit_call_p && !rb_ujit_enabled_p())
|
||||
return Qundef;
|
||||
RB_DEBUG_COUNTER_INC(mjit_exec);
|
||||
|
||||
|
@ -150,6 +151,11 @@ mjit_exec(rb_execution_context_t *ec)
|
|||
body = iseq->body;
|
||||
body->total_calls++;
|
||||
|
||||
const int ujit_call_threashold = 10;
|
||||
if (body->total_calls == ujit_call_threashold) {
|
||||
rb_ujit_compile_iseq(iseq);
|
||||
}
|
||||
|
||||
mjit_func_t func = body->jit_func;
|
||||
if (UNLIKELY((uintptr_t)func <= LAST_JIT_ISEQ_FUNC)) {
|
||||
# ifdef MJIT_HEADER
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue