зеркало из https://github.com/github/ruby.git
Stop incrementing `jit_entry_calls` once threshold is hit
Otherwise the ISeq page will constantly be written into preventing it from being shared.
This commit is contained in:
Родитель
24bcd49473
Коммит
cedb333063
22
vm.c
22
vm.c
|
@ -381,19 +381,16 @@ static VALUE vm_invoke_proc(rb_execution_context_t *ec, rb_proc_t *proc, VALUE s
|
||||||
static inline rb_jit_func_t
|
static inline rb_jit_func_t
|
||||||
jit_compile(rb_execution_context_t *ec)
|
jit_compile(rb_execution_context_t *ec)
|
||||||
{
|
{
|
||||||
// Increment the ISEQ's call counter
|
|
||||||
const rb_iseq_t *iseq = ec->cfp->iseq;
|
const rb_iseq_t *iseq = ec->cfp->iseq;
|
||||||
struct rb_iseq_constant_body *body = ISEQ_BODY(iseq);
|
struct rb_iseq_constant_body *body = ISEQ_BODY(iseq);
|
||||||
bool yjit_enabled = rb_yjit_compile_new_iseqs();
|
bool yjit_enabled = rb_yjit_compile_new_iseqs();
|
||||||
if (yjit_enabled || rb_rjit_call_p) {
|
if (!(yjit_enabled || rb_rjit_call_p)) {
|
||||||
body->jit_entry_calls++;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Trigger JIT compilation if not compiled
|
// Increment the ISEQ's call counter and trigger JIT compilation if not compiled
|
||||||
if (body->jit_entry == NULL) {
|
if (body->jit_entry == NULL) {
|
||||||
|
body->jit_entry_calls++;
|
||||||
if (yjit_enabled) {
|
if (yjit_enabled) {
|
||||||
if (rb_yjit_threshold_hit(iseq, body->jit_entry_calls)) {
|
if (rb_yjit_threshold_hit(iseq, body->jit_entry_calls)) {
|
||||||
rb_yjit_compile_iseq(iseq, ec, false);
|
rb_yjit_compile_iseq(iseq, ec, false);
|
||||||
|
@ -436,20 +433,19 @@ jit_exec(rb_execution_context_t *ec)
|
||||||
static inline rb_jit_func_t
|
static inline rb_jit_func_t
|
||||||
jit_compile_exception(rb_execution_context_t *ec)
|
jit_compile_exception(rb_execution_context_t *ec)
|
||||||
{
|
{
|
||||||
// Increment the ISEQ's call counter
|
|
||||||
const rb_iseq_t *iseq = ec->cfp->iseq;
|
const rb_iseq_t *iseq = ec->cfp->iseq;
|
||||||
struct rb_iseq_constant_body *body = ISEQ_BODY(iseq);
|
struct rb_iseq_constant_body *body = ISEQ_BODY(iseq);
|
||||||
if (rb_yjit_compile_new_iseqs()) {
|
if (!rb_yjit_compile_new_iseqs()) {
|
||||||
body->jit_exception_calls++;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Trigger JIT compilation if not compiled
|
// Increment the ISEQ's call counter and trigger JIT compilation if not compiled
|
||||||
if (body->jit_exception == NULL && rb_yjit_threshold_hit(iseq, body->jit_exception_calls)) {
|
if (body->jit_exception == NULL) {
|
||||||
|
body->jit_exception_calls++;
|
||||||
|
if (rb_yjit_threshold_hit(iseq, body->jit_exception_calls)) {
|
||||||
rb_yjit_compile_iseq(iseq, ec, true);
|
rb_yjit_compile_iseq(iseq, ec, true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return body->jit_exception;
|
return body->jit_exception;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче