Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/opcache/jit/zend_jit.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@

#define ZEND_JIT_DEBUG_PERSISTENT 0x1f0 /* profile and debugger flags can't be changed at run-time */

#define ZEND_JIT_TRACE_MAX_LENGTH 1024 /* max length of single trace */
#define ZEND_JIT_TRACE_MAX_EXITS 512 /* max number of side exits per trace */

#define ZEND_JIT_TRACE_MAX_FUNCS 30 /* max number of different functions in a single trace */
Expand Down Expand Up @@ -115,6 +114,7 @@ typedef struct _zend_jit_globals {
zend_long max_recursive_calls; /* max number of recursive inlined call unrolls */
zend_long max_recursive_returns; /* max number of recursive inlined return unrolls */
zend_long max_polymorphic_calls; /* max number of inlined polymorphic calls */
zend_long max_trace_length; /* max length of a single trace */

zend_sym_node *symbols; /* symbols for disassembler */

Expand Down
4 changes: 2 additions & 2 deletions ext/opcache/jit/zend_jit_trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -7591,7 +7591,7 @@ int ZEND_FASTCALL zend_jit_trace_hot_root(zend_execute_data *execute_data, const
zend_jit_op_array_trace_extension *jit_extension;
size_t offset;
uint32_t trace_num;
zend_jit_trace_rec trace_buffer[ZEND_JIT_TRACE_MAX_LENGTH];
zend_jit_trace_rec trace_buffer[JIT_G(max_trace_length)];

ZEND_ASSERT(EX(func)->type == ZEND_USER_FUNCTION);
ZEND_ASSERT(opline >= EX(func)->op_array.opcodes &&
Expand Down Expand Up @@ -7926,7 +7926,7 @@ int ZEND_FASTCALL zend_jit_trace_hot_side(zend_execute_data *execute_data, uint3
zend_jit_trace_stop stop;
int ret = 0;
uint32_t trace_num;
zend_jit_trace_rec trace_buffer[ZEND_JIT_TRACE_MAX_LENGTH];
zend_jit_trace_rec trace_buffer[JIT_G(max_trace_length)];
uint32_t is_megamorphic = 0;
uint32_t polymorphism = 0;

Expand Down
4 changes: 2 additions & 2 deletions ext/opcache/jit/zend_jit_vm_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_jit_loop_trace_helper(ZEND_OPCODE_HAN
trace_buffer[idx].info = _op | (_info); \
trace_buffer[idx].ptr = _ptr; \
idx++; \
if (idx >= ZEND_JIT_TRACE_MAX_LENGTH - 2) { \
if (idx >= JIT_G(max_trace_length) - 2) { \
stop = ZEND_JIT_TRACE_STOP_TOO_LONG; \
break; \
}
Expand All @@ -372,7 +372,7 @@ ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_jit_loop_trace_helper(ZEND_OPCODE_HAN
trace_buffer[idx].op3_type = _op3_type; \
trace_buffer[idx].ptr = _ptr; \
idx++; \
if (idx >= ZEND_JIT_TRACE_MAX_LENGTH - 2) { \
if (idx >= JIT_G(max_trace_length) - 2) { \
stop = ZEND_JIT_TRACE_STOP_TOO_LONG; \
break; \
}
Expand Down
2 changes: 2 additions & 0 deletions ext/opcache/zend_accelerator_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ ZEND_INI_BEGIN()
STD_PHP_INI_ENTRY("opcache.jit_max_recursive_calls" , "2", PHP_INI_ALL, OnUpdateUnrollC, max_recursive_calls, zend_jit_globals, jit_globals)
STD_PHP_INI_ENTRY("opcache.jit_max_recursive_returns" , "2", PHP_INI_ALL, OnUpdateUnrollR, max_recursive_returns, zend_jit_globals, jit_globals)
STD_PHP_INI_ENTRY("opcache.jit_max_polymorphic_calls" , "2", PHP_INI_ALL, OnUpdateLong, max_polymorphic_calls, zend_jit_globals, jit_globals)
STD_PHP_INI_ENTRY("opcache.jit_max_trace_length" , "1024", PHP_INI_ALL, OnUpdateLong, max_trace_length, zend_jit_globals, jit_globals)
#endif
ZEND_INI_END()

Expand Down Expand Up @@ -849,6 +850,7 @@ ZEND_FUNCTION(opcache_get_configuration)
add_assoc_long(&directives, "opcache.jit_max_root_traces", JIT_G(max_root_traces));
add_assoc_long(&directives, "opcache.jit_max_side_traces", JIT_G(max_side_traces));
add_assoc_long(&directives, "opcache.jit_prof_threshold", JIT_G(prof_threshold));
add_assoc_long(&directives, "opcache.jit_max_trace_length", JIT_G(max_trace_length));
#endif

add_assoc_zval(return_value, "directives", &directives);
Expand Down