]> granicus.if.org Git - php/commitdiff
Additional fix for bug #78185 (File cache no longer works)
authorDmitry Stogov <dmitry@zend.com>
Fri, 21 Jun 2019 07:06:35 +0000 (10:06 +0300)
committerDmitry Stogov <dmitry@zend.com>
Fri, 21 Jun 2019 07:06:35 +0000 (10:06 +0300)
ext/opcache/ZendAccelerator.c
ext/opcache/ZendAccelerator.h
ext/opcache/zend_accelerator_module.c
ext/opcache/zend_file_cache.c
ext/opcache/zend_persist.c

index 986b955787bfcfd7e946bcdda22d4646a72953de..d5be7a93a2ec6efcd91405c04f5987f771d9aa41 100644 (file)
@@ -2946,11 +2946,11 @@ static int accel_post_startup(void)
 #ifdef HAVE_JIT
                if (ZCG(accel_directives).jit &&
                    ZCG(accel_directives).jit_buffer_size &&
-                   ZSMMG(reserved)) {
-                       zend_jit_startup(ZCG(accel_directives).jit, ZSMMG(reserved), jit_size, reattached);
+                   ZSMMG(reserved) &&
+                       zend_jit_startup(ZCG(accel_directives).jit, ZSMMG(reserved), jit_size, reattached) == SUCCESS) {
+                       ZCG(jit_enabled) = 1;
                } else {
-                       ZCG(accel_directives).jit = 0;
-                       ZCG(accel_directives).jit_buffer_size = 0;
+                       ZCG(jit_enabled) = 0;
                }
 #endif
                zend_shared_alloc_save_state();
index 27a9dce7da1f399aeee2f400ec4611ba0c659e17..ae59a3d2835d0a672ae44ad076bb4902176f715f 100644 (file)
@@ -220,6 +220,9 @@ typedef struct _zend_accel_globals {
        void                   *arena_mem;
        zend_persistent_script *current_persistent_script;
        zend_bool               is_immutable_class;
+#ifdef HAVE_JIT
+       zend_bool               jit_enabled;
+#endif
        /* cache to save hash lookup on the same INCLUDE opcode */
        const zend_op          *cache_opline;
        zend_persistent_script *cache_persistent_script;
index 292653311af536e45b49939e9e976702780207ff..551d5ad09d9be5cfa29898005c55a120057ed700 100644 (file)
@@ -464,7 +464,7 @@ void zend_accel_info(ZEND_MODULE_INFO_FUNC_ARGS)
                php_info_print_table_row(2, "File Cache", "Disabled");
        }
 #if HAVE_JIT
-       if (ZCG(accel_directives).jit) {
+       if (ZCG(jit_enabled)) {
                php_info_print_table_row(2, "JIT", "Enabled");
        } else {
                php_info_print_table_row(2, "JIT", "Disabled");
index 0e4d7748c9112bbd459fbc859a254902f713c348..4079c8bf1c757901a914510ee4d0f75079a0bba3 100644 (file)
@@ -903,7 +903,7 @@ int zend_file_cache_script_store(zend_persistent_script *script, int in_shm)
 
 #ifdef HAVE_JIT
        /* FIXME: dump jited codes out to file cache? */
-       if (ZCG(accel_directives).jit) {
+       if (ZCG(jit_enabled)) {
                return FAILURE;
        }
 #endif
index f4df9a301ba900bc8eace5a64f9b4c6be7d8f5ac..5d2d6ba31585fad7d27112f9716a10ad6a07af97 100644 (file)
@@ -538,7 +538,7 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc
        ZCG(mem) = (void*)((char*)ZCG(mem) + ZEND_ALIGNED_SIZE(zend_extensions_op_array_persist(op_array, ZCG(mem))));
 
 #ifdef HAVE_JIT
-       if (ZCG(accel_directives).jit &&
+       if (ZCG(jit_enabled) &&
            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);
@@ -1078,7 +1078,7 @@ 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 && for_shm) {
+       if (ZCG(jit_enabled) && for_shm) {
                zend_jit_unprotect();
        }
 #endif
@@ -1097,7 +1097,7 @@ 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 && for_shm) {
+       if (ZCG(jit_enabled) && for_shm) {
                if (ZEND_JIT_LEVEL(ZCG(accel_directives).jit) >= ZEND_JIT_LEVEL_OPT_SCRIPT) {
                        zend_jit_script(&script->script);
                }