com php-src: Fixed JIT for preloaded functions and classes: ext/opcache/zend_persist.c
| From: | Dmitry Stogov | Date: | Mon, 29 Apr 2019 21:23:57 +0000 |
| Subject: | com php-src: Fixed JIT for preloaded functions and classes: ext/opcache/zend_persist.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-105982@lists.php.net to get a copy of this message | ||
Commit: faf24142f3f58d0f4c99143b06d120fe8b853d47
Author: Dmitry Stogov <dmitry@zend.com> Tue, 30 Apr 2019 00:23:57 +0300
Parents: 465c82b1af1c5b8a70e671428d33a5b537d1d2cd
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=faf24142f3f58d0f4c99143b06d120fe8b853d47
Log:
Fixed JIT for preloaded functions and classes
Changed paths:
M ext/opcache/zend_persist.c
Diff:
diff --git a/ext/opcache/zend_persist.c b/ext/opcache/zend_persist.c
index 39e5d5f..83171e2 100644
--- a/ext/opcache/zend_persist.c
+++ b/ext/opcache/zend_persist.c
@@ -634,7 +634,8 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc
#ifdef HAVE_JIT
if (ZCG(accel_directives).jit &&
- ZEND_JIT_LEVEL(ZCG(accel_directives).jit) <= ZEND_JIT_LEVEL_OPT_FUNCS) {
+ ZEND_JIT_LEVEL(ZCG(accel_directives).jit) <= ZEND_JIT_LEVEL_OPT_FUNCS &&
+ !ZCG(current_persistent_script)->corrupted) {
zend_jit_op_array(op_array, ZCG(current_persistent_script) ?
&ZCG(current_persistent_script)->script : NULL);
}
#endif
@@ -1118,10 +1119,6 @@ static void zend_accel_persist_class_table(HashTable *class_table)
zend_persistent_script *zend_accel_script_persist(zend_persistent_script *script, const char **key,
unsigned int key_length, int for_shm)
{
-#ifdef HAVE_JIT
- zend_long orig_jit = 0;
-#endif
-
script->mem = ZCG(mem);
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
ZCG(mem) = (void*)((char*)ZCG(mem) + script->arena_size);
#ifdef HAVE_JIT
- if (ZCG(accel_directives).jit) {
- if (key) {
- zend_jit_unprotect();
- } else {
- orig_jit = ZCG(accel_directives).jit;
- ZCG(accel_directives).jit = 0;
- }
+ if (ZCG(accel_directives).jit && for_shm) {
+ zend_jit_unprotect();
}
#endif
@@ -1171,13 +1163,11 @@ zend_persistent_script *zend_accel_script_persist(zend_persistent_script
*script
ZCSG(map_ptr_last) = CG(map_ptr_last);
#ifdef HAVE_JIT
- if (ZCG(accel_directives).jit) {
+ if (ZCG(accel_directives).jit && for_shm) {
if (ZEND_JIT_LEVEL(ZCG(accel_directives).jit) >= ZEND_JIT_LEVEL_OPT_SCRIPT) {
zend_jit_script(&script->script);
}
zend_jit_protect();
- } else if (!key) {
- ZCG(accel_directives).jit = orig_jit;
}
#endif