Skip to content

Commit f4b4631

Browse files
committed
Prevent CGG reordering if hanlers order is defined by zend_vm_order.txt
1 parent 0085cbf commit f4b4631

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

Zend/zend_vm_gen.php

+12-8
Original file line numberDiff line numberDiff line change
@@ -1652,12 +1652,6 @@ function read_order_file($fn) {
16521652
function gen_executor_code($f, $spec, $kind, $prolog, &$switch_labels = array()) {
16531653
global $list, $opcodes, $helpers, $op_types_ex, $gen_order;
16541654

1655-
if ($kind == ZEND_VM_KIND_HYBRID && file_exists(__DIR__ . "/zend_vm_order.txt")) {
1656-
$gen_order = read_order_file(__DIR__ . "/zend_vm_order.txt");
1657-
} else {
1658-
$gen_order = null;
1659-
}
1660-
16611655
if ($spec) {
16621656
// Produce specialized executor
16631657
$op1t = $op_types_ex;
@@ -1770,7 +1764,13 @@ function skip_blanks($f, $prolog, $epilog) {
17701764

17711765
// Generates executor from skeleton file and definition (specialized or unspecialized)
17721766
function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name) {
1773-
global $params, $skeleton_file, $line_no;
1767+
global $params, $skeleton_file, $line_no, $gen_order;
1768+
1769+
if ($kind == ZEND_VM_KIND_HYBRID && file_exists(__DIR__ . "/zend_vm_order.txt")) {
1770+
$gen_order = read_order_file(__DIR__ . "/zend_vm_order.txt");
1771+
} else {
1772+
$gen_order = null;
1773+
}
17741774

17751775
$switch_labels = array();
17761776
$lineno = 0;
@@ -1811,7 +1811,11 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name)
18111811
out($f,"#endif\n\n");
18121812
}
18131813
out($f,"#ifndef VM_TRACE\n");
1814-
out($f,"# define VM_TRACE(op)\n");
1814+
if (is_array($gen_order)) {
1815+
out($f,"# define VM_TRACE(op) ZEND_VM_GUARD(op);\n");
1816+
} else {
1817+
out($f,"# define VM_TRACE(op)\n");
1818+
}
18151819
out($f,"#endif\n");
18161820
out($f,"#ifndef VM_TRACE_START\n");
18171821
out($f,"# define VM_TRACE_START()\n");

0 commit comments

Comments
 (0)