]> granicus.if.org Git - php/commitdiff
- MFH Little debug hack to allow printing vm function
authorMarcus Boerger <helly@php.net>
Mon, 21 Jul 2008 08:14:24 +0000 (08:14 +0000)
committerMarcus Boerger <helly@php.net>
Mon, 21 Jul 2008 08:14:24 +0000 (08:14 +0000)
Zend/zend_vm_gen.php

index 10f1371880f2a0725a7a920d2184e5abdd1b76d4..45d80145a81ef76ffc817b57057b65a9ea4ac0b7 100644 (file)
@@ -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);
                }
        }