Skip to content

Commit 634707a

Browse files
committed
Rename CFP_HAS_JIT_RETURN to CFP_JIT_RETURN
Return the pointer directly instead of a bool, for consistency with CFP_ISEQ and CFP_PC. The pointer is truthy in if conditions so all callers work unchanged.
1 parent ee60b99 commit 634707a

5 files changed

Lines changed: 13 additions & 13 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_HAS_JIT_RETURN(cfp) && cfp->jit_return != leave_exception) {
1483+
if (CFP_JIT_RETURN(cfp) && 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_HAS_JIT_RETURN(cfp)) {
2855+
if (CFP_JIT_RETURN(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 (rb_zjit_enabled_p && CFP_HAS_JIT_RETURN(cfp)) {
3674+
if (CFP_JIT_RETURN(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_HAS_JIT_RETURN(cfp)) {
483+
else if (CFP_JIT_RETURN(cfp)) {
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: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,23 +69,23 @@ enum zjit_poison_values {
6969
ZJIT_JIT_RETURN_POISON = 2,
7070
};
7171

72-
// Check if cfp->jit_return holds a ZJIT lightweight frame (JITFrame pointer).
72+
// Return the JITFrame pointer from cfp->jit_return, or NULL if not present.
7373
// YJIT also uses jit_return (as a return address), so this must only return
74-
// true when ZJIT is enabled and has set jit_return to a JITFrame pointer.
75-
static inline bool
76-
CFP_HAS_JIT_RETURN(const rb_control_frame_t *cfp)
74+
// non-NULL when ZJIT is enabled and has set jit_return to a JITFrame pointer.
75+
static inline void *
76+
CFP_JIT_RETURN(const rb_control_frame_t *cfp)
7777
{
78-
if (!rb_zjit_enabled_p) return false;
78+
if (!rb_zjit_enabled_p) return NULL;
7979
#if USE_ZJIT
8080
RUBY_ASSERT_ALWAYS(cfp->jit_return != (void *)ZJIT_JIT_RETURN_POISON);
8181
#endif
82-
return !!cfp->jit_return;
82+
return cfp->jit_return;
8383
}
8484

8585
static inline const VALUE*
8686
CFP_PC(const rb_control_frame_t *cfp)
8787
{
88-
if (CFP_HAS_JIT_RETURN(cfp)) {
88+
if (CFP_JIT_RETURN(cfp)) {
8989
return ((const zjit_jit_frame_t *)cfp->jit_return)->pc;
9090
}
9191
return cfp->pc;
@@ -94,7 +94,7 @@ CFP_PC(const rb_control_frame_t *cfp)
9494
static inline const rb_iseq_t*
9595
CFP_ISEQ(const rb_control_frame_t *cfp)
9696
{
97-
if (CFP_HAS_JIT_RETURN(cfp)) {
97+
if (CFP_JIT_RETURN(cfp)) {
9898
return ((const zjit_jit_frame_t *)cfp->jit_return)->iseq;
9999
}
100100
return cfp->_iseq;

zjit/src/backend/lir.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2673,7 +2673,7 @@ impl Assembler
26732673
// Clear jit_return to fully materialize the frame. This must happen
26742674
// before any C call in the exit path (e.g. no_profile_send_recompile)
26752675
// because that C call can trigger GC, which walks the stack and would
2676-
// hit the CFP_HAS_JIT_RETURN assertion if jit_return still holds the
2676+
// hit the CFP_JIT_RETURN assertion if jit_return still holds the
26772677
// runtime_checks poison value (JIT_RETURN_POISON).
26782678
asm_comment!(asm, "clear cfp->jit_return");
26792679
asm.store(Opnd::mem(64, CFP, RUBY_OFFSET_CFP_JIT_RETURN), 0.into());

0 commit comments

Comments
 (0)