Skip to content

Commit e957b3a

Browse files
authored
YJIT: Stop checking rb_zjit_enabled_p on YJIT callbacks (ruby#16648)
1 parent bcd1479 commit e957b3a

4 files changed

Lines changed: 7 additions & 7 deletions

File tree

cont.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1480,7 +1480,7 @@ rb_yjit_cancel_jit_return(void *leave_exit, void *leave_exception)
14801480

14811481
const rb_control_frame_t *cfp = cont->ec->cfp;
14821482
while (!RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P(cont->ec, cfp)) {
1483-
if (CFP_JIT_RETURN(cfp) && cfp->jit_return != leave_exception) {
1483+
if (cfp->jit_return && cfp->jit_return != leave_exception) {
14841484
((rb_control_frame_t *)cfp)->jit_return = leave_exit;
14851485
}
14861486
cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);

vm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2852,7 +2852,7 @@ zjit_materialize_frames(rb_control_frame_t *cfp)
28522852
if (!rb_zjit_enabled_p) return;
28532853

28542854
while (true) {
2855-
if (CFP_JIT_RETURN(cfp)) {
2855+
if (CFP_ZJIT_FRAME(cfp)) {
28562856
const zjit_jit_frame_t *jit_frame = (const zjit_jit_frame_t *)cfp->jit_return;
28572857
cfp->pc = jit_frame->pc;
28582858
cfp->_iseq = (rb_iseq_t *)jit_frame->iseq;
@@ -3671,7 +3671,7 @@ rb_execution_context_update(rb_execution_context_t *ec)
36713671
while (cfp != limit_cfp) {
36723672
const VALUE *ep = cfp->ep;
36733673
cfp->self = rb_gc_location(cfp->self);
3674-
if (CFP_JIT_RETURN(cfp)) {
3674+
if (CFP_ZJIT_FRAME(cfp)) {
36753675
rb_zjit_jit_frame_update_references((zjit_jit_frame_t *)cfp->jit_return);
36763676
// block_code must always be relocated. For ISEQ frames, the JIT caller
36773677
// may have written it (gen_block_handler_specval) for passing blocks.

yjit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ rb_yjit_set_exception_return(rb_control_frame_t *cfp, void *leave_exit, void *le
480480
// If it's a FINISH frame, just normally exit with a non-Qundef value.
481481
cfp->jit_return = leave_exit;
482482
}
483-
else if (CFP_JIT_RETURN(cfp)) {
483+
else if (cfp->jit_return) {
484484
while (!VM_FRAME_FINISHED_P(cfp)) {
485485
if (cfp->jit_return == leave_exit) {
486486
// Unlike jit_exec(), leave_exit is not safe on a non-FINISH frame on

zjit.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ enum zjit_poison_values {
7575
// YJIT also uses jit_return (as a return address), so this must only return
7676
// non-NULL when ZJIT is enabled and has set jit_return to a JITFrame pointer.
7777
static inline void *
78-
CFP_JIT_RETURN(const rb_control_frame_t *cfp)
78+
CFP_ZJIT_FRAME(const rb_control_frame_t *cfp)
7979
{
8080
if (!rb_zjit_enabled_p) return NULL;
8181
#if USE_ZJIT
@@ -87,7 +87,7 @@ CFP_JIT_RETURN(const rb_control_frame_t *cfp)
8787
static inline const VALUE*
8888
CFP_PC(const rb_control_frame_t *cfp)
8989
{
90-
if (CFP_JIT_RETURN(cfp)) {
90+
if (CFP_ZJIT_FRAME(cfp)) {
9191
return ((const zjit_jit_frame_t *)cfp->jit_return)->pc;
9292
}
9393
return cfp->pc;
@@ -96,7 +96,7 @@ CFP_PC(const rb_control_frame_t *cfp)
9696
static inline const rb_iseq_t*
9797
CFP_ISEQ(const rb_control_frame_t *cfp)
9898
{
99-
if (CFP_JIT_RETURN(cfp)) {
99+
if (CFP_ZJIT_FRAME(cfp)) {
100100
return ((const zjit_jit_frame_t *)cfp->jit_return)->iseq;
101101
}
102102
return cfp->_iseq;

0 commit comments

Comments
 (0)