summaryrefslogtreecommitdiff
path: root/ext/opcache
diff options
context:
space:
mode:
Diffstat (limited to 'ext/opcache')
-rw-r--r--ext/opcache/Optimizer/compact_literals.c33
-rw-r--r--ext/opcache/README5
-rw-r--r--ext/opcache/ZendAccelerator.c5
-rw-r--r--ext/opcache/ZendAccelerator.h1
-rw-r--r--ext/opcache/zend_accelerator_module.c2
-rw-r--r--ext/opcache/zend_accelerator_util_funcs.c21
-rw-r--r--ext/opcache/zend_file_cache.c6
-rw-r--r--ext/opcache/zend_persist.c3
-rw-r--r--ext/opcache/zend_persist_calc.c3
9 files changed, 34 insertions, 45 deletions
diff --git a/ext/opcache/Optimizer/compact_literals.c b/ext/opcache/Optimizer/compact_literals.c
index c72e8f6772..deae12cdbb 100644
--- a/ext/opcache/Optimizer/compact_literals.c
+++ b/ext/opcache/Optimizer/compact_literals.c
@@ -128,6 +128,7 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx
void *checkpoint = zend_arena_checkpoint(ctx->arena);
if (op_array->last_literal) {
+ cache_size = 0;
info = (literal_info*)zend_arena_calloc(&ctx->arena, op_array->last_literal, sizeof(literal_info));
/* Mark literals of specific types */
@@ -286,6 +287,19 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx
case ZEND_BIND_GLOBAL:
LITERAL_INFO(opline->op2.constant, LITERAL_GLOBAL, 0, 1, 1);
break;
+ case ZEND_RECV_INIT:
+ LITERAL_INFO(opline->op2.constant, LITERAL_VALUE, 0, 0, 1);
+ if (Z_CACHE_SLOT(op_array->literals[opline->op2.constant]) != -1) {
+ Z_CACHE_SLOT(op_array->literals[opline->op2.constant]) = cache_size;
+ cache_size += sizeof(void *);
+ }
+ break;
+ case ZEND_RECV:
+ case ZEND_VERIFY_RETURN_TYPE:
+ if (opline->op2.num != -1) {
+ opline->op2.num = cache_size;
+ cache_size += sizeof(void *);
+ }
default:
if (ZEND_OP1_TYPE(opline) == IS_CONST) {
LITERAL_INFO(opline->op1.constant, LITERAL_VALUE, 1, 0, 1);
@@ -319,7 +333,7 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx
#endif
/* Merge equal constants */
- j = 0; cache_size = 0;
+ j = 0;
zend_hash_init(&hash, op_array->last_literal, NULL, NULL, 0);
map = (int*)zend_arena_alloc(&ctx->arena, op_array->last_literal * sizeof(int));
memset(map, 0, op_array->last_literal * sizeof(int));
@@ -331,15 +345,26 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx
}
switch (Z_TYPE(op_array->literals[i])) {
case IS_NULL:
- if (l_null < 0) {
- l_null = j;
+ /* Only checking MAY_MERGE for IS_NULL here
+ * is because only IS_NULL can be default value for class type hinting(RECV_INIT). */
+ if ((info[i].flags & LITERAL_MAY_MERGE)) {
+ if (l_null < 0) {
+ l_null = j;
+ if (i != j) {
+ op_array->literals[j] = op_array->literals[i];
+ info[j] = info[i];
+ }
+ j++;
+ }
+ map[i] = l_null;
+ } else {
+ map[i] = j;
if (i != j) {
op_array->literals[j] = op_array->literals[i];
info[j] = info[i];
}
j++;
}
- map[i] = l_null;
break;
case IS_FALSE:
if (l_false < 0) {
diff --git a/ext/opcache/README b/ext/opcache/README
index ef656ae579..c074440130 100644
--- a/ext/opcache/README
+++ b/ext/opcache/README
@@ -127,11 +127,6 @@ opcache.save_comments (default "1")
size of the optimized code. Disabling "Doc Comments" may break some
existing applications and frameworks (e.g. Doctrine, ZF2, PHPUnit)
-opcache.load_comments (default "1")
- If disabled, PHPDoc comments are not loaded from SHM, so "Doc Comments"
- may be always stored (save_comments=1), but not loaded by applications
- that don't need them anyway.
-
opcache.fast_shutdown (default "0")
If enabled, a fast shutdown sequence is used for the accelerated code
The fast shutdown sequence doesn't free each allocated block, but lets
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index 36684218d8..18e94287a2 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -2355,8 +2355,9 @@ static inline int accel_find_sapi(void)
return SUCCESS;
}
}
- if (ZCG(accel_directives).enable_cli &&
- strcmp(sapi_module.name, "cli") == 0) {
+ if (ZCG(accel_directives).enable_cli && (
+ strcmp(sapi_module.name, "cli") == 0
+ || strcmp(sapi_module.name, "phpdbg") == 0)) {
return SUCCESS;
}
}
diff --git a/ext/opcache/ZendAccelerator.h b/ext/opcache/ZendAccelerator.h
index 2c6584a1e2..6ce4613d2f 100644
--- a/ext/opcache/ZendAccelerator.h
+++ b/ext/opcache/ZendAccelerator.h
@@ -196,7 +196,6 @@ typedef struct _zend_accel_directives {
zend_bool validate_timestamps;
zend_bool revalidate_path;
zend_bool save_comments;
- zend_bool load_comments;
zend_bool fast_shutdown;
zend_bool protect_memory;
zend_bool file_override_enabled;
diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c
index 7a8ef8d3e8..531ea6e9ed 100644
--- a/ext/opcache/zend_accelerator_module.c
+++ b/ext/opcache/zend_accelerator_module.c
@@ -292,7 +292,6 @@ ZEND_INI_BEGIN()
STD_PHP_INI_ENTRY("opcache.protect_memory" , "0" , PHP_INI_SYSTEM, OnUpdateBool, accel_directives.protect_memory, zend_accel_globals, accel_globals)
STD_PHP_INI_ENTRY("opcache.save_comments" , "1" , PHP_INI_SYSTEM, OnUpdateBool, accel_directives.save_comments, zend_accel_globals, accel_globals)
- STD_PHP_INI_ENTRY("opcache.load_comments" , "1" , PHP_INI_ALL, OnUpdateBool, accel_directives.load_comments, zend_accel_globals, accel_globals)
STD_PHP_INI_ENTRY("opcache.fast_shutdown" , "0" , PHP_INI_SYSTEM, OnUpdateBool, accel_directives.fast_shutdown, zend_accel_globals, accel_globals)
STD_PHP_INI_ENTRY("opcache.optimization_level" , DEFAULT_OPTIMIZATION_LEVEL , PHP_INI_SYSTEM, OnUpdateLong, accel_directives.optimization_level, zend_accel_globals, accel_globals)
@@ -695,7 +694,6 @@ static ZEND_FUNCTION(opcache_get_configuration)
add_assoc_bool(&directives, "opcache.protect_memory", ZCG(accel_directives).protect_memory);
add_assoc_bool(&directives, "opcache.save_comments", ZCG(accel_directives).save_comments);
- add_assoc_bool(&directives, "opcache.load_comments", ZCG(accel_directives).load_comments);
add_assoc_bool(&directives, "opcache.fast_shutdown", ZCG(accel_directives).fast_shutdown);
add_assoc_bool(&directives, "opcache.enable_file_override", ZCG(accel_directives).file_override_enabled);
add_assoc_long(&directives, "opcache.optimization_level", ZCG(accel_directives).optimization_level);
diff --git a/ext/opcache/zend_accelerator_util_funcs.c b/ext/opcache/zend_accelerator_util_funcs.c
index 9582b723a2..996deecbb2 100644
--- a/ext/opcache/zend_accelerator_util_funcs.c
+++ b/ext/opcache/zend_accelerator_util_funcs.c
@@ -373,18 +373,8 @@ static void zend_hash_clone_prop_info(HashTable *ht, HashTable *source, zend_cla
prop_info = ARENA_REALLOC(Z_PTR(p->val));
ZVAL_PTR(&q->val, prop_info);
- if (prop_info->ce == old_ce || (prop_info->flags & ZEND_ACC_SHADOW)) {
- /* Copy constructor */
- if (prop_info->doc_comment) {
- if (ZCG(accel_directives).load_comments) {
- prop_info->doc_comment = zend_string_dup(prop_info->doc_comment, 0);
- } else {
- prop_info->doc_comment = NULL;
- }
- }
- prop_info->ce = ARENA_REALLOC(prop_info->ce);
- } else if ((void*)prop_info->ce >= ZCG(current_persistent_script)->arena_mem &&
- (void*)prop_info->ce < (void*)((char*)ZCG(current_persistent_script)->arena_mem + ZCG(current_persistent_script)->arena_size)) {
+ if ((void*)prop_info->ce >= ZCG(current_persistent_script)->arena_mem &&
+ (void*)prop_info->ce < (void*)((char*)ZCG(current_persistent_script)->arena_mem + ZCG(current_persistent_script)->arena_size)) {
prop_info->ce = ARENA_REALLOC(prop_info->ce);
}
}
@@ -447,13 +437,6 @@ static void zend_class_copy_ctor(zend_class_entry **pce)
} else {
ce->interfaces = NULL;
}
- if (ZEND_CE_DOC_COMMENT(ce)) {
- if (ZCG(accel_directives).load_comments) {
- ZEND_CE_DOC_COMMENT(ce) = zend_string_dup(ZEND_CE_DOC_COMMENT(ce), 0);
- } else {
- ZEND_CE_DOC_COMMENT(ce) = NULL;
- }
- }
if (ce->parent) {
ce->parent = ARENA_REALLOC(ce->parent);
diff --git a/ext/opcache/zend_file_cache.c b/ext/opcache/zend_file_cache.c
index 10a149c9f6..219bb50820 100644
--- a/ext/opcache/zend_file_cache.c
+++ b/ext/opcache/zend_file_cache.c
@@ -438,9 +438,6 @@ static void zend_file_cache_serialize_op_array(zend_op_array *op_arra
if (!IS_SERIALIZED(p->class_name)) {
SERIALIZE_STR(p->class_name);
}
- if (p->class_name && !IS_SERIALIZED(p->lower_class_name)) {
- SERIALIZE_STR(p->lower_class_name);
- }
p++;
}
}
@@ -965,9 +962,6 @@ static void zend_file_cache_unserialize_op_array(zend_op_array *op_arr
if (!IS_UNSERIALIZED(p->class_name)) {
UNSERIALIZE_STR(p->class_name);
}
- if (p->class_name && !IS_UNSERIALIZED(p->lower_class_name)) {
- UNSERIALIZE_STR(p->lower_class_name);
- }
p++;
}
}
diff --git a/ext/opcache/zend_persist.c b/ext/opcache/zend_persist.c
index 585c34f46e..09eebe0d02 100644
--- a/ext/opcache/zend_persist.c
+++ b/ext/opcache/zend_persist.c
@@ -581,9 +581,6 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc
}
if (arg_info[i].class_name) {
zend_accel_store_interned_string(arg_info[i].class_name);
- if (arg_info[i].lower_class_name) {
- zend_accel_store_interned_string(arg_info[i].lower_class_name);
- }
}
}
}
diff --git a/ext/opcache/zend_persist_calc.c b/ext/opcache/zend_persist_calc.c
index d721db2feb..98412109a5 100644
--- a/ext/opcache/zend_persist_calc.c
+++ b/ext/opcache/zend_persist_calc.c
@@ -225,9 +225,6 @@ static void zend_persist_op_array_calc_ex(zend_op_array *op_array)
}
if (arg_info[i].class_name) {
ADD_INTERNED_STRING(arg_info[i].class_name, 1);
- if (arg_info[i].lower_class_name) {
- ADD_INTERNED_STRING(arg_info[i].lower_class_name, 1);
- }
}
}
}