com php-src: Improve debugging of non-local variables: ext/opcache/Optimizer/block_pass.c ext/opcache/Optimizer/ zend_optimizer.h
| From: | Dmitry Stogov | Date: | Wed, 09 Dec 2015 14:21:57 +0000 |
| Subject: | com php-src: Improve debugging of non-local variables: ext/opcache/Optimizer/block_pass.c ext/opcache/Optimizer/ zend_optimizer.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-90186@lists.php.net to get a copy of this message | ||
Commit: 4fd30c9565dc9ee4fdc59beee0e98c2f0508178e
Author: Dmitry Stogov <dmitry@zend.com> Wed, 9 Dec 2015 17:21:57 +0300
Parents: d6d421b517d4f5ab4245ab1cb37d682cf3be42bf
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=4fd30c9565dc9ee4fdc59beee0e98c2f0508178e
Log:
Improve debugging of non-local variables
Changed paths:
M ext/opcache/Optimizer/block_pass.c
M ext/opcache/Optimizer/zend_optimizer.h
Diff:
diff --git a/ext/opcache/Optimizer/block_pass.c b/ext/opcache/Optimizer/block_pass.c
index 6aab22e...8c0bc91 100644
--- a/ext/opcache/Optimizer/block_pass.c
+++ b/ext/opcache/Optimizer/block_pass.c
@@ -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;
diff --git a/ext/opcache/Optimizer/zend_optimizer.h b/ext/opcache/Optimizer/zend_optimizer.h
index c8e33c3..c101301 100644
--- a/ext/opcache/Optimizer/zend_optimizer.h
+++ b/ext/opcache/Optimizer/zend_optimizer.h
@@ -62,8 +62,10 @@
#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;