Skip to content

Commit e0a40f4

Browse files
committed
Add API to exempt function from being JITed
Signed-off-by: Bob Weinand <[email protected]>
1 parent ba748e7 commit e0a40f4

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

ext/opcache/jit/zend_jit.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@ void zend_jit_startup(void *jit_buffer, size_t size, bool reattached);
162162
void zend_jit_shutdown(void);
163163
void zend_jit_activate(void);
164164
void zend_jit_deactivate(void);
165-
void zend_jit_status(zval *ret);
165+
ZEND_EXT_API void zend_jit_status(zval *ret);
166+
ZEND_EXT_API void zend_jit_blacklist_function(zend_op_array *op_array);
166167
void zend_jit_restart(void);
167168

168169
#define ZREG_LOAD (1<<0)

ext/opcache/jit/zend_jit_trace.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7656,6 +7656,23 @@ static void zend_jit_blacklist_root_trace(const zend_op *opline, size_t offset)
76567656
zend_shared_alloc_unlock();
76577657
}
76587658

7659+
ZEND_EXT_API void zend_jit_blacklist_function(zend_op_array *op_array) {
7660+
zend_jit_op_array_trace_extension *jit_extension = (zend_jit_op_array_trace_extension *)ZEND_FUNC_INFO(op_array);
7661+
if (!jit_extension) {
7662+
return;
7663+
}
7664+
7665+
// First not-skipped op
7666+
zend_op *opline = op_array->opcodes;
7667+
if (!(op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS)) {
7668+
while (opline->opcode == ZEND_RECV || opline->opcode == ZEND_RECV_INIT) {
7669+
opline++;
7670+
}
7671+
}
7672+
7673+
zend_jit_blacklist_root_trace(opline, jit_extension->offset);
7674+
}
7675+
76597676
static bool zend_jit_trace_is_bad_root(const zend_op *opline, zend_jit_trace_stop stop, size_t offset)
76607677
{
76617678
const zend_op **cache_opline = JIT_G(bad_root_cache_opline);

0 commit comments

Comments
 (0)