Skip to content

Commit 7382895

Browse files
committed
Change script to define 'ZEND_VM_GEN_KIND' instead of 'ZEND_VM_KIND' for internal usage
1 parent 5cf4861 commit 7382895

File tree

1 file changed

+21
-22
lines changed

1 file changed

+21
-22
lines changed

Zend/zend_vm_gen.php

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,7 @@ function($matches) use ($spec, $prefix, $op1, $op2, $extra_spec, $name, $kind) {
846846
$handler = $matches[1];
847847
$opcode = $opcodes[$opnames[$handler]];
848848
$inline =
849-
ZEND_VM_KIND == ZEND_VM_KIND_HYBRID &&
849+
ZEND_VM_GEN_KIND == ZEND_VM_KIND_HYBRID &&
850850
isset($opcode["use"]) &&
851851
is_hot_handler($opcode["hot"], $op1, $op2, $extra_spec) &&
852852
is_hot_handler($opcodes[$opnames[$name]]["hot"], $op1, $op2, $extra_spec) ?
@@ -1091,7 +1091,7 @@ function gen_handler($f, $spec, $kind, $name, $op1, $op2, $use, $code, $lineno,
10911091
case ZEND_VM_KIND_CALL:
10921092
case ZEND_VM_KIND_TAILCALL:
10931093
$cconv = $kind === ZEND_VM_KIND_TAILCALL ? 'ZEND_OPCODE_HANDLER_CCONV' : 'ZEND_OPCODE_HANDLER_FUNC_CCONV';
1094-
if ($opcode["hot"] && ZEND_VM_KIND == ZEND_VM_KIND_HYBRID && is_hot_handler($opcode["hot"], $op1, $op2, $extra_spec)) {
1094+
if ($opcode["hot"] && ZEND_VM_GEN_KIND == ZEND_VM_KIND_HYBRID && is_hot_handler($opcode["hot"], $op1, $op2, $extra_spec)) {
10951095
if (isset($opcode["use"])) {
10961096
out($f,"static zend_always_inline ZEND_OPCODE_HANDLER_RET {$cconv} {$spec_name}_INLINE_HANDLER(ZEND_OPCODE_HANDLER_ARGS)\n");
10971097
$additional_func = true;
@@ -2485,21 +2485,20 @@ function gen_vm_opcodes_header(
24852485
};
24862486
24872487
ENDNAMES;
2488-
$str .= "#define ZEND_VM_KIND_AS_STRING\tzend_vm_kind_name[ZEND_VM_KIND]\n";
24892488
$str .= "#if 0\n";
2490-
if ($GLOBALS["vm_kind_name"][ZEND_VM_KIND] === "ZEND_VM_KIND_HYBRID") {
2489+
if ($GLOBALS["vm_kind_name"][ZEND_VM_GEN_KIND] === "ZEND_VM_KIND_HYBRID") {
24912490
$str .= "/* HYBRID requires support for computed GOTO and global register variables*/\n";
24922491
$str .= "#elif (defined(__GNUC__) && defined(HAVE_GCC_GLOBAL_REGS))\n";
24932492
$str .= "# define ZEND_VM_KIND\t\tZEND_VM_KIND_HYBRID\n";
24942493
}
2495-
if ($GLOBALS["vm_kind_name"][ZEND_VM_KIND] === "ZEND_VM_KIND_HYBRID" || $GLOBALS["vm_kind_name"][ZEND_VM_KIND] === "ZEND_VM_KIND_CALL") {
2494+
if ($GLOBALS["vm_kind_name"][ZEND_VM_GEN_KIND] === "ZEND_VM_KIND_HYBRID" || $GLOBALS["vm_kind_name"][ZEND_VM_GEN_KIND] === "ZEND_VM_KIND_CALL") {
24962495
$str .= "#elif defined(HAVE_MUSTTAIL) && defined(HAVE_PRESERVE_NONE) && (defined(__x86_64__) || defined(__aarch64__))\n";
24972496
$str .= "# define ZEND_VM_KIND\t\tZEND_VM_KIND_TAILCALL\n";
24982497
$str .= "#else\n";
24992498
$str .= "# define ZEND_VM_KIND\t\tZEND_VM_KIND_CALL\n";
25002499
} else {
25012500
$str .= "#else\n";
2502-
$str .= "#define ZEND_VM_KIND\t\t" . $GLOBALS["vm_kind_name"][ZEND_VM_KIND] . "\n";
2501+
$str .= "#define ZEND_VM_KIND\t\t" . $GLOBALS["vm_kind_name"][ZEND_VM_GEN_KIND] . "\n";
25032502
}
25042503
$str .= "#endif\n";
25052504
$str .= "\n";
@@ -2753,9 +2752,9 @@ function gen_vm($def, $skel) {
27532752
}
27542753

27552754
// Store parameters
2756-
if ((ZEND_VM_KIND == ZEND_VM_KIND_GOTO
2757-
|| ZEND_VM_KIND == ZEND_VM_KIND_SWITCH
2758-
|| (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID && $hot))
2755+
if ((ZEND_VM_GEN_KIND == ZEND_VM_KIND_GOTO
2756+
|| ZEND_VM_GEN_KIND == ZEND_VM_KIND_SWITCH
2757+
|| (ZEND_VM_GEN_KIND == ZEND_VM_KIND_HYBRID && $hot))
27592758
&& $param) {
27602759
foreach (explode(",", $param ) as $p) {
27612760
$p = trim($p);
@@ -2817,7 +2816,7 @@ function gen_vm($def, $skel) {
28172816
die("ERROR ($def:$lineno): Opcode with name '$op' is not defined.\n");
28182817
}
28192818
$opcodes[$opnames[$dsc['op']]]['alias'] = $op;
2820-
if (!ZEND_VM_SPEC && ZEND_VM_KIND == ZEND_VM_KIND_SWITCH) {
2819+
if (!ZEND_VM_SPEC && ZEND_VM_GEN_KIND == ZEND_VM_KIND_SWITCH) {
28212820
$code = $opnames[$op];
28222821
$opcodes[$code]['use'] = 1;
28232822
}
@@ -2930,7 +2929,7 @@ function gen_vm($def, $skel) {
29302929
out($f, "255\n};\n\n");
29312930

29322931
// Generate specialized executor
2933-
gen_executor($f, $skl, ZEND_VM_SPEC, ZEND_VM_KIND, "execute", "zend_vm_init");
2932+
gen_executor($f, $skl, ZEND_VM_SPEC, ZEND_VM_GEN_KIND, "execute", "zend_vm_init");
29342933
out($f, "\n");
29352934

29362935
// Generate zend_vm_get_opcode_handler() function
@@ -3024,7 +3023,7 @@ function gen_vm($def, $skel) {
30243023
out($f, "}\n");
30253024
out($f, "#endif\n\n");
30263025

3027-
if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID || ZEND_VM_KIND == ZEND_VM_KIND_CALL) {
3026+
if (ZEND_VM_GEN_KIND == ZEND_VM_KIND_HYBRID || ZEND_VM_GEN_KIND == ZEND_VM_KIND_CALL) {
30283027
// Generate zend_vm_get_opcode_handler_func() function
30293028
out($f, "#if ZEND_VM_KIND == ZEND_VM_KIND_HYBRID || ZEND_VM_KIND == ZEND_VM_KIND_TAILCALL\n");
30303029
out($f,"static zend_vm_opcode_handler_func_t zend_vm_get_opcode_handler_func(uint8_t opcode, const zend_op* op)\n");
@@ -3135,10 +3134,10 @@ function gen_vm($def, $skel) {
31353134
out($f, "}\n\n");
31363135

31373136
// Generate zend_vm_call_opcode_handler() function
3138-
if (ZEND_VM_KIND == ZEND_VM_KIND_CALL || ZEND_VM_KIND == ZEND_VM_KIND_HYBRID) {
3137+
if (ZEND_VM_GEN_KIND == ZEND_VM_KIND_CALL || ZEND_VM_GEN_KIND == ZEND_VM_KIND_HYBRID) {
31393138
out($f, "ZEND_API int ZEND_FASTCALL zend_vm_call_opcode_handler(zend_execute_data* ex)\n");
31403139
out($f, "{\n");
3141-
if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID) {
3140+
if (ZEND_VM_GEN_KIND == ZEND_VM_KIND_HYBRID) {
31423141
out($f,"#if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID || ZEND_VM_KIND == ZEND_VM_KIND_TAILCALL)\n");
31433142
out($f, "\tzend_vm_opcode_handler_func_t handler;\n");
31443143
out($f,"#endif\n");
@@ -3157,15 +3156,15 @@ function gen_vm($def, $skel) {
31573156
out($f, "\n");
31583157
out($f, "\tLOAD_OPLINE();\n");
31593158
out($f,"#if defined(ZEND_VM_FP_GLOBAL_REG) && defined(ZEND_VM_IP_GLOBAL_REG)\n");
3160-
if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID) {
3159+
if (ZEND_VM_GEN_KIND == ZEND_VM_KIND_HYBRID) {
31613160
out($f,"#if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID)\n");
31623161
out($f, "\thandler = zend_vm_get_opcode_handler_func(zend_user_opcodes[opline->opcode], opline);\n");
31633162
out($f, "\thandler(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n");
31643163
out($f, "\tif (EXPECTED(opline != &hybrid_halt_op)) {\n");
31653164
out($f,"#else\n");
31663165
}
31673166
out($f, "\t(OPLINE->handler)(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n");
3168-
if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID) {
3167+
if (ZEND_VM_GEN_KIND == ZEND_VM_KIND_HYBRID) {
31693168
out($f, "\tif (EXPECTED(opline)) {\n");
31703169
out($f,"#endif\n");
31713170
} else {
@@ -3248,16 +3247,16 @@ function usage() {
32483247
$kind = substr($argv[$i], strlen("--with-vm-kind="));
32493248
switch ($kind) {
32503249
case "CALL":
3251-
define("ZEND_VM_KIND", ZEND_VM_KIND_CALL);
3250+
define("ZEND_VM_GEN_KIND", ZEND_VM_KIND_CALL);
32523251
break;
32533252
case "SWITCH":
3254-
define("ZEND_VM_KIND", ZEND_VM_KIND_SWITCH);
3253+
define("ZEND_VM_GEN_KIND", ZEND_VM_KIND_SWITCH);
32553254
break;
32563255
case "GOTO":
3257-
define("ZEND_VM_KIND", ZEND_VM_KIND_GOTO);
3256+
define("ZEND_VM_GEN_KIND", ZEND_VM_KIND_GOTO);
32583257
break;
32593258
case "HYBRID":
3260-
define("ZEND_VM_KIND", ZEND_VM_KIND_HYBRID);
3259+
define("ZEND_VM_GEN_KIND", ZEND_VM_KIND_HYBRID);
32613260
break;
32623261
default:
32633262
echo("ERROR: Invalid vm kind '$kind'\n");
@@ -3281,9 +3280,9 @@ function usage() {
32813280
}
32823281

32833282
// Using defaults
3284-
if (!defined("ZEND_VM_KIND")) {
3283+
if (!defined("ZEND_VM_GEN_KIND")) {
32853284
// Using CALL threading by default
3286-
define("ZEND_VM_KIND", ZEND_VM_KIND_HYBRID);
3285+
define("ZEND_VM_GEN_KIND", ZEND_VM_KIND_HYBRID);
32873286
}
32883287
if (!defined("ZEND_VM_SPEC")) {
32893288
// Using specialized executor by default

0 commit comments

Comments
 (0)