]> granicus.if.org Git - php/commitdiff
JIT internal functions with return type in debug mode
authorNikita Popov <nikita.ppv@gmail.com>
Mon, 27 Jul 2020 13:01:29 +0000 (15:01 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Mon, 27 Jul 2020 13:02:59 +0000 (15:02 +0200)
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.

Zend/tests/return_types/internal_functions001.phpt
ext/opcache/jit/zend_jit_x86.dasc

index ebed8515e56da7072efdb5898a50176bb2a1bf13..153e32ca6e6f267e352f5d6ae6fe0561b952154c 100644 (file)
@@ -6,6 +6,8 @@ if (!extension_loaded('zend-test')) die('skip zend-test extension not loaded');
 // Internal function return types are only checked in debug builds
 if (!PHP_DEBUG) die('skip requires debug build');
 ?>
+--INI--
+opcache.jit=0
 --FILE--
 <?php
 zend_test_array_return();
index 6ae7f325082f12efa4d650cc497e8a0f90da3791..f9690b3e7c92fcf7df770a44af6e3658275239e2 100644 (file)
@@ -8579,14 +8579,6 @@ static int zend_jit_do_fcall(dasm_State **Dst, const zend_op *opline, const zend
        } else if (func->type == ZEND_INTERNAL_FUNCTION) {
                ZEND_ASSERT(opline->opcode != ZEND_DO_UCALL);
                call_num_args = call_info->num_args;
-#if ZEND_DEBUG
-               if (func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {
-                       // TODO: Now most internal functions have type hints ???
-                       if (!trace) {
-                               goto fallback;
-                       }
-               }
-#endif
        } else {
                ZEND_UNREACHABLE();
        }
@@ -9112,20 +9104,6 @@ static int zend_jit_do_fcall(dasm_State **Dst, const zend_op *opline, const zend
        }
 
        return 1;
-#if ZEND_DEBUG
-fallback:
-       /* fallback to subroutine threading */
-       if (trace) {
-               return zend_jit_trace_handler(Dst, op_array, opline, /* may_throw */ 1, trace);
-       }
-       if (opline->opcode == ZEND_DO_FCALL ||
-           opline->opcode == ZEND_DO_UCALL ||
-           opline->opcode == ZEND_DO_FCALL_BY_NAME ){
-               return zend_jit_call(Dst, opline, next_block);
-       } else {
-               return zend_jit_handler(Dst, opline, /* may_throw */ 1);
-       }
-#endif
 }
 
 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)