Skip to content

Commit f50a2ce

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

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
@@ -7602,6 +7602,23 @@ static void zend_jit_blacklist_root_trace(const zend_op *opline, size_t offset)
76027602
zend_shared_alloc_unlock();
76037603
}
76047604

7605+
ZEND_EXT_API void zend_jit_blacklist_function(zend_op_array *op_array) {
7606+
zend_jit_op_array_trace_extension *jit_extension = (zend_jit_op_array_trace_extension *)ZEND_FUNC_INFO(op_array);
7607+
if (!jit_extension) {
7608+
return;
7609+
}
7610+
7611+
// First not-skipped op
7612+
zend_op *opline = op_array->opcodes;
7613+
if (!(op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS)) {
7614+
while (opline->opcode == ZEND_RECV || opline->opcode == ZEND_RECV_INIT) {
7615+
opline++;
7616+
}
7617+
}
7618+
7619+
zend_jit_blacklist_root_trace(opline, jit_extension->offset);
7620+
}
7621+
76057622
static bool zend_jit_trace_is_bad_root(const zend_op *opline, zend_jit_trace_stop stop, size_t offset)
76067623
{
76077624
const zend_op **cache_opline = JIT_G(bad_root_cache_opline);

0 commit comments

Comments
 (0)