@@ -1323,6 +1323,8 @@ static int zend_jit(const zend_op_array *op_array, zend_ssa *ssa, const zend_op
1323
1323
bool ce_is_instanceof ;
1324
1324
bool on_this ;
1325
1325
1326
+ ZEND_ASSERT (!(op_array -> fn_flags & ZEND_ACC_CLOSURE ) || !(op_array -> scope ));
1327
+
1326
1328
if (JIT_G (bisect_limit )) {
1327
1329
jit_bisect_pos ++ ;
1328
1330
if (jit_bisect_pos >= JIT_G (bisect_limit )) {
@@ -2884,6 +2886,18 @@ static int zend_real_jit_func(zend_op_array *op_array, zend_script *script, cons
2884
2886
/* Build SSA */
2885
2887
memset (& ssa , 0 , sizeof (zend_ssa ));
2886
2888
2889
+ if (op_array -> fn_flags & ZEND_ACC_CLOSURE ) {
2890
+ if (JIT_G (trigger ) == ZEND_JIT_ON_FIRST_EXEC ) {
2891
+ zend_jit_op_array_extension * jit_extension = (zend_jit_op_array_extension * )ZEND_FUNC_INFO (op_array );
2892
+ op_array = (zend_op_array * ) jit_extension -> op_array ;
2893
+ } else if (JIT_G (trigger ) == ZEND_JIT_ON_HOT_COUNTERS ) {
2894
+ zend_jit_op_array_hot_extension * jit_extension = (zend_jit_op_array_hot_extension * )ZEND_FUNC_INFO (op_array );
2895
+ op_array = (zend_op_array * ) jit_extension -> op_array ;
2896
+ } else {
2897
+ ZEND_ASSERT (!op_array -> scope );
2898
+ }
2899
+ }
2900
+
2887
2901
if (zend_jit_op_array_analyze1 (op_array , script , & ssa ) != SUCCESS ) {
2888
2902
goto jit_failure ;
2889
2903
}
@@ -3101,6 +3115,7 @@ static int zend_jit_setup_hot_counters(zend_op_array *op_array)
3101
3115
}
3102
3116
memset (& jit_extension -> func_info , 0 , sizeof (zend_func_info ));
3103
3117
jit_extension -> func_info .flags = ZEND_FUNC_JIT_ON_HOT_COUNTERS ;
3118
+ jit_extension -> op_array = op_array ;
3104
3119
jit_extension -> counter = & zend_jit_hot_counters [zend_jit_op_array_hash (op_array ) & (ZEND_HOT_COUNTERS_COUNT - 1 )];
3105
3120
for (i = 0 ; i < op_array -> last ; i ++ ) {
3106
3121
jit_extension -> orig_handlers [i ] = op_array -> opcodes [i ].handler ;
@@ -3145,6 +3160,7 @@ int zend_jit_op_array(zend_op_array *op_array, zend_script *script)
3145
3160
}
3146
3161
memset (& jit_extension -> func_info , 0 , sizeof (zend_func_info ));
3147
3162
jit_extension -> func_info .flags = ZEND_FUNC_JIT_ON_FIRST_EXEC ;
3163
+ jit_extension -> op_array = op_array ;
3148
3164
jit_extension -> orig_handler = (void * )opline -> handler ;
3149
3165
ZEND_SET_FUNC_INFO (op_array , (void * )jit_extension );
3150
3166
opline -> handler = (const void * )zend_jit_runtime_jit_handler ;
@@ -3174,6 +3190,7 @@ int zend_jit_op_array(zend_op_array *op_array, zend_script *script)
3174
3190
}
3175
3191
memset (& jit_extension -> func_info , 0 , sizeof (zend_func_info ));
3176
3192
jit_extension -> func_info .flags = ZEND_FUNC_JIT_ON_PROF_REQUEST ;
3193
+ jit_extension -> op_array = op_array ;
3177
3194
jit_extension -> orig_handler = (void * )opline -> handler ;
3178
3195
ZEND_SET_FUNC_INFO (op_array , (void * )jit_extension );
3179
3196
opline -> handler = (const void * )zend_jit_profile_jit_handler ;
0 commit comments