Skip to content

Commit faf2414

Browse files
committed
Fixed JIT for preloaded functions and classes
1 parent 465c82b commit faf2414

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

ext/opcache/zend_persist.c

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,8 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc
634634

635635
#ifdef HAVE_JIT
636636
if (ZCG(accel_directives).jit &&
637-
ZEND_JIT_LEVEL(ZCG(accel_directives).jit) <= ZEND_JIT_LEVEL_OPT_FUNCS) {
637+
ZEND_JIT_LEVEL(ZCG(accel_directives).jit) <= ZEND_JIT_LEVEL_OPT_FUNCS &&
638+
!ZCG(current_persistent_script)->corrupted) {
638639
zend_jit_op_array(op_array, ZCG(current_persistent_script) ? &ZCG(current_persistent_script)->script : NULL);
639640
}
640641
#endif
@@ -1118,10 +1119,6 @@ static void zend_accel_persist_class_table(HashTable *class_table)
11181119

11191120
zend_persistent_script *zend_accel_script_persist(zend_persistent_script *script, const char **key, unsigned int key_length, int for_shm)
11201121
{
1121-
#ifdef HAVE_JIT
1122-
zend_long orig_jit = 0;
1123-
#endif
1124-
11251122
script->mem = ZCG(mem);
11261123

11271124
ZEND_ASSERT(((zend_uintptr_t)ZCG(mem) & 0x7) == 0); /* should be 8 byte aligned */
@@ -1152,13 +1149,8 @@ zend_persistent_script *zend_accel_script_persist(zend_persistent_script *script
11521149
ZCG(mem) = (void*)((char*)ZCG(mem) + script->arena_size);
11531150

11541151
#ifdef HAVE_JIT
1155-
if (ZCG(accel_directives).jit) {
1156-
if (key) {
1157-
zend_jit_unprotect();
1158-
} else {
1159-
orig_jit = ZCG(accel_directives).jit;
1160-
ZCG(accel_directives).jit = 0;
1161-
}
1152+
if (ZCG(accel_directives).jit && for_shm) {
1153+
zend_jit_unprotect();
11621154
}
11631155
#endif
11641156

@@ -1171,13 +1163,11 @@ zend_persistent_script *zend_accel_script_persist(zend_persistent_script *script
11711163
ZCSG(map_ptr_last) = CG(map_ptr_last);
11721164

11731165
#ifdef HAVE_JIT
1174-
if (ZCG(accel_directives).jit) {
1166+
if (ZCG(accel_directives).jit && for_shm) {
11751167
if (ZEND_JIT_LEVEL(ZCG(accel_directives).jit) >= ZEND_JIT_LEVEL_OPT_SCRIPT) {
11761168
zend_jit_script(&script->script);
11771169
}
11781170
zend_jit_protect();
1179-
} else if (!key) {
1180-
ZCG(accel_directives).jit = orig_jit;
11811171
}
11821172
#endif
11831173

0 commit comments

Comments
 (0)