@@ -1286,6 +1286,8 @@ static int zend_jit(const zend_op_array *op_array, zend_ssa *ssa, const zend_op
1286
1286
bool ce_is_instanceof ;
1287
1287
bool on_this ;
1288
1288
1289
+ ZEND_ASSERT (!(op_array -> fn_flags & ZEND_ACC_CLOSURE ) || !(op_array -> scope ));
1290
+
1289
1291
if (JIT_G (bisect_limit )) {
1290
1292
jit_bisect_pos ++ ;
1291
1293
if (jit_bisect_pos >= JIT_G (bisect_limit )) {
@@ -2834,6 +2836,17 @@ static int zend_real_jit_func(zend_op_array *op_array, zend_script *script, cons
2834
2836
/* Build SSA */
2835
2837
memset (& ssa , 0 , sizeof (zend_ssa ));
2836
2838
2839
+ if (op_array -> fn_flags & ZEND_ACC_CLOSURE ) {
2840
+ if (JIT_G (trigger ) == ZEND_JIT_ON_FIRST_EXEC ||
2841
+ JIT_G (trigger ) == ZEND_JIT_ON_PROF_REQUEST ||
2842
+ JIT_G (trigger ) == ZEND_JIT_ON_HOT_COUNTERS ) {
2843
+ zend_jit_op_array_extension_common * jit_extension = (zend_jit_op_array_extension_common * )ZEND_FUNC_INFO (op_array );
2844
+ op_array = (zend_op_array * ) jit_extension -> op_array ;
2845
+ } else {
2846
+ ZEND_ASSERT (!op_array -> scope );
2847
+ }
2848
+ }
2849
+
2837
2850
if (zend_jit_op_array_analyze1 (op_array , script , & ssa ) != SUCCESS ) {
2838
2851
goto jit_failure ;
2839
2852
}
@@ -3051,6 +3064,7 @@ static int zend_jit_setup_hot_counters(zend_op_array *op_array)
3051
3064
}
3052
3065
memset (& jit_extension -> func_info , 0 , sizeof (zend_func_info ));
3053
3066
jit_extension -> func_info .flags = ZEND_FUNC_JIT_ON_HOT_COUNTERS ;
3067
+ jit_extension -> op_array = op_array ;
3054
3068
jit_extension -> counter = & zend_jit_hot_counters [zend_jit_op_array_hash (op_array ) & (ZEND_HOT_COUNTERS_COUNT - 1 )];
3055
3069
for (i = 0 ; i < op_array -> last ; i ++ ) {
3056
3070
jit_extension -> orig_handlers [i ] = op_array -> opcodes [i ].handler ;
@@ -3095,6 +3109,7 @@ int zend_jit_op_array(zend_op_array *op_array, zend_script *script)
3095
3109
}
3096
3110
memset (& jit_extension -> func_info , 0 , sizeof (zend_func_info ));
3097
3111
jit_extension -> func_info .flags = ZEND_FUNC_JIT_ON_FIRST_EXEC ;
3112
+ jit_extension -> op_array = op_array ;
3098
3113
jit_extension -> orig_handler = (void * )opline -> handler ;
3099
3114
ZEND_SET_FUNC_INFO (op_array , (void * )jit_extension );
3100
3115
opline -> handler = (const void * )zend_jit_runtime_jit_handler ;
@@ -3124,6 +3139,7 @@ int zend_jit_op_array(zend_op_array *op_array, zend_script *script)
3124
3139
}
3125
3140
memset (& jit_extension -> func_info , 0 , sizeof (zend_func_info ));
3126
3141
jit_extension -> func_info .flags = ZEND_FUNC_JIT_ON_PROF_REQUEST ;
3142
+ jit_extension -> op_array = op_array ;
3127
3143
jit_extension -> orig_handler = (void * )opline -> handler ;
3128
3144
ZEND_SET_FUNC_INFO (op_array , (void * )jit_extension );
3129
3145
opline -> handler = (const void * )zend_jit_profile_jit_handler ;
0 commit comments