diff options
author | Dmitry Stogov <dmitry@zend.com> | 2018-02-15 13:48:04 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2018-02-15 13:48:04 +0300 |
commit | 23da83c8ca0165fb212897c765550399161abecc (patch) | |
tree | f0f2edc47ae1eb79d553937e2d66e586bcaffcb3 /Zend/zend_vm_gen.php | |
parent | 8543f566cfa5594c1ee19aab0b66d4f1980ab259 (diff) | |
download | php-git-23da83c8ca0165fb212897c765550399161abecc.tar.gz |
Avoid inlining of rarely used handlers
Diffstat (limited to 'Zend/zend_vm_gen.php')
-rw-r--r-- | Zend/zend_vm_gen.php | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Zend/zend_vm_gen.php b/Zend/zend_vm_gen.php index 588af86aea..fee42a84bb 100644 --- a/Zend/zend_vm_gen.php +++ b/Zend/zend_vm_gen.php @@ -1013,11 +1013,13 @@ function skip_extra_spec_function($op1, $op2, $extra_spec) { return false; } -function is_hot_handler($hot, $op1, $op2) { +function is_hot_handler($hot, $op1, $op2, $extra_spec) { if ($hot === 'HOT_') { return true; } else if ($hot === 'HOT_OBJ_') { return (($op1 === 'UNUSED') || ($op1 === 'CV')) && ($op2 === 'CONST'); + } else if ($hot === 'HOT_SEND_') { + return !empty($extra_spec["QUICK_ARG"]); } else { return false; } @@ -1044,7 +1046,7 @@ function gen_handler($f, $spec, $kind, $name, $op1, $op2, $use, $code, $lineno, out($f,"\t\t\t\tHYBRID_BREAK();\n"); return; case ZEND_VM_KIND_CALL: - if ($opcode["hot"] && ZEND_VM_KIND == ZEND_VM_KIND_HYBRID && is_hot_handler($opcode["hot"], $op1, $op2)) { + if ($opcode["hot"] && ZEND_VM_KIND == ZEND_VM_KIND_HYBRID && is_hot_handler($opcode["hot"], $op1, $op2, $extra_spec)) { out($f,"static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL {$spec_name}_HANDLER(ZEND_OPCODE_HANDLER_ARGS)\n"); } else { out($f,"static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL {$spec_name}_HANDLER(ZEND_OPCODE_HANDLER_ARGS)\n"); @@ -2146,10 +2148,11 @@ function gen_vm($def, $skel) { ++$lineno; if (strpos($line,"ZEND_VM_HANDLER(") === 0 || strpos($line,"ZEND_VM_HOT_HANDLER(") === 0 || + strpos($line,"ZEND_VM_HOT_SEND_HANDLER(") === 0 || strpos($line,"ZEND_VM_HOT_OBJ_HANDLER(") === 0) { // Parsing opcode handler's definition if (preg_match( - "/^ZEND_VM_(HOT_|HOT_OBJ_)?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_|HOT_OBJ_|HOT_SEND_)?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"); @@ -2193,10 +2196,11 @@ function gen_vm($def, $skel) { $list[$lineno] = array("handler"=>$handler); } else if (strpos($line,"ZEND_VM_TYPE_SPEC_HANDLER(") === 0 || strpos($line,"ZEND_VM_HOT_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_)?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_|HOT_OBJ_|HOT_SEND_)?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"); |