summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2020-06-16 11:27:34 +0300
committerDmitry Stogov <dmitry@zend.com>2020-06-16 11:27:34 +0300
commitbdd84063729dc06d32c454fdd70628e991627e9c (patch)
treef0c15409676dabb28415ee3e7d038f144c5dd2ab
parent293a0e797c305f686ace750751d942898c7dd78b (diff)
downloadphp-git-bdd84063729dc06d32c454fdd70628e991627e9c.tar.gz
Added JIT debug flag to dump the size of generated code (opcache.jit_debug=0x200)
-rw-r--r--ext/opcache/jit/zend_jit.c4
-rw-r--r--ext/opcache/jit/zend_jit.h1
2 files changed, 5 insertions, 0 deletions
diff --git a/ext/opcache/jit/zend_jit.c b/ext/opcache/jit/zend_jit.c
index 70102e58fe..cb6a1e7ce3 100644
--- a/ext/opcache/jit/zend_jit.c
+++ b/ext/opcache/jit/zend_jit.c
@@ -3833,6 +3833,10 @@ ZEND_EXT_API int zend_jit_startup(void *buf, size_t size, zend_bool reattached)
ZEND_EXT_API void zend_jit_shutdown(void)
{
+ if (JIT_G(debug) & ZEND_JIT_DEBUG_SIZE) {
+ fprintf(stderr, "\nJIT memory usage: %d\n", (char*)*dasm_ptr - (char*)dasm_buf);
+ }
+
#ifdef HAVE_OPROFILE
if (JIT_G(debug) & ZEND_JIT_DEBUG_OPROFILE) {
zend_jit_oprofile_shutdown();
diff --git a/ext/opcache/jit/zend_jit.h b/ext/opcache/jit/zend_jit.h
index 810f678d6c..406e0edece 100644
--- a/ext/opcache/jit/zend_jit.h
+++ b/ext/opcache/jit/zend_jit.h
@@ -53,6 +53,7 @@
#define ZEND_JIT_DEBUG_VTUNE (1<<7)
#define ZEND_JIT_DEBUG_GDB (1<<8)
+#define ZEND_JIT_DEBUG_SIZE (1<<9)
#define ZEND_JIT_DEBUG_TRACE_START (1<<12)
#define ZEND_JIT_DEBUG_TRACE_STOP (1<<13)