From: Dmitry Stogov Date: Mon, 21 Apr 2014 12:34:40 +0000 (+0400) Subject: Cleanup X-Git-Tag: POST_PHPNG_MERGE~412^2~81^2~11 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=afe66d89a122d0349f56ddd4c4abfd5d2da68f19;p=php Cleanup --- diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index 6350e7ed09..edf7c2ccd3 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -479,11 +479,7 @@ zval *zend_std_read_property(zval *object, zval *member, int type, zend_uint cac } else { retval = &EG(uninitialized_zval); } -//??? if (EXPECTED(retval != object)) { zval_ptr_dtor(&tmp_object); -//??? } else { -//??? Z_DELREF_P(object); -//??? } } else { if (Z_STRVAL_P(member)[0] == '\0') { if (Z_STRLEN_P(member) == 0) { diff --git a/ext/opcache/Optimizer/block_pass.c b/ext/opcache/Optimizer/block_pass.c index 2260af80bc..51ab3cd97b 100644 --- a/ext/opcache/Optimizer/block_pass.c +++ b/ext/opcache/Optimizer/block_pass.c @@ -1038,9 +1038,6 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, er = EG(error_reporting); EG(error_reporting) = 0; if (binary_op(&result, &ZEND_OP1_LITERAL(opline), &ZEND_OP2_LITERAL(opline) TSRMLS_CC) == SUCCESS) { -//??? PZ_SET_REFCOUNT_P(&result, 1); -//??? PZ_UNSET_ISREF_P(&result); - literal_dtor(&ZEND_OP1_LITERAL(opline)); literal_dtor(&ZEND_OP2_LITERAL(opline)); opline->opcode = ZEND_QM_ASSIGN; @@ -1068,8 +1065,6 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, convert_to_boolean(&result); ZVAL_NULL(&ZEND_OP1_LITERAL(opline)); } -//??? PZ_SET_REFCOUNT_P(&result, 1); -//??? PZ_UNSET_ISREF_P(&result); opline->opcode = ZEND_QM_ASSIGN; update_op1_const(op_array, opline, &result TSRMLS_CC); } else if ((opline->opcode == ZEND_RETURN || opline->opcode == ZEND_EXIT) && @@ -1654,11 +1649,6 @@ next_target: char *same_t=NULL; zend_code_block *target_block; int var_num = op_array->last_var + op_array->T; -//??? if (op_array->T >= (zend_uint)op_array->last_var) { -//??? var_num = op_array->T; -//??? } else { -//??? var_num = op_array->last_var; -//??? } if (var_num <= 0) { return; diff --git a/ext/opcache/Optimizer/compact_literals.c b/ext/opcache/Optimizer/compact_literals.c index 6c3bf41ec3..59628243f6 100644 --- a/ext/opcache/Optimizer/compact_literals.c +++ b/ext/opcache/Optimizer/compact_literals.c @@ -396,13 +396,6 @@ static void optimizer_compact_literals(zend_op_array *op_array TSRMLS_DC) op_array->literals[j] = op_array->literals[i]; info[j] = info[i]; } -//??? if (!Z_STR(op_array->literals[j].hash_value) { -//??? if (IS_INTERNED(Z_STRVAL(op_array->literals[j].constant))) { -//??? op_array->literals[j].hash_value = INTERNED_HASH(Z_STRVAL(op_array->literals[j].constant)); -//??? } else { -//??? op_array->literals[j].hash_value = zend_hash_func(Z_STRVAL(op_array->literals[j].constant), Z_STRLEN(op_array->literals[j].constant)+1); -//??? } -//??? } if (LITERAL_NUM_SLOTS(info[i].flags)) { Z_CACHE_SLOT(op_array->literals[j]) = cache_slots; cache_slots += LITERAL_NUM_SLOTS(info[i].flags); @@ -412,13 +405,6 @@ static void optimizer_compact_literals(zend_op_array *op_array TSRMLS_DC) while (n > 1) { i++; if (i != j) op_array->literals[j] = op_array->literals[i]; -//??? if (!op_array->literals[j].hash_value) { -//??? if (IS_INTERNED(Z_STRVAL(op_array->literals[j].constant))) { -//??? op_array->literals[j].hash_value = INTERNED_HASH(Z_STRVAL(op_array->literals[j].constant)); -//??? } else { -//??? op_array->literals[j].hash_value = zend_hash_func(Z_STRVAL(op_array->literals[j].constant), Z_STRLEN(op_array->literals[j].constant)+1); -//??? } -//??? } j++; n--; } diff --git a/ext/opcache/Optimizer/pass1_5.c b/ext/opcache/Optimizer/pass1_5.c index 207b8d0e61..4e1410a76e 100644 --- a/ext/opcache/Optimizer/pass1_5.c +++ b/ext/opcache/Optimizer/pass1_5.c @@ -60,9 +60,6 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { break; } EG(error_reporting) = er; -//??? PZ_SET_REFCOUNT_P(&result, 1); -//??? PZ_UNSET_ISREF_P(&result); - literal_dtor(&ZEND_OP1_LITERAL(opline)); literal_dtor(&ZEND_OP2_LITERAL(opline)); MAKE_NOP(opline); @@ -134,9 +131,6 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { break; } EG(error_reporting) = er; -//??? PZ_SET_REFCOUNT_P(&result, 1); -//??? PZ_UNSET_ISREF_P(&result); - literal_dtor(&ZEND_OP1_LITERAL(opline)); MAKE_NOP(opline); diff --git a/ext/opcache/Optimizer/zend_optimizer.c b/ext/opcache/Optimizer/zend_optimizer.c index 0498bcba07..39f7b01eea 100644 --- a/ext/opcache/Optimizer/zend_optimizer.c +++ b/ext/opcache/Optimizer/zend_optimizer.c @@ -170,24 +170,20 @@ static void update_op1_const(zend_op_array *op_array, case ZEND_FETCH_CONSTANT: opline->op1.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC); STR_HASH_VAL(Z_STR(ZEND_OP1_LITERAL(opline))); -//??? Z_HASH_P(&ZEND_OP1_LITERAL(opline)) = zend_hash_func(Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline)) + 1); Z_CACHE_SLOT(op_array->literals[opline->op1.constant]) = op_array->last_cache_slot++; zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val)); zend_optimizer_add_literal(op_array, val TSRMLS_CC); STR_HASH_VAL(Z_STR(op_array->literals[opline->op1.constant+1])); -//??? op_array->literals[opline->op1.constant+1].hash_value = zend_hash_func(Z_STRVAL(op_array->literals[opline->op1.constant+1].constant), Z_STRLEN(op_array->literals[opline->op1.constant+1].constant) + 1); break; case ZEND_DO_FCALL: zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val)); opline->op1.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC); STR_HASH_VAL(Z_STR(ZEND_OP1_LITERAL(opline))); -//??? Z_HASH_P(&ZEND_OP1_LITERAL(opline)) = zend_hash_func(Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline)) + 1); Z_CACHE_SLOT(op_array->literals[opline->op1.constant]) = op_array->last_cache_slot++; break; default: opline->op1.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC); STR_HASH_VAL(Z_STR(ZEND_OP1_LITERAL(opline))); -//??? Z_HASH_P(&ZEND_OP1_LITERAL(opline)) = zend_hash_func(Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline)) + 1); break; } } else { @@ -208,7 +204,6 @@ static void update_op2_const(zend_op_array *op_array, opline->op2.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC); if (Z_TYPE_P(val) == IS_STRING) { STR_HASH_VAL(Z_STR(ZEND_OP2_LITERAL(opline))); -//??? Z_HASH_P(&ZEND_OP2_LITERAL(opline)) = zend_hash_func(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline)) + 1); switch (opline->opcode) { case ZEND_FETCH_R: case ZEND_FETCH_W: @@ -227,14 +222,12 @@ static void update_op2_const(zend_op_array *op_array, zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val)); zend_optimizer_add_literal(op_array, val TSRMLS_CC); STR_HASH_VAL(Z_STR(op_array->literals[opline->op2.constant+1])); -//??? op_array->literals[opline->op2.constant+1].hash_value = zend_hash_func(Z_STRVAL(op_array->literals[opline->op2.constant+1].constant), Z_STRLEN(op_array->literals[opline->op2.constant+1].constant) + 1); break; case ZEND_INIT_METHOD_CALL: case ZEND_INIT_STATIC_METHOD_CALL: zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val)); zend_optimizer_add_literal(op_array, val TSRMLS_CC); STR_HASH_VAL(Z_STR(op_array->literals[opline->op2.constant+1])); -//??? op_array->literals[opline->op2.constant+1].hash_value = zend_hash_func(Z_STRVAL(op_array->literals[opline->op2.constant+1].constant), Z_STRLEN(op_array->literals[opline->op2.constant+1].constant) + 1); /* break missing intentionally */ /*case ZEND_FETCH_CONSTANT:*/ case ZEND_ASSIGN_OBJ: diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index 01dfd5c2a9..4dec15c01b 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -1247,6 +1247,8 @@ static const struct jit_auto_global_info #endif }; +static zend_string *jit_auto_globals_str[4]; + static int zend_accel_get_auto_globals(TSRMLS_D) { int i, ag_size = (sizeof(jit_auto_globals_info) / sizeof(jit_auto_globals_info[0])); @@ -1254,7 +1256,7 @@ static int zend_accel_get_auto_globals(TSRMLS_D) int mask = 0; for (i = 0; i < ag_size ; i++) { - if (zend_hash_str_exists(&EG(symbol_table).ht, jit_auto_globals_info[i].name, jit_auto_globals_info[i].len)) { + if (zend_hash_exists(&EG(symbol_table).ht, jit_auto_globals_str[i])) { mask |= n; } n += n; @@ -1265,7 +1267,7 @@ static int zend_accel_get_auto_globals(TSRMLS_D) #if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO static int zend_accel_get_auto_globals_no_jit(TSRMLS_D) { - if (zend_hash_str_exists(&EG(symbol_table).ht, jit_auto_globals_info[3].name, jit_auto_globals_info[3].len)) { + if (zend_hash_exists(&EG(symbol_table).ht, jit_auto_globals_str[3])) { return 8; } return 0; @@ -1276,19 +1278,26 @@ static void zend_accel_set_auto_globals(int mask TSRMLS_DC) { int i, ag_size = (sizeof(jit_auto_globals_info) / sizeof(jit_auto_globals_info[0])); int n = 1; - zend_string *str; for (i = 0; i < ag_size ; i++) { if (mask & n) { -//??? - str = STR_INIT(jit_auto_globals_info[i].name, jit_auto_globals_info[i].len, 0); - zend_is_auto_global(str TSRMLS_CC); - STR_RELEASE(str); + zend_is_auto_global(jit_auto_globals_str[i] TSRMLS_CC); } n += n; } } +static void zend_accel_init_auto_globals(TSRMLS_D) +{ + int i, ag_size = (sizeof(jit_auto_globals_info) / sizeof(jit_auto_globals_info[0])); + + for (i = 0; i < ag_size ; i++) { + jit_auto_globals_str[i] = STR_INIT(jit_auto_globals_info[i].name, jit_auto_globals_info[i].len, 1); + STR_HASH_VAL(jit_auto_globals_str[i]); + jit_auto_globals_str[i] = accel_new_interned_string(jit_auto_globals_str[i] TSRMLS_CC); + } +} + static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_handle, int type, char *key, unsigned int key_length, zend_op_array **op_array_p, int *from_shared_memory TSRMLS_DC) { zend_persistent_script *new_persistent_script; @@ -2624,6 +2633,9 @@ static int accel_startup(zend_extension *extension) /* from this point further, shared memory is supposed to be OK */ + /* Init auto-global strings */ + zend_accel_init_auto_globals(TSRMLS_C); + /* Override compiler */ accelerator_orig_compile_file = zend_compile_file; zend_compile_file = persistent_compile_file; diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index d2a6790d6b..0ef31460bd 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -4974,11 +4974,6 @@ ZEND_METHOD(reflection_property, getValue) zend_unmangle_property_name(ref->prop.name->val, ref->prop.name->len, &class_name, &prop_name); member_p = zend_read_property(ref->ce, object, prop_name, strlen(prop_name), 1 TSRMLS_CC); ZVAL_DUP(return_value, member_p); -//??? - if (member_p != &EG(uninitialized_zval)) { - zval_add_ref(member_p); - zval_ptr_dtor(member_p); - } } } /* }}} */