@@ -6591,7 +6591,8 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
65916591 op_array_ssa = & jit_extension -> func_info .ssa ;
65926592 top = frame ;
65936593 if (frame -> prev ) {
6594- checked_stack -= frame -> used_stack ;
6594+ checked_stack = frame -> old_checked_stack ;
6595+ peek_checked_stack = frame -> old_peek_checked_stack ;
65956596 frame = frame -> prev ;
65966597 stack = frame -> stack ;
65976598 ZEND_ASSERT (& frame -> func -> op_array == op_array );
@@ -6764,24 +6765,40 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
67646765 }
67656766 }
67666767 }
6768+ call -> old_checked_stack = checked_stack ;
6769+ call -> old_peek_checked_stack = peek_checked_stack ;
67676770 if (p -> info & ZEND_JIT_TRACE_FAKE_INIT_CALL ) {
67686771 frame -> call_level ++ ;
6769- call -> used_stack = 0 ;
6772+ call -> used_stack = checked_stack = peek_checked_stack = 0 ;
67706773 } else {
67716774 if (p -> func ) {
67726775 call -> used_stack = zend_vm_calc_used_stack (init_opline -> extended_value , (zend_function * )p -> func );
67736776 } else {
67746777 call -> used_stack = (ZEND_CALL_FRAME_SLOT + init_opline -> extended_value ) * sizeof (zval );
67756778 }
6776- checked_stack += call -> used_stack ;
6777- if (checked_stack > peek_checked_stack ) {
6778- peek_checked_stack = checked_stack ;
6779+ switch (init_opline -> opcode ) {
6780+ case ZEND_INIT_FCALL :
6781+ case ZEND_INIT_FCALL_BY_NAME :
6782+ case ZEND_INIT_NS_FCALL_BY_NAME :
6783+ case ZEND_INIT_METHOD_CALL :
6784+ case ZEND_INIT_DYNAMIC_CALL :
6785+ //case ZEND_INIT_STATIC_METHOD_CALL:
6786+ //case ZEND_INIT_USER_CALL:
6787+ //case ZEND_NEW:
6788+ checked_stack += call -> used_stack ;
6789+ if (checked_stack > peek_checked_stack ) {
6790+ peek_checked_stack = checked_stack ;
6791+ }
6792+ break ;
6793+ default :
6794+ checked_stack = peek_checked_stack = 0 ;
67796795 }
67806796 }
67816797 } else if (p -> op == ZEND_JIT_TRACE_DO_ICALL ) {
67826798 call = frame -> call ;
67836799 if (call ) {
6784- checked_stack -= call -> used_stack ;
6800+ checked_stack = call -> old_checked_stack ;
6801+ peek_checked_stack = call -> old_peek_checked_stack ;
67856802 top = call ;
67866803 frame -> call = call -> prev ;
67876804 }
0 commit comments