]> granicus.if.org Git - php/commitdiff
Improve debugging of non-local variables
authorDmitry Stogov <dmitry@zend.com>
Wed, 9 Dec 2015 14:21:57 +0000 (17:21 +0300)
committerDmitry Stogov <dmitry@zend.com>
Wed, 9 Dec 2015 14:21:57 +0000 (17:21 +0300)
ext/opcache/Optimizer/block_pass.c
ext/opcache/Optimizer/zend_optimizer.h

index 6aab22eff58f88536dfcb26deb23012fbf86004c..8c0bc91762eb79cb815e1090077f220a577373dc 100644 (file)
@@ -30,8 +30,6 @@
 #include "zend_cfg.h"
 #include "zend_dump.h"
 
-#define DEBUG_BLOCKPASS 0
-
 /* Checks if a constant (like "true") may be replaced by its value */
 int zend_optimizer_get_persistent_constant(zend_string *name, zval *result, int copy)
 {
@@ -1534,15 +1532,14 @@ static void zend_t_usage(zend_cfg *cfg, zend_op_array *op_array, zend_bitset use
                }
        }
 
-#if DEBUG_BLOCKPASS > 2
-       {
+       if (ctx->debug_level & ZEND_DUMP_BLOCK_PASS_VARS) {
                int printed = 0;
                uint32_t i;
 
                for (i = op_array->last_var; i< op_array->T; i++) {
                        if (zend_bitset_in(used_ext, i)) {
                                if (!printed) {
-                                       fprintf(stderr, "NON-LOCAL-VARS: %s: %d", op_array->function_name ? op_array->function_name->val : "(null)", i);
+                                       fprintf(stderr, "NON-LOCAL-VARS: %d", i);
                                        printed = 1;
                                } else {
                                        fprintf(stderr, ", %d", i);
@@ -1551,10 +1548,8 @@ static void zend_t_usage(zend_cfg *cfg, zend_op_array *op_array, zend_bitset use
                }
                if (printed) {
                        fprintf(stderr, "\n");
-                       zend_dump_op_array(op_array, cfg, 0);
                }
        }
-#endif
 
        for (n = 0; n < cfg->blocks_count; n++) {
                block = cfg->blocks + n;
index c8e33c368eb00d4c6f2754b1ff996dc5f032a907..c1013013ce9f667364c280b3101040d848658e05 100644 (file)
 
 #define ZEND_DUMP_BEFORE_OPTIMIZER  (1<<16)
 #define ZEND_DUMP_AFTER_OPTIMIZER   (1<<17)
+
 #define ZEND_DUMP_BEFORE_BLOCK_PASS (1<<18)
 #define ZEND_DUMP_AFTER_BLOCK_PASS  (1<<19)
+#define ZEND_DUMP_BLOCK_PASS_VARS   (1<<20)
 
 typedef struct _zend_script {
        zend_string   *filename;