Skip to content

Commit 6d97e7f

Browse files
committed
JIT internal functions with return type in debug mode
The return type check is just a debug assertion, it's okay if it is not performed in JIT mode. We already don't perform all the argument validation in that case. Just disable the one test that checks for this. This removes an annoying discrepancy between debug&release mode.
1 parent 52cebf6 commit 6d97e7f

File tree

2 files changed

+2
-22
lines changed

2 files changed

+2
-22
lines changed

Zend/tests/return_types/internal_functions001.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ if (!extension_loaded('zend-test')) die('skip zend-test extension not loaded');
66
// Internal function return types are only checked in debug builds
77
if (!PHP_DEBUG) die('skip requires debug build');
88
?>
9+
--INI--
10+
opcache.jit=0
911
--FILE--
1012
<?php
1113
zend_test_array_return();

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8579,14 +8579,6 @@ static int zend_jit_do_fcall(dasm_State **Dst, const zend_op *opline, const zend
85798579
} else if (func->type == ZEND_INTERNAL_FUNCTION) {
85808580
ZEND_ASSERT(opline->opcode != ZEND_DO_UCALL);
85818581
call_num_args = call_info->num_args;
8582-
#if ZEND_DEBUG
8583-
if (func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {
8584-
// TODO: Now most internal functions have type hints ???
8585-
if (!trace) {
8586-
goto fallback;
8587-
}
8588-
}
8589-
#endif
85908582
} else {
85918583
ZEND_UNREACHABLE();
85928584
}
@@ -9112,20 +9104,6 @@ static int zend_jit_do_fcall(dasm_State **Dst, const zend_op *opline, const zend
91129104
}
91139105

91149106
return 1;
9115-
#if ZEND_DEBUG
9116-
fallback:
9117-
/* fallback to subroutine threading */
9118-
if (trace) {
9119-
return zend_jit_trace_handler(Dst, op_array, opline, /* may_throw */ 1, trace);
9120-
}
9121-
if (opline->opcode == ZEND_DO_FCALL ||
9122-
opline->opcode == ZEND_DO_UCALL ||
9123-
opline->opcode == ZEND_DO_FCALL_BY_NAME ){
9124-
return zend_jit_call(Dst, opline, next_block);
9125-
} else {
9126-
return zend_jit_handler(Dst, opline, /* may_throw */ 1);
9127-
}
9128-
#endif
91299107
}
91309108

91319109
static int zend_jit_send_val(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, uint32_t op1_info, zend_jit_addr op1_addr)

0 commit comments

Comments
 (0)