mirror of
https://github.com/php/php-src.git
synced 2026-04-05 07:02:33 +02:00
Properly define ZEND_OP_DATA in zend_vm_def.h
This allows zend_vm_gen.php to define them in zend_vm_opcodes.{c,h} without further hacks.
This commit is contained in:
@@ -766,8 +766,6 @@ ZEND_API void zend_assert_valid_class_name(const zend_string *const_name);
|
||||
|
||||
#include "zend_vm_opcodes.h"
|
||||
|
||||
#define ZEND_OP_DATA 137
|
||||
|
||||
/* END: OPCODES */
|
||||
|
||||
/* class fetches */
|
||||
|
||||
@@ -7875,3 +7875,5 @@ ZEND_VM_C_LABEL(call_trampoline_end):
|
||||
ZEND_VM_INC_OPCODE();
|
||||
ZEND_VM_LEAVE();
|
||||
}
|
||||
|
||||
ZEND_VM_DEFINE_OP(137, ZEND_OP_DATA);
|
||||
|
||||
@@ -1911,6 +1911,7 @@ call_trampoline_end:
|
||||
ZEND_VM_INC_OPCODE();
|
||||
ZEND_VM_LEAVE();
|
||||
}
|
||||
|
||||
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
|
||||
@@ -1353,6 +1353,31 @@ function gen_vm($def, $skel) {
|
||||
die("ERROR ($def:$lineno): helper '{$m[2]}' is not defined.\n");
|
||||
}
|
||||
$export[] = array("helper",$m[1],$m[2]);
|
||||
} else if (strpos($line,"ZEND_VM_DEFINE_OP(") === 0) {
|
||||
if (preg_match(
|
||||
"/^ZEND_VM_DEFINE_OP\(\s*([0-9]+)\s*,\s*([A-Z_]+)\s*\);/",
|
||||
$line,
|
||||
$m) == 0) {
|
||||
die("ERROR ($def:$lineno): Invalid ZEND_VM_DEFINE_OP definition.\n");
|
||||
}
|
||||
$code = (int)$m[1];
|
||||
$op = $m[2];
|
||||
$len = strlen($op);
|
||||
|
||||
if ($len > $max_opcode_len) {
|
||||
$max_opcode_len = $len;
|
||||
}
|
||||
if ($code > $max_opcode) {
|
||||
$max_opcode = $code;
|
||||
}
|
||||
if (isset($opcodes[$code])) {
|
||||
die("ERROR ($def:$lineno): Opcode with code '$code' is already defined.\n");
|
||||
}
|
||||
if (isset($opnames[$op])) {
|
||||
die("ERROR ($def:$lineno): Opcode with name '$op' is already defined.\n");
|
||||
}
|
||||
$opcodes[$code] = array("op"=>$op,"code"=>"");
|
||||
$opnames[$op] = $code;
|
||||
} else if ($handler !== null) {
|
||||
// Add line of code to current opcode handler
|
||||
$opcodes[$handler]["code"] .= $line;
|
||||
@@ -1418,9 +1443,9 @@ function gen_vm($def, $skel) {
|
||||
}
|
||||
fputs($f, "};\n\n");
|
||||
|
||||
fputs($f, "ZEND_API const char* zend_get_opcode_name(zend_uchar opcode) {\n");
|
||||
fputs($f, "\treturn zend_vm_opcodes_map[opcode];\n");
|
||||
fputs($f, "}\n");
|
||||
fputs($f, "ZEND_API const char* zend_get_opcode_name(zend_uchar opcode) {\n");
|
||||
fputs($f, "\treturn zend_vm_opcodes_map[opcode];\n");
|
||||
fputs($f, "}\n");
|
||||
|
||||
fclose($f);
|
||||
echo "zend_vm_opcodes.c generated successfully.\n";
|
||||
|
||||
@@ -159,7 +159,7 @@ const char *zend_vm_opcodes_map[171] = {
|
||||
"ZEND_POST_INC_OBJ",
|
||||
"ZEND_POST_DEC_OBJ",
|
||||
"ZEND_ASSIGN_OBJ",
|
||||
NULL,
|
||||
"ZEND_OP_DATA",
|
||||
"ZEND_INSTANCEOF",
|
||||
"ZEND_DECLARE_CLASS",
|
||||
"ZEND_DECLARE_INHERITED_CLASS",
|
||||
|
||||
@@ -169,6 +169,7 @@ END_EXTERN_C()
|
||||
#define ZEND_POST_INC_OBJ 134
|
||||
#define ZEND_POST_DEC_OBJ 135
|
||||
#define ZEND_ASSIGN_OBJ 136
|
||||
#define ZEND_OP_DATA 137
|
||||
#define ZEND_INSTANCEOF 138
|
||||
#define ZEND_DECLARE_CLASS 139
|
||||
#define ZEND_DECLARE_INHERITED_CLASS 140
|
||||
|
||||
Reference in New Issue
Block a user