mirror of
https://github.com/php/php-src.git
synced 2024-12-26 18:29:37 +08:00
Merge branch 'PHP-7.4'
* PHP-7.4: Remove duplicated code for (PRE|POST)_DEC_(OBJ|STATIC_PROP) opcodes
This commit is contained in:
commit
ee9f03fb4c
@ -1156,7 +1156,7 @@ ZEND_VM_HANDLER(26, ZEND_ASSIGN_OP, VAR|CV, CONST|TMPVAR|CV, OP)
|
||||
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
|
||||
}
|
||||
|
||||
ZEND_VM_HELPER(zend_pre_incdec_property_helper, VAR|UNUSED|CV, CONST|TMPVAR|CV)
|
||||
ZEND_VM_HANDLER(132, ZEND_PRE_INC_OBJ, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CACHE_SLOT)
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op1, free_op2;
|
||||
@ -1228,17 +1228,12 @@ ZEND_VM_C_LABEL(pre_incdec_object):
|
||||
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
|
||||
}
|
||||
|
||||
ZEND_VM_HANDLER(132, ZEND_PRE_INC_OBJ, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CACHE_SLOT)
|
||||
{
|
||||
ZEND_VM_DISPATCH_TO_HELPER(zend_pre_incdec_property_helper);
|
||||
}
|
||||
|
||||
ZEND_VM_HANDLER(133, ZEND_PRE_DEC_OBJ, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CACHE_SLOT)
|
||||
{
|
||||
ZEND_VM_DISPATCH_TO_HELPER(zend_pre_incdec_property_helper);
|
||||
ZEND_VM_DISPATCH_TO_HANDLER(ZEND_PRE_INC_OBJ);
|
||||
}
|
||||
|
||||
ZEND_VM_HELPER(zend_post_incdec_property_helper, VAR|UNUSED|CV, CONST|TMPVAR|CV)
|
||||
ZEND_VM_HANDLER(134, ZEND_POST_INC_OBJ, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CACHE_SLOT)
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op1, free_op2;
|
||||
@ -1309,18 +1304,13 @@ ZEND_VM_C_LABEL(post_incdec_object):
|
||||
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
|
||||
}
|
||||
|
||||
ZEND_VM_HANDLER(134, ZEND_POST_INC_OBJ, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CACHE_SLOT)
|
||||
{
|
||||
ZEND_VM_DISPATCH_TO_HELPER(zend_post_incdec_property_helper);
|
||||
}
|
||||
|
||||
ZEND_VM_HANDLER(135, ZEND_POST_DEC_OBJ, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CACHE_SLOT)
|
||||
{
|
||||
ZEND_VM_DISPATCH_TO_HELPER(zend_post_incdec_property_helper);
|
||||
ZEND_VM_DISPATCH_TO_HANDLER(ZEND_POST_INC_OBJ);
|
||||
}
|
||||
|
||||
/* No specialization for op_types (CONST|TMPVAR|CV, UNUSED|CONST|VAR) */
|
||||
ZEND_VM_HELPER(zend_pre_incdec_static_property_helper, ANY, ANY)
|
||||
ZEND_VM_HANDLER(38, ZEND_PRE_INC_STATIC_PROP, ANY, ANY, CACHE_SLOT)
|
||||
{
|
||||
USE_OPLINE
|
||||
zval *prop;
|
||||
@ -1338,20 +1328,14 @@ ZEND_VM_HELPER(zend_pre_incdec_static_property_helper, ANY, ANY)
|
||||
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
|
||||
}
|
||||
|
||||
/* No specialization for op_types (CONST|TMPVAR|CV, UNUSED|CONST|VAR) */
|
||||
ZEND_VM_HANDLER(38, ZEND_PRE_INC_STATIC_PROP, ANY, ANY, CACHE_SLOT)
|
||||
{
|
||||
ZEND_VM_DISPATCH_TO_HELPER(zend_pre_incdec_static_property_helper);
|
||||
}
|
||||
|
||||
/* No specialization for op_types (CONST|TMPVAR|CV, UNUSED|CONST|VAR) */
|
||||
ZEND_VM_HANDLER(39, ZEND_PRE_DEC_STATIC_PROP, ANY, ANY, CACHE_SLOT)
|
||||
{
|
||||
ZEND_VM_DISPATCH_TO_HELPER(zend_pre_incdec_static_property_helper);
|
||||
ZEND_VM_DISPATCH_TO_HANDLER(ZEND_PRE_INC_STATIC_PROP);
|
||||
}
|
||||
|
||||
/* No specialization for op_types (CONST|TMPVAR|CV, UNUSED|CONST|VAR) */
|
||||
ZEND_VM_HELPER(zend_post_incdec_static_property_helper, ANY, ANY)
|
||||
ZEND_VM_HANDLER(40, ZEND_POST_INC_STATIC_PROP, ANY, ANY, CACHE_SLOT)
|
||||
{
|
||||
USE_OPLINE
|
||||
zval *prop;
|
||||
@ -1369,16 +1353,10 @@ ZEND_VM_HELPER(zend_post_incdec_static_property_helper, ANY, ANY)
|
||||
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
|
||||
}
|
||||
|
||||
/* No specialization for op_types (CONST|TMPVAR|CV, UNUSED|CONST|VAR) */
|
||||
ZEND_VM_HANDLER(40, ZEND_POST_INC_STATIC_PROP, ANY, ANY, CACHE_SLOT)
|
||||
{
|
||||
ZEND_VM_DISPATCH_TO_HELPER(zend_post_incdec_static_property_helper);
|
||||
}
|
||||
|
||||
/* No specialization for op_types (CONST|TMPVAR|CV, UNUSED|CONST|VAR) */
|
||||
ZEND_VM_HANDLER(41, ZEND_POST_DEC_STATIC_PROP, ANY, ANY, CACHE_SLOT)
|
||||
{
|
||||
ZEND_VM_DISPATCH_TO_HELPER(zend_post_incdec_static_property_helper);
|
||||
ZEND_VM_DISPATCH_TO_HANDLER(ZEND_POST_INC_STATIC_PROP);
|
||||
}
|
||||
|
||||
ZEND_VM_HANDLER(34, ZEND_PRE_INC, VAR|CV, ANY, SPEC(RETVAL))
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1061,6 +1061,10 @@ function is_inline_hybrid_handler($name, $hot, $op1, $op2, $extra_spec) {
|
||||
function gen_handler($f, $spec, $kind, $name, $op1, $op2, $use, $code, $lineno, $opcode, $extra_spec = null, &$switch_labels = array()) {
|
||||
global $definition_file, $prefix, $opnames, $gen_order;
|
||||
|
||||
if (isset($opcode['alias']) && ($spec || $kind != ZEND_VM_KIND_SWITCH)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($spec && skip_extra_spec_function($op1, $op2, $extra_spec)) {
|
||||
return;
|
||||
}
|
||||
@ -1204,7 +1208,7 @@ function gen_null_label($f, $kind, $prolog) {
|
||||
|
||||
// Generates array of opcode handlers (specialized or unspecialized)
|
||||
function gen_labels($f, $spec, $kind, $prolog, &$specs, $switch_labels = array()) {
|
||||
global $opcodes, $op_types, $prefix, $op_types_ex;
|
||||
global $opcodes, $opnames, $op_types, $prefix, $op_types_ex;
|
||||
|
||||
$list = [];
|
||||
$next = 0;
|
||||
@ -1214,6 +1218,10 @@ function gen_labels($f, $spec, $kind, $prolog, &$specs, $switch_labels = array()
|
||||
|
||||
// For each opcode in opcode number order
|
||||
foreach($opcodes as $num => $dsc) {
|
||||
if (isset($dsc['alias'])) {
|
||||
$specs[$num] = $specs[$opnames[$dsc['alias']]];
|
||||
continue;
|
||||
}
|
||||
$specs[$num] = "$label";
|
||||
$spec_op1 = $spec_op2 = $spec_extra = false;
|
||||
$def_op1_type = $def_op2_type = "ANY";
|
||||
@ -1425,8 +1433,18 @@ function gen_labels($f, $spec, $kind, $prolog, &$specs, $switch_labels = array()
|
||||
}
|
||||
$next = $num+1;
|
||||
|
||||
//ugly trick for ZEND_VM_DEFINE_OP
|
||||
if ($dsc["code"]) {
|
||||
if (isset($dsc['alias']) && $kind != ZEND_VM_KIND_SWITCH) {
|
||||
// Emit pointer to unspecialized handler
|
||||
switch ($kind) {
|
||||
case ZEND_VM_KIND_CALL:
|
||||
out($f,$prolog.$dsc['alias']."_HANDLER,\n");
|
||||
break;
|
||||
case ZEND_VM_KIND_GOTO:
|
||||
out($f,$prolog."(void*)&&".$dsc['alias']."_LABEL,\n");
|
||||
break;
|
||||
}
|
||||
$list[] = $dsc["op"];
|
||||
} else if ($dsc["code"]) { //ugly trick for ZEND_VM_DEFINE_OP
|
||||
// Emit pointer to unspecialized handler
|
||||
switch ($kind) {
|
||||
case ZEND_VM_KIND_CALL:
|
||||
@ -2496,7 +2514,17 @@ function gen_vm($def, $skel) {
|
||||
|
||||
// Search for opcode handlers those are used by other opcode handlers
|
||||
foreach ($opcodes as $dsc) {
|
||||
if (preg_match_all("/ZEND_VM_DISPATCH_TO_HANDLER\(\s*([A-Z_]*)\s*\)/m", $dsc["code"], $mm, PREG_SET_ORDER)) {
|
||||
if (preg_match("/^\s*{\s*ZEND_VM_DISPATCH_TO_HANDLER\(\s*([A-Z_]*)\s*\)\s*;\s*}\s*/", $dsc["code"], $m)) {
|
||||
$op = $m[1];
|
||||
if (!isset($opnames[$op])) {
|
||||
die("ERROR ($def:$lineno): Opcode with name '$op' is not defined.\n");
|
||||
}
|
||||
$opcodes[$opnames[$dsc['op']]]['alias'] = $op;
|
||||
if (!ZEND_VM_SPEC && ZEND_VM_KIND == ZEND_VM_KIND_SWITCH) {
|
||||
$code = $opnames[$op];
|
||||
$opcodes[$code]['use'] = 1;
|
||||
}
|
||||
} else if (preg_match_all("/ZEND_VM_DISPATCH_TO_HANDLER\(\s*([A-Z_]*)\s*\)/m", $dsc["code"], $mm, PREG_SET_ORDER)) {
|
||||
foreach ($mm as $m) {
|
||||
$op = $m[1];
|
||||
if (!isset($opnames[$op])) {
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user