com php-src: Add jit_bisect_limit: ext/opcache/ZendAcce lerator.h ext/opcache/jit/zend_jit.c ext/opcache/zend _accelerator_module.c
| From: | Nikita Popov | Date: | Fri, 30 Aug 2019 12:50:22 +0000 |
| Subject: | com php-src: Add jit_bisect_limit: ext/opcache/ZendAcce lerator.h ext/opcache/jit/zend_jit.c ext/opcache/zend _accelerator_module.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-108158@lists.php.net to get a copy of this message | ||
Commit: 65fa6dac195a859f6b96bdbf06f69645215df9c6
Author: Nikita Popov <nikita.ppv@gmail.com> Fri, 30 Aug 2019 12:47:49 +0200
Parents: 39ab4104ed89d2457742dea4bd68e7e5fa2901c6
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=65fa6dac195a859f6b96bdbf06f69645215df9c6
Log:
Add jit_bisect_limit
To help identify which function is being miscompiled.
Changed paths:
M ext/opcache/ZendAccelerator.h
M ext/opcache/jit/zend_jit.c
M ext/opcache/zend_accelerator_module.c
Diff:
diff --git a/ext/opcache/ZendAccelerator.h b/ext/opcache/ZendAccelerator.h
index 0f31c65..8a49c8e 100644
--- a/ext/opcache/ZendAccelerator.h
+++ b/ext/opcache/ZendAccelerator.h
@@ -192,6 +192,7 @@ typedef struct _zend_accel_directives {
zend_long jit;
zend_long jit_buffer_size;
zend_long jit_debug;
+ zend_long jit_bisect_limit;
#endif
} zend_accel_directives;
diff --git a/ext/opcache/jit/zend_jit.c b/ext/opcache/jit/zend_jit.c
index 6f537da..bba076c 100644
--- a/ext/opcache/jit/zend_jit.c
+++ b/ext/opcache/jit/zend_jit.c
@@ -92,6 +92,8 @@ static void **dasm_ptr = NULL;
static size_t dasm_size = 0;
+static zend_long jit_bisect_pos = 0;
+
static const void *zend_jit_runtime_jit_handler = NULL;
static const void *zend_jit_profile_jit_handler = NULL;
static const void *zend_jit_func_counter_handler = NULL;
@@ -1972,6 +1974,20 @@ static int zend_jit(zend_op_array *op_array, zend_ssa *ssa, const zend_op
*rt_op
zend_bool is_terminated = 1; /* previous basic block is terminated by jump */
zend_bool recv_emitted = 0; /* emitted at least one RECV opcode */
+ if (ZCG(accel_directives).jit_bisect_limit) {
+ jit_bisect_pos++;
+ if (jit_bisect_pos >= ZCG(accel_directives).jit_bisect_limit) {
+ if (jit_bisect_pos == ZCG(accel_directives).jit_bisect_limit) {
+ fprintf(stderr, "Not JITing %s%s%s in %s:%d and after due to jit_bisect_limit\n",
+ op_array->scope ? ZSTR_VAL(op_array->scope->name) : "",
+ op_array->scope ? "::" : "",
+ op_array->function_name ? ZSTR_VAL(op_array->function_name) : "{main}",
+ ZSTR_VAL(op_array->filename), op_array->line_start);
+ }
+ return FAILURE;
+ }
+ }
+
if (zend_jit_reg_alloc) {
checkpoint = zend_arena_checkpoint(CG(arena));
ra = zend_jit_allocate_registers(op_array, ssa);
diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c
index 4e8c8c7..9f4dc2e 100644
--- a/ext/opcache/zend_accelerator_module.c
+++ b/ext/opcache/zend_accelerator_module.c
@@ -313,6 +313,7 @@ ZEND_INI_BEGIN()
STD_PHP_INI_ENTRY("opcache.jit" , ZEND_JIT_DEFAULT,
PHP_INI_SYSTEM, OnUpdateLong, accel_directives.jit, zend_accel_globals,
accel_globals)
STD_PHP_INI_ENTRY("opcache.jit_buffer_size" , "0" ,
PHP_INI_SYSTEM, OnUpdateLong, accel_directives.jit_buffer_size, zend_accel_globals,
accel_globals)
STD_PHP_INI_ENTRY("opcache.jit_debug" , "0" ,
PHP_INI_SYSTEM, OnUpdateLong, accel_directives.jit_debug, zend_accel_globals,
accel_globals)
+ STD_PHP_INI_ENTRY("opcache.jit_bisect_limit" , "0" ,
PHP_INI_SYSTEM, OnUpdateLong, accel_directives.jit_bisect_limit,
zend_accel_globals, accel_globals)
#endif
ZEND_INI_END()
@@ -780,6 +781,7 @@ static ZEND_FUNCTION(opcache_get_configuration)
add_assoc_long(&directives, "opcache.jit", ZCG(accel_directives).jit);
add_assoc_long(&directives, "opcache.jit_buffer_size",
ZCG(accel_directives).jit_buffer_size);
add_assoc_long(&directives, "opcache.jit_debug", ZCG(accel_directives).jit_debug);
+ add_assoc_long(&directives, "opcache.jit_bisect_limit",
ZCG(accel_directives).jit_bisect_limit);
#endif
add_assoc_zval(return_value, "directives", &directives);