]> granicus.if.org Git - php/commitdiff
Break dependency between opcache and optimizer. Remove copatibility macros.
authorDmitry Stogov <dmitry@zend.com>
Wed, 11 Nov 2015 23:02:24 +0000 (02:02 +0300)
committerDmitry Stogov <dmitry@zend.com>
Wed, 11 Nov 2015 23:02:24 +0000 (02:02 +0300)
14 files changed:
ext/opcache/Optimizer/block_pass.c
ext/opcache/Optimizer/nop_removal.c
ext/opcache/Optimizer/pass1_5.c
ext/opcache/Optimizer/pass3.c
ext/opcache/Optimizer/zend_optimizer.c
ext/opcache/Optimizer/zend_optimizer.h
ext/opcache/Optimizer/zend_optimizer_internal.h
ext/opcache/ZendAccelerator.c
ext/opcache/ZendAccelerator.h
ext/opcache/zend_accelerator_module.c
ext/opcache/zend_accelerator_util_funcs.c
ext/opcache/zend_file_cache.c
ext/opcache/zend_persist.c
ext/opcache/zend_persist_calc.c

index 1d172b2a5ee3daac079b26a0852c276116f3e393..61f86f5ebb3e93544ec0a6e6f126a7f9b059255b 100644 (file)
@@ -39,7 +39,7 @@ int zend_optimizer_get_persistent_constant(zend_string *name, zval *result, int
        ALLOCA_FLAG(use_heap);
 
        if ((c = zend_hash_find_ptr(EG(zend_constants), name)) == NULL) {
-               lookup_name = DO_ALLOCA(ZSTR_LEN(name) + 1);
+               lookup_name = do_alloca(ZSTR_LEN(name) + 1, use_heap);
                memcpy(lookup_name, ZSTR_VAL(name), ZSTR_LEN(name) + 1);
                zend_str_tolower(lookup_name, ZSTR_LEN(name));
 
@@ -50,7 +50,7 @@ int zend_optimizer_get_persistent_constant(zend_string *name, zval *result, int
                } else {
                        retval = 0;
                }
-               FREE_ALLOCA(lookup_name);
+               free_alloca(lookup_name, use_heap);
        }
 
        if (retval) {
index 8a20eb2007d8b2eb4e5075c6e5cac98cd2d5c0d2..75e84c76444e808b09124ced19f1d1648fb4efea 100644 (file)
@@ -39,7 +39,7 @@ void zend_optimizer_nop_removal(zend_op_array *op_array)
        uint32_t *shiftlist;
        ALLOCA_FLAG(use_heap);
 
-       shiftlist = (uint32_t *)DO_ALLOCA(sizeof(uint32_t) * op_array->last);
+       shiftlist = (uint32_t *)do_alloca(sizeof(uint32_t) * op_array->last, use_heap);
        i = new_count = shift = 0;
        end = op_array->opcodes + op_array->last;
        for (opline = op_array->opcodes; opline < end; opline++) {
@@ -134,5 +134,5 @@ void zend_optimizer_nop_removal(zend_op_array *op_array)
                        } while (*opline_num != (uint32_t)-1);
                }
        }
-       FREE_ALLOCA(shiftlist);
+       free_alloca(shiftlist, use_heap);
 }
index 2aba4db3e5e8a73923e1f5f9b58de5284eaf892c..ca1cf45539a293ae79ee3cdcc5d697e6f930bc64 100644 (file)
@@ -302,7 +302,7 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx)
                                                                (ce->type == ZEND_INTERNAL_CLASS &&
                                                                 ce->info.internal.module->type != MODULE_PERSISTENT) ||
                                                                (ce->type == ZEND_USER_CLASS &&
-                                                                ZEND_CE_FILENAME(ce) != op_array->filename)) {
+                                                                ce->info.user.filename != op_array->filename)) {
                                                        break;
                                                }
                                        }
index 3e589df628686b2541526b9c00726a4fa44d589e..2a74717f1045b093abed98ec7c7343867cfbb9cb 100644 (file)
@@ -63,7 +63,7 @@ void zend_optimizer_pass3(zend_op_array *op_array)
        uint32_t opline_num = 0;
        ALLOCA_FLAG(use_heap);
 
-       jmp_hitlist = (uint32_t *)DO_ALLOCA(sizeof(uint32_t)*op_array->last);
+       jmp_hitlist = (uint32_t *)do_alloca(sizeof(uint32_t)*op_array->last, use_heap);
        opline = op_array->opcodes;
 
        while (opline < end) {
@@ -429,5 +429,5 @@ done_jmp_optimization:
                opline++;
                opline_num++;
        }
-       FREE_ALLOCA(jmp_hitlist);
+       free_alloca(jmp_hitlist, use_heap);
 }
index eb772553093ceda51c15a14e0aad516ea2b09beb..14c50d1e689ec5b55825b4f613ae33bca7b19fc3 100644 (file)
@@ -355,7 +355,7 @@ void zend_optimizer_remove_live_range(zend_op_array *op_array, uint32_t var)
                uint32_t *map;
                ALLOCA_FLAG(use_heap);
 
-               map = (uint32_t *)DO_ALLOCA(sizeof(uint32_t) * op_array->last_live_range);
+               map = (uint32_t *)do_alloca(sizeof(uint32_t) * op_array->last_live_range, use_heap);
 
                do {
                        if (op_array->opcodes[op_array->live_range[i].end].op1.var != var) {
@@ -534,7 +534,7 @@ static void zend_optimize(zend_op_array      *op_array,
         * - optimize series of ADD_STRING and/or ADD_CHAR
         * - convert CAST(IS_BOOL,x) into BOOL(x)
         */
-       if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
+       if (ZEND_OPTIMIZER_PASS_1 & ctx->optimization_level) {
                zend_optimizer_pass1(op_array, ctx);
        }
 
@@ -544,7 +544,7 @@ static void zend_optimize(zend_op_array      *op_array,
         * - optimize static BRKs and CONTs
         * - pre-evaluate constant function calls
         */
-       if (ZEND_OPTIMIZER_PASS_2 & OPTIMIZATION_LEVEL) {
+       if (ZEND_OPTIMIZER_PASS_2 & ctx->optimization_level) {
                zend_optimizer_pass2(op_array);
        }
 
@@ -553,48 +553,48 @@ static void zend_optimize(zend_op_array      *op_array,
         * - optimize series of JMPs
         * - change $i++ to ++$i where possible
         */
-       if (ZEND_OPTIMIZER_PASS_3 & OPTIMIZATION_LEVEL) {
+       if (ZEND_OPTIMIZER_PASS_3 & ctx->optimization_level) {
                zend_optimizer_pass3(op_array);
        }
 
        /* pass 4:
         * - INIT_FCALL_BY_NAME -> DO_FCALL
         */
-       if (ZEND_OPTIMIZER_PASS_4 & OPTIMIZATION_LEVEL) {
+       if (ZEND_OPTIMIZER_PASS_4 & ctx->optimization_level) {
                optimize_func_calls(op_array, ctx);
        }
 
        /* pass 5:
         * - CFG optimization
         */
-       if (ZEND_OPTIMIZER_PASS_5 & OPTIMIZATION_LEVEL) {
+       if (ZEND_OPTIMIZER_PASS_5 & ctx->optimization_level) {
                optimize_cfg(op_array, ctx);
        }
 
        /* pass 9:
         * - Optimize temp variables usage
         */
-       if (ZEND_OPTIMIZER_PASS_9 & OPTIMIZATION_LEVEL) {
+       if (ZEND_OPTIMIZER_PASS_9 & ctx->optimization_level) {
                optimize_temporary_variables(op_array, ctx);
        }
 
        /* pass 10:
         * - remove NOPs
         */
-       if (((ZEND_OPTIMIZER_PASS_10|ZEND_OPTIMIZER_PASS_5) & OPTIMIZATION_LEVEL) == ZEND_OPTIMIZER_PASS_10) {
+       if (((ZEND_OPTIMIZER_PASS_10|ZEND_OPTIMIZER_PASS_5) & ctx->optimization_level) == ZEND_OPTIMIZER_PASS_10) {
                zend_optimizer_nop_removal(op_array);
        }
 
        /* pass 11:
         * - Compact literals table
         */
-       if (ZEND_OPTIMIZER_PASS_11 & OPTIMIZATION_LEVEL) {
+       if (ZEND_OPTIMIZER_PASS_11 & ctx->optimization_level) {
                zend_optimizer_compact_literals(op_array, ctx);
        }
 }
 
-static void zend_accel_optimize(zend_op_array      *op_array,
-                                zend_optimizer_ctx *ctx)
+static void zend_optimize_op_array(zend_op_array      *op_array,
+                                   zend_optimizer_ctx *ctx)
 {
        zend_op *opline, *end;
 
@@ -693,7 +693,7 @@ static void zend_accel_optimize(zend_op_array      *op_array,
        }
 }
 
-static void zend_accel_adjust_fcall_stack_size(zend_op_array *op_array, zend_optimizer_ctx *ctx)
+static void zend_adjust_fcall_stack_size(zend_op_array *op_array, zend_optimizer_ctx *ctx)
 {
        zend_function *func;
        zend_op *opline, *end;
@@ -713,7 +713,7 @@ static void zend_accel_adjust_fcall_stack_size(zend_op_array *op_array, zend_opt
        }
 }
 
-int zend_accel_script_optimize(zend_persistent_script *script)
+int zend_optimize_script(zend_script *script, zend_long optimization_level)
 {
        uint idx, j;
        Bucket *p, *q;
@@ -725,13 +725,13 @@ int zend_accel_script_optimize(zend_persistent_script *script)
        ctx.script = script;
        ctx.constants = NULL;
 
-       zend_accel_optimize(&script->main_op_array, &ctx);
+       zend_optimize_op_array(&script->main_op_array, &ctx);
 
        for (idx = 0; idx < script->function_table.nNumUsed; idx++) {
                p = script->function_table.arData + idx;
                if (Z_TYPE(p->val) == IS_UNDEF) continue;
                op_array = (zend_op_array*)Z_PTR(p->val);
-               zend_accel_optimize(op_array, &ctx);
+               zend_optimize_op_array(op_array, &ctx);
        }
 
        for (idx = 0; idx < script->class_table.nNumUsed; idx++) {
@@ -743,7 +743,7 @@ int zend_accel_script_optimize(zend_persistent_script *script)
                        if (Z_TYPE(q->val) == IS_UNDEF) continue;
                        op_array = (zend_op_array*)Z_PTR(q->val);
                        if (op_array->scope == ce) {
-                               zend_accel_optimize(op_array, &ctx);
+                               zend_optimize_op_array(op_array, &ctx);
                        } else if (op_array->type == ZEND_USER_FUNCTION) {
                                zend_op_array *orig_op_array;
                                if ((orig_op_array = zend_hash_find_ptr(&op_array->scope->function_table, q->key)) != NULL) {
@@ -755,14 +755,14 @@ int zend_accel_script_optimize(zend_persistent_script *script)
                }
        }
 
-       if (ZEND_OPTIMIZER_PASS_12 & OPTIMIZATION_LEVEL) {
-               zend_accel_adjust_fcall_stack_size(&script->main_op_array, &ctx);
+       if (ZEND_OPTIMIZER_PASS_12 & optimization_level) {
+               zend_adjust_fcall_stack_size(&script->main_op_array, &ctx);
 
                for (idx = 0; idx < script->function_table.nNumUsed; idx++) {
                        p = script->function_table.arData + idx;
                        if (Z_TYPE(p->val) == IS_UNDEF) continue;
                        op_array = (zend_op_array*)Z_PTR(p->val);
-                       zend_accel_adjust_fcall_stack_size(op_array, &ctx);
+                       zend_adjust_fcall_stack_size(op_array, &ctx);
                }
 
                for (idx = 0; idx < script->class_table.nNumUsed; idx++) {
@@ -774,7 +774,7 @@ int zend_accel_script_optimize(zend_persistent_script *script)
                                if (Z_TYPE(q->val) == IS_UNDEF) continue;
                                op_array = (zend_op_array*)Z_PTR(q->val);
                                if (op_array->scope == ce) {
-                                       zend_accel_adjust_fcall_stack_size(op_array, &ctx);
+                                       zend_adjust_fcall_stack_size(op_array, &ctx);
                                } else if (op_array->type == ZEND_USER_FUNCTION) {
                                        zend_op_array *orig_op_array;
                                        if ((orig_op_array = zend_hash_find_ptr(&op_array->scope->function_table, q->key)) != NULL) {
index 27c6159b7d1fc8fb4927eb1999cf332bca95a8a0..9c2a805e7690579a5ee9c109561eb4d97b26ab46 100644 (file)
 
 #define DEFAULT_OPTIMIZATION_LEVEL  "0xFFFFFFFF"
 
+typedef struct _zend_script {
+       zend_string   *filename;
+       zend_op_array  main_op_array;
+       HashTable      function_table;
+       HashTable      class_table;
+} zend_script;
+
+int zend_optimize_script(zend_script *script, zend_long optimization_level);
+
 #endif
index c20634087f8a9eb03bf89f5495bcc8987348be65..7f8962e3ab3dc8fbe325d2b428780b8c9abe07bb 100644 (file)
 #ifndef ZEND_OPTIMIZER_INTERNAL_H
 #define ZEND_OPTIMIZER_INTERNAL_H
 
-#include "ZendAccelerator.h"
+#define ZEND_RESULT_TYPE(opline)               (opline)->result_type
+#define ZEND_RESULT(opline)                            (opline)->result
+#define ZEND_OP1_TYPE(opline)                  (opline)->op1_type
+#define ZEND_OP1(opline)                               (opline)->op1
+#define ZEND_OP1_LITERAL(opline)               (op_array)->literals[(opline)->op1.constant]
+#define ZEND_OP2_TYPE(opline)                  (opline)->op2_type
+#define ZEND_OP2(opline)                               (opline)->op2
+#define ZEND_OP2_LITERAL(opline)               (op_array)->literals[(opline)->op2.constant]
 
 #define VAR_NUM(v) EX_VAR_TO_NUM(v)
 #define NUM_VAR(v) ((uint32_t)(zend_uintptr_t)ZEND_CALL_VAR_NUM(0, v))
@@ -51,8 +58,9 @@
 
 typedef struct _zend_optimizer_ctx {
        zend_arena             *arena;
-       zend_persistent_script *script;
+       zend_script            *script;
        HashTable              *constants;
+       zend_long               optimization_level;
 } zend_optimizer_ctx;
 
 typedef struct _zend_code_block zend_code_block;
@@ -87,9 +95,6 @@ struct _zend_block_source {
        zend_block_source  *next;
 };
 
-#define OPTIMIZATION_LEVEL \
-       ZCG(accel_directives).optimization_level
-
 #define LITERAL_LONG(op, val) do { \
                zval _c; \
                ZVAL_LONG(&_c, val); \
index e23e7515b8fee63501aa20dbeb7e361b70dc2201..32e6d78a2fb7745a01bb747f83b73d4b6b368c07 100644 (file)
@@ -851,17 +851,17 @@ static inline int do_validate_timestamps(zend_persistent_script *persistent_scri
         * See bug #15140
         */
        if (file_handle->opened_path) {
-               if (persistent_script->full_path != file_handle->opened_path &&
-                   (ZSTR_LEN(persistent_script->full_path) != ZSTR_LEN(file_handle->opened_path) ||
-                    memcmp(ZSTR_VAL(persistent_script->full_path), ZSTR_VAL(file_handle->opened_path), ZSTR_LEN(file_handle->opened_path)) != 0)) {
+               if (persistent_script->script.filename != file_handle->opened_path &&
+                   (ZSTR_LEN(persistent_script->script.filename) != ZSTR_LEN(file_handle->opened_path) ||
+                    memcmp(ZSTR_VAL(persistent_script->script.filename), ZSTR_VAL(file_handle->opened_path), ZSTR_LEN(file_handle->opened_path)) != 0)) {
                        return FAILURE;
                }
        } else {
                full_path_ptr = accelerator_orig_zend_resolve_path(file_handle->filename, strlen(file_handle->filename));
                if (full_path_ptr &&
-                   persistent_script->full_path != full_path_ptr &&
-                   (ZSTR_LEN(persistent_script->full_path) != ZSTR_LEN(full_path_ptr) ||
-                    memcmp(ZSTR_VAL(persistent_script->full_path), ZSTR_VAL(full_path_ptr), ZSTR_LEN(full_path_ptr)) != 0)) {
+                   persistent_script->script.filename != full_path_ptr &&
+                   (ZSTR_LEN(persistent_script->script.filename) != ZSTR_LEN(full_path_ptr) ||
+                    memcmp(ZSTR_VAL(persistent_script->script.filename), ZSTR_VAL(full_path_ptr), ZSTR_LEN(full_path_ptr)) != 0)) {
                        zend_string_release(full_path_ptr);
                        return FAILURE;
                }
@@ -889,8 +889,8 @@ static inline int do_validate_timestamps(zend_persistent_script *persistent_scri
        }
 
        ps_handle.type = ZEND_HANDLE_FILENAME;
-       ps_handle.filename = ZSTR_VAL(persistent_script->full_path);
-       ps_handle.opened_path = persistent_script->full_path;
+       ps_handle.filename = ZSTR_VAL(persistent_script->script.filename);
+       ps_handle.opened_path = persistent_script->script.filename;
 
        if (zend_get_file_handle_timestamp(&ps_handle, NULL) == persistent_script->timestamp) {
                return SUCCESS;
@@ -1157,7 +1157,7 @@ static zend_persistent_script *cache_script_in_file_cache(zend_persistent_script
                return new_persistent_script;
        }
 
-       if (!zend_accel_script_optimize(new_persistent_script)) {
+       if (!zend_optimize_script(&new_persistent_script->script, ZCG(accel_directives).optimization_level)) {
                return new_persistent_script;
        }
 
@@ -1181,16 +1181,16 @@ static zend_persistent_script *cache_script_in_file_cache(zend_persistent_script
        zend_shared_alloc_destroy_xlat_table();
 
        new_persistent_script->is_phar =
-               new_persistent_script->full_path &&
-               strstr(ZSTR_VAL(new_persistent_script->full_path), ".phar") &&
-               !strstr(ZSTR_VAL(new_persistent_script->full_path), "://");
+               new_persistent_script->script.filename &&
+               strstr(ZSTR_VAL(new_persistent_script->script.filename), ".phar") &&
+               !strstr(ZSTR_VAL(new_persistent_script->script.filename), "://");
 
        /* Consistency check */
        if ((char*)new_persistent_script->mem + new_persistent_script->size != (char*)ZCG(mem)) {
                zend_accel_error(
                        ((char*)new_persistent_script->mem + new_persistent_script->size < (char*)ZCG(mem)) ? ACCEL_LOG_ERROR : ACCEL_LOG_WARNING,
                        "Internal error: wrong size calculation: %s start=0x%08x, end=0x%08x, real=0x%08x\n",
-                       ZSTR_VAL(new_persistent_script->full_path),
+                       ZSTR_VAL(new_persistent_script->script.filename),
                        new_persistent_script->mem,
                        (char *)new_persistent_script->mem + new_persistent_script->size,
                        ZCG(mem));
@@ -1215,7 +1215,7 @@ static zend_persistent_script *cache_script_in_shared_memory(zend_persistent_scr
                return new_persistent_script;
        }
 
-       if (!zend_accel_script_optimize(new_persistent_script)) {
+       if (!zend_optimize_script(&new_persistent_script->script, ZCG(accel_directives).optimization_level)) {
                return new_persistent_script;
        }
 
@@ -1233,7 +1233,7 @@ static zend_persistent_script *cache_script_in_shared_memory(zend_persistent_scr
        /* Check if we still need to put the file into the cache (may be it was
         * already stored by another process. This final check is done under
         * exclusive lock) */
-       bucket = zend_accel_hash_find_entry(&ZCSG(hash), new_persistent_script->full_path);
+       bucket = zend_accel_hash_find_entry(&ZCSG(hash), new_persistent_script->script.filename);
        if (bucket) {
                zend_persistent_script *existing_persistent_script = (zend_persistent_script *)bucket->data;
 
@@ -1275,16 +1275,16 @@ static zend_persistent_script *cache_script_in_shared_memory(zend_persistent_scr
        zend_shared_alloc_destroy_xlat_table();
 
        new_persistent_script->is_phar =
-               new_persistent_script->full_path &&
-               strstr(ZSTR_VAL(new_persistent_script->full_path), ".phar") &&
-               !strstr(ZSTR_VAL(new_persistent_script->full_path), "://");
+               new_persistent_script->script.filename &&
+               strstr(ZSTR_VAL(new_persistent_script->script.filename), ".phar") &&
+               !strstr(ZSTR_VAL(new_persistent_script->script.filename), "://");
 
        /* Consistency check */
        if ((char*)new_persistent_script->mem + new_persistent_script->size != (char*)ZCG(mem)) {
                zend_accel_error(
                        ((char*)new_persistent_script->mem + new_persistent_script->size < (char*)ZCG(mem)) ? ACCEL_LOG_ERROR : ACCEL_LOG_WARNING,
                        "Internal error: wrong size calculation: %s start=0x%08x, end=0x%08x, real=0x%08x\n",
-                       ZSTR_VAL(new_persistent_script->full_path),
+                       ZSTR_VAL(new_persistent_script->script.filename),
                        new_persistent_script->mem,
                        (char *)new_persistent_script->mem + new_persistent_script->size,
                        ZCG(mem));
@@ -1293,14 +1293,14 @@ static zend_persistent_script *cache_script_in_shared_memory(zend_persistent_scr
        new_persistent_script->dynamic_members.checksum = zend_accel_script_checksum(new_persistent_script);
 
        /* store script structure in the hash table */
-       bucket = zend_accel_hash_update(&ZCSG(hash), ZSTR_VAL(new_persistent_script->full_path), ZSTR_LEN(new_persistent_script->full_path), 0, new_persistent_script);
+       bucket = zend_accel_hash_update(&ZCSG(hash), ZSTR_VAL(new_persistent_script->script.filename), ZSTR_LEN(new_persistent_script->script.filename), 0, new_persistent_script);
        if (bucket) {
-               zend_accel_error(ACCEL_LOG_INFO, "Cached script '%s'", new_persistent_script->full_path);
+               zend_accel_error(ACCEL_LOG_INFO, "Cached script '%s'", new_persistent_script->script.filename);
                if (key &&
                    /* key may contain non-persistent PHAR aliases (see issues #115 and #149) */
                    memcmp(key, "phar://", sizeof("phar://") - 1) != 0 &&
-                   (ZSTR_LEN(new_persistent_script->full_path) != key_length ||
-                    memcmp(ZSTR_VAL(new_persistent_script->full_path), key, key_length) != 0)) {
+                   (ZSTR_LEN(new_persistent_script->script.filename) != key_length ||
+                    memcmp(ZSTR_VAL(new_persistent_script->script.filename), key, key_length) != 0)) {
                        /* link key to the same persistent script in hash table */
                        if (zend_accel_hash_update(&ZCSG(hash), key, key_length, 1, bucket)) {
                                zend_accel_error(ACCEL_LOG_INFO, "Added key '%s'", key);
@@ -1468,7 +1468,7 @@ static zend_persistent_script *opcache_compile_file(zend_file_handle *file_handl
 
        /* Override them with ours */
        CG(function_table) = &ZCG(function_table);
-       EG(class_table) = CG(class_table) = &new_persistent_script->class_table;
+       EG(class_table) = CG(class_table) = &new_persistent_script->script.class_table;
        ZVAL_UNDEF(&EG(user_error_handler));
 
        zend_try {
@@ -1505,8 +1505,8 @@ static zend_persistent_script *opcache_compile_file(zend_file_handle *file_handl
           Here we aren't sure we would store it, but we will need it
           further anyway.
        */
-       zend_accel_move_user_functions(&ZCG(function_table), &new_persistent_script->function_table);
-       new_persistent_script->main_op_array = *op_array;
+       zend_accel_move_user_functions(&ZCG(function_table), &new_persistent_script->script.function_table);
+       new_persistent_script->script.main_op_array = *op_array;
 
        efree(op_array); /* we have valid persistent_script, so it's safe to free op_array */
 
@@ -1527,11 +1527,11 @@ static zend_persistent_script *opcache_compile_file(zend_file_handle *file_handl
        }
 
        if (file_handle->opened_path) {
-               new_persistent_script->full_path = zend_string_copy(file_handle->opened_path);
+               new_persistent_script->script.filename = zend_string_copy(file_handle->opened_path);
        } else {
-               new_persistent_script->full_path = zend_string_init(file_handle->filename, strlen(file_handle->filename), 0);
+               new_persistent_script->script.filename = zend_string_init(file_handle->filename, strlen(file_handle->filename), 0);
        }
-       zend_string_hash_val(new_persistent_script->full_path);
+       zend_string_hash_val(new_persistent_script->script.filename);
 
        /* Now persistent_script structure is ready in process memory */
        return new_persistent_script;
@@ -1565,21 +1565,21 @@ zend_op_array *file_cache_compile_file(zend_file_handle *file_handle, int type)
        persistent_script = zend_file_cache_script_load(file_handle);
        if (persistent_script) {
                /* see bug #15471 (old BTS) */
-               if (persistent_script->full_path) {
+               if (persistent_script->script.filename) {
                        if (!EG(current_execute_data) || !EG(current_execute_data)->opline ||
                            !EG(current_execute_data)->func ||
                            !ZEND_USER_CODE(EG(current_execute_data)->func->common.type) ||
                            EG(current_execute_data)->opline->opcode != ZEND_INCLUDE_OR_EVAL ||
                            (EG(current_execute_data)->opline->extended_value != ZEND_INCLUDE_ONCE &&
                             EG(current_execute_data)->opline->extended_value != ZEND_REQUIRE_ONCE)) {
-                               if (zend_hash_add_empty_element(&EG(included_files), persistent_script->full_path) != NULL) {
+                               if (zend_hash_add_empty_element(&EG(included_files), persistent_script->script.filename) != NULL) {
                                        /* ext/phar has to load phar's metadata into memory */
                                        if (persistent_script->is_phar) {
                                                php_stream_statbuf ssb;
-                                               char *fname = emalloc(sizeof("phar://") + ZSTR_LEN(persistent_script->full_path));
+                                               char *fname = emalloc(sizeof("phar://") + ZSTR_LEN(persistent_script->script.filename));
 
                                                memcpy(fname, "phar://", sizeof("phar://") - 1);
-                                               memcpy(fname + sizeof("phar://") - 1, ZSTR_VAL(persistent_script->full_path), ZSTR_LEN(persistent_script->full_path) + 1);
+                                               memcpy(fname + sizeof("phar://") - 1, ZSTR_VAL(persistent_script->script.filename), ZSTR_LEN(persistent_script->script.filename) + 1);
                                                php_stream_stat_path(fname, &ssb);
                                                efree(fname);
                                        }
@@ -1741,7 +1741,7 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type)
                if (checksum != persistent_script->dynamic_members.checksum ) {
                        /* The checksum is wrong */
                        zend_accel_error(ACCEL_LOG_INFO, "Checksum failed for '%s':  expected=0x%0.8X, found=0x%0.8X",
-                                                        persistent_script->full_path, persistent_script->dynamic_members.checksum, checksum);
+                                                        persistent_script->script.filename, persistent_script->dynamic_members.checksum, checksum);
                        zend_shared_alloc_lock();
                        if (!persistent_script->corrupted) {
                                persistent_script->corrupted = 1;
@@ -1818,21 +1818,21 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type)
 #endif
 
                /* see bug #15471 (old BTS) */
-               if (persistent_script->full_path) {
+               if (persistent_script->script.filename) {
                        if (!EG(current_execute_data) || !EG(current_execute_data)->opline ||
                            !EG(current_execute_data)->func ||
                            !ZEND_USER_CODE(EG(current_execute_data)->func->common.type) ||
                            EG(current_execute_data)->opline->opcode != ZEND_INCLUDE_OR_EVAL ||
                            (EG(current_execute_data)->opline->extended_value != ZEND_INCLUDE_ONCE &&
                             EG(current_execute_data)->opline->extended_value != ZEND_REQUIRE_ONCE)) {
-                               if (zend_hash_add_empty_element(&EG(included_files), persistent_script->full_path) != NULL) {
+                               if (zend_hash_add_empty_element(&EG(included_files), persistent_script->script.filename) != NULL) {
                                        /* ext/phar has to load phar's metadata into memory */
                                        if (persistent_script->is_phar) {
                                                php_stream_statbuf ssb;
-                                               char *fname = emalloc(sizeof("phar://") + ZSTR_LEN(persistent_script->full_path));
+                                               char *fname = emalloc(sizeof("phar://") + ZSTR_LEN(persistent_script->script.filename));
 
                                                memcpy(fname, "phar://", sizeof("phar://") - 1);
-                                               memcpy(fname + sizeof("phar://") - 1, ZSTR_VAL(persistent_script->full_path), ZSTR_LEN(persistent_script->full_path) + 1);
+                                               memcpy(fname + sizeof("phar://") - 1, ZSTR_VAL(persistent_script->script.filename), ZSTR_LEN(persistent_script->script.filename) + 1);
                                                php_stream_stat_path(fname, &ssb);
                                                efree(fname);
                                        }
@@ -1871,7 +1871,7 @@ static int persistent_stream_open_function(const char *filename, zend_file_handl
                        /* we are in include_once or FastCGI request */
                        handle->filename = (char*)filename;
                        handle->free_filename = 0;
-                       handle->opened_path = zend_string_copy(ZCG(cache_persistent_script)->full_path);
+                       handle->opened_path = zend_string_copy(ZCG(cache_persistent_script)->script.filename);
                        handle->type = ZEND_HANDLE_FILENAME;
                        return SUCCESS;
                }
@@ -1913,7 +1913,7 @@ static zend_string* persistent_zend_resolve_path(const char *filename, int filen
                                                if (!persistent_script->corrupted) {
                                                        ZCG(cache_opline) = EG(current_execute_data) ? EG(current_execute_data)->opline : NULL;
                                                        ZCG(cache_persistent_script) = persistent_script;
-                                                       return zend_string_copy(persistent_script->full_path);
+                                                       return zend_string_copy(persistent_script->script.filename);
                                                }
                                        }
                                } else {
index 798b2d7365d06c4a2edd28a3681768409ecc2048..c70950366627270cfabdee787b2d171473006448 100644 (file)
 # include <sys/param.h>
 #endif
 
-#define PHP_5_0_X_API_NO               220040412
-#define PHP_5_1_X_API_NO               220051025
-#define PHP_5_2_X_API_NO               220060519
-#define PHP_5_3_X_API_NO               220090626
-#define PHP_5_4_X_API_NO               220100525
-#define PHP_5_5_X_API_NO               220121212
-#define PHP_5_6_X_API_NO               220131226
-
 /*** file locking ***/
 #ifndef ZEND_WIN32
 extern int lock_file;
@@ -127,18 +119,6 @@ extern int lock_file;
 # endif
 #endif
 
-#define PZ_REFCOUNT_P(pz)                              (pz)->refcount__gc
-#define PZ_SET_REFCOUNT_P(pz, v)               (pz)->refcount__gc = (v)
-#define PZ_ADDREF_P(pz)                                        ++((pz)->refcount__gc)
-#define PZ_DELREF_P(pz)                                        --((pz)->refcount__gc)
-#define PZ_ISREF_P(pz)                                 (pz)->is_ref__gc
-#define PZ_SET_ISREF_P(pz)                             Z_SET_ISREF_TO_P(pz, 1)
-#define PZ_UNSET_ISREF_P(pz)                   Z_SET_ISREF_TO_P(pz, 0)
-#define PZ_SET_ISREF_TO_P(pz, isref)   (pz)->is_ref__gc = (isref)
-
-#define DO_ALLOCA(x)   do_alloca(x, use_heap)
-#define FREE_ALLOCA(x) free_alloca(x, use_heap)
-
 #if defined(HAVE_OPCACHE_FILE_CACHE) && defined(ZEND_WIN32)
 # define ENABLE_FILE_CACHE_FALLBACK 1
 #endif
@@ -156,11 +136,8 @@ typedef enum _zend_accel_restart_reason {
 } zend_accel_restart_reason;
 
 typedef struct _zend_persistent_script {
-       zend_string   *full_path;              /* full real path with resolved symlinks */
-       zend_op_array  main_op_array;
-       HashTable      function_table;
-       HashTable      class_table;
-       zend_long           compiler_halt_offset;   /* position of __HALT_COMPILER or -1 */
+       zend_script    script;
+       zend_long      compiler_halt_offset;   /* position of __HALT_COMPILER or -1 */
        int            ping_auto_globals_mask; /* which autoglobals are used by the script */
        accel_time_t   timestamp;              /* the script modification time */
        zend_bool      corrupted;
@@ -325,37 +302,15 @@ void zend_accel_schedule_restart_if_necessary(zend_accel_restart_reason reason);
 accel_time_t zend_get_file_handle_timestamp(zend_file_handle *file_handle, size_t *size);
 int  validate_timestamp_and_record(zend_persistent_script *persistent_script, zend_file_handle *file_handle);
 int  zend_accel_invalidate(const char *filename, int filename_len, zend_bool force);
-int  zend_accel_script_optimize(zend_persistent_script *persistent_script);
 int  accelerator_shm_read_lock(void);
 void accelerator_shm_read_unlock(void);
 
 char *accel_make_persistent_key(const char *path, int path_length, int *key_len);
 zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type);
 
-#if !defined(ZEND_DECLARE_INHERITED_CLASS_DELAYED)
-# define ZEND_DECLARE_INHERITED_CLASS_DELAYED 145
-#endif
-
-#define ZEND_DECLARE_INHERITED_CLASS_DELAYED_FLAG 0x80
-
 #define IS_ACCEL_INTERNED(str) \
        ((char*)(str) >= ZCSG(interned_strings_start) && (char*)(str) < ZCSG(interned_strings_end))
 
 zend_string *accel_new_interned_string(zend_string *str);
 
-# define ZEND_RESULT_TYPE(opline)      (opline)->result_type
-# define ZEND_RESULT(opline)           (opline)->result
-# define ZEND_OP1_TYPE(opline)         (opline)->op1_type
-# define ZEND_OP1(opline)                      (opline)->op1
-# define ZEND_OP1_CONST(opline)                (*(opline)->op1.zv)
-# define ZEND_OP1_LITERAL(opline)      (op_array)->literals[(opline)->op1.constant]
-# define ZEND_OP2_TYPE(opline)         (opline)->op2_type
-# define ZEND_OP2(opline)                      (opline)->op2
-# define ZEND_OP2_CONST(opline)                (*(opline)->op2.zv)
-# define ZEND_OP2_LITERAL(opline)      (op_array)->literals[(opline)->op2.constant]
-# define ZEND_DONE_PASS_TWO(op_array)  (((op_array)->fn_flags & ZEND_ACC_DONE_PASS_TWO) != 0)
-# define ZEND_CE_FILENAME(ce)                  (ce)->info.user.filename
-# define ZEND_CE_DOC_COMMENT(ce)        (ce)->info.user.doc_comment
-# define ZEND_CE_DOC_COMMENT_LEN(ce)   (ce)->info.user.doc_comment_len
-
 #endif /* ZEND_ACCELERATOR_H */
index f65e2700009f5497472009611e9001171b7bd984..8514e2b39147ce6b3ef59634e7f7887d9ff00001 100644 (file)
@@ -545,7 +545,7 @@ static int accelerator_get_scripts(zval *return_value)
                        script = (zend_persistent_script *)cache_entry->data;
 
                        array_init(&persistent_script_report);
-                       add_assoc_str(&persistent_script_report, "full_path", zend_string_dup(script->full_path, 0));
+                       add_assoc_str(&persistent_script_report, "full_path", zend_string_dup(script->script.filename, 0));
                        add_assoc_long(&persistent_script_report, "hits", (zend_long)script->dynamic_members.hits);
                        add_assoc_long(&persistent_script_report, "memory_consumption", script->dynamic_members.memory_consumption);
                        ta = localtime(&script->dynamic_members.last_used);
index cfb03a00e40f5d8eb7ccde6dd28506bff00bf19a..ab048c6df3c695dd0e0ad1a61fa79d31cbcdcfb3 100644 (file)
@@ -72,12 +72,12 @@ zend_persistent_script* create_persistent_script(void)
        zend_persistent_script *persistent_script = (zend_persistent_script *) emalloc(sizeof(zend_persistent_script));
        memset(persistent_script, 0, sizeof(zend_persistent_script));
 
-       zend_hash_init(&persistent_script->function_table, 128, NULL, ZEND_FUNCTION_DTOR, 0);
+       zend_hash_init(&persistent_script->script.function_table, 128, NULL, ZEND_FUNCTION_DTOR, 0);
        /* class_table is usually destroyed by free_persistent_script() that
         * overrides destructor. ZEND_CLASS_DTOR may be used by standard
         * PHP compiler
         */
-       zend_hash_init(&persistent_script->class_table, 16, NULL, ZEND_CLASS_DTOR, 0);
+       zend_hash_init(&persistent_script->script.class_table, 16, NULL, ZEND_CLASS_DTOR, 0);
 
        return persistent_script;
 }
@@ -85,18 +85,18 @@ zend_persistent_script* create_persistent_script(void)
 void free_persistent_script(zend_persistent_script *persistent_script, int destroy_elements)
 {
        if (destroy_elements) {
-               persistent_script->function_table.pDestructor = zend_accel_destroy_zend_function;
-               persistent_script->class_table.pDestructor = zend_accel_destroy_zend_class;
+               persistent_script->script.function_table.pDestructor = zend_accel_destroy_zend_function;
+               persistent_script->script.class_table.pDestructor = zend_accel_destroy_zend_class;
        } else {
-               persistent_script->function_table.pDestructor = NULL;
-               persistent_script->class_table.pDestructor = NULL;
+               persistent_script->script.function_table.pDestructor = NULL;
+               persistent_script->script.class_table.pDestructor = NULL;
        }
 
-       zend_hash_destroy(&persistent_script->function_table);
-       zend_hash_destroy(&persistent_script->class_table);
+       zend_hash_destroy(&persistent_script->script.function_table);
+       zend_hash_destroy(&persistent_script->script.class_table);
 
-       if (persistent_script->full_path) {
-               zend_string_release(persistent_script->full_path);
+       if (persistent_script->script.filename) {
+               zend_string_release(persistent_script->script.filename);
        }
 
        efree(persistent_script);
@@ -679,7 +679,7 @@ zend_op_array* zend_accel_load_script(zend_persistent_script *persistent_script,
        zend_op_array *op_array;
 
        op_array = (zend_op_array *) emalloc(sizeof(zend_op_array));
-       *op_array = persistent_script->main_op_array;
+       *op_array = persistent_script->script.main_op_array;
 
        if (EXPECTED(from_shared_memory)) {
                zend_hash_init(&ZCG(bind_hash), 10, NULL, NULL, 0);
@@ -699,22 +699,22 @@ zend_op_array* zend_accel_load_script(zend_persistent_script *persistent_script,
                }
 
                /* Copy all the necessary stuff from shared memory to regular memory, and protect the shared script */
-               if (zend_hash_num_elements(&persistent_script->class_table) > 0) {
-                       zend_accel_class_hash_copy(CG(class_table), &persistent_script->class_table, (unique_copy_ctor_func_t) zend_class_copy_ctor);
+               if (zend_hash_num_elements(&persistent_script->script.class_table) > 0) {
+                       zend_accel_class_hash_copy(CG(class_table), &persistent_script->script.class_table, (unique_copy_ctor_func_t) zend_class_copy_ctor);
                }
                /* we must first to copy all classes and then prepare functions, since functions may try to bind
                   classes - which depend on pre-bind class entries existent in the class table */
-               if (zend_hash_num_elements(&persistent_script->function_table) > 0) {
-                       zend_accel_function_hash_copy_from_shm(CG(function_table), &persistent_script->function_table);
+               if (zend_hash_num_elements(&persistent_script->script.function_table) > 0) {
+                       zend_accel_function_hash_copy_from_shm(CG(function_table), &persistent_script->script.function_table);
                }
 
                /* Register __COMPILER_HALT_OFFSET__ constant */
                if (persistent_script->compiler_halt_offset != 0 &&
-                   persistent_script->full_path) {
+                   persistent_script->script.filename) {
                        zend_string *name;
                        char haltoff[] = "__COMPILER_HALT_OFFSET__";
 
-                       name = zend_mangle_property_name(haltoff, sizeof(haltoff) - 1, ZSTR_VAL(persistent_script->full_path), ZSTR_LEN(persistent_script->full_path), 0);
+                       name = zend_mangle_property_name(haltoff, sizeof(haltoff) - 1, ZSTR_VAL(persistent_script->script.filename), ZSTR_LEN(persistent_script->script.filename), 0);
                        if (!zend_hash_exists(EG(zend_constants), name)) {
                                zend_register_long_constant(ZSTR_VAL(name), ZSTR_LEN(name), persistent_script->compiler_halt_offset, CONST_CS, 0);
                        }
@@ -724,17 +724,17 @@ zend_op_array* zend_accel_load_script(zend_persistent_script *persistent_script,
                zend_hash_destroy(&ZCG(bind_hash));
                ZCG(current_persistent_script) = NULL;
        } else /* if (!from_shared_memory) */ {
-               if (zend_hash_num_elements(&persistent_script->function_table) > 0) {
-                       zend_accel_function_hash_copy(CG(function_table), &persistent_script->function_table);
+               if (zend_hash_num_elements(&persistent_script->script.function_table) > 0) {
+                       zend_accel_function_hash_copy(CG(function_table), &persistent_script->script.function_table);
                }
-               if (zend_hash_num_elements(&persistent_script->class_table) > 0) {
-                       zend_accel_class_hash_copy(CG(class_table), &persistent_script->class_table, NULL);
+               if (zend_hash_num_elements(&persistent_script->script.class_table) > 0) {
+                       zend_accel_class_hash_copy(CG(class_table), &persistent_script->script.class_table, NULL);
                }
        }
 
        if (op_array->early_binding != (uint32_t)-1) {
                zend_string *orig_compiled_filename = CG(compiled_filename);
-               CG(compiled_filename) = persistent_script->full_path;
+               CG(compiled_filename) = persistent_script->script.filename;
                zend_do_delayed_early_binding(op_array);
                CG(compiled_filename) = orig_compiled_filename;
        }
index 3fb3c7be2cb0389c24a27c42776b646ed5d0092e..3054e57a6f5aabea5fa6e068bce30695a17ebcc0 100644 (file)
@@ -381,10 +381,10 @@ static void zend_file_cache_serialize_op_array(zend_op_array            *op_arra
                end = opline + op_array->last;
                while (opline < end) {
 # if ZEND_USE_ABS_CONST_ADDR
-                       if (ZEND_OP1_TYPE(opline) == IS_CONST) {
+                       if (opline->op1_type == IS_CONST) {
                                SERIALIZE_PTR(opline->op1.zv);
                        }
-                       if (ZEND_OP2_TYPE(opline) == IS_CONST) {
+                       if (opline->op2_type == IS_CONST) {
                                SERIALIZE_PTR(opline->op2.zv);
                        }
 # endif
@@ -546,8 +546,8 @@ static void zend_file_cache_serialize_class(zval                     *zv,
                }
        }
        zend_file_cache_serialize_hash(&ce->constants_table, script, info, buf, zend_file_cache_serialize_zval);
-       SERIALIZE_STR(ZEND_CE_FILENAME(ce));
-       SERIALIZE_STR(ZEND_CE_DOC_COMMENT(ce));
+       SERIALIZE_STR(ce->info.user.filename);
+       SERIALIZE_STR(ce->info.user.doc_comment);
        zend_file_cache_serialize_hash(&ce->properties_info, script, info, buf, zend_file_cache_serialize_prop_info);
 
        if (ce->trait_aliases) {
@@ -659,11 +659,11 @@ static void zend_file_cache_serialize(zend_persistent_script   *script,
        memcpy(buf, script->mem, script->size);
 
        new_script = (zend_persistent_script*)((char*)buf + info->script_offset);
-       SERIALIZE_STR(new_script->full_path);
+       SERIALIZE_STR(new_script->script.filename);
 
-       zend_file_cache_serialize_hash(&new_script->class_table, script, info, buf, zend_file_cache_serialize_class);
-       zend_file_cache_serialize_hash(&new_script->function_table, script, info, buf, zend_file_cache_serialize_func);
-       zend_file_cache_serialize_op_array(&new_script->main_op_array, script, info, buf);
+       zend_file_cache_serialize_hash(&new_script->script.class_table, script, info, buf, zend_file_cache_serialize_class);
+       zend_file_cache_serialize_hash(&new_script->script.function_table, script, info, buf, zend_file_cache_serialize_func);
+       zend_file_cache_serialize_op_array(&new_script->script.main_op_array, script, info, buf);
 
        SERIALIZE_PTR(new_script->arena_mem);
        new_script->mem = NULL;
@@ -711,7 +711,7 @@ int zend_file_cache_script_store(zend_persistent_script *script, int in_shm)
 #endif
        void *mem, *buf;
 
-       filename = zend_file_cache_get_bin_file_path(script->full_path);
+       filename = zend_file_cache_get_bin_file_path(script->script.filename);
 
        if (zend_file_cache_mkdir(filename, strlen(ZCG(accel_directives).file_cache)) != SUCCESS) {
                zend_accel_error(ACCEL_LOG_WARNING, "opcache cannot create directory for file '%s'\n", filename);
@@ -936,10 +936,10 @@ static void zend_file_cache_unserialize_op_array(zend_op_array           *op_arr
                end = opline + op_array->last;
                while (opline < end) {
 # if ZEND_USE_ABS_CONST_ADDR
-                       if (ZEND_OP1_TYPE(opline) == IS_CONST) {
+                       if (opline->op1_type == IS_CONST) {
                                UNSERIALIZE_PTR(opline->op1.zv);
                        }
-                       if (ZEND_OP2_TYPE(opline) == IS_CONST) {
+                       if (opline->op2_type == IS_CONST) {
                                UNSERIALIZE_PTR(opline->op2.zv);
                        }
 # endif
@@ -1091,8 +1091,8 @@ static void zend_file_cache_unserialize_class(zval                    *zv,
        }
        zend_file_cache_unserialize_hash(&ce->constants_table,
                        script, buf, zend_file_cache_unserialize_zval, NULL);
-       UNSERIALIZE_STR(ZEND_CE_FILENAME(ce));
-       UNSERIALIZE_STR(ZEND_CE_DOC_COMMENT(ce));
+       UNSERIALIZE_STR(ce->info.user.filename);
+       UNSERIALIZE_STR(ce->info.user.doc_comment);
        zend_file_cache_unserialize_hash(&ce->properties_info,
                        script, buf, zend_file_cache_unserialize_prop_info, ZVAL_PTR_DTOR);
 
@@ -1192,13 +1192,13 @@ static void zend_file_cache_unserialize(zend_persistent_script  *script,
 {
        script->mem = buf;
 
-       UNSERIALIZE_STR(script->full_path);
+       UNSERIALIZE_STR(script->script.filename);
 
-       zend_file_cache_unserialize_hash(&script->class_table,
+       zend_file_cache_unserialize_hash(&script->script.class_table,
                        script, buf, zend_file_cache_unserialize_class, ZEND_CLASS_DTOR);
-       zend_file_cache_unserialize_hash(&script->function_table,
+       zend_file_cache_unserialize_hash(&script->script.function_table,
                        script, buf, zend_file_cache_unserialize_func, ZEND_FUNCTION_DTOR);
-       zend_file_cache_unserialize_op_array(&script->main_op_array, script, buf);
+       zend_file_cache_unserialize_op_array(&script->script.main_op_array, script, buf);
 
        UNSERIALIZE_PTR(script->arena_mem);
 }
@@ -1351,7 +1351,7 @@ use_process_mem:
        if (cache_it) {
                script->dynamic_members.checksum = zend_accel_script_checksum(script);
 
-               zend_accel_hash_update(&ZCSG(hash), ZSTR_VAL(script->full_path), ZSTR_LEN(script->full_path), 0, script);
+               zend_accel_hash_update(&ZCSG(hash), ZSTR_VAL(script->script.filename), ZSTR_LEN(script->script.filename), 0, script);
 
                zend_shared_alloc_unlock();
                zend_arena_release(&CG(arena), checkpoint);
index 97757142fc68b94ffa8e52526a37e78ac9733492..11cf33ee4a5bfdf1ff6953e068d7bd5b35f06c43 100644 (file)
@@ -517,22 +517,22 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc
 
                for (; opline < end ; opline++, offset++) {
 # if ZEND_USE_ABS_CONST_ADDR
-                       if (ZEND_OP1_TYPE(opline) == IS_CONST) {
+                       if (opline->op1_type == IS_CONST) {
                                opline->op1.zv = (zval*)((char*)opline->op1.zv + ((char*)op_array->literals - (char*)orig_literals));
                        }
-                       if (ZEND_OP2_TYPE(opline) == IS_CONST) {
+                       if (opline->op2_type == IS_CONST) {
                                opline->op2.zv = (zval*)((char*)opline->op2.zv + ((char*)op_array->literals - (char*)orig_literals));
                        }
 # endif
 # if ZEND_USE_ABS_JMP_ADDR
-                       if (ZEND_DONE_PASS_TWO(op_array)) {
+                       if (op_array->fn_flags & ZEND_ACC_DONE_PASS_TWO) {
                                /* fix jumps to point to new array */
                                switch (opline->opcode) {
                                        case ZEND_JMP:
                                        case ZEND_FAST_CALL:
                                        case ZEND_DECLARE_ANON_CLASS:
                                        case ZEND_DECLARE_ANON_INHERITED_CLASS:
-                                               ZEND_OP1(opline).jmp_addr = &new_opcodes[ZEND_OP1(opline).jmp_addr - op_array->opcodes];
+                                               opline->op1.jmp_addr = &new_opcodes[opline->op1.jmp_addr - op_array->opcodes];
                                                break;
                                        case ZEND_JMPZNZ:
                                                /* relative extended_value don't have to be changed */
@@ -547,7 +547,7 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc
                                        case ZEND_FE_RESET_R:
                                        case ZEND_FE_RESET_RW:
                                        case ZEND_ASSERT_CHECK:
-                                               ZEND_OP2(opline).jmp_addr = &new_opcodes[ZEND_OP2(opline).jmp_addr - op_array->opcodes];
+                                               opline->op2.jmp_addr = &new_opcodes[opline->op2.jmp_addr - op_array->opcodes];
                                                break;
                                        case ZEND_FE_FETCH_R:
                                        case ZEND_FE_FETCH_RW:
@@ -747,19 +747,19 @@ static void zend_persist_class_entry(zval *zv)
 
                zend_hash_persist(&ce->constants_table, zend_persist_zval);
 
-               if (ZEND_CE_FILENAME(ce)) {
+               if (ce->info.user.filename) {
                        /* do not free! PHP has centralized filename storage, compiler will free it */
-                       zend_accel_memdup_string(ZEND_CE_FILENAME(ce));
+                       zend_accel_memdup_string(ce->info.user.filename);
                }
-               if (ZEND_CE_DOC_COMMENT(ce)) {
+               if (ce->info.user.doc_comment) {
                        if (ZCG(accel_directives).save_comments) {
-                               zend_accel_store_string(ZEND_CE_DOC_COMMENT(ce));
+                               zend_accel_store_string(ce->info.user.doc_comment);
                        } else {
-                               if (!zend_shared_alloc_get_xlat_entry(ZEND_CE_DOC_COMMENT(ce))) {
-                                       zend_shared_alloc_register_xlat_entry(ZEND_CE_DOC_COMMENT(ce), ZEND_CE_DOC_COMMENT(ce));
-                                       zend_string_release(ZEND_CE_DOC_COMMENT(ce));
+                               if (!zend_shared_alloc_get_xlat_entry(ce->info.user.doc_comment)) {
+                                       zend_shared_alloc_register_xlat_entry(ce->info.user.doc_comment, ce->info.user.doc_comment);
+                                       zend_string_release(ce->info.user.doc_comment);
                                }
-                               ZEND_CE_DOC_COMMENT(ce) = NULL;
+                               ce->info.user.doc_comment = NULL;
                        }
                }
                zend_hash_persist(&ce->properties_info, zend_persist_property_info);
@@ -906,7 +906,7 @@ zend_persistent_script *zend_accel_script_persist(zend_persistent_script *script
        if (key && *key) {
                *key = zend_accel_memdup(*key, key_length + 1);
        }
-       zend_accel_store_string(script->full_path);
+       zend_accel_store_string(script->script.filename);
 
 #ifdef __SSE2__
        /* Align to 64-byte boundary */
@@ -918,9 +918,9 @@ zend_persistent_script *zend_accel_script_persist(zend_persistent_script *script
        script->arena_mem = ZCG(arena_mem) = ZCG(mem);
        ZCG(mem) = (void*)((char*)ZCG(mem) + script->arena_size);
 
-       zend_accel_persist_class_table(&script->class_table);
-       zend_hash_persist(&script->function_table, zend_persist_op_array);
-       zend_persist_op_array_ex(&script->main_op_array, script);
+       zend_accel_persist_class_table(&script->script.class_table);
+       zend_hash_persist(&script->script.function_table, zend_persist_op_array);
+       zend_persist_op_array_ex(&script->script.main_op_array, script);
 
        return script;
 }
index 51664f28d4f7f81741e8436fc8eb9973a5e3f8c6..a3c2d1a90597673f457093124dc3731259e8637e 100644 (file)
@@ -318,11 +318,11 @@ static void zend_persist_class_entry_calc(zval *zv)
                }
                zend_hash_persist_calc(&ce->constants_table, zend_persist_zval_calc);
 
-               if (ZEND_CE_FILENAME(ce)) {
-                       ADD_STRING(ZEND_CE_FILENAME(ce));
+               if (ce->info.user.filename) {
+                       ADD_STRING(ce->info.user.filename);
                }
-               if (ZCG(accel_directives).save_comments && ZEND_CE_DOC_COMMENT(ce)) {
-                       ADD_STRING(ZEND_CE_DOC_COMMENT(ce));
+               if (ZCG(accel_directives).save_comments && ce->info.user.doc_comment) {
+                       ADD_STRING(ce->info.user.doc_comment);
                }
 
                zend_hash_persist_calc(&ce->properties_info, zend_persist_property_info_calc);
@@ -391,16 +391,16 @@ uint zend_accel_script_persist_calc(zend_persistent_script *new_persistent_scrip
        if (key) {
                ADD_DUP_SIZE(key, key_length + 1);
        }
-       ADD_STRING(new_persistent_script->full_path);
+       ADD_STRING(new_persistent_script->script.filename);
 
 #ifdef __SSE2__
        /* Align size to 64-byte boundary */
        new_persistent_script->size = (new_persistent_script->size + 63) & ~63;
 #endif
 
-       zend_accel_persist_class_table_calc(&new_persistent_script->class_table);
-       zend_hash_persist_calc(&new_persistent_script->function_table, zend_persist_op_array_calc);
-       zend_persist_op_array_calc_ex(&new_persistent_script->main_op_array);
+       zend_accel_persist_class_table_calc(&new_persistent_script->script.class_table);
+       zend_hash_persist_calc(&new_persistent_script->script.function_table, zend_persist_op_array_calc);
+       zend_persist_op_array_calc_ex(&new_persistent_script->script.main_op_array);
 
 #ifdef __SSE2__
        /* Align size to 64-byte boundary */