Skip to content

Commit bdd8406

Browse files
committed
Added JIT debug flag to dump the size of generated code (opcache.jit_debug=0x200)
1 parent 293a0e7 commit bdd8406

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

ext/opcache/jit/zend_jit.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3833,6 +3833,10 @@ ZEND_EXT_API int zend_jit_startup(void *buf, size_t size, zend_bool reattached)
38333833

38343834
ZEND_EXT_API void zend_jit_shutdown(void)
38353835
{
3836+
if (JIT_G(debug) & ZEND_JIT_DEBUG_SIZE) {
3837+
fprintf(stderr, "\nJIT memory usage: %d\n", (char*)*dasm_ptr - (char*)dasm_buf);
3838+
}
3839+
38363840
#ifdef HAVE_OPROFILE
38373841
if (JIT_G(debug) & ZEND_JIT_DEBUG_OPROFILE) {
38383842
zend_jit_oprofile_shutdown();

ext/opcache/jit/zend_jit.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
#define ZEND_JIT_DEBUG_VTUNE (1<<7)
5454

5555
#define ZEND_JIT_DEBUG_GDB (1<<8)
56+
#define ZEND_JIT_DEBUG_SIZE (1<<9)
5657

5758
#define ZEND_JIT_DEBUG_TRACE_START (1<<12)
5859
#define ZEND_JIT_DEBUG_TRACE_STOP (1<<13)

0 commit comments

Comments
 (0)