Skip to content

Commit

Permalink
Remove a few references to $GLOBALS and clean up a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
SammyK committed Jun 1, 2016
1 parent 1afcf15 commit 6f10874
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions Zend/zend_vm_gen.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
$Id$
*/

$header_text = <<< DATA
const HEADER_TEXT = <<< DATA
/*
+----------------------------------------------------------------------+
| Zend Engine |
Expand Down Expand Up @@ -50,9 +50,9 @@

error_reporting(E_ALL);

define("ZEND_VM_KIND_CALL", 1);
define("ZEND_VM_KIND_SWITCH", 2);
define("ZEND_VM_KIND_GOTO", 3);
const ZEND_VM_KIND_CALL = 1;
const ZEND_VM_KIND_SWITCH = 2;
const ZEND_VM_KIND_GOTO = 3;

$vm_op_flags = array(
"ZEND_VM_OP_SPEC" => 1<<0,
Expand Down Expand Up @@ -2136,7 +2136,7 @@ function gen_vm($def, $skel) {
$f = fopen(__DIR__ . "/zend_vm_opcodes.h", "w+") or die("ERROR: Cannot create zend_vm_opcodes.h\n");

// Insert header
out($f, $GLOBALS['header_text']);
out($f, HEADER_TEXT);
fputs($f, "#ifndef ZEND_VM_OPCODES_H\n#define ZEND_VM_OPCODES_H\n\n");
fputs($f, "#define ZEND_VM_SPEC\t\t" . ZEND_VM_SPEC . "\n");
fputs($f, "#define ZEND_VM_LINES\t\t" . ZEND_VM_LINES . "\n");
Expand Down Expand Up @@ -2176,7 +2176,7 @@ function gen_vm($def, $skel) {
$f = fopen(__DIR__ . "/zend_vm_opcodes.c", "w+") or die("ERROR: Cannot create zend_vm_opcodes.c\n");

// Insert header
out($f, $GLOBALS['header_text']);
out($f, HEADER_TEXT);
fputs($f,"#include <stdio.h>\n");
fputs($f,"#include <zend.h>\n\n");

Expand Down Expand Up @@ -2208,7 +2208,7 @@ function gen_vm($def, $skel) {
$executor_file = realpath(__DIR__ . "/zend_vm_execute.h");

// Insert header
out($f, $GLOBALS['header_text']);
out($f, HEADER_TEXT);

out($f, "#ifdef ZEND_WIN32\n");
// Suppress free_op1 warnings on Windows
Expand Down Expand Up @@ -2497,7 +2497,7 @@ function usage() {
}

// Parse arguments
for ($i = 1; $i < $argc; $i++) {
for ($i = 1; $i < $argc; $i++) {
if (strpos($argv[$i],"--with-vm-kind=") === 0) {
$kind = substr($argv[$i], strlen("--with-vm-kind="));
switch ($kind) {
Expand All @@ -2516,7 +2516,7 @@ function usage() {
die();
}
} else if ($argv[$i] == "--without-specializer") {
// Disabling specialization
// Disabling specialization
define("ZEND_VM_SPEC", 0);
} else if ($argv[$i] == "--with-lines") {
// Enabling debugging using original zend_vm_def.h
Expand All @@ -2533,18 +2533,16 @@ function usage() {

// Using defaults
if (!defined("ZEND_VM_KIND")) {
// Using CALL threading by default
// Using CALL threading by default
define("ZEND_VM_KIND", ZEND_VM_KIND_CALL);
}
if (!defined("ZEND_VM_SPEC")) {
// Using specialized executor by default
// Using specialized executor by default
define("ZEND_VM_SPEC", 1);
}
if (!defined("ZEND_VM_LINES")) {
// Disabling #line directives
// Disabling #line directives
define("ZEND_VM_LINES", 0);
}

gen_vm(__DIR__ . "/zend_vm_def.h", __DIR__ . "/zend_vm_execute.skl");

?>

0 comments on commit 6f10874

Please sign in to comment.