From: Marcus Boerger Date: Mon, 21 Jul 2008 08:14:24 +0000 (+0000) Subject: - MFH Little debug hack to allow printing vm function X-Git-Tag: php-5.3.0alpha1~251 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2b5e4d45537b3156b6ca318f588f21eaefa7f180;p=php - MFH Little debug hack to allow printing vm function --- diff --git a/Zend/zend_vm_gen.php b/Zend/zend_vm_gen.php index 10f1371880..45d80145a8 100644 --- a/Zend/zend_vm_gen.php +++ b/Zend/zend_vm_gen.php @@ -304,7 +304,7 @@ function helper_name($name, $spec, $op1, $op2) { } // Generates code for opcode handler or helper -function gen_code($f, $spec, $kind, $export, $code, $op1, $op2) { +function gen_code($f, $spec, $kind, $export, $code, $op1, $op2, $name) { global $op1_type, $op2_type, $op1_get_zval_ptr, $op2_get_zval_ptr, $op1_get_zval_ptr_ptr, $op2_get_zval_ptr_ptr, $op1_get_obj_zval_ptr, $op2_get_obj_zval_ptr, @@ -381,6 +381,9 @@ function gen_code($f, $spec, $kind, $export, $code, $op1, $op2) { ), $code); + if (0 && strpos($code, '{') === 0) { + $code = "{\n\tfprintf(stderr, \"$name\\n\");\n" . substr($code, 1); + } // Updating code according to selected threading model switch($kind) { case ZEND_VM_KIND_CALL: @@ -506,7 +509,7 @@ function gen_handler($f, $spec, $kind, $name, $op1, $op2, $use, $code, $lineno) } // Generate opcode handler's code - gen_code($f, $spec, $kind, 0, $code, $op1, $op2); + gen_code($f, $spec, $kind, 0, $code, $op1, $op2, $name); } // Generates helper @@ -537,7 +540,7 @@ function gen_helper($f, $spec, $kind, $name, $op1, $op2, $param, $code, $lineno) } // Generate helper's code - gen_code($f, $spec, $kind, 0, $code, $op1, $op2); + gen_code($f, $spec, $kind, 0, $code, $op1, $op2, $name); } // Generates array of opcode handlers (specialized or unspecialized) @@ -1254,7 +1257,7 @@ function gen_vm($def, $skel) { } } if (!$done) { - gen_code($f, 0, ZEND_VM_KIND_CALL, 1, $code, 'ANY', 'ANY'); + gen_code($f, 0, ZEND_VM_KIND_CALL, 1, $code, 'ANY', 'ANY', $name); } }