Skip to content

Commit 16ca097

Browse files
committed
Do not exit to VM when setting undefined prop in constructor
JIT'ed ASSIGN_OBJ expressions will exit to VM when the prop is undef. However, in a constructor it's very likely the case. Therefore most traces with `new` expressions will exit to VM. Here I ensure that we don't need to exit to VM when it's likely that the prop will be undef. In the function JIT we compile a slow path to handle such properties, but not in the tracing JIT, assumingly to reduce code size. Here I enable compilation of the slow path in the tracing JIT when it's likely the prop will be undef. Quite conveniently we already record the prop type during tracing, so I use that to make the decision. This results in a 1.20% wall time improvement on the symfony demo benchmark with 20 warmup requests. Closes GH-18576
1 parent 3cd0383 commit 16ca097

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ext/opcache/jit/zend_jit_ir.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14971,8 +14971,9 @@ static int zend_jit_assign_obj(zend_jit_ctx *jit,
1497114971
ZEND_ASSERT(slow_inputs == IR_UNUSED);
1497214972
goto slow_path;
1497314973
}
14974+
1497414975
// Undefined property with potential magic __get()/__set() or lazy object
14975-
if (JIT_G(trigger) == ZEND_JIT_ON_HOT_TRACE) {
14976+
if (JIT_G(trigger) == ZEND_JIT_ON_HOT_TRACE && prop_type != IS_UNDEF) {
1497614977
int32_t exit_point = zend_jit_trace_get_exit_point(opline, ZEND_JIT_EXIT_TO_VM);
1497714978
const void *exit_addr = zend_jit_trace_get_exit_addr(exit_point);
1497814979

0 commit comments

Comments
 (0)