@@ -1262,6 +1262,39 @@ void zend_update_parent_ce(zend_class_entry *ce)
1262
1262
}
1263
1263
}
1264
1264
1265
+ static void zend_accel_persist_jit_op_array (zend_op_array * op_array , zend_class_entry * ce )
1266
+ {
1267
+ if (op_array -> type == ZEND_USER_FUNCTION ) {
1268
+ if (op_array -> scope == ce
1269
+ && !(op_array -> fn_flags & ZEND_ACC_ABSTRACT )
1270
+ && !(op_array -> fn_flags & ZEND_ACC_TRAIT_CLONE )) {
1271
+ zend_jit_op_array (op_array , ZCG (current_persistent_script ) ? & ZCG (current_persistent_script )-> script : NULL );
1272
+ for (uint32_t i = 0 ; i < op_array -> num_dynamic_func_defs ; i ++ ) {
1273
+ zend_jit_op_array (op_array -> dynamic_func_defs [i ], ZCG (current_persistent_script ) ? & ZCG (current_persistent_script )-> script : NULL );
1274
+ }
1275
+ }
1276
+ }
1277
+ }
1278
+
1279
+ static void zend_accel_persist_link_func_info (zend_op_array * op_array , zend_class_entry * ce )
1280
+ {
1281
+ if (op_array -> type == ZEND_USER_FUNCTION
1282
+ && !(op_array -> fn_flags & ZEND_ACC_ABSTRACT )) {
1283
+ if ((op_array -> scope != ce
1284
+ || (op_array -> fn_flags & ZEND_ACC_TRAIT_CLONE ))
1285
+ && (JIT_G (trigger ) == ZEND_JIT_ON_FIRST_EXEC
1286
+ || JIT_G (trigger ) == ZEND_JIT_ON_PROF_REQUEST
1287
+ || JIT_G (trigger ) == ZEND_JIT_ON_HOT_COUNTERS
1288
+ || JIT_G (trigger ) == ZEND_JIT_ON_HOT_TRACE )) {
1289
+ void * jit_extension = zend_shared_alloc_get_xlat_entry (op_array -> opcodes );
1290
+
1291
+ if (jit_extension ) {
1292
+ ZEND_SET_FUNC_INFO (op_array , jit_extension );
1293
+ }
1294
+ }
1295
+ }
1296
+ }
1297
+
1265
1298
static void zend_accel_persist_class_table (HashTable * class_table )
1266
1299
{
1267
1300
Bucket * p ;
@@ -1288,44 +1321,48 @@ static void zend_accel_persist_class_table(HashTable *class_table)
1288
1321
if (JIT_G (on ) && JIT_G (opt_level ) <= ZEND_JIT_LEVEL_OPT_FUNCS &&
1289
1322
!ZCG (current_persistent_script )-> corrupted ) {
1290
1323
zend_op_array * op_array ;
1324
+ zend_property_info * prop ;
1291
1325
1292
1326
ZEND_HASH_MAP_FOREACH_BUCKET (class_table , p ) {
1293
1327
if (EXPECTED (Z_TYPE (p -> val ) != IS_ALIAS_PTR )) {
1294
1328
ce = Z_PTR (p -> val );
1295
1329
ZEND_HASH_MAP_FOREACH_PTR (& ce -> function_table , op_array ) {
1296
- if (op_array -> type == ZEND_USER_FUNCTION ) {
1297
- if (op_array -> scope == ce
1298
- && !(op_array -> fn_flags & ZEND_ACC_ABSTRACT )
1299
- && !(op_array -> fn_flags & ZEND_ACC_TRAIT_CLONE )) {
1300
- zend_jit_op_array (op_array , ZCG (current_persistent_script ) ? & ZCG (current_persistent_script )-> script : NULL );
1301
- for (uint32_t i = 0 ; i < op_array -> num_dynamic_func_defs ; i ++ ) {
1302
- zend_jit_op_array (op_array -> dynamic_func_defs [i ], ZCG (current_persistent_script ) ? & ZCG (current_persistent_script )-> script : NULL );
1330
+ zend_accel_persist_jit_op_array (op_array , ce );
1331
+ } ZEND_HASH_FOREACH_END ();
1332
+
1333
+ if (ce -> num_hooked_props > 0 ) {
1334
+ ZEND_HASH_MAP_FOREACH_PTR (& ce -> properties_info , prop ) {
1335
+ if (prop -> hooks ) {
1336
+ for (uint32_t i = 0 ; i < ZEND_PROPERTY_HOOK_COUNT ; i ++ ) {
1337
+ if (prop -> hooks [i ]) {
1338
+ op_array = & prop -> hooks [i ]-> op_array ;
1339
+ zend_accel_persist_jit_op_array (op_array , ce );
1340
+ }
1303
1341
}
1304
1342
}
1305
- }
1306
- } ZEND_HASH_FOREACH_END ();
1343
+ } ZEND_HASH_FOREACH_END ();
1344
+ }
1307
1345
}
1308
1346
} ZEND_HASH_FOREACH_END ();
1309
1347
ZEND_HASH_MAP_FOREACH_BUCKET (class_table , p ) {
1310
1348
if (EXPECTED (Z_TYPE (p -> val ) != IS_ALIAS_PTR )) {
1311
1349
ce = Z_PTR (p -> val );
1312
1350
ZEND_HASH_MAP_FOREACH_PTR (& ce -> function_table , op_array ) {
1313
- if (op_array -> type == ZEND_USER_FUNCTION
1314
- && !(op_array -> fn_flags & ZEND_ACC_ABSTRACT )) {
1315
- if ((op_array -> scope != ce
1316
- || (op_array -> fn_flags & ZEND_ACC_TRAIT_CLONE ))
1317
- && (JIT_G (trigger ) == ZEND_JIT_ON_FIRST_EXEC
1318
- || JIT_G (trigger ) == ZEND_JIT_ON_PROF_REQUEST
1319
- || JIT_G (trigger ) == ZEND_JIT_ON_HOT_COUNTERS
1320
- || JIT_G (trigger ) == ZEND_JIT_ON_HOT_TRACE )) {
1321
- void * jit_extension = zend_shared_alloc_get_xlat_entry (op_array -> opcodes );
1322
-
1323
- if (jit_extension ) {
1324
- ZEND_SET_FUNC_INFO (op_array , jit_extension );
1351
+ zend_accel_persist_link_func_info (op_array , ce );
1352
+ } ZEND_HASH_FOREACH_END ();
1353
+
1354
+ if (ce -> num_hooked_props > 0 ) {
1355
+ ZEND_HASH_MAP_FOREACH_PTR (& ce -> properties_info , prop ) {
1356
+ if (prop -> hooks ) {
1357
+ for (uint32_t i = 0 ; i < ZEND_PROPERTY_HOOK_COUNT ; i ++ ) {
1358
+ if (prop -> hooks [i ]) {
1359
+ op_array = & prop -> hooks [i ]-> op_array ;
1360
+ zend_accel_persist_link_func_info (op_array , ce );
1361
+ }
1325
1362
}
1326
1363
}
1327
- }
1328
- } ZEND_HASH_FOREACH_END ();
1364
+ } ZEND_HASH_FOREACH_END ();
1365
+ }
1329
1366
}
1330
1367
} ZEND_HASH_FOREACH_END ();
1331
1368
}
0 commit comments