From cbd51cc7c322be9e1187a710160040767b4fe267 Mon Sep 17 00:00:00 2001 From: Arnaud Le Blanc Date: Mon, 16 Mar 2026 19:43:22 +0100 Subject: [PATCH] zend_vm_gen.php: Make room for new ZEND_VM_ flags Split OP flags and EXT flags in two separate sets, in zend_vm_gen.php to maintain 32bit support. In Zend/zend_vm_opcodes.c we can unify them again. --- Zend/Optimizer/zend_dump.c | 2 +- Zend/zend_vm_gen.php | 145 +++++---- Zend/zend_vm_opcodes.c | 428 +++++++++++++------------- Zend/zend_vm_opcodes.h | 77 ++--- ext/opcache/jit/zend_jit_vm_helpers.c | 2 +- 5 files changed, 348 insertions(+), 306 deletions(-) diff --git a/Zend/Optimizer/zend_dump.c b/Zend/Optimizer/zend_dump.c index 16cb751882427..407d25f72565e 100644 --- a/Zend/Optimizer/zend_dump.c +++ b/Zend/Optimizer/zend_dump.c @@ -460,7 +460,7 @@ static void zend_dump_range_constraint(const zend_op_array *op_array, const zend ZEND_API void zend_dump_op(const zend_op_array *op_array, const zend_basic_block *b, const zend_op *opline, uint32_t dump_flags, const zend_ssa *ssa, const zend_ssa_op *ssa_op) { const char *name = zend_get_opcode_name(opline->opcode); - uint32_t flags = zend_get_opcode_flags(opline->opcode); + uint64_t flags = zend_get_opcode_flags(opline->opcode); uint32_t n = 0; if (!ssa_op || ssa_op->result_use < 0) { diff --git a/Zend/zend_vm_gen.php b/Zend/zend_vm_gen.php index f8989b2336f47..f64663ff0b45a 100755 --- a/Zend/zend_vm_gen.php +++ b/Zend/zend_vm_gen.php @@ -55,22 +55,42 @@ const ZEND_VM_KIND_HYBRID = 4; const ZEND_VM_KIND_TAILCALL = 5; +// Per-operand flags +// ZEND_VM_OP[12]_FLAGS(zend_get_opcode_flags(opcode)) $vm_op_flags = array( - "ZEND_VM_OP_SPEC" => 1<<0, - "ZEND_VM_OP_CONST" => 1<<1, - "ZEND_VM_OP_TMPVAR" => 1<<2, - "ZEND_VM_OP_TMPVARCV" => 1<<3, - "ZEND_VM_OP_MASK" => 0xf0, - "ZEND_VM_OP_NUM" => 0x10, - "ZEND_VM_OP_JMP_ADDR" => 0x20, - "ZEND_VM_OP_TRY_CATCH" => 0x30, - "ZEND_VM_OP_LOOP_END" => 0x40, - "ZEND_VM_OP_THIS" => 0x50, - "ZEND_VM_OP_NEXT" => 0x60, - "ZEND_VM_OP_CLASS_FETCH" => 0x70, - "ZEND_VM_OP_CONSTRUCTOR" => 0x80, - "ZEND_VM_OP_CONST_FETCH" => 0x90, - "ZEND_VM_OP_CACHE_SLOT" => 0xa0, + "ZEND_VM_OP_SHIFT" => 16, + + // An operand can have zero of more of these: + "ZEND_VM_OP_SPEC_MASK" => 0xff, + "ZEND_VM_OP_CONST" => 1<<0, + "ZEND_VM_OP_TMP" => 1<<1, + "ZEND_VM_OP_VAR" => 1<<2, + "ZEND_VM_OP_UNUSED" => 1<<3, + "ZEND_VM_OP_CV" => 1<<4, + "ZEND_VM_OP_TMPVAR" => 1<<5, + "ZEND_VM_OP_TMPVARCV" => 1<<6, + // unused in ZEND_VM_OP_SPEC_MASK: (1<<7) + + // unused: (1<<8)-(1<<11) + + // An operand can have at most one of these: + "ZEND_VM_OP_MASK" => 0xf000, + "ZEND_VM_OP_NUM" => 1<<12, + "ZEND_VM_OP_JMP_ADDR" => 2<<12, + "ZEND_VM_OP_TRY_CATCH" => 3<<12, + "ZEND_VM_OP_LOOP_END" => 4<<12, + "ZEND_VM_OP_THIS" => 5<<12, + "ZEND_VM_OP_NEXT" => 6<<12, + "ZEND_VM_OP_CLASS_FETCH" => 7<<12, + "ZEND_VM_OP_CONSTRUCTOR" => 8<<12, + "ZEND_VM_OP_CONST_FETCH" => 9<<12, + "ZEND_VM_OP_CACHE_SLOT" => 10<<12, + // unused in ZEND_VM_OP_MASK: (11<<12)-(15<<12) +); + +// Opcode-level flags +$vm_ext_flags = array( + // unused: bits (1<<0)-(1<<15) "ZEND_VM_EXT_VAR_FETCH" => 1<<16, "ZEND_VM_EXT_ISSET" => 1<<17, @@ -78,7 +98,7 @@ "ZEND_VM_EXT_ARRAY_INIT" => 1<<19, "ZEND_VM_EXT_REF" => 1<<20, "ZEND_VM_EXT_FETCH_REF" => 1<<21, - "ZEND_VM_EXT_DIM_WRITE" => 1<<22, + "ZEND_VM_EXT_DIM_WRITE" => 1<<22, "ZEND_VM_EXT_MASK" => 0x0f000000, "ZEND_VM_EXT_NUM" => 0x01000000, "ZEND_VM_EXT_LAST_CATCH" => 0x02000000, @@ -100,15 +120,19 @@ define($name, $val); } +foreach ($vm_ext_flags as $name => $val) { + define($name, $val); +} + $vm_op_decode = array( "ANY" => 0, - "CONST" => ZEND_VM_OP_SPEC | ZEND_VM_OP_CONST, - "TMP" => ZEND_VM_OP_SPEC, - "VAR" => ZEND_VM_OP_SPEC, - "UNUSED" => ZEND_VM_OP_SPEC, - "CV" => ZEND_VM_OP_SPEC, - "TMPVAR" => ZEND_VM_OP_SPEC | ZEND_VM_OP_TMPVAR, - "TMPVARCV" => ZEND_VM_OP_SPEC | ZEND_VM_OP_TMPVARCV, + "CONST" => ZEND_VM_OP_CONST, + "TMP" => ZEND_VM_OP_TMP, + "VAR" => ZEND_VM_OP_VAR, + "UNUSED" => ZEND_VM_OP_UNUSED, + "CV" => ZEND_VM_OP_CV, + "TMPVAR" => ZEND_VM_OP_TMPVAR, + "TMPVARCV" => ZEND_VM_OP_TMPVARCV, "NUM" => ZEND_VM_OP_NUM, "JMP_ADDR" => ZEND_VM_OP_JMP_ADDR, "TRY_CATCH" => ZEND_VM_OP_TRY_CATCH, @@ -2389,7 +2413,7 @@ function parse_operand_spec($def, $lineno, $str, &$flags) { die("ERROR ($def:$lineno): Wrong operand type '$str'\n"); } } - if (!($flags & ZEND_VM_OP_SPEC)) { + if (!($flags & ZEND_VM_OP_SPEC_MASK)) { if (count($a) != 1) { die("ERROR ($def:$lineno): Wrong operand type '$str'\n"); } @@ -2398,18 +2422,32 @@ function parse_operand_spec($def, $lineno, $str, &$flags) { return array_flip($a); } -function parse_ext_spec($def, $lineno, $str) { +function parse_ext_spec($def, $lineno, $str, $spec_str) { global $vm_ext_decode; $flags = 0; - $a = explode("|",$str); - foreach ($a as $val) { - if (isset($vm_ext_decode[$val])) { - $flags |= $vm_ext_decode[$val]; - } else { - die("ERROR ($def:$lineno): Wrong extended_value type '$str'\n"); + + if ($str !== '') { + $a = explode("|",$str); + foreach ($a as $val) { + if (isset($vm_ext_decode[$val])) { + $flags |= $vm_ext_decode[$val]; + } else { + die("ERROR ($def:$lineno): Wrong extended_value type '$str'\n"); + } + } + } + if ($spec_str !== '') { + $a = explode(",",$spec_str); + foreach ($a as $val) { + if (isset($vm_ext_decode[$val])) { + $flags |= $vm_ext_decode[$val]; + } else { + // Spec flags are validated separately. + } } } + return $flags; } @@ -2464,7 +2502,7 @@ function parse_spec_rules($def, $lineno, $str) { } function gen_vm_opcodes_header( - array $opcodes, int $max_opcode, int $max_opcode_len, array $vm_op_flags + array $opcodes, int $max_opcode, int $max_opcode_len, array $vm_op_flags, array $vm_ext_flags ): string { $str = HEADER_TEXT; $str .= "#ifndef ZEND_VM_OPCODES_H\n#define ZEND_VM_OPCODES_H\n\n"; @@ -2538,12 +2576,15 @@ function gen_vm_opcodes_header( foreach ($vm_op_flags as $name => $val) { $str .= sprintf("#define %-24s 0x%08x\n", $name, $val); } - $str .= "#define ZEND_VM_OP1_FLAGS(flags) (flags & 0xff)\n"; - $str .= "#define ZEND_VM_OP2_FLAGS(flags) ((flags >> 8) & 0xff)\n"; + foreach ($vm_ext_flags as $name => $val) { + $str .= sprintf("#define %-24s (UINT64_C(0x%08x) << 32)\n", $name, $val); + } + $str .= sprintf("#define ZEND_VM_OP1_FLAGS(flags) (flags & 0x%08x)\n", (1<> %d) & 0x%08x)\n", ZEND_VM_OP_SHIFT, (1< $max_opcode_len) { $max_opcode_len = $len; @@ -2649,14 +2688,14 @@ function gen_vm($def, $skel) { if (isset($opnames[$op])) { die("ERROR ($def:$lineno): Opcode with name '$op' is already defined.\n"); } - $opcodes[$code] = array("op"=>$op,"op1"=>$op1,"op2"=>$op2,"code"=>"","flags"=>$flags,"hot"=>$hot); + $opcodes[$code] = array("op"=>$op,"op1"=>$op1,"op2"=>$op2,"code"=>"","flags"=>$flags,"ext_flags"=>$ext_flags,"hot"=>$hot); if (isset($m[9])) { $opcodes[$code]["spec"] = parse_spec_rules($def, $lineno, $m[9]); if (isset($opcodes[$code]["spec"]["NO_CONST_CONST"])) { - $opcodes[$code]["flags"] |= $vm_op_flags["ZEND_VM_NO_CONST_CONST"]; + $opcodes[$code]["ext_flags"] |= ZEND_VM_NO_CONST_CONST; } if (isset($opcodes[$code]["spec"]["COMMUTATIVE"])) { - $opcodes[$code]["flags"] |= $vm_op_flags["ZEND_VM_COMMUTATIVE"]; + $opcodes[$code]["ext_flags"] |= ZEND_VM_COMMUTATIVE; } } $opnames[$op] = $code; @@ -2701,23 +2740,21 @@ function gen_vm($def, $skel) { $op = $m[4]; $op1 = parse_operand_spec($def, $lineno, $m[5], $flags1); $op2 = parse_operand_spec($def, $lineno, $m[6], $flags2); - $flags = $flags1 | ($flags2 << 8); - if (!empty($m[8])) { - $flags |= parse_ext_spec($def, $lineno, $m[8]); - } + $flags = $flags1 | ($flags2 << ZEND_VM_OP_SHIFT); + $ext_flags = parse_ext_spec($def, $lineno, $m[8] ?? '', $m[10] ?? ''); if (isset($opcodes[$code])) { die("ERROR ($def:$lineno): Opcode with name '$code' is already defined.\n"); } $used_extra_spec["TYPE"] = 1; - $opcodes[$code] = array("op"=>$op,"op1"=>$op1,"op2"=>$op2,"code"=>"","flags"=>$flags,"hot"=>$hot,"is_type_spec"=>true); + $opcodes[$code] = array("op"=>$op,"op1"=>$op1,"op2"=>$op2,"code"=>"","flags"=>$flags,"ext_flags"=>$ext_flags,"hot"=>$hot,"is_type_spec"=>true); if (isset($m[10])) { $opcodes[$code]["spec"] = parse_spec_rules($def, $lineno, $m[10]); if (isset($opcodes[$code]["spec"]["NO_CONST_CONST"])) { - $opcodes[$code]["flags"] |= $vm_op_flags["ZEND_VM_NO_CONST_CONST"]; + $opcodes[$code]["ext_flags"] |= ZEND_VM_NO_CONST_CONST; } if (isset($opcodes[$code]["spec"]["COMMUTATIVE"])) { - $opcodes[$code]["flags"] |= $vm_op_flags["ZEND_VM_COMMUTATIVE"]; + $opcodes[$code]["ext_flags"] |= ZEND_VM_COMMUTATIVE; } } $opnames[$op] = $code; @@ -2836,7 +2873,7 @@ function gen_vm($def, $skel) { } // Generate opcode #defines (zend_vm_opcodes.h) - $str = gen_vm_opcodes_header($opcodes, $max_opcode, $max_opcode_len, $vm_op_flags); + $str = gen_vm_opcodes_header($opcodes, $max_opcode, $max_opcode_len, $vm_op_flags, $vm_ext_flags); write_file_if_changed(__DIR__ . "/zend_vm_opcodes.h", $str); echo "zend_vm_opcodes.h generated successfully.\n"; @@ -2855,9 +2892,9 @@ function gen_vm($def, $skel) { } out($f, "};\n\n"); - out($f,"static uint32_t zend_vm_opcodes_flags[".($max_opcode + 1)."] = {\n"); + out($f,"static uint64_t zend_vm_opcodes_flags[".($max_opcode + 1)."] = {\n"); for ($i = 0; $i <= $max_opcode; $i++) { - out($f, sprintf("\t0x%08x,\n", isset($opcodes[$i]["flags"]) ? $opcodes[$i]["flags"] : 0)); + out($f, sprintf("\tUINT64_C(0x%08x) | (UINT64_C(0x%08x) << 32), /* %s */\n", $opcodes[$i]["flags"] ?? 0, $opcodes[$i]["ext_flags"] ?? 0, $opcodes[$i]["op"] ?? '')); } out($f, "};\n\n"); @@ -2868,7 +2905,7 @@ function gen_vm($def, $skel) { out($f, "\treturn zend_vm_opcodes_names[opcode];\n"); out($f, "}\n"); - out($f, "ZEND_API uint32_t ZEND_FASTCALL zend_get_opcode_flags(uint8_t opcode) {\n"); + out($f, "ZEND_API uint64_t ZEND_FASTCALL zend_get_opcode_flags(uint8_t opcode) {\n"); out($f, "\tif (UNEXPECTED(opcode > ZEND_VM_LAST_OPCODE)) {\n"); out($f, "\t\topcode = ZEND_NOP;\n"); out($f, "\t}\n"); diff --git a/Zend/zend_vm_opcodes.c b/Zend/zend_vm_opcodes.c index 87cd00a6f8b58..6dfa4331ad286 100644 --- a/Zend/zend_vm_opcodes.c +++ b/Zend/zend_vm_opcodes.c @@ -237,219 +237,219 @@ static const char *zend_vm_opcodes_names[212] = { "ZEND_TYPE_ASSERT", }; -static uint32_t zend_vm_opcodes_flags[212] = { - 0x00000000, - 0x00000b0b, - 0x00000b0b, - 0x80000b0b, - 0x00000303, - 0x00000b0b, - 0x00000b0b, - 0x00000b0b, - 0x40000303, - 0x80000b0b, - 0x80000b0b, - 0x80000b0b, - 0x00000303, - 0x0000000b, - 0x00000003, - 0x80000303, - 0x80000303, - 0x80000303, - 0x80000303, - 0x80000303, - 0x00000b0b, - 0x00000b0b, - 0x00000301, - 0x00006301, - 0x00040351, - 0x00040000, - 0x04000301, - 0x04006301, - 0x04000351, - 0x04000000, - 0x0b000101, - 0x00000003, - 0x0b040351, - 0x0b040000, - 0x00000001, - 0x00000001, - 0x00000001, - 0x00000001, - 0x00040000, - 0x00040000, - 0x00040000, - 0x00040000, - 0x00000020, - 0x00002003, - 0x00002003, - 0x00000000, - 0x00002003, - 0x00002003, - 0x00000301, - 0x00000101, - 0x00001301, - 0x07000003, - 0x00000003, - 0x00000303, - 0x01000301, - 0x01000301, - 0x01000301, - 0x00000000, - 0x00000001, - 0x01040300, - 0x00000000, - 0x01040310, - 0x00000003, - 0x00000110, - 0x00000310, - 0x00001307, - 0x00001301, - 0x00001301, - 0x0100a173, - 0x01040300, - 0x00004005, - 0x00186303, - 0x00106303, - 0x08000003, - 0x00010107, - 0x00000301, - 0x00040351, - 0x00002003, - 0x03000001, - 0x00000000, - 0x00010103, - 0x00000307, - 0x00040357, - 0x00010103, - 0x00006301, - 0x00640351, - 0x00010103, - 0x00006301, - 0x00040351, - 0x00010103, - 0x00000307, - 0x00040357, - 0x00010103, - 0x00006303, - 0x00240353, - 0x00010103, - 0x00000301, - 0x00040351, - 0x0000030b, - 0x00040391, - 0x00001301, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x01000000, - 0x00001301, - 0x02042003, - 0x00000003, - 0x00040371, - 0x00000053, - 0x0b000003, - 0x01040353, - 0x01048373, - 0x00030103, - 0x00020303, - 0x00001303, - 0x00001301, - 0x01000303, - 0x01000000, - 0x00001003, - 0x00000003, - 0x00040003, - 0x09000003, - 0x00000103, - 0x00002003, - 0x03000001, - 0x00004005, - 0x01000300, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00040351, - 0x00040351, - 0x00040351, - 0x00040351, - 0x00000003, - 0x00000000, - 0x00047301, - 0x00000000, - 0x00000101, - 0x00001000, - 0x00001003, - 0x00000303, - 0x00000003, - 0x00000303, - 0x00040000, - 0x00000000, - 0x00060353, - 0x00000000, - 0x00000000, - 0x00002000, - 0x00002003, - 0x00000101, - 0x00020101, - 0x00000301, - 0x00000101, - 0x00000071, - 0x00000000, - 0x00000000, - 0x0b000303, - 0x00000003, - 0x00000020, - 0x00003000, - 0x00000110, - 0x00000000, - 0x00000003, - 0x00000105, - 0x00040301, - 0x00002003, - 0x00000303, - 0x00000101, - 0x00000103, - 0x00047000, - 0x00647000, - 0x00047000, - 0x00047000, - 0x00247000, - 0x00047000, - 0x00040000, - 0x00067000, - 0x00040b73, - 0x00100101, - 0x00100001, - 0x00000101, - 0x00001301, - 0x00000101, - 0x0300030b, - 0x0300030b, - 0x01000303, - 0x00000103, - 0x00000103, - 0x00000101, - 0x00000103, - 0x00000303, - 0x0300030b, - 0x00000301, - 0x0000010b, - 0x00002003, - 0x00000101, - 0x00000101, - 0x00000101, - 0x01040101, - 0x00002001, - 0x00000101, - 0x00000100, - 0x00000000, - 0x00000000, - 0x01042003, - 0x01001103, - 0x00000303, - 0x01000003, +static uint64_t zend_vm_opcodes_flags[212] = { + UINT64_C(0x00000000) | (UINT64_C(0x00000000) << 32), /* ZEND_NOP */ + UINT64_C(0x00410041) | (UINT64_C(0x00000000) << 32), /* ZEND_ADD */ + UINT64_C(0x00410041) | (UINT64_C(0x00000000) << 32), /* ZEND_SUB */ + UINT64_C(0x00410041) | (UINT64_C(0x80000000) << 32), /* ZEND_MUL */ + UINT64_C(0x00130013) | (UINT64_C(0x00000000) << 32), /* ZEND_DIV */ + UINT64_C(0x00410041) | (UINT64_C(0x00000000) << 32), /* ZEND_MOD */ + UINT64_C(0x00410041) | (UINT64_C(0x00000000) << 32), /* ZEND_SL */ + UINT64_C(0x00410041) | (UINT64_C(0x00000000) << 32), /* ZEND_SR */ + UINT64_C(0x00130013) | (UINT64_C(0x40000000) << 32), /* ZEND_CONCAT */ + UINT64_C(0x00410041) | (UINT64_C(0x80000000) << 32), /* ZEND_BW_OR */ + UINT64_C(0x00410041) | (UINT64_C(0x80000000) << 32), /* ZEND_BW_AND */ + UINT64_C(0x00410041) | (UINT64_C(0x80000000) << 32), /* ZEND_BW_XOR */ + UINT64_C(0x00130013) | (UINT64_C(0x00000000) << 32), /* ZEND_POW */ + UINT64_C(0x00000041) | (UINT64_C(0x00000000) << 32), /* ZEND_BW_NOT */ + UINT64_C(0x00000013) | (UINT64_C(0x00000000) << 32), /* ZEND_BOOL_NOT */ + UINT64_C(0x00130013) | (UINT64_C(0x80000000) << 32), /* ZEND_BOOL_XOR */ + UINT64_C(0x00130013) | (UINT64_C(0x80000000) << 32), /* ZEND_IS_IDENTICAL */ + UINT64_C(0x00130013) | (UINT64_C(0x80000000) << 32), /* ZEND_IS_NOT_IDENTICAL */ + UINT64_C(0x00130013) | (UINT64_C(0x80000000) << 32), /* ZEND_IS_EQUAL */ + UINT64_C(0x00130013) | (UINT64_C(0x80000000) << 32), /* ZEND_IS_NOT_EQUAL */ + UINT64_C(0x00410041) | (UINT64_C(0x00000000) << 32), /* ZEND_IS_SMALLER */ + UINT64_C(0x00410041) | (UINT64_C(0x00000000) << 32), /* ZEND_IS_SMALLER_OR_EQUAL */ + UINT64_C(0x00130014) | (UINT64_C(0x00000000) << 32), /* ZEND_ASSIGN */ + UINT64_C(0x601b0014) | (UINT64_C(0x00000000) << 32), /* ZEND_ASSIGN_DIM */ + UINT64_C(0x0013501c) | (UINT64_C(0x00040000) << 32), /* ZEND_ASSIGN_OBJ */ + UINT64_C(0x00000000) | (UINT64_C(0x00040000) << 32), /* ZEND_ASSIGN_STATIC_PROP */ + UINT64_C(0x00130014) | (UINT64_C(0x04000000) << 32), /* ZEND_ASSIGN_OP */ + UINT64_C(0x601b0014) | (UINT64_C(0x04000000) << 32), /* ZEND_ASSIGN_DIM_OP */ + UINT64_C(0x0013501c) | (UINT64_C(0x04000000) << 32), /* ZEND_ASSIGN_OBJ_OP */ + UINT64_C(0x00000000) | (UINT64_C(0x04000000) << 32), /* ZEND_ASSIGN_STATIC_PROP_OP */ + UINT64_C(0x00140014) | (UINT64_C(0x0b000000) << 32), /* ZEND_ASSIGN_REF */ + UINT64_C(0x00000017) | (UINT64_C(0x00000000) << 32), /* ZEND_QM_ASSIGN */ + UINT64_C(0x0013501c) | (UINT64_C(0x0b040000) << 32), /* ZEND_ASSIGN_OBJ_REF */ + UINT64_C(0x00000000) | (UINT64_C(0x0b040000) << 32), /* ZEND_ASSIGN_STATIC_PROP_REF */ + UINT64_C(0x00000014) | (UINT64_C(0x00000000) << 32), /* ZEND_PRE_INC */ + UINT64_C(0x00000014) | (UINT64_C(0x00000000) << 32), /* ZEND_PRE_DEC */ + UINT64_C(0x00000014) | (UINT64_C(0x00000000) << 32), /* ZEND_POST_INC */ + UINT64_C(0x00000014) | (UINT64_C(0x00000000) << 32), /* ZEND_POST_DEC */ + UINT64_C(0x00000000) | (UINT64_C(0x00040000) << 32), /* ZEND_PRE_INC_STATIC_PROP */ + UINT64_C(0x00000000) | (UINT64_C(0x00040000) << 32), /* ZEND_PRE_DEC_STATIC_PROP */ + UINT64_C(0x00000000) | (UINT64_C(0x00040000) << 32), /* ZEND_POST_INC_STATIC_PROP */ + UINT64_C(0x00000000) | (UINT64_C(0x00040000) << 32), /* ZEND_POST_DEC_STATIC_PROP */ + UINT64_C(0x00002000) | (UINT64_C(0x00000000) << 32), /* ZEND_JMP */ + UINT64_C(0x20000013) | (UINT64_C(0x00000000) << 32), /* ZEND_JMPZ */ + UINT64_C(0x20000013) | (UINT64_C(0x00000000) << 32), /* ZEND_JMPNZ */ + UINT64_C(0x00000000) | (UINT64_C(0x00000000) << 32), /* */ + UINT64_C(0x20000013) | (UINT64_C(0x00000000) << 32), /* ZEND_JMPZ_EX */ + UINT64_C(0x20000013) | (UINT64_C(0x00000000) << 32), /* ZEND_JMPNZ_EX */ + UINT64_C(0x00130002) | (UINT64_C(0x00000000) << 32), /* ZEND_CASE */ + UINT64_C(0x00080010) | (UINT64_C(0x00000000) << 32), /* ZEND_CHECK_VAR */ + UINT64_C(0x10090004) | (UINT64_C(0x00000000) << 32), /* ZEND_SEND_VAR_NO_REF_EX */ + UINT64_C(0x00000013) | (UINT64_C(0x07000000) << 32), /* ZEND_CAST */ + UINT64_C(0x00000013) | (UINT64_C(0x00000000) << 32), /* ZEND_BOOL */ + UINT64_C(0x00130013) | (UINT64_C(0x00000000) << 32), /* ZEND_FAST_CONCAT */ + UINT64_C(0x00130008) | (UINT64_C(0x01000000) << 32), /* ZEND_ROPE_INIT */ + UINT64_C(0x00130002) | (UINT64_C(0x01000000) << 32), /* ZEND_ROPE_ADD */ + UINT64_C(0x00130002) | (UINT64_C(0x01000000) << 32), /* ZEND_ROPE_END */ + UINT64_C(0x00000000) | (UINT64_C(0x00000000) << 32), /* ZEND_BEGIN_SILENCE */ + UINT64_C(0x00000002) | (UINT64_C(0x00000000) << 32), /* ZEND_END_SILENCE */ + UINT64_C(0x00010000) | (UINT64_C(0x01040000) << 32), /* ZEND_INIT_FCALL_BY_NAME */ + UINT64_C(0x00000000) | (UINT64_C(0x00000000) << 32), /* ZEND_DO_FCALL */ + UINT64_C(0x00011000) | (UINT64_C(0x01040000) << 32), /* ZEND_INIT_FCALL */ + UINT64_C(0x00000013) | (UINT64_C(0x00000000) << 32), /* ZEND_RETURN */ + UINT64_C(0x00081000) | (UINT64_C(0x00000000) << 32), /* ZEND_RECV */ + UINT64_C(0x00011000) | (UINT64_C(0x00000000) << 32), /* ZEND_RECV_INIT */ + UINT64_C(0x10090021) | (UINT64_C(0x00000000) << 32), /* ZEND_SEND_VAL */ + UINT64_C(0x10090014) | (UINT64_C(0x00000000) << 32), /* ZEND_SEND_VAR_EX */ + UINT64_C(0x10090014) | (UINT64_C(0x00000000) << 32), /* ZEND_SEND_REF */ + UINT64_C(0xa008700d) | (UINT64_C(0x01000000) << 32), /* ZEND_NEW */ + UINT64_C(0x00010000) | (UINT64_C(0x01040000) << 32), /* ZEND_INIT_NS_FCALL_BY_NAME */ + UINT64_C(0x40000020) | (UINT64_C(0x00000000) << 32), /* ZEND_FREE */ + UINT64_C(0x601b001f) | (UINT64_C(0x00180000) << 32), /* ZEND_INIT_ARRAY */ + UINT64_C(0x601b0017) | (UINT64_C(0x00100000) << 32), /* ZEND_ADD_ARRAY_ELEMENT */ + UINT64_C(0x00000013) | (UINT64_C(0x08000000) << 32), /* ZEND_INCLUDE_OR_EVAL */ + UINT64_C(0x00080031) | (UINT64_C(0x00010000) << 32), /* ZEND_UNSET_VAR */ + UINT64_C(0x00130014) | (UINT64_C(0x00000000) << 32), /* ZEND_UNSET_DIM */ + UINT64_C(0x0013501c) | (UINT64_C(0x00040000) << 32), /* ZEND_UNSET_OBJ */ + UINT64_C(0x20000013) | (UINT64_C(0x00000000) << 32), /* ZEND_FE_RESET_R */ + UINT64_C(0x00000002) | (UINT64_C(0x03000000) << 32), /* ZEND_FE_FETCH_R */ + UINT64_C(0x00000000) | (UINT64_C(0x00000000) << 32), /* */ + UINT64_C(0x00080013) | (UINT64_C(0x00010000) << 32), /* ZEND_FETCH_R */ + UINT64_C(0x00130031) | (UINT64_C(0x00000000) << 32), /* ZEND_FETCH_DIM_R */ + UINT64_C(0x00135039) | (UINT64_C(0x00040000) << 32), /* ZEND_FETCH_OBJ_R */ + UINT64_C(0x00080013) | (UINT64_C(0x00010000) << 32), /* ZEND_FETCH_W */ + UINT64_C(0x601b0014) | (UINT64_C(0x00000000) << 32), /* ZEND_FETCH_DIM_W */ + UINT64_C(0x0013501c) | (UINT64_C(0x00640000) << 32), /* ZEND_FETCH_OBJ_W */ + UINT64_C(0x00080013) | (UINT64_C(0x00010000) << 32), /* ZEND_FETCH_RW */ + UINT64_C(0x601b0014) | (UINT64_C(0x00000000) << 32), /* ZEND_FETCH_DIM_RW */ + UINT64_C(0x0013501c) | (UINT64_C(0x00040000) << 32), /* ZEND_FETCH_OBJ_RW */ + UINT64_C(0x00080013) | (UINT64_C(0x00010000) << 32), /* ZEND_FETCH_IS */ + UINT64_C(0x00130031) | (UINT64_C(0x00000000) << 32), /* ZEND_FETCH_DIM_IS */ + UINT64_C(0x00135039) | (UINT64_C(0x00040000) << 32), /* ZEND_FETCH_OBJ_IS */ + UINT64_C(0x00080013) | (UINT64_C(0x00010000) << 32), /* ZEND_FETCH_FUNC_ARG */ + UINT64_C(0x601b0017) | (UINT64_C(0x00000000) << 32), /* ZEND_FETCH_DIM_FUNC_ARG */ + UINT64_C(0x0013501f) | (UINT64_C(0x00240000) << 32), /* ZEND_FETCH_OBJ_FUNC_ARG */ + UINT64_C(0x00080013) | (UINT64_C(0x00010000) << 32), /* ZEND_FETCH_UNSET */ + UINT64_C(0x00130014) | (UINT64_C(0x00000000) << 32), /* ZEND_FETCH_DIM_UNSET */ + UINT64_C(0x0013501c) | (UINT64_C(0x00040000) << 32), /* ZEND_FETCH_OBJ_UNSET */ + UINT64_C(0x00130041) | (UINT64_C(0x00000000) << 32), /* ZEND_FETCH_LIST_R */ + UINT64_C(0x00019008) | (UINT64_C(0x00040000) << 32), /* ZEND_FETCH_CONSTANT */ + UINT64_C(0x10090008) | (UINT64_C(0x00000000) << 32), /* ZEND_CHECK_FUNC_ARG */ + UINT64_C(0x00000000) | (UINT64_C(0x00000000) << 32), /* ZEND_EXT_STMT */ + UINT64_C(0x00000000) | (UINT64_C(0x00000000) << 32), /* ZEND_EXT_FCALL_BEGIN */ + UINT64_C(0x00000000) | (UINT64_C(0x00000000) << 32), /* ZEND_EXT_FCALL_END */ + UINT64_C(0x00000000) | (UINT64_C(0x00000000) << 32), /* ZEND_EXT_NOP */ + UINT64_C(0x00000000) | (UINT64_C(0x01000000) << 32), /* ZEND_TICKS */ + UINT64_C(0x10090004) | (UINT64_C(0x00000000) << 32), /* ZEND_SEND_VAR_NO_REF */ + UINT64_C(0x20000001) | (UINT64_C(0x02040000) << 32), /* ZEND_CATCH */ + UINT64_C(0x00000013) | (UINT64_C(0x00000000) << 32), /* ZEND_THROW */ + UINT64_C(0x001b7008) | (UINT64_C(0x00040000) << 32), /* ZEND_FETCH_CLASS */ + UINT64_C(0x0000501b) | (UINT64_C(0x00000000) << 32), /* ZEND_CLONE */ + UINT64_C(0x00000017) | (UINT64_C(0x0b000000) << 32), /* ZEND_RETURN_BY_REF */ + UINT64_C(0x0013501b) | (UINT64_C(0x01040000) << 32), /* ZEND_INIT_METHOD_CALL */ + UINT64_C(0x801b700d) | (UINT64_C(0x01040000) << 32), /* ZEND_INIT_STATIC_METHOD_CALL */ + UINT64_C(0x00080013) | (UINT64_C(0x00030000) << 32), /* ZEND_ISSET_ISEMPTY_VAR */ + UINT64_C(0x00130013) | (UINT64_C(0x00020000) << 32), /* ZEND_ISSET_ISEMPTY_DIM_OBJ */ + UINT64_C(0x10090003) | (UINT64_C(0x00000000) << 32), /* ZEND_SEND_VAL_EX */ + UINT64_C(0x10090014) | (UINT64_C(0x00000000) << 32), /* ZEND_SEND_VAR */ + UINT64_C(0x00130001) | (UINT64_C(0x01000000) << 32), /* ZEND_INIT_USER_CALL */ + UINT64_C(0x00000000) | (UINT64_C(0x01000000) << 32), /* ZEND_SEND_ARRAY */ + UINT64_C(0x10000013) | (UINT64_C(0x00000000) << 32), /* ZEND_SEND_USER */ + UINT64_C(0x00000013) | (UINT64_C(0x00000000) << 32), /* ZEND_STRLEN */ + UINT64_C(0x00000001) | (UINT64_C(0x00040000) << 32), /* ZEND_DEFINED */ + UINT64_C(0x00000013) | (UINT64_C(0x09000000) << 32), /* ZEND_TYPE_CHECK */ + UINT64_C(0x0008001f) | (UINT64_C(0x00000000) << 32), /* ZEND_VERIFY_RETURN_TYPE */ + UINT64_C(0x20000017) | (UINT64_C(0x00000000) << 32), /* ZEND_FE_RESET_RW */ + UINT64_C(0x00000004) | (UINT64_C(0x03000000) << 32), /* ZEND_FE_FETCH_RW */ + UINT64_C(0x40000020) | (UINT64_C(0x00000000) << 32), /* ZEND_FE_FREE */ + UINT64_C(0x00130000) | (UINT64_C(0x01000000) << 32), /* ZEND_INIT_DYNAMIC_CALL */ + UINT64_C(0x00000000) | (UINT64_C(0x00000000) << 32), /* ZEND_DO_ICALL */ + UINT64_C(0x00000000) | (UINT64_C(0x00000000) << 32), /* ZEND_DO_UCALL */ + UINT64_C(0x00000000) | (UINT64_C(0x00000000) << 32), /* ZEND_DO_FCALL_BY_NAME */ + UINT64_C(0x0013501c) | (UINT64_C(0x00040000) << 32), /* ZEND_PRE_INC_OBJ */ + UINT64_C(0x0013501c) | (UINT64_C(0x00040000) << 32), /* ZEND_PRE_DEC_OBJ */ + UINT64_C(0x0013501c) | (UINT64_C(0x00040000) << 32), /* ZEND_POST_INC_OBJ */ + UINT64_C(0x0013501c) | (UINT64_C(0x00040000) << 32), /* ZEND_POST_DEC_OBJ */ + UINT64_C(0x00000013) | (UINT64_C(0x00000000) << 32), /* ZEND_ECHO */ + UINT64_C(0x00000000) | (UINT64_C(0x00000000) << 32), /* ZEND_OP_DATA */ + UINT64_C(0x700d0012) | (UINT64_C(0x00040000) << 32), /* ZEND_INSTANCEOF */ + UINT64_C(0x00000000) | (UINT64_C(0x00000000) << 32), /* ZEND_GENERATOR_CREATE */ + UINT64_C(0x00080014) | (UINT64_C(0x00000000) << 32), /* ZEND_MAKE_REF */ + UINT64_C(0x10000000) | (UINT64_C(0x00000000) << 32), /* ZEND_DECLARE_FUNCTION */ + UINT64_C(0x10000001) | (UINT64_C(0x00000000) << 32), /* ZEND_DECLARE_LAMBDA_FUNCTION */ + UINT64_C(0x00010001) | (UINT64_C(0x00000000) << 32), /* ZEND_DECLARE_CONST */ + UINT64_C(0x00000001) | (UINT64_C(0x00000000) << 32), /* ZEND_DECLARE_CLASS */ + UINT64_C(0x00010001) | (UINT64_C(0x00000000) << 32), /* ZEND_DECLARE_CLASS_DELAYED */ + UINT64_C(0x00000000) | (UINT64_C(0x00040000) << 32), /* ZEND_DECLARE_ANON_CLASS */ + UINT64_C(0x00000000) | (UINT64_C(0x00000000) << 32), /* ZEND_ADD_ARRAY_UNPACK */ + UINT64_C(0x0013501b) | (UINT64_C(0x00060000) << 32), /* ZEND_ISSET_ISEMPTY_PROP_OBJ */ + UINT64_C(0x00000000) | (UINT64_C(0x00000000) << 32), /* ZEND_HANDLE_EXCEPTION */ + UINT64_C(0x00000000) | (UINT64_C(0x00000000) << 32), /* ZEND_USER_OPCODE */ + UINT64_C(0x20000000) | (UINT64_C(0x00000000) << 32), /* ZEND_ASSERT_CHECK */ + UINT64_C(0x20000013) | (UINT64_C(0x00000000) << 32), /* ZEND_JMP_SET */ + UINT64_C(0x00080010) | (UINT64_C(0x00000000) << 32), /* ZEND_UNSET_CV */ + UINT64_C(0x00080010) | (UINT64_C(0x00020000) << 32), /* ZEND_ISSET_ISEMPTY_CV */ + UINT64_C(0x00130004) | (UINT64_C(0x00000000) << 32), /* ZEND_FETCH_LIST_W */ + UINT64_C(0x00080004) | (UINT64_C(0x00000000) << 32), /* ZEND_SEPARATE */ + UINT64_C(0x0000701a) | (UINT64_C(0x00000000) << 32), /* ZEND_FETCH_CLASS_NAME */ + UINT64_C(0x00000000) | (UINT64_C(0x00000000) << 32), /* ZEND_CALL_TRAMPOLINE */ + UINT64_C(0x00000000) | (UINT64_C(0x00000000) << 32), /* ZEND_DISCARD_EXCEPTION */ + UINT64_C(0x001b001f) | (UINT64_C(0x0b000000) << 32), /* ZEND_YIELD */ + UINT64_C(0x00000017) | (UINT64_C(0x00000000) << 32), /* ZEND_GENERATOR_RETURN */ + UINT64_C(0x00002000) | (UINT64_C(0x00000000) << 32), /* ZEND_FAST_CALL */ + UINT64_C(0x30000000) | (UINT64_C(0x00000000) << 32), /* ZEND_FAST_RET */ + UINT64_C(0x00081000) | (UINT64_C(0x00000000) << 32), /* ZEND_RECV_VARIADIC */ + UINT64_C(0x00000000) | (UINT64_C(0x00000000) << 32), /* ZEND_SEND_UNPACK */ + UINT64_C(0x00000013) | (UINT64_C(0x00000000) << 32), /* ZEND_YIELD_FROM */ + UINT64_C(0x00080020) | (UINT64_C(0x00000000) << 32), /* ZEND_COPY_TMP */ + UINT64_C(0x00010010) | (UINT64_C(0x00040000) << 32), /* ZEND_BIND_GLOBAL */ + UINT64_C(0x20000013) | (UINT64_C(0x00000000) << 32), /* ZEND_COALESCE */ + UINT64_C(0x00130013) | (UINT64_C(0x00000000) << 32), /* ZEND_SPACESHIP */ + UINT64_C(0x00080008) | (UINT64_C(0x00000000) << 32), /* ZEND_FUNC_NUM_ARGS */ + UINT64_C(0x00080009) | (UINT64_C(0x00000000) << 32), /* ZEND_FUNC_GET_ARGS */ + UINT64_C(0x70000000) | (UINT64_C(0x00040000) << 32), /* ZEND_FETCH_STATIC_PROP_R */ + UINT64_C(0x70000000) | (UINT64_C(0x00640000) << 32), /* ZEND_FETCH_STATIC_PROP_W */ + UINT64_C(0x70000000) | (UINT64_C(0x00040000) << 32), /* ZEND_FETCH_STATIC_PROP_RW */ + UINT64_C(0x70000000) | (UINT64_C(0x00040000) << 32), /* ZEND_FETCH_STATIC_PROP_IS */ + UINT64_C(0x70000000) | (UINT64_C(0x00240000) << 32), /* ZEND_FETCH_STATIC_PROP_FUNC_ARG */ + UINT64_C(0x70000000) | (UINT64_C(0x00040000) << 32), /* ZEND_FETCH_STATIC_PROP_UNSET */ + UINT64_C(0x00000000) | (UINT64_C(0x00040000) << 32), /* ZEND_UNSET_STATIC_PROP */ + UINT64_C(0x70000000) | (UINT64_C(0x00060000) << 32), /* ZEND_ISSET_ISEMPTY_STATIC_PROP */ + UINT64_C(0x0041700d) | (UINT64_C(0x00040000) << 32), /* ZEND_FETCH_CLASS_CONSTANT */ + UINT64_C(0x00100002) | (UINT64_C(0x00100000) << 32), /* ZEND_BIND_LEXICAL */ + UINT64_C(0x00000010) | (UINT64_C(0x00100000) << 32), /* ZEND_BIND_STATIC */ + UINT64_C(0x00080008) | (UINT64_C(0x00000000) << 32), /* ZEND_FETCH_THIS */ + UINT64_C(0x10090004) | (UINT64_C(0x00000000) << 32), /* ZEND_SEND_FUNC_ARG */ + UINT64_C(0x00080008) | (UINT64_C(0x00000000) << 32), /* ZEND_ISSET_ISEMPTY_THIS */ + UINT64_C(0x00010041) | (UINT64_C(0x03000000) << 32), /* ZEND_SWITCH_LONG */ + UINT64_C(0x00010041) | (UINT64_C(0x03000000) << 32), /* ZEND_SWITCH_STRING */ + UINT64_C(0x00010013) | (UINT64_C(0x01000000) << 32), /* ZEND_IN_ARRAY */ + UINT64_C(0x00080013) | (UINT64_C(0x00000000) << 32), /* ZEND_COUNT */ + UINT64_C(0x0008001b) | (UINT64_C(0x00000000) << 32), /* ZEND_GET_CLASS */ + UINT64_C(0x00080008) | (UINT64_C(0x00000000) << 32), /* ZEND_GET_CALLED_CLASS */ + UINT64_C(0x00080013) | (UINT64_C(0x00000000) << 32), /* ZEND_GET_TYPE */ + UINT64_C(0x00130013) | (UINT64_C(0x00000000) << 32), /* ZEND_ARRAY_KEY_EXISTS */ + UINT64_C(0x00010041) | (UINT64_C(0x03000000) << 32), /* ZEND_MATCH */ + UINT64_C(0x00130002) | (UINT64_C(0x00000000) << 32), /* ZEND_CASE_STRICT */ + UINT64_C(0x00080041) | (UINT64_C(0x00000000) << 32), /* ZEND_MATCH_ERROR */ + UINT64_C(0x20000013) | (UINT64_C(0x00000000) << 32), /* ZEND_JMP_NULL */ + UINT64_C(0x00080008) | (UINT64_C(0x00000000) << 32), /* ZEND_CHECK_UNDEF_ARGS */ + UINT64_C(0x00080008) | (UINT64_C(0x00000000) << 32), /* ZEND_FETCH_GLOBALS */ + UINT64_C(0x00080008) | (UINT64_C(0x00000000) << 32), /* ZEND_VERIFY_NEVER_TYPE */ + UINT64_C(0x00080008) | (UINT64_C(0x01040000) << 32), /* ZEND_CALLABLE_CONVERT */ + UINT64_C(0x20000010) | (UINT64_C(0x00000000) << 32), /* ZEND_BIND_INIT_STATIC_OR_JMP */ + UINT64_C(0x00080008) | (UINT64_C(0x00000000) << 32), /* ZEND_FRAMELESS_ICALL_0 */ + UINT64_C(0x00080000) | (UINT64_C(0x00000000) << 32), /* ZEND_FRAMELESS_ICALL_1 */ + UINT64_C(0x00000000) | (UINT64_C(0x00000000) << 32), /* ZEND_FRAMELESS_ICALL_2 */ + UINT64_C(0x00000000) | (UINT64_C(0x00000000) << 32), /* ZEND_FRAMELESS_ICALL_3 */ + UINT64_C(0x20000001) | (UINT64_C(0x01040000) << 32), /* ZEND_JMP_FRAMELESS */ + UINT64_C(0x10080001) | (UINT64_C(0x01000000) << 32), /* ZEND_INIT_PARENT_PROPERTY_HOOK_CALL */ + UINT64_C(0x00010001) | (UINT64_C(0x00000000) << 32), /* ZEND_DECLARE_ATTRIBUTED_CONST */ + UINT64_C(0x00000001) | (UINT64_C(0x01000000) << 32), /* ZEND_TYPE_ASSERT */ }; ZEND_API const char* ZEND_FASTCALL zend_get_opcode_name(uint8_t opcode) { @@ -458,7 +458,7 @@ ZEND_API const char* ZEND_FASTCALL zend_get_opcode_name(uint8_t opcode) { } return zend_vm_opcodes_names[opcode]; } -ZEND_API uint32_t ZEND_FASTCALL zend_get_opcode_flags(uint8_t opcode) { +ZEND_API uint64_t ZEND_FASTCALL zend_get_opcode_flags(uint8_t opcode) { if (UNEXPECTED(opcode > ZEND_VM_LAST_OPCODE)) { opcode = ZEND_NOP; } diff --git a/Zend/zend_vm_opcodes.h b/Zend/zend_vm_opcodes.h index 7aae4d0e55f19..ce04764566d21 100644 --- a/Zend/zend_vm_opcodes.h +++ b/Zend/zend_vm_opcodes.h @@ -78,46 +78,51 @@ typedef const void* zend_vm_opcode_handler_t; # error #endif -#define ZEND_VM_OP_SPEC 0x00000001 -#define ZEND_VM_OP_CONST 0x00000002 -#define ZEND_VM_OP_TMPVAR 0x00000004 -#define ZEND_VM_OP_TMPVARCV 0x00000008 -#define ZEND_VM_OP_MASK 0x000000f0 -#define ZEND_VM_OP_NUM 0x00000010 -#define ZEND_VM_OP_JMP_ADDR 0x00000020 -#define ZEND_VM_OP_TRY_CATCH 0x00000030 -#define ZEND_VM_OP_LOOP_END 0x00000040 -#define ZEND_VM_OP_THIS 0x00000050 -#define ZEND_VM_OP_NEXT 0x00000060 -#define ZEND_VM_OP_CLASS_FETCH 0x00000070 -#define ZEND_VM_OP_CONSTRUCTOR 0x00000080 -#define ZEND_VM_OP_CONST_FETCH 0x00000090 -#define ZEND_VM_OP_CACHE_SLOT 0x000000a0 -#define ZEND_VM_EXT_VAR_FETCH 0x00010000 -#define ZEND_VM_EXT_ISSET 0x00020000 -#define ZEND_VM_EXT_CACHE_SLOT 0x00040000 -#define ZEND_VM_EXT_ARRAY_INIT 0x00080000 -#define ZEND_VM_EXT_REF 0x00100000 -#define ZEND_VM_EXT_FETCH_REF 0x00200000 -#define ZEND_VM_EXT_DIM_WRITE 0x00400000 -#define ZEND_VM_EXT_MASK 0x0f000000 -#define ZEND_VM_EXT_NUM 0x01000000 -#define ZEND_VM_EXT_LAST_CATCH 0x02000000 -#define ZEND_VM_EXT_JMP_ADDR 0x03000000 -#define ZEND_VM_EXT_OP 0x04000000 -#define ZEND_VM_EXT_TYPE 0x07000000 -#define ZEND_VM_EXT_EVAL 0x08000000 -#define ZEND_VM_EXT_TYPE_MASK 0x09000000 -#define ZEND_VM_EXT_SRC 0x0b000000 -#define ZEND_VM_NO_CONST_CONST 0x40000000 -#define ZEND_VM_COMMUTATIVE 0x80000000 -#define ZEND_VM_OP1_FLAGS(flags) (flags & 0xff) -#define ZEND_VM_OP2_FLAGS(flags) ((flags >> 8) & 0xff) +#define ZEND_VM_OP_SHIFT 0x00000010 +#define ZEND_VM_OP_SPEC_MASK 0x000000ff +#define ZEND_VM_OP_CONST 0x00000001 +#define ZEND_VM_OP_TMP 0x00000002 +#define ZEND_VM_OP_VAR 0x00000004 +#define ZEND_VM_OP_UNUSED 0x00000008 +#define ZEND_VM_OP_CV 0x00000010 +#define ZEND_VM_OP_TMPVAR 0x00000020 +#define ZEND_VM_OP_TMPVARCV 0x00000040 +#define ZEND_VM_OP_MASK 0x0000f000 +#define ZEND_VM_OP_NUM 0x00001000 +#define ZEND_VM_OP_JMP_ADDR 0x00002000 +#define ZEND_VM_OP_TRY_CATCH 0x00003000 +#define ZEND_VM_OP_LOOP_END 0x00004000 +#define ZEND_VM_OP_THIS 0x00005000 +#define ZEND_VM_OP_NEXT 0x00006000 +#define ZEND_VM_OP_CLASS_FETCH 0x00007000 +#define ZEND_VM_OP_CONSTRUCTOR 0x00008000 +#define ZEND_VM_OP_CONST_FETCH 0x00009000 +#define ZEND_VM_OP_CACHE_SLOT 0x0000a000 +#define ZEND_VM_EXT_VAR_FETCH (UINT64_C(0x00010000) << 32) +#define ZEND_VM_EXT_ISSET (UINT64_C(0x00020000) << 32) +#define ZEND_VM_EXT_CACHE_SLOT (UINT64_C(0x00040000) << 32) +#define ZEND_VM_EXT_ARRAY_INIT (UINT64_C(0x00080000) << 32) +#define ZEND_VM_EXT_REF (UINT64_C(0x00100000) << 32) +#define ZEND_VM_EXT_FETCH_REF (UINT64_C(0x00200000) << 32) +#define ZEND_VM_EXT_DIM_WRITE (UINT64_C(0x00400000) << 32) +#define ZEND_VM_EXT_MASK (UINT64_C(0x0f000000) << 32) +#define ZEND_VM_EXT_NUM (UINT64_C(0x01000000) << 32) +#define ZEND_VM_EXT_LAST_CATCH (UINT64_C(0x02000000) << 32) +#define ZEND_VM_EXT_JMP_ADDR (UINT64_C(0x03000000) << 32) +#define ZEND_VM_EXT_OP (UINT64_C(0x04000000) << 32) +#define ZEND_VM_EXT_TYPE (UINT64_C(0x07000000) << 32) +#define ZEND_VM_EXT_EVAL (UINT64_C(0x08000000) << 32) +#define ZEND_VM_EXT_TYPE_MASK (UINT64_C(0x09000000) << 32) +#define ZEND_VM_EXT_SRC (UINT64_C(0x0b000000) << 32) +#define ZEND_VM_NO_CONST_CONST (UINT64_C(0x40000000) << 32) +#define ZEND_VM_COMMUTATIVE (UINT64_C(0x80000000) << 32) +#define ZEND_VM_OP1_FLAGS(flags) (flags & 0x0000ffff) +#define ZEND_VM_OP2_FLAGS(flags) ((flags >> 16) & 0x0000ffff) BEGIN_EXTERN_C() ZEND_API const char* ZEND_FASTCALL zend_get_opcode_name(uint8_t opcode); -ZEND_API uint32_t ZEND_FASTCALL zend_get_opcode_flags(uint8_t opcode); +ZEND_API uint64_t ZEND_FASTCALL zend_get_opcode_flags(uint8_t opcode); ZEND_API uint8_t zend_get_opcode_id(const char *name, size_t length); END_EXTERN_C() diff --git a/ext/opcache/jit/zend_jit_vm_helpers.c b/ext/opcache/jit/zend_jit_vm_helpers.c index bed5ab59992ed..c17bb7bf552b4 100644 --- a/ext/opcache/jit/zend_jit_vm_helpers.c +++ b/ext/opcache/jit/zend_jit_vm_helpers.c @@ -845,7 +845,7 @@ zend_jit_trace_stop ZEND_FASTCALL zend_jit_trace_execute(zend_execute_data *ex, } op1_type |= flags; } else if (opline->op1_type == IS_UNUSED && (op_array->fn_flags & ZEND_ACC_CLOSURE)) { - uint32_t op1_flags = ZEND_VM_OP1_FLAGS(zend_get_opcode_flags(opline->opcode)); + uint64_t op1_flags = ZEND_VM_OP1_FLAGS(zend_get_opcode_flags(opline->opcode)); if ((op1_flags & ZEND_VM_OP_MASK) == ZEND_VM_OP_THIS) { op1_type = IS_OBJECT; ce1 = Z_OBJCE(EX(This));