]> granicus.if.org Git - php/commitdiff
Introduce and use ZEND_VM_INLINE_HANDLER() to avoid ZEND_RETURN exception
authorDmitry Stogov <dmitry@zend.com>
Thu, 4 Jul 2019 12:54:45 +0000 (15:54 +0300)
committerDmitry Stogov <dmitry@zend.com>
Thu, 4 Jul 2019 12:54:45 +0000 (15:54 +0300)
Zend/zend_vm_def.h
Zend/zend_vm_gen.php

index 9cad9c15da3875270259a2567ac316ac50d96e3e..3f1cbc37e15d9916e7f430e71d51904899011f5f 100644 (file)
@@ -4142,7 +4142,7 @@ ZEND_VM_COLD_CONST_HANDLER(124, ZEND_VERIFY_RETURN_TYPE, CONST|TMP|VAR|UNUSED|CV
        ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
 }
 
-ZEND_VM_HOT_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY)
+ZEND_VM_INLINE_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY)
 {
        USE_OPLINE
        zval *retval_ptr;
index 2e0ad0b2c1c948f165acd0edf06ffdc744d21995..324c4fc4478063937d3969e5f7e1d8589686691e 100755 (executable)
@@ -1069,7 +1069,7 @@ function skip_extra_spec_function($op1, $op2, $extra_spec) {
 }
 
 function is_hot_handler($hot, $op1, $op2, $extra_spec) {
-       if ($hot === 'HOT_') {
+       if ($hot === 'HOT_' || $hot === 'INLINE_') {
                return true;
        } else if ($hot === 'HOT_NOCONST_') {
                return ($op1 !== 'CONST');
@@ -1099,8 +1099,7 @@ function is_cold_handler($hot, $op1, $op2, $extra_spec) {
 }
 
 function is_inline_hybrid_handler($name, $hot, $op1, $op2, $extra_spec) {
-       return $name == "ZEND_RETURN";
-       //return $hot && is_hot_handler($hot, $op1, $op2, $extra_spec);
+       return ($hot === 'INLINE_');
 }
 
 // Generates opcode handler
@@ -2391,6 +2390,7 @@ function gen_vm($def, $skel) {
        foreach ($in as $line) {
                ++$lineno;
                if (strpos($line,"ZEND_VM_HANDLER(") === 0 ||
+                   strpos($line,"ZEND_VM_INLINE_HANDLER(") === 0 ||
                    strpos($line,"ZEND_VM_HOT_HANDLER(") === 0 ||
                    strpos($line,"ZEND_VM_HOT_NOCONST_HANDLER(") === 0 ||
                    strpos($line,"ZEND_VM_HOT_SEND_HANDLER(") === 0 ||
@@ -2400,7 +2400,7 @@ function gen_vm($def, $skel) {
                    strpos($line,"ZEND_VM_COLD_CONSTCONST_HANDLER(") === 0) {
                  // Parsing opcode handler's definition
                        if (preg_match(
-                                       "/^ZEND_VM_(HOT_|HOT_OBJ_|HOT_SEND_|HOT_NOCONST_|COLD_|COLD_CONST_|COLD_CONSTCONST_)?HANDLER\(\s*([0-9]+)\s*,\s*([A-Z_]+)\s*,\s*([A-Z_|]+)\s*,\s*([A-Z_|]+)\s*(,\s*([A-Z_|]+)\s*)?(,\s*SPEC\(([A-Z_|=,]+)\)\s*)?\)/",
+                                       "/^ZEND_VM_(HOT_|INLINE_|HOT_OBJ_|HOT_SEND_|HOT_NOCONST_|COLD_|COLD_CONST_|COLD_CONSTCONST_)?HANDLER\(\s*([0-9]+)\s*,\s*([A-Z_]+)\s*,\s*([A-Z_|]+)\s*,\s*([A-Z_|]+)\s*(,\s*([A-Z_|]+)\s*)?(,\s*SPEC\(([A-Z_|=,]+)\)\s*)?\)/",
                                        $line,
                                        $m) == 0) {
                                die("ERROR ($def:$lineno): Invalid ZEND_VM_HANDLER definition.\n");
@@ -2443,13 +2443,14 @@ function gen_vm($def, $skel) {
                        $helper = null;
                        $list[$lineno] = array("handler"=>$handler);
                } else if (strpos($line,"ZEND_VM_TYPE_SPEC_HANDLER(") === 0 ||
+                          strpos($line,"ZEND_VM_INLINE_TYPE_SPEC_HANDLER(") === 0 ||
                           strpos($line,"ZEND_VM_HOT_TYPE_SPEC_HANDLER(") === 0 ||
                           strpos($line,"ZEND_VM_HOT_NOCONST_TYPE_SPEC_HANDLER(") === 0 ||
                           strpos($line,"ZEND_VM_HOT_SEND_TYPE_SPEC_HANDLER(") === 0 ||
                           strpos($line,"ZEND_VM_HOT_OBJ_TYPE_SPEC_HANDLER(") === 0) {
                  // Parsing opcode handler's definition
                        if (preg_match(
-                                       "/^ZEND_VM_(HOT_|HOT_OBJ_|HOT_SEND_|HOT_NOCONST_)?TYPE_SPEC_HANDLER\(\s*([A-Z_]+)\s*,\s*((?:[^(,]|\([^()]*|(?R)*\))*),\s*([A-Za-z_]+)\s*,\s*([A-Z_|]+)\s*,\s*([A-Z_|]+)\s*(,\s*([A-Z_|]+)\s*)?(,\s*SPEC\(([A-Z_|=,]+)\)\s*)?\)/",
+                                       "/^ZEND_VM_(HOT_|INLINE_|HOT_OBJ_|HOT_SEND_|HOT_NOCONST_)?TYPE_SPEC_HANDLER\(\s*([A-Z_]+)\s*,\s*((?:[^(,]|\([^()]*|(?R)*\))*),\s*([A-Za-z_]+)\s*,\s*([A-Z_|]+)\s*,\s*([A-Z_|]+)\s*(,\s*([A-Z_|]+)\s*)?(,\s*SPEC\(([A-Z_|=,]+)\)\s*)?\)/",
                                        $line,
                                        $m) == 0) {
                                die("ERROR ($def:$lineno): Invalid ZEND_VM_TYPE_HANDLER_HANDLER definition.\n");