Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions Zend/zend_vm_gen.php
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ function($matches) use ($spec, $prefix, $op1, $op2, $extra_spec, $name) {
$handler = $matches[1];
$opcode = $opcodes[$opnames[$handler]];
$inline =
ZEND_VM_KIND == ZEND_VM_KIND_HYBRID &&
ZEND_VM_GEN_KIND == ZEND_VM_KIND_HYBRID &&
isset($opcode["use"]) &&
is_hot_handler($opcode["hot"], $op1, $op2, $extra_spec) &&
is_hot_handler($opcodes[$opnames[$name]]["hot"], $op1, $op2, $extra_spec) ?
Expand Down Expand Up @@ -1077,7 +1077,7 @@ function gen_handler($f, $spec, $kind, $name, $op1, $op2, $use, $code, $lineno,
}
return;
case ZEND_VM_KIND_CALL:
if ($opcode["hot"] && ZEND_VM_KIND == ZEND_VM_KIND_HYBRID && is_hot_handler($opcode["hot"], $op1, $op2, $extra_spec)) {
if ($opcode["hot"] && ZEND_VM_GEN_KIND == ZEND_VM_KIND_HYBRID && is_hot_handler($opcode["hot"], $op1, $op2, $extra_spec)) {
if (isset($opcode["use"])) {
out($f,"static zend_always_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL {$spec_name}_INLINE_HANDLER(ZEND_OPCODE_HANDLER_ARGS)\n");
$additional_func = true;
Expand Down Expand Up @@ -2326,15 +2326,15 @@ function gen_vm_opcodes_header(
$str .= "#define ZEND_VM_KIND_SWITCH\t" . ZEND_VM_KIND_SWITCH . "\n";
$str .= "#define ZEND_VM_KIND_GOTO\t" . ZEND_VM_KIND_GOTO . "\n";
$str .= "#define ZEND_VM_KIND_HYBRID\t" . ZEND_VM_KIND_HYBRID . "\n";
if ($GLOBALS["vm_kind_name"][ZEND_VM_KIND] === "ZEND_VM_KIND_HYBRID") {
if ($GLOBALS["vm_kind_name"][ZEND_VM_GEN_KIND] === "ZEND_VM_KIND_HYBRID") {
$str .= "/* HYBRID requires support for computed GOTO and global register variables*/\n";
$str .= "#if (defined(__GNUC__) && defined(HAVE_GCC_GLOBAL_REGS))\n";
$str .= "# define ZEND_VM_KIND\t\tZEND_VM_KIND_HYBRID\n";
$str .= "#else\n";
$str .= "# define ZEND_VM_KIND\t\tZEND_VM_KIND_CALL\n";
$str .= "#endif\n";
} else {
$str .= "#define ZEND_VM_KIND\t\t" . $GLOBALS["vm_kind_name"][ZEND_VM_KIND] . "\n";
$str .= "#define ZEND_VM_KIND\t\t" . $GLOBALS["vm_kind_name"][ZEND_VM_GEN_KIND] . "\n";
}
$str .= "\n";
$str .= "#if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID) && !defined(__SANITIZE_ADDRESS__)\n";
Expand Down Expand Up @@ -2536,9 +2536,9 @@ function gen_vm($def, $skel) {
}

// Store parameters
if ((ZEND_VM_KIND == ZEND_VM_KIND_GOTO
|| ZEND_VM_KIND == ZEND_VM_KIND_SWITCH
|| (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID && $hot))
if ((ZEND_VM_GEN_KIND == ZEND_VM_KIND_GOTO
|| ZEND_VM_GEN_KIND == ZEND_VM_KIND_SWITCH
|| (ZEND_VM_GEN_KIND == ZEND_VM_KIND_HYBRID && $hot))
&& $param) {
foreach (explode(",", $param ) as $p) {
$p = trim($p);
Expand Down Expand Up @@ -2600,7 +2600,7 @@ function gen_vm($def, $skel) {
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) {
if (!ZEND_VM_SPEC && ZEND_VM_GEN_KIND == ZEND_VM_KIND_SWITCH) {
$code = $opnames[$op];
$opcodes[$code]['use'] = 1;
}
Expand Down Expand Up @@ -2713,7 +2713,7 @@ function gen_vm($def, $skel) {
out($f, "255\n};\n\n");

// Generate specialized executor
gen_executor($f, $skl, ZEND_VM_SPEC, ZEND_VM_KIND, "execute", "zend_vm_init");
gen_executor($f, $skl, ZEND_VM_SPEC, ZEND_VM_GEN_KIND, "execute", "zend_vm_init");
out($f, "\n");

// Generate zend_vm_get_opcode_handler() function
Expand Down Expand Up @@ -2807,7 +2807,7 @@ function gen_vm($def, $skel) {
out($f, "}\n");
out($f, "#endif\n\n");

if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID) {
if (ZEND_VM_GEN_KIND == ZEND_VM_KIND_HYBRID) {
// Generate zend_vm_get_opcode_handler_func() function
out($f, "#if ZEND_VM_KIND == ZEND_VM_KIND_HYBRID\n");
out($f,"static const void *zend_vm_get_opcode_handler_func(uint8_t opcode, const zend_op* op)\n");
Expand Down Expand Up @@ -2918,10 +2918,10 @@ function gen_vm($def, $skel) {
out($f, "}\n\n");

// Generate zend_vm_call_opcode_handler() function
if (ZEND_VM_KIND == ZEND_VM_KIND_CALL || ZEND_VM_KIND == ZEND_VM_KIND_HYBRID) {
if (ZEND_VM_GEN_KIND == ZEND_VM_KIND_CALL || ZEND_VM_GEN_KIND == ZEND_VM_KIND_HYBRID) {
out($f, "ZEND_API int ZEND_FASTCALL zend_vm_call_opcode_handler(zend_execute_data* ex)\n");
out($f, "{\n");
if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID) {
if (ZEND_VM_GEN_KIND == ZEND_VM_KIND_HYBRID) {
out($f,"#if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID)\n");
out($f, "\topcode_handler_t handler;\n");
out($f,"#endif\n");
Expand All @@ -2939,15 +2939,15 @@ function gen_vm($def, $skel) {
out($f, "\n");
out($f, "\tLOAD_OPLINE();\n");
out($f,"#if defined(ZEND_VM_FP_GLOBAL_REG) && defined(ZEND_VM_IP_GLOBAL_REG)\n");
if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID) {
if (ZEND_VM_GEN_KIND == ZEND_VM_KIND_HYBRID) {
out($f,"#if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID)\n");
out($f, "\thandler = (opcode_handler_t)zend_vm_get_opcode_handler_func(zend_user_opcodes[opline->opcode], opline);\n");
out($f, "\thandler(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n");
out($f, "\tif (EXPECTED(opline != &hybrid_halt_op)) {\n");
out($f,"#else\n");
}
out($f, "\t((opcode_handler_t)OPLINE->handler)(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n");
if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID) {
if (ZEND_VM_GEN_KIND == ZEND_VM_KIND_HYBRID) {
out($f, "\tif (EXPECTED(opline)) {\n");
out($f,"#endif\n");
} else {
Expand Down Expand Up @@ -3009,16 +3009,16 @@ function usage() {
$kind = substr($argv[$i], strlen("--with-vm-kind="));
switch ($kind) {
case "CALL":
define("ZEND_VM_KIND", ZEND_VM_KIND_CALL);
define("ZEND_VM_GEN_KIND", ZEND_VM_KIND_CALL);
break;
case "SWITCH":
define("ZEND_VM_KIND", ZEND_VM_KIND_SWITCH);
define("ZEND_VM_GEN_KIND", ZEND_VM_KIND_SWITCH);
break;
case "GOTO":
define("ZEND_VM_KIND", ZEND_VM_KIND_GOTO);
define("ZEND_VM_GEN_KIND", ZEND_VM_KIND_GOTO);
break;
case "HYBRID":
define("ZEND_VM_KIND", ZEND_VM_KIND_HYBRID);
define("ZEND_VM_GEN_KIND", ZEND_VM_KIND_HYBRID);
break;
default:
echo("ERROR: Invalid vm kind '$kind'\n");
Expand All @@ -3042,9 +3042,9 @@ function usage() {
}

// Using defaults
if (!defined("ZEND_VM_KIND")) {
if (!defined("ZEND_VM_GEN_KIND")) {
// Using CALL threading by default
define("ZEND_VM_KIND", ZEND_VM_KIND_HYBRID);
define("ZEND_VM_GEN_KIND", ZEND_VM_KIND_HYBRID);
}
if (!defined("ZEND_VM_SPEC")) {
// Using specialized executor by default
Expand Down
Loading