]> granicus.if.org Git - php/commitdiff
Don't skip RECV instuctions when function uses type hints
authorDmitry Stogov <dmitry@zend.com>
Fri, 1 Nov 2019 06:33:46 +0000 (09:33 +0300)
committerDmitry Stogov <dmitry@zend.com>
Fri, 1 Nov 2019 06:33:46 +0000 (09:33 +0300)
ext/opcache/jit/zend_jit.c

index da50c6d61d2409e910a3ef86cdedd3f5347ad066..de0569a88ae93aa02655cc238b9e56f058325e18 100644 (file)
@@ -2567,8 +2567,10 @@ static void ZEND_FASTCALL zend_runtime_jit(void)
                zend_jit_unprotect();
 
                /* restore original opcode handlers */
-               while (opline->opcode == ZEND_RECV || opline->opcode == ZEND_RECV_INIT) {
-                       opline++;
+               if (!(op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS)) {
+                       while (opline->opcode == ZEND_RECV || opline->opcode == ZEND_RECV_INIT) {
+                               opline++;
+                       }
                }
                opline->handler = ZEND_FUNC_INFO(op_array);
                ZEND_SET_FUNC_INFO(op_array, NULL);
@@ -2597,8 +2599,10 @@ void zend_jit_check_funcs(HashTable *function_table, zend_bool is_method) {
                }
                op_array = &func->op_array;
                opline = op_array->opcodes;
-               while (opline->opcode == ZEND_RECV || opline->opcode == ZEND_RECV_INIT) {
-                       opline++;
+               if (!(op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS)) {
+                       while (opline->opcode == ZEND_RECV || opline->opcode == ZEND_RECV_INIT) {
+                               opline++;
+                       }
                }
                if (opline->handler == zend_jit_profile_jit_handler) {
                        if (!RUN_TIME_CACHE(op_array)) {
@@ -2667,8 +2671,10 @@ static int zend_jit_setup_hot_counters(zend_op_array *op_array)
        }
        ZEND_SET_FUNC_INFO(op_array, (void*)jit_extension);
 
-       while (opline->opcode == ZEND_RECV || opline->opcode == ZEND_RECV_INIT) {
-               opline++;
+       if (!(op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS)) {
+               while (opline->opcode == ZEND_RECV || opline->opcode == ZEND_RECV_INIT) {
+                       opline++;
+               }
        }
 
        opline->handler = (const void*)zend_jit_func_counter_handler;
@@ -2713,8 +2719,10 @@ ZEND_EXT_API int zend_jit_op_array(zend_op_array *op_array, zend_script *script)
 
                /* Set run-time JIT handler */
                ZEND_ASSERT(zend_jit_runtime_jit_handler != NULL);
-               while (opline->opcode == ZEND_RECV || opline->opcode == ZEND_RECV_INIT) {
-                       opline++;
+               if (!(op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS)) {
+                       while (opline->opcode == ZEND_RECV || opline->opcode == ZEND_RECV_INIT) {
+                               opline++;
+                       }
                }
                ZEND_SET_FUNC_INFO(op_array, (void*)opline->handler);
                opline->handler = (const void*)zend_jit_runtime_jit_handler;
@@ -2725,8 +2733,10 @@ ZEND_EXT_API int zend_jit_op_array(zend_op_array *op_array, zend_script *script)
 
                ZEND_ASSERT(zend_jit_profile_jit_handler != NULL);
                if (op_array->function_name) {
-                       while (opline->opcode == ZEND_RECV || opline->opcode == ZEND_RECV_INIT) {
-                               opline++;
+                       if (!(op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS)) {
+                               while (opline->opcode == ZEND_RECV || opline->opcode == ZEND_RECV_INIT) {
+                                       opline++;
+                               }
                        }
                        ZEND_SET_FUNC_INFO(op_array, (void*)opline->handler);
                        opline->handler = (const void*)zend_jit_profile_jit_handler;