diff options
Diffstat (limited to 'ext/opcache')
23 files changed, 490 insertions, 504 deletions
diff --git a/ext/opcache/Optimizer/block_pass.c b/ext/opcache/Optimizer/block_pass.c index 6f3f1310a0..d2dc38962a 100644 --- a/ext/opcache/Optimizer/block_pass.c +++ b/ext/opcache/Optimizer/block_pass.c @@ -30,7 +30,7 @@ #define DEBUG_BLOCKPASS 0 /* Checks if a constant (like "true") may be replaced by its value */ -int zend_optimizer_get_persistent_constant(zend_string *name, zval *result, int copy TSRMLS_DC) +int zend_optimizer_get_persistent_constant(zend_string *name, zval *result, int copy) { zend_constant *c; char *lookup_name; @@ -585,7 +585,7 @@ static void strip_nop(zend_code_block *block, zend_optimizer_ctx *ctx) block->len = new_end - block->start_opline; } -static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, char *used_ext, zend_cfg *cfg, zend_optimizer_ctx *ctx TSRMLS_DC) +static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, char *used_ext, zend_cfg *cfg, zend_optimizer_ctx *ctx) { zend_op *opline = block->start_opline; zend_op *end, *last_op = NULL; @@ -626,7 +626,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, zval c = ZEND_OP1_LITERAL(src); VAR_UNSET(opline->op1); zval_copy_ctor(&c); - zend_optimizer_update_op1_const(op_array, opline, &c TSRMLS_CC); + zend_optimizer_update_op1_const(op_array, opline, &c); literal_dtor(&ZEND_OP1_LITERAL(src)); MAKE_NOP(src); } @@ -640,7 +640,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, zval c = ZEND_OP1_LITERAL(src); VAR_UNSET(opline->op2); zval_copy_ctor(&c); - zend_optimizer_update_op2_const(op_array, opline, &c TSRMLS_CC); + zend_optimizer_update_op2_const(op_array, opline, &c); literal_dtor(&ZEND_OP1_LITERAL(src)); MAKE_NOP(src); } @@ -744,7 +744,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, literal_dtor(arg); MAKE_NOP(sv); MAKE_NOP(fcall); - ZEND_OP1_LITERAL(opline) = zend_optimizer_add_literal(op_array, &c TSRMLS_CC); + ZEND_OP1_LITERAL(opline) = zend_optimizer_add_literal(op_array, &c); /* no copy ctor - get already copied it */ ZEND_OP1_TYPE(opline) = IS_CONST; } @@ -923,7 +923,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, memcpy(Z_STRVAL(ZEND_OP1_LITERAL(last_op)) + old_len, Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline))); Z_STRVAL(ZEND_OP1_LITERAL(last_op))[l] = '\0'; zval_dtor(&ZEND_OP1_LITERAL(opline)); - Z_STR(ZEND_OP1_LITERAL(opline)) = zend_new_interned_string(Z_STR(ZEND_OP1_LITERAL(last_op)) TSRMLS_CC); + Z_STR(ZEND_OP1_LITERAL(opline)) = zend_new_interned_string(Z_STR(ZEND_OP1_LITERAL(last_op))); if (!Z_REFCOUNTED(ZEND_OP1_LITERAL(opline))) { Z_TYPE_FLAGS(ZEND_OP1_LITERAL(opline)) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE); } @@ -967,7 +967,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, memcpy(Z_STRVAL(ZEND_OP2_LITERAL(src)) + old_len, Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline))); Z_STRVAL(ZEND_OP2_LITERAL(src))[l] = '\0'; zend_string_release(Z_STR(ZEND_OP2_LITERAL(opline))); - Z_STR(ZEND_OP2_LITERAL(opline)) = zend_new_interned_string(Z_STR(ZEND_OP2_LITERAL(src)) TSRMLS_CC); + Z_STR(ZEND_OP2_LITERAL(opline)) = zend_new_interned_string(Z_STR(ZEND_OP2_LITERAL(src))); if (!Z_REFCOUNTED(ZEND_OP2_LITERAL(opline))) { Z_TYPE_FLAGS(ZEND_OP2_LITERAL(opline)) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE); } @@ -1004,7 +1004,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, ZEND_OP1_TYPE(opline)==IS_CONST && ZEND_OP2_TYPE(opline)==IS_CONST) { /* evaluate constant expressions */ - int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC) = get_binary_op(opline->opcode); + int (*binary_op)(zval *result, zval *op1, zval *op2) = get_binary_op(opline->opcode); zval result; int er; @@ -1021,12 +1021,12 @@ 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) { + if (binary_op(&result, &ZEND_OP1_LITERAL(opline), &ZEND_OP2_LITERAL(opline)) == SUCCESS) { literal_dtor(&ZEND_OP1_LITERAL(opline)); literal_dtor(&ZEND_OP2_LITERAL(opline)); opline->opcode = ZEND_QM_ASSIGN; SET_UNUSED(opline->op2); - zend_optimizer_update_op1_const(op_array, opline, &result TSRMLS_CC); + zend_optimizer_update_op1_const(op_array, opline, &result); } EG(error_reporting) = er; } else if ((opline->opcode == ZEND_BOOL || @@ -1037,7 +1037,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, zval result; if (unary_op) { - unary_op(&result, &ZEND_OP1_LITERAL(opline) TSRMLS_CC); + unary_op(&result, &ZEND_OP1_LITERAL(opline)); literal_dtor(&ZEND_OP1_LITERAL(opline)); } else { /* BOOL */ @@ -1046,7 +1046,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, ZVAL_NULL(&ZEND_OP1_LITERAL(opline)); } opline->opcode = ZEND_QM_ASSIGN; - zend_optimizer_update_op1_const(op_array, opline, &result TSRMLS_CC); + zend_optimizer_update_op1_const(op_array, opline, &result); } else if ((opline->opcode == ZEND_RETURN || opline->opcode == ZEND_EXIT) && (ZEND_OP1_TYPE(opline) & (IS_TMP_VAR|IS_VAR)) && VAR_SOURCE(opline->op1) && @@ -1251,7 +1251,7 @@ static void assemble_code_blocks(zend_cfg *cfg, zend_op_array *op_array) } } -static void zend_jmp_optimization(zend_code_block *block, zend_op_array *op_array, zend_code_block *blocks, zend_cfg *cfg, zend_optimizer_ctx *ctx TSRMLS_DC) +static void zend_jmp_optimization(zend_code_block *block, zend_op_array *op_array, zend_code_block *blocks, zend_cfg *cfg, zend_optimizer_ctx *ctx) { /* last_op is the last opcode of the current block */ zend_op *last_op = (block->start_opline + block->len - 1); @@ -1293,7 +1293,7 @@ static void zend_jmp_optimization(zend_code_block *block, zend_op_array *op_arra if (ZEND_OP1_TYPE(last_op) == IS_CONST) { zval zv = ZEND_OP1_LITERAL(last_op); zval_copy_ctor(&zv); - last_op->op1.constant = zend_optimizer_add_literal(op_array, &zv TSRMLS_CC); + last_op->op1.constant = zend_optimizer_add_literal(op_array, &zv); } del_source(block, block->op1_to); if (block->op1_to->op2_to) { @@ -1319,7 +1319,7 @@ static void zend_jmp_optimization(zend_code_block *block, zend_op_array *op_arra if (ZEND_OP1_TYPE(last_op) == IS_CONST) { zval zv = ZEND_OP1_LITERAL(last_op); zval_copy_ctor(&zv); - last_op->op1.constant = zend_optimizer_add_literal(op_array, &zv TSRMLS_CC); + last_op->op1.constant = zend_optimizer_add_literal(op_array, &zv); } del_source(block, block->op1_to); block->op1_to = NULL; @@ -1384,7 +1384,7 @@ static void zend_jmp_optimization(zend_code_block *block, zend_op_array *op_arra case ZEND_JMPNZ: /* constant conditional JMPs */ if (ZEND_OP1_TYPE(last_op) == IS_CONST) { - int should_jmp = zend_is_true(&ZEND_OP1_LITERAL(last_op) TSRMLS_CC); + int should_jmp = zend_is_true(&ZEND_OP1_LITERAL(last_op)); if (last_op->opcode == ZEND_JMPZ) { should_jmp = !should_jmp; @@ -1528,7 +1528,7 @@ next_target: case ZEND_JMPZ_EX: /* constant conditional JMPs */ if (ZEND_OP1_TYPE(last_op) == IS_CONST) { - int should_jmp = zend_is_true(&ZEND_OP1_LITERAL(last_op) TSRMLS_CC); + int should_jmp = zend_is_true(&ZEND_OP1_LITERAL(last_op)); if (last_op->opcode == ZEND_JMPZ_EX) { should_jmp = !should_jmp; @@ -1641,7 +1641,7 @@ next_target_ex: } if (ZEND_OP1_TYPE(last_op) == IS_CONST) { - if (!zend_is_true(&ZEND_OP1_LITERAL(last_op) TSRMLS_CC)) { + if (!zend_is_true(&ZEND_OP1_LITERAL(last_op))) { /* JMPZNZ(false,L1,L2) -> JMP(L1) */ zend_code_block *todel; @@ -1908,7 +1908,7 @@ static void zend_t_usage(zend_code_block *block, zend_op_array *op_array, char * #define PASSES 3 -void optimize_cfg(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRMLS_DC) +void optimize_cfg(zend_op_array *op_array, zend_optimizer_ctx *ctx) { zend_cfg cfg; zend_code_block *cur_block; @@ -1953,7 +1953,7 @@ void optimize_cfg(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRMLS_DC) if (!cur_block->access) { continue; } - zend_optimize_block(cur_block, op_array, usage, &cfg, ctx TSRMLS_CC); + zend_optimize_block(cur_block, op_array, usage, &cfg, ctx); } /* Jump optimization for each block */ @@ -1961,7 +1961,7 @@ void optimize_cfg(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRMLS_DC) if (!cur_block->access) { continue; } - zend_jmp_optimization(cur_block, op_array, cfg.blocks, &cfg, ctx TSRMLS_CC); + zend_jmp_optimization(cur_block, op_array, cfg.blocks, &cfg, ctx); } /* Eliminate unreachable basic blocks */ diff --git a/ext/opcache/Optimizer/compact_literals.c b/ext/opcache/Optimizer/compact_literals.c index 8fb5a9b0c9..0dee9d6146 100644 --- a/ext/opcache/Optimizer/compact_literals.c +++ b/ext/opcache/Optimizer/compact_literals.c @@ -114,7 +114,7 @@ static void optimizer_literal_class_info(literal_info *info, } } -void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRMLS_DC) +void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx *ctx) { zend_op *opline, *end; int i, j, n, *map, cache_slots; @@ -309,7 +309,7 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx for (i = 0; i < op_array->last_literal; i++) { zval zv = op_array->literals[i].constant; - use_copy = zend_make_printable_zval(&op_array->literals[i].constant, &zv TSRMLS_CC); + use_copy = zend_make_printable_zval(&op_array->literals[i].constant, &zv); fprintf(stderr, "Literal %d, val (%d):%s\n", i, Z_STRLEN(zv), Z_STRVAL(zv)); if (use_copy) { zval_dtor(&zv); @@ -490,7 +490,7 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx for (i = 0; i < op_array->last_literal; i++) { zval zv = op_array->literals[i].constant; - use_copy = zend_make_printable_zval(&op_array->literals[i].constant, &zv TSRMLS_CC); + use_copy = zend_make_printable_zval(&op_array->literals[i].constant, &zv); fprintf(stderr, "Literal %d, val (%d):%s\n", i, Z_STRLEN(zv), Z_STRVAL(zv)); if (use_copy) { zval_dtor(&zv); diff --git a/ext/opcache/Optimizer/optimize_func_calls.c b/ext/opcache/Optimizer/optimize_func_calls.c index 5c765cef4e..0fa08b7d32 100644 --- a/ext/opcache/Optimizer/optimize_func_calls.c +++ b/ext/opcache/Optimizer/optimize_func_calls.c @@ -38,7 +38,7 @@ typedef struct _optimizer_call_info { zend_op *opline; } optimizer_call_info; -void optimize_func_calls(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRMLS_DC) +void optimize_func_calls(zend_op_array *op_array, zend_optimizer_ctx *ctx) { zend_op *opline = op_array->opcodes; zend_op *end = opline + op_array->last; diff --git a/ext/opcache/Optimizer/pass1_5.c b/ext/opcache/Optimizer/pass1_5.c index 6eb6a4ce02..819a093600 100644 --- a/ext/opcache/Optimizer/pass1_5.c +++ b/ext/opcache/Optimizer/pass1_5.c @@ -37,7 +37,7 @@ #define ZEND_IS_CONSTANT_TYPE(t) ((t) == IS_CONSTANT) -void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRMLS_DC) +void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx) { int i = 0; zend_op *opline = op_array->opcodes; @@ -68,7 +68,7 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRML if (ZEND_OP1_TYPE(opline) == IS_CONST && ZEND_OP2_TYPE(opline) == IS_CONST) { /* binary operation with constant operands */ - int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC) = get_binary_op(opline->opcode); + int (*binary_op)(zval *result, zval *op1, zval *op2) = get_binary_op(opline->opcode); uint32_t tv = ZEND_RESULT(opline).var; /* temporary variable */ zval result; int er; @@ -82,7 +82,7 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRML er = EG(error_reporting); EG(error_reporting) = 0; /* evaluate constant expression */ - if (binary_op(&result, &ZEND_OP1_LITERAL(opline), &ZEND_OP2_LITERAL(opline) TSRMLS_CC) != SUCCESS) { + if (binary_op(&result, &ZEND_OP1_LITERAL(opline), &ZEND_OP2_LITERAL(opline)) != SUCCESS) { EG(error_reporting) = er; break; } @@ -91,7 +91,7 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRML literal_dtor(&ZEND_OP2_LITERAL(opline)); MAKE_NOP(opline); - zend_optimizer_replace_by_const(op_array, opline + 1, IS_TMP_VAR, tv, &result TSRMLS_CC); + zend_optimizer_replace_by_const(op_array, opline + 1, IS_TMP_VAR, tv, &result); } break; @@ -127,7 +127,7 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRML literal_dtor(&ZEND_OP1_LITERAL(opline)); MAKE_NOP(opline); - zend_optimizer_replace_by_const(op_array, opline + 1, type, tv, &res TSRMLS_CC); + zend_optimizer_replace_by_const(op_array, opline + 1, type, tv, &res); } else if (opline->extended_value == _IS_BOOL) { /* T = CAST(X, IS_BOOL) => T = BOOL(X) */ opline->opcode = ZEND_BOOL; @@ -146,7 +146,7 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRML er = EG(error_reporting); EG(error_reporting) = 0; - if (unary_op(&result, &ZEND_OP1_LITERAL(opline) TSRMLS_CC) != SUCCESS) { + if (unary_op(&result, &ZEND_OP1_LITERAL(opline)) != SUCCESS) { EG(error_reporting) = er; break; } @@ -154,7 +154,7 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRML literal_dtor(&ZEND_OP1_LITERAL(opline)); MAKE_NOP(opline); - zend_optimizer_replace_by_const(op_array, opline + 1, IS_TMP_VAR, tv, &result TSRMLS_CC); + zend_optimizer_replace_by_const(op_array, opline + 1, IS_TMP_VAR, tv, &result); } break; @@ -243,12 +243,12 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRML memset(&fake_execute_data, 0, sizeof(zend_execute_data)); fake_execute_data.func = (zend_function*)op_array; EG(current_execute_data) = &fake_execute_data; - if ((offset = zend_get_constant_str("__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__") - 1 TSRMLS_CC)) != NULL) { + if ((offset = zend_get_constant_str("__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__") - 1)) != NULL) { uint32_t tv = ZEND_RESULT(opline).var; literal_dtor(&ZEND_OP2_LITERAL(opline)); MAKE_NOP(opline); - zend_optimizer_replace_by_const(op_array, opline, IS_TMP_VAR, tv, offset TSRMLS_CC); + zend_optimizer_replace_by_const(op_array, opline, IS_TMP_VAR, tv, offset); } EG(current_execute_data) = orig_execute_data; break; @@ -261,7 +261,7 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRML uint32_t tv = ZEND_RESULT(opline).var; zval c; - if (!zend_optimizer_get_persistent_constant(Z_STR(ZEND_OP2_LITERAL(opline)), &c, 1 TSRMLS_CC)) { + if (!zend_optimizer_get_persistent_constant(Z_STR(ZEND_OP2_LITERAL(opline)), &c, 1)) { if (!ctx->constants || !zend_optimizer_get_collected_constant(ctx->constants, &ZEND_OP2_LITERAL(opline), &c)) { break; } @@ -271,7 +271,7 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRML } literal_dtor(&ZEND_OP2_LITERAL(opline)); MAKE_NOP(opline); - zend_optimizer_replace_by_const(op_array, opline, IS_TMP_VAR, tv, &c TSRMLS_CC); + zend_optimizer_replace_by_const(op_array, opline, IS_TMP_VAR, tv, &c); } /* class constant */ @@ -319,7 +319,7 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRML break; } if (ZEND_IS_CONSTANT_TYPE(Z_TYPE_P(c))) { - if (!zend_optimizer_get_persistent_constant(Z_STR_P(c), &t, 1 TSRMLS_CC) || + if (!zend_optimizer_get_persistent_constant(Z_STR_P(c), &t, 1) || ZEND_IS_CONSTANT_TYPE(Z_TYPE(t))) { break; } @@ -335,7 +335,7 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRML } literal_dtor(&ZEND_OP2_LITERAL(opline)); MAKE_NOP(opline); - zend_optimizer_replace_by_const(op_array, opline, IS_TMP_VAR, tv, &t TSRMLS_CC); + zend_optimizer_replace_by_const(op_array, opline, IS_TMP_VAR, tv, &t); } } } @@ -436,7 +436,7 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRML func->module->type == MODULE_PERSISTENT) { zval t; ZVAL_BOOL(&t, 1); - if (zend_optimizer_replace_by_const(op_array, opline + 1, IS_VAR, ZEND_RESULT(opline).var, &t TSRMLS_CC)) { + if (zend_optimizer_replace_by_const(op_array, opline + 1, IS_VAR, ZEND_RESULT(opline).var, &t)) { literal_dtor(&ZEND_OP2_LITERAL(init_opline)); MAKE_NOP(init_opline); literal_dtor(&ZEND_OP1_LITERAL(send1_opline)); @@ -471,7 +471,7 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRML } } - if (zend_optimizer_replace_by_const(op_array, opline + 1, IS_VAR, ZEND_RESULT(opline).var, &t TSRMLS_CC)) { + if (zend_optimizer_replace_by_const(op_array, opline + 1, IS_VAR, ZEND_RESULT(opline).var, &t)) { literal_dtor(&ZEND_OP2_LITERAL(init_opline)); MAKE_NOP(init_opline); literal_dtor(&ZEND_OP1_LITERAL(send1_opline)); @@ -484,10 +484,10 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRML "defined", sizeof("defined")-1)) { zval t; - if (zend_optimizer_get_persistent_constant(Z_STR(ZEND_OP1_LITERAL(send1_opline)), &t, 0 TSRMLS_CC)) { + if (zend_optimizer_get_persistent_constant(Z_STR(ZEND_OP1_LITERAL(send1_opline)), &t, 0)) { ZVAL_BOOL(&t, 1); - if (zend_optimizer_replace_by_const(op_array, opline + 1, IS_VAR, ZEND_RESULT(opline).var, &t TSRMLS_CC)) { + if (zend_optimizer_replace_by_const(op_array, opline + 1, IS_VAR, ZEND_RESULT(opline).var, &t)) { literal_dtor(&ZEND_OP2_LITERAL(init_opline)); MAKE_NOP(init_opline); literal_dtor(&ZEND_OP1_LITERAL(send1_opline)); @@ -501,8 +501,8 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRML "constant", sizeof("constant")-1)) { zval t; - if (zend_optimizer_get_persistent_constant(Z_STR(ZEND_OP1_LITERAL(send1_opline)), &t, 1 TSRMLS_CC)) { - if (zend_optimizer_replace_by_const(op_array, opline + 1, IS_VAR, ZEND_RESULT(opline).var, &t TSRMLS_CC)) { + if (zend_optimizer_get_persistent_constant(Z_STR(ZEND_OP1_LITERAL(send1_opline)), &t, 1)) { + if (zend_optimizer_replace_by_const(op_array, opline + 1, IS_VAR, ZEND_RESULT(opline).var, &t)) { literal_dtor(&ZEND_OP2_LITERAL(init_opline)); MAKE_NOP(init_opline); literal_dtor(&ZEND_OP1_LITERAL(send1_opline)); @@ -518,7 +518,7 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRML zval t; ZVAL_LONG(&t, Z_STRLEN(ZEND_OP1_LITERAL(send1_opline))); - if (zend_optimizer_replace_by_const(op_array, opline + 1, IS_VAR, ZEND_RESULT(opline).var, &t TSRMLS_CC)) { + if (zend_optimizer_replace_by_const(op_array, opline + 1, IS_VAR, ZEND_RESULT(opline).var, &t)) { literal_dtor(&ZEND_OP2_LITERAL(init_opline)); MAKE_NOP(init_opline); literal_dtor(&ZEND_OP1_LITERAL(send1_opline)); @@ -537,7 +537,7 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRML zval t; ZVAL_STR(&t, dirname); - if (zend_optimizer_replace_by_const(op_array, opline + 1, IS_VAR, ZEND_RESULT(opline).var, &t TSRMLS_CC)) { + if (zend_optimizer_replace_by_const(op_array, opline + 1, IS_VAR, ZEND_RESULT(opline).var, &t)) { literal_dtor(&ZEND_OP2_LITERAL(init_opline)); MAKE_NOP(init_opline); literal_dtor(&ZEND_OP1_LITERAL(send1_opline)); @@ -560,7 +560,7 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRML zval t; ZVAL_LONG(&t, Z_STRLEN(ZEND_OP1_LITERAL(opline))); - zend_optimizer_replace_by_const(op_array, opline + 1, IS_TMP_VAR, ZEND_RESULT(opline).var, &t TSRMLS_CC); + zend_optimizer_replace_by_const(op_array, opline + 1, IS_TMP_VAR, ZEND_RESULT(opline).var, &t); literal_dtor(&ZEND_OP1_LITERAL(opline)); MAKE_NOP(opline); } @@ -569,11 +569,11 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRML { zval c; uint32_t tv = ZEND_RESULT(opline).var; - if (!zend_optimizer_get_persistent_constant(Z_STR(ZEND_OP1_LITERAL(opline)), &c, 0 TSRMLS_CC)) { + if (!zend_optimizer_get_persistent_constant(Z_STR(ZEND_OP1_LITERAL(opline)), &c, 0)) { break; } ZVAL_TRUE(&c); - zend_optimizer_replace_by_const(op_array, opline, IS_TMP_VAR, tv, &c TSRMLS_CC); + zend_optimizer_replace_by_const(op_array, opline, IS_TMP_VAR, tv, &c); literal_dtor(&ZEND_OP1_LITERAL(opline)); MAKE_NOP(opline); } diff --git a/ext/opcache/Optimizer/pass2.c b/ext/opcache/Optimizer/pass2.c index 859bc2f3bc..4c839edf5a 100644 --- a/ext/opcache/Optimizer/pass2.c +++ b/ext/opcache/Optimizer/pass2.c @@ -33,7 +33,7 @@ #include "zend_execute.h" #include "zend_vm.h" -void zend_optimizer_pass2(zend_op_array *op_array TSRMLS_DC) +void zend_optimizer_pass2(zend_op_array *op_array) { zend_op *opline; zend_op *end = op_array->opcodes + op_array->last; @@ -47,7 +47,7 @@ void zend_optimizer_pass2(zend_op_array *op_array TSRMLS_DC) case ZEND_DIV: if (ZEND_OP1_TYPE(opline) == IS_CONST) { if (Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_STRING) { - convert_scalar_to_number(&ZEND_OP1_LITERAL(opline) TSRMLS_CC); + convert_scalar_to_number(&ZEND_OP1_LITERAL(opline)); } } /* break missing *intentionally* - the assign_op's may only optimize op2 */ @@ -61,7 +61,7 @@ void zend_optimizer_pass2(zend_op_array *op_array TSRMLS_DC) } if (ZEND_OP2_TYPE(opline) == IS_CONST) { if (Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING) { - convert_scalar_to_number(&ZEND_OP2_LITERAL(opline) TSRMLS_CC); + convert_scalar_to_number(&ZEND_OP2_LITERAL(opline)); } } break; @@ -119,7 +119,7 @@ void zend_optimizer_pass2(zend_op_array *op_array TSRMLS_DC) /* convert Ti = JMPZ_EX(C, L) => Ti = QM_ASSIGN(C) in case we know it wouldn't jump */ } else if (ZEND_OP1_TYPE(opline) == IS_CONST) { - int should_jmp = zend_is_true(&ZEND_OP1_LITERAL(opline) TSRMLS_CC); + int should_jmp = zend_is_true(&ZEND_OP1_LITERAL(opline)); if (opline->opcode == ZEND_JMPZ_EX) { should_jmp = !should_jmp; } @@ -133,7 +133,7 @@ void zend_optimizer_pass2(zend_op_array *op_array TSRMLS_DC) case ZEND_JMPZ: case ZEND_JMPNZ: if (ZEND_OP1_TYPE(opline) == IS_CONST) { - int should_jmp = zend_is_true(&ZEND_OP1_LITERAL(opline) TSRMLS_CC); + int should_jmp = zend_is_true(&ZEND_OP1_LITERAL(opline)); if (opline->opcode == ZEND_JMPZ) { should_jmp = !should_jmp; @@ -169,7 +169,7 @@ void zend_optimizer_pass2(zend_op_array *op_array TSRMLS_DC) case ZEND_JMPZNZ: if (ZEND_OP1_TYPE(opline) == IS_CONST) { int opline_num; - if (zend_is_true(&ZEND_OP1_LITERAL(opline) TSRMLS_CC)) { + if (zend_is_true(&ZEND_OP1_LITERAL(opline))) { opline_num = opline->extended_value; /* JMPNZ */ } else { opline_num = ZEND_OP2(opline).opline_num; /* JMPZ */ diff --git a/ext/opcache/Optimizer/pass3.c b/ext/opcache/Optimizer/pass3.c index 8d8cb50580..8a4646a595 100644 --- a/ext/opcache/Optimizer/pass3.c +++ b/ext/opcache/Optimizer/pass3.c @@ -53,7 +53,7 @@ } \ jmp_hitlist[jmp_hitlist_count++] = ZEND_OP2(&op_array->opcodes[target]).opline_num; -void zend_optimizer_pass3(zend_op_array *op_array TSRMLS_DC) +void zend_optimizer_pass3(zend_op_array *op_array) { zend_op *opline; zend_op *end = op_array->opcodes + op_array->last; diff --git a/ext/opcache/Optimizer/zend_optimizer.c b/ext/opcache/Optimizer/zend_optimizer.c index a36b6584b3..229831231e 100644 --- a/ext/opcache/Optimizer/zend_optimizer.c +++ b/ext/opcache/Optimizer/zend_optimizer.c @@ -99,7 +99,7 @@ int zend_optimizer_lookup_cv(zend_op_array *op_array, zend_string* name) return (int)(zend_intptr_t)ZEND_CALL_VAR_NUM(NULL, i); } -int zend_optimizer_add_literal(zend_op_array *op_array, zval *zv TSRMLS_DC) +int zend_optimizer_add_literal(zend_op_array *op_array, zval *zv) { int i = op_array->last_literal; op_array->last_literal++; @@ -113,7 +113,7 @@ int zend_optimizer_add_literal(zend_op_array *op_array, zval *zv TSRMLS_DC) void zend_optimizer_update_op1_const(zend_op_array *op_array, zend_op *opline, - zval *val TSRMLS_DC) + zval *val) { if (opline->opcode == ZEND_FREE) { MAKE_NOP(opline); @@ -127,37 +127,37 @@ void zend_optimizer_update_op1_const(zend_op_array *op_array, case ZEND_FETCH_CONSTANT: case ZEND_DEFINED: case ZEND_NEW: - opline->op1.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC); + opline->op1.constant = zend_optimizer_add_literal(op_array, val); zend_string_hash_val(Z_STR(ZEND_OP1_LITERAL(opline))); 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); + zend_optimizer_add_literal(op_array, val); zend_string_hash_val(Z_STR(op_array->literals[opline->op1.constant+1])); break; default: - opline->op1.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC); + opline->op1.constant = zend_optimizer_add_literal(op_array, val); zend_string_hash_val(Z_STR(ZEND_OP1_LITERAL(opline))); break; } } else { - opline->op1.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC); + opline->op1.constant = zend_optimizer_add_literal(op_array, val); } } } void zend_optimizer_update_op2_const(zend_op_array *op_array, zend_op *opline, - zval *val TSRMLS_DC) + zval *val) { ZEND_OP2_TYPE(opline) = IS_CONST; if (opline->opcode == ZEND_INIT_FCALL) { zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val)); - opline->op2.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC); + opline->op2.constant = zend_optimizer_add_literal(op_array, val); zend_string_hash_val(Z_STR(ZEND_OP2_LITERAL(opline))); Z_CACHE_SLOT(op_array->literals[opline->op2.constant]) = op_array->last_cache_slot++; return; } - opline->op2.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC); + opline->op2.constant = zend_optimizer_add_literal(op_array, val); if (Z_TYPE_P(val) == IS_STRING) { zend_string_hash_val(Z_STR(ZEND_OP2_LITERAL(opline))); switch (opline->opcode) { @@ -177,13 +177,13 @@ void zend_optimizer_update_op2_const(zend_op_array *op_array, case ZEND_INSTANCEOF: Z_CACHE_SLOT(op_array->literals[opline->op2.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); + zend_optimizer_add_literal(op_array, val); zend_string_hash_val(Z_STR(op_array->literals[opline->op2.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); + zend_optimizer_add_literal(op_array, val); zend_string_hash_val(Z_STR(op_array->literals[opline->op2.constant+1])); /* break missing intentionally */ /*case ZEND_FETCH_CONSTANT:*/ @@ -268,7 +268,7 @@ int zend_optimizer_replace_by_const(zend_op_array *op_array, zend_op *opline, zend_uchar type, uint32_t var, - zval *val TSRMLS_DC) + zval *val) { zend_op *end = op_array->opcodes + op_array->last; @@ -313,7 +313,7 @@ int zend_optimizer_replace_by_const(zend_op_array *op_array, zval old_val; ZVAL_COPY_VALUE(&old_val, val); zval_copy_ctor(val); - zend_optimizer_update_op1_const(op_array, opline, val TSRMLS_CC); + zend_optimizer_update_op1_const(op_array, opline, val); ZVAL_COPY_VALUE(val, &old_val); opline++; continue; @@ -325,7 +325,7 @@ int zend_optimizer_replace_by_const(zend_op_array *op_array, default: break; } - zend_optimizer_update_op1_const(op_array, opline, val TSRMLS_CC); + zend_optimizer_update_op1_const(op_array, opline, val); break; } @@ -337,7 +337,7 @@ int zend_optimizer_replace_by_const(zend_op_array *op_array, default: break; } - zend_optimizer_update_op2_const(op_array, opline, val TSRMLS_CC); + zend_optimizer_update_op2_const(op_array, opline, val); break; } opline++; @@ -347,7 +347,7 @@ int zend_optimizer_replace_by_const(zend_op_array *op_array, } static void zend_optimize(zend_op_array *op_array, - zend_optimizer_ctx *ctx TSRMLS_DC) + zend_optimizer_ctx *ctx) { if (op_array->type == ZEND_EVAL_CODE) { return; @@ -360,7 +360,7 @@ static void zend_optimize(zend_op_array *op_array, * - convert CAST(IS_BOOL,x) into BOOL(x) */ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { - zend_optimizer_pass1(op_array, ctx TSRMLS_CC); + zend_optimizer_pass1(op_array, ctx); } /* pass 2: @@ -370,7 +370,7 @@ static void zend_optimize(zend_op_array *op_array, * - pre-evaluate constant function calls */ if (ZEND_OPTIMIZER_PASS_2 & OPTIMIZATION_LEVEL) { - zend_optimizer_pass2(op_array TSRMLS_CC); + zend_optimizer_pass2(op_array); } /* pass 3: @@ -379,21 +379,21 @@ static void zend_optimize(zend_op_array *op_array, * - change $i++ to ++$i where possible */ if (ZEND_OPTIMIZER_PASS_3 & OPTIMIZATION_LEVEL) { - zend_optimizer_pass3(op_array TSRMLS_CC); + zend_optimizer_pass3(op_array); } /* pass 4: * - INIT_FCALL_BY_NAME -> DO_FCALL */ if (ZEND_OPTIMIZER_PASS_4 & OPTIMIZATION_LEVEL) { - optimize_func_calls(op_array, ctx TSRMLS_CC); + optimize_func_calls(op_array, ctx); } /* pass 5: * - CFG optimization */ if (ZEND_OPTIMIZER_PASS_5 & OPTIMIZATION_LEVEL) { - optimize_cfg(op_array, ctx TSRMLS_CC); + optimize_cfg(op_array, ctx); } /* pass 9: @@ -414,12 +414,12 @@ static void zend_optimize(zend_op_array *op_array, * - Compact literals table */ if (ZEND_OPTIMIZER_PASS_11 & OPTIMIZATION_LEVEL) { - zend_optimizer_compact_literals(op_array, ctx TSRMLS_CC); + zend_optimizer_compact_literals(op_array, ctx); } } static void zend_accel_optimize(zend_op_array *op_array, - zend_optimizer_ctx *ctx TSRMLS_DC) + zend_optimizer_ctx *ctx) { zend_op *opline, *end; @@ -459,7 +459,7 @@ static void zend_accel_optimize(zend_op_array *op_array, } /* Do actual optimizations */ - zend_optimize(op_array, ctx TSRMLS_CC); + zend_optimize(op_array, ctx); /* Redo pass_two() */ opline = op_array->opcodes; @@ -498,7 +498,7 @@ static void zend_accel_optimize(zend_op_array *op_array, } } -int zend_accel_script_optimize(zend_persistent_script *script TSRMLS_DC) +int zend_accel_script_optimize(zend_persistent_script *script) { uint idx, j; Bucket *p, *q; @@ -510,13 +510,13 @@ int zend_accel_script_optimize(zend_persistent_script *script TSRMLS_DC) ctx.script = script; ctx.constants = NULL; - zend_accel_optimize(&script->main_op_array, &ctx TSRMLS_CC); + zend_accel_optimize(&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 TSRMLS_CC); + zend_accel_optimize(op_array, &ctx); } for (idx = 0; idx < script->class_table.nNumUsed; idx++) { @@ -528,7 +528,7 @@ int zend_accel_script_optimize(zend_persistent_script *script TSRMLS_DC) 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 TSRMLS_CC); + zend_accel_optimize(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) { diff --git a/ext/opcache/Optimizer/zend_optimizer_internal.h b/ext/opcache/Optimizer/zend_optimizer_internal.h index ee44bf671c..5e86ab84e6 100644 --- a/ext/opcache/Optimizer/zend_optimizer_internal.h +++ b/ext/opcache/Optimizer/zend_optimizer_internal.h @@ -82,13 +82,13 @@ struct _zend_block_source { #define LITERAL_LONG(op, val) do { \ zval _c; \ ZVAL_LONG(&_c, val); \ - op.constant = zend_optimizer_add_literal(op_array, &_c TSRMLS_CC); \ + op.constant = zend_optimizer_add_literal(op_array, &_c); \ } while (0) #define LITERAL_BOOL(op, val) do { \ zval _c; \ ZVAL_BOOL(&_c, val); \ - op.constant = zend_optimizer_add_literal(op_array, &_c TSRMLS_CC); \ + op.constant = zend_optimizer_add_literal(op_array, &_c); \ } while (0) #define literal_dtor(zv) do { \ @@ -101,30 +101,30 @@ struct _zend_block_source { target = src; \ } while (0) -int zend_optimizer_add_literal(zend_op_array *op_array, zval *zv TSRMLS_DC); -int zend_optimizer_get_persistent_constant(zend_string *name, zval *result, int copy TSRMLS_DC); +int zend_optimizer_add_literal(zend_op_array *op_array, zval *zv); +int zend_optimizer_get_persistent_constant(zend_string *name, zval *result, int copy); void zend_optimizer_collect_constant(zend_optimizer_ctx *ctx, zval *name, zval* value); int zend_optimizer_get_collected_constant(HashTable *constants, zval *name, zval* value); int zend_optimizer_lookup_cv(zend_op_array *op_array, zend_string* name); void zend_optimizer_update_op1_const(zend_op_array *op_array, zend_op *opline, - zval *val TSRMLS_DC); + zval *val); void zend_optimizer_update_op2_const(zend_op_array *op_array, zend_op *opline, - zval *val TSRMLS_DC); + zval *val); int zend_optimizer_replace_by_const(zend_op_array *op_array, zend_op *opline, zend_uchar type, uint32_t var, - zval *val TSRMLS_DC); + zval *val); -void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRMLS_DC); -void zend_optimizer_pass2(zend_op_array *op_array TSRMLS_DC); -void zend_optimizer_pass3(zend_op_array *op_array TSRMLS_DC); -void optimize_func_calls(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRMLS_DC); -void optimize_cfg(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRMLS_DC); +void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx); +void zend_optimizer_pass2(zend_op_array *op_array); +void zend_optimizer_pass3(zend_op_array *op_array); +void optimize_func_calls(zend_op_array *op_array, zend_optimizer_ctx *ctx); +void optimize_cfg(zend_op_array *op_array, zend_optimizer_ctx *ctx); void optimize_temporary_variables(zend_op_array *op_array, zend_optimizer_ctx *ctx); void zend_optimizer_nop_removal(zend_op_array *op_array); -void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRMLS_DC); +void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx *ctx); #endif diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index 486cb39a17..5faa9c61c3 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -74,13 +74,13 @@ typedef int gid_t; #define SHM_PROTECT() \ do { \ if (ZCG(accel_directives).protect_memory) { \ - zend_accel_shared_protect(1 TSRMLS_CC); \ + zend_accel_shared_protect(1); \ } \ } while (0) #define SHM_UNPROTECT() \ do { \ if (ZCG(accel_directives).protect_memory) { \ - zend_accel_shared_protect(0 TSRMLS_CC); \ + zend_accel_shared_protect(0); \ } \ } while (0) @@ -103,9 +103,9 @@ zend_bool accel_startup_ok = 0; static char *zps_failure_reason = NULL; char *zps_api_failure_reason = NULL; -static zend_op_array *(*accelerator_orig_compile_file)(zend_file_handle *file_handle, int type TSRMLS_DC); -static int (*accelerator_orig_zend_stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC); -static char *(*accelerator_orig_zend_resolve_path)(const char *filename, int filename_len TSRMLS_DC); +static zend_op_array *(*accelerator_orig_compile_file)(zend_file_handle *file_handle, int type); +static int (*accelerator_orig_zend_stream_open_function)(const char *filename, zend_file_handle *handle ); +static char *(*accelerator_orig_zend_resolve_path)(const char *filename, int filename_len); static void (*orig_chdir)(INTERNAL_FUNCTION_PARAMETERS) = NULL; static ZEND_INI_MH((*orig_include_path_on_modify)) = NULL; @@ -164,7 +164,7 @@ static ZEND_FUNCTION(accel_chdir) } } -static inline char* accel_getcwd(int *cwd_len TSRMLS_DC) +static inline char* accel_getcwd(int *cwd_len) { if (ZCG(cwd)) { *cwd_len = ZCG(cwd_len); @@ -181,10 +181,10 @@ static inline char* accel_getcwd(int *cwd_len TSRMLS_DC) } } -void zend_accel_schedule_restart_if_necessary(zend_accel_restart_reason reason TSRMLS_DC) +void zend_accel_schedule_restart_if_necessary(zend_accel_restart_reason reason) { if ((((double) ZSMMG(wasted_shared_memory)) / ZCG(accel_directives).memory_consumption) >= ZCG(accel_directives).max_wasted_percentage) { - zend_accel_schedule_restart(reason TSRMLS_CC); + zend_accel_schedule_restart(reason); } } @@ -195,7 +195,7 @@ void zend_accel_schedule_restart_if_necessary(zend_accel_restart_reason reason T */ static ZEND_INI_MH(accel_include_path_on_modify) { - int ret = orig_include_path_on_modify(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); + int ret = orig_include_path_on_modify(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage); ZCG(include_path_key) = NULL; if (ret == SUCCESS) { @@ -210,7 +210,7 @@ static ZEND_INI_MH(accel_include_path_on_modify) if (!ZCG(include_path_key) && !zend_accel_hash_is_full(&ZCSG(include_paths))) { SHM_UNPROTECT(); - zend_shared_alloc_lock(TSRMLS_C); + zend_shared_alloc_lock(); ZCG(include_path_key) = zend_accel_hash_find(&ZCSG(include_paths), ZCG(include_path), ZCG(include_path_len)); if (!ZCG(include_path_key) && @@ -224,11 +224,11 @@ static ZEND_INI_MH(accel_include_path_on_modify) ZCG(include_path_key) = key + ZCG(include_path_len) + 1; zend_accel_hash_update(&ZCSG(include_paths), key, ZCG(include_path_len), 0, ZCG(include_path_key)); } else { - zend_accel_schedule_restart_if_necessary(ACCEL_RESTART_OOM TSRMLS_CC); + zend_accel_schedule_restart_if_necessary(ACCEL_RESTART_OOM); } } - zend_shared_alloc_unlock(TSRMLS_C); + zend_shared_alloc_unlock(); SHM_PROTECT(); } } else { @@ -243,29 +243,29 @@ static ZEND_INI_MH(accel_include_path_on_modify) } /* Interned strings support */ -static zend_string *(*orig_new_interned_string)(zend_string *str TSRMLS_DC); -static void (*orig_interned_strings_snapshot)(TSRMLS_D); -static void (*orig_interned_strings_restore)(TSRMLS_D); +static zend_string *(*orig_new_interned_string)(zend_string *str); +static void (*orig_interned_strings_snapshot)(void); +static void (*orig_interned_strings_restore)(void); /* O+ disables creation of interned strings by regular PHP compiler, instead, * it creates interned strings in shared memory when saves a script. * Such interned strings are shared across all PHP processes */ -static zend_string *accel_new_interned_string_for_php(zend_string *str TSRMLS_DC) +static zend_string *accel_new_interned_string_for_php(zend_string *str) { return str; } -static void accel_interned_strings_snapshot_for_php(TSRMLS_D) +static void accel_interned_strings_snapshot_for_php(void) { } -static void accel_interned_strings_restore_for_php(TSRMLS_D) +static void accel_interned_strings_restore_for_php(void) { } #ifndef ZTS -static void accel_interned_strings_restore_state(TSRMLS_D) +static void accel_interned_strings_restore_state(void) { uint idx = ZCSG(interned_strings).nNumUsed; uint nIndex; @@ -292,13 +292,13 @@ static void accel_interned_strings_restore_state(TSRMLS_D) } } -static void accel_interned_strings_save_state(TSRMLS_D) +static void accel_interned_strings_save_state(void) { ZCSG(interned_strings_saved_top) = ZCSG(interned_strings_top); } #endif -zend_string *accel_new_interned_string(zend_string *str TSRMLS_DC) +zend_string *accel_new_interned_string(zend_string *str) { /* for now interned strings are supported only for non-ZTS build */ #ifndef ZTS @@ -366,18 +366,18 @@ zend_string *accel_new_interned_string(zend_string *str TSRMLS_DC) #ifndef ZTS /* Copy PHP interned strings from PHP process memory into the shared memory */ -static void accel_use_shm_interned_strings(TSRMLS_D) +static void accel_use_shm_interned_strings(void) { uint idx, j; Bucket *p, *q; /* empty string */ - CG(empty_string) = accel_new_interned_string(CG(empty_string) TSRMLS_CC); + CG(empty_string) = accel_new_interned_string(CG(empty_string)); for (j = 0; j < 256; j++) { char s[2]; s[0] = j; s[1] = 0; - CG(one_char_string)[j] = accel_new_interned_string(zend_string_init(s, 1, 0) TSRMLS_CC); + CG(one_char_string)[j] = accel_new_interned_string(zend_string_init(s, 1, 0)); } /* function table hash keys */ @@ -385,10 +385,10 @@ static void accel_use_shm_interned_strings(TSRMLS_D) p = CG(function_table)->arData + idx; if (Z_TYPE(p->val) == IS_UNDEF) continue; if (p->key) { - p->key = accel_new_interned_string(p->key TSRMLS_CC); + p->key = accel_new_interned_string(p->key); } if (Z_FUNC(p->val)->common.function_name) { - Z_FUNC(p->val)->common.function_name = accel_new_interned_string(Z_FUNC(p->val)->common.function_name TSRMLS_CC); + Z_FUNC(p->val)->common.function_name = accel_new_interned_string(Z_FUNC(p->val)->common.function_name); } } @@ -401,11 +401,11 @@ static void accel_use_shm_interned_strings(TSRMLS_D) ce = (zend_class_entry*)Z_PTR(p->val); if (p->key) { - p->key = accel_new_interned_string(p->key TSRMLS_CC); + p->key = accel_new_interned_string(p->key); } if (ce->name) { - ce->name = accel_new_interned_string(ce->name TSRMLS_CC); + ce->name = accel_new_interned_string(ce->name); } for (j = 0; j < ce->properties_info.nNumUsed; j++) { @@ -417,11 +417,11 @@ static void accel_use_shm_interned_strings(TSRMLS_D) info = (zend_property_info*)Z_PTR(q->val); if (q->key) { - q->key = accel_new_interned_string(q->key TSRMLS_CC); + q->key = accel_new_interned_string(q->key); } if (info->name) { - info->name = accel_new_interned_string(info->name TSRMLS_CC); + info->name = accel_new_interned_string(info->name); } } @@ -429,10 +429,10 @@ static void accel_use_shm_interned_strings(TSRMLS_D) q = ce->function_table.arData + j; if (Z_TYPE(q->val) == IS_UNDEF) continue; if (q->key) { - q->key = accel_new_interned_string(q->key TSRMLS_CC); + q->key = accel_new_interned_string(q->key); } if (Z_FUNC(q->val)->common.function_name) { - Z_FUNC(q->val)->common.function_name = accel_new_interned_string(Z_FUNC(q->val)->common.function_name TSRMLS_CC); + Z_FUNC(q->val)->common.function_name = accel_new_interned_string(Z_FUNC(q->val)->common.function_name); } } @@ -440,7 +440,7 @@ static void accel_use_shm_interned_strings(TSRMLS_D) q = ce->constants_table.arData + j; if (!Z_TYPE(q->val) == IS_UNDEF) continue; if (q->key) { - q->key = accel_new_interned_string(q->key TSRMLS_CC); + q->key = accel_new_interned_string(q->key); } } } @@ -450,7 +450,7 @@ static void accel_use_shm_interned_strings(TSRMLS_D) p = EG(zend_constants)->arData + idx; if (!Z_TYPE(p->val) == IS_UNDEF) continue; if (p->key) { - p->key = accel_new_interned_string(p->key TSRMLS_CC); + p->key = accel_new_interned_string(p->key); } } @@ -463,15 +463,15 @@ static void accel_use_shm_interned_strings(TSRMLS_D) auto_global = (zend_auto_global*)Z_PTR(p->val);; - auto_global->name = accel_new_interned_string(auto_global->name TSRMLS_CC); + auto_global->name = accel_new_interned_string(auto_global->name); if (p->key) { - p->key = accel_new_interned_string(p->key TSRMLS_CC); + p->key = accel_new_interned_string(p->key); } } } #endif -static inline void accel_restart_enter(TSRMLS_D) +static inline void accel_restart_enter(void) { #ifdef ZEND_WIN32 INCREMENT(restart_in); @@ -485,7 +485,7 @@ static inline void accel_restart_enter(TSRMLS_D) ZCSG(restart_in_progress) = 1; } -static inline void accel_restart_leave(TSRMLS_D) +static inline void accel_restart_leave(void) { #ifdef ZEND_WIN32 ZCSG(restart_in_progress) = 0; @@ -500,7 +500,7 @@ static inline void accel_restart_leave(TSRMLS_D) #endif } -static inline int accel_restart_is_active(TSRMLS_D) +static inline int accel_restart_is_active(void) { if (ZCSG(restart_in_progress)) { #ifndef ZEND_WIN32 @@ -524,7 +524,7 @@ static inline int accel_restart_is_active(TSRMLS_D) } /* Creates a read lock for SHM access */ -static inline void accel_activate_add(TSRMLS_D) +static inline void accel_activate_add(void) { #ifdef ZEND_WIN32 INCREMENT(mem_usage); @@ -538,7 +538,7 @@ static inline void accel_activate_add(TSRMLS_D) } /* Releases a lock for SHM access */ -static inline void accel_deactivate_sub(TSRMLS_D) +static inline void accel_deactivate_sub(void) { #ifdef ZEND_WIN32 if (ZCG(counted)) { @@ -554,10 +554,10 @@ static inline void accel_deactivate_sub(TSRMLS_D) #endif } -static inline void accel_unlock_all(TSRMLS_D) +static inline void accel_unlock_all(void) { #ifdef ZEND_WIN32 - accel_deactivate_sub(TSRMLS_C); + accel_deactivate_sub(); #else static const FLOCK_STRUCTURE(mem_usage_unlock_all, F_UNLCK, SEEK_SET, 0, 0); @@ -610,7 +610,7 @@ static inline void kill_all_lockers(struct flock *mem_usage_check) } #endif -static inline int accel_is_inactive(TSRMLS_D) +static inline int accel_is_inactive(void) { #ifdef ZEND_WIN32 if (LOCKVAL(mem_usage) == 0) { @@ -641,7 +641,7 @@ static inline int accel_is_inactive(TSRMLS_D) return FAILURE; } -static int zend_get_stream_timestamp(const char *filename, zend_stat_t *statbuf TSRMLS_DC) +static int zend_get_stream_timestamp(const char *filename, zend_stat_t *statbuf) { php_stream_wrapper *wrapper; php_stream_statbuf stream_statbuf; @@ -651,7 +651,7 @@ static int zend_get_stream_timestamp(const char *filename, zend_stat_t *statbuf return FAILURE; } - wrapper = php_stream_locate_url_wrapper(filename, NULL, STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC); + wrapper = php_stream_locate_url_wrapper(filename, NULL, STREAM_LOCATE_WRAPPERS_ONLY); if (!wrapper) { return FAILURE; } @@ -663,7 +663,7 @@ static int zend_get_stream_timestamp(const char *filename, zend_stat_t *statbuf er = EG(error_reporting); EG(error_reporting) = 0; zend_try { - ret = wrapper->wops->url_stat(wrapper, (char*)filename, PHP_STREAM_URL_STAT_QUIET, &stream_statbuf, NULL TSRMLS_CC); + ret = wrapper->wops->url_stat(wrapper, (char*)filename, PHP_STREAM_URL_STAT_QUIET, &stream_statbuf, NULL); } zend_catch { ret = -1; } zend_end_try(); @@ -722,7 +722,7 @@ static accel_time_t zend_get_file_handle_timestamp_win(zend_file_handle *file_ha } #endif -static accel_time_t zend_get_file_handle_timestamp(zend_file_handle *file_handle, size_t *size TSRMLS_DC) +static accel_time_t zend_get_file_handle_timestamp(zend_file_handle *file_handle, size_t *size) { zend_stat_t statbuf; #ifdef ZEND_WIN32 @@ -733,7 +733,7 @@ static accel_time_t zend_get_file_handle_timestamp(zend_file_handle *file_handle !EG(current_execute_data) && file_handle->filename == SG(request_info).path_translated) { - zend_stat_t *tmpbuf = sapi_module.get_stat(TSRMLS_C); + zend_stat_t *tmpbuf = sapi_module.get_stat(); if (tmpbuf) { if (size) { @@ -758,7 +758,7 @@ static accel_time_t zend_get_file_handle_timestamp(zend_file_handle *file_handle break; case ZEND_HANDLE_FP: if (zend_fstat(fileno(file_handle->handle.fp), &statbuf) == -1) { - if (zend_get_stream_timestamp(file_handle->filename, &statbuf TSRMLS_CC) != SUCCESS) { + if (zend_get_stream_timestamp(file_handle->filename, &statbuf) != SUCCESS) { return 0; } } @@ -770,7 +770,7 @@ static accel_time_t zend_get_file_handle_timestamp(zend_file_handle *file_handle if (file_path) { if (is_stream_path(file_path)) { - if (zend_get_stream_timestamp(file_path, &statbuf TSRMLS_CC) == SUCCESS) { + if (zend_get_stream_timestamp(file_path, &statbuf) == SUCCESS) { break; } } @@ -779,7 +779,7 @@ static accel_time_t zend_get_file_handle_timestamp(zend_file_handle *file_handle } } - if (zend_get_stream_timestamp(file_handle->filename, &statbuf TSRMLS_CC) != SUCCESS) { + if (zend_get_stream_timestamp(file_handle->filename, &statbuf) != SUCCESS) { return 0; } break; @@ -799,7 +799,7 @@ static accel_time_t zend_get_file_handle_timestamp(zend_file_handle *file_handle er = EG(error_reporting); EG(error_reporting) = 0; zend_try { - ret = stream->ops->stat(stream, &sb TSRMLS_CC); + ret = stream->ops->stat(stream, &sb); } zend_catch { ret = -1; } zend_end_try(); @@ -822,7 +822,7 @@ static accel_time_t zend_get_file_handle_timestamp(zend_file_handle *file_handle return statbuf.st_mtime; } -static inline int do_validate_timestamps(zend_persistent_script *persistent_script, zend_file_handle *file_handle TSRMLS_DC) +static inline int do_validate_timestamps(zend_persistent_script *persistent_script, zend_file_handle *file_handle) { zend_file_handle ps_handle; char *full_path_ptr = NULL; @@ -836,7 +836,7 @@ static inline int do_validate_timestamps(zend_persistent_script *persistent_scri return FAILURE; } } else { - full_path_ptr = accelerator_orig_zend_resolve_path(file_handle->filename, strlen(file_handle->filename) TSRMLS_CC); + full_path_ptr = accelerator_orig_zend_resolve_path(file_handle->filename, strlen(file_handle->filename)); if (full_path_ptr && strcmp(persistent_script->full_path->val, full_path_ptr) != 0) { efree(full_path_ptr); return FAILURE; @@ -852,7 +852,7 @@ static inline int do_validate_timestamps(zend_persistent_script *persistent_scri return FAILURE; } - if (zend_get_file_handle_timestamp(file_handle, NULL TSRMLS_CC) == persistent_script->timestamp) { + if (zend_get_file_handle_timestamp(file_handle, NULL) == persistent_script->timestamp) { if (full_path_ptr) { efree(full_path_ptr); file_handle->opened_path = NULL; @@ -868,19 +868,19 @@ static inline int do_validate_timestamps(zend_persistent_script *persistent_scri ps_handle.filename = persistent_script->full_path->val; ps_handle.opened_path = persistent_script->full_path->val; - if (zend_get_file_handle_timestamp(&ps_handle, NULL TSRMLS_CC) == persistent_script->timestamp) { + if (zend_get_file_handle_timestamp(&ps_handle, NULL) == persistent_script->timestamp) { return SUCCESS; } return FAILURE; } -int validate_timestamp_and_record(zend_persistent_script *persistent_script, zend_file_handle *file_handle TSRMLS_DC) +int validate_timestamp_and_record(zend_persistent_script *persistent_script, zend_file_handle *file_handle) { if (ZCG(accel_directives).revalidate_freq && persistent_script->dynamic_members.revalidate >= ZCG(request_time)) { return SUCCESS; - } else if (do_validate_timestamps(persistent_script, file_handle TSRMLS_CC) == FAILURE) { + } else if (do_validate_timestamps(persistent_script, file_handle) == FAILURE) { return FAILURE; } else { persistent_script->dynamic_members.revalidate = ZCG(request_time) + ZCG(accel_directives).revalidate_freq; @@ -914,7 +914,7 @@ static unsigned int zend_accel_script_checksum(zend_persistent_script *persisten /* Instead of resolving full real path name each time we need to identify file, * we create a key that consist from requested file name, current working * directory, current include_path, etc */ -char *accel_make_persistent_key_ex(zend_file_handle *file_handle, int path_length, int *key_len TSRMLS_DC) +char *accel_make_persistent_key_ex(zend_file_handle *file_handle, int path_length, int *key_len) { int key_length; @@ -930,7 +930,7 @@ char *accel_make_persistent_key_ex(zend_file_handle *file_handle, int path_lengt int cwd_len; char *cwd; - if ((cwd = accel_getcwd(&cwd_len TSRMLS_CC)) == NULL) { + if ((cwd = accel_getcwd(&cwd_len)) == NULL) { /* we don't handle this well for now. */ zend_accel_error(ACCEL_LOG_INFO, "getcwd() failed for '%s' (%d), please try to set opcache.use_cwd to 0 in ini file", file_handle->filename, errno); if (file_handle->opened_path) { @@ -955,7 +955,7 @@ char *accel_make_persistent_key_ex(zend_file_handle *file_handle, int path_lengt !zend_accel_hash_is_full(&ZCSG(include_paths))) { SHM_UNPROTECT(); - zend_shared_alloc_lock(TSRMLS_C); + zend_shared_alloc_lock(); ZCG(include_path_key) = zend_accel_hash_find(&ZCSG(include_paths), ZCG(include_path), ZCG(include_path_len)); if (ZCG(include_path_key)) { @@ -973,11 +973,11 @@ char *accel_make_persistent_key_ex(zend_file_handle *file_handle, int path_lengt include_path = ZCG(include_path_key); include_path_len = 1; } else { - zend_accel_schedule_restart_if_necessary(ACCEL_RESTART_OOM TSRMLS_CC); + zend_accel_schedule_restart_if_necessary(ACCEL_RESTART_OOM); } } - zend_shared_alloc_unlock(TSRMLS_C); + zend_shared_alloc_unlock(); SHM_PROTECT(); } } @@ -987,7 +987,7 @@ char *accel_make_persistent_key_ex(zend_file_handle *file_handle, int path_lengt in include path too. */ if (EG(current_execute_data) && - (parent_script = zend_get_executed_filename(TSRMLS_C)) != NULL && + (parent_script = zend_get_executed_filename()) != NULL && parent_script[0] != '[') { parent_script_len = strlen(parent_script); @@ -1040,21 +1040,21 @@ char *accel_make_persistent_key_ex(zend_file_handle *file_handle, int path_lengt return ZCG(key); } -static inline char *accel_make_persistent_key(zend_file_handle *file_handle, int *key_len TSRMLS_DC) +static inline char *accel_make_persistent_key(zend_file_handle *file_handle, int *key_len) { - return accel_make_persistent_key_ex(file_handle, strlen(file_handle->filename), key_len TSRMLS_CC); + return accel_make_persistent_key_ex(file_handle, strlen(file_handle->filename), key_len); } -int zend_accel_invalidate(const char *filename, int filename_len, zend_bool force TSRMLS_DC) +int zend_accel_invalidate(const char *filename, int filename_len, zend_bool force) { char *realpath; zend_persistent_script *persistent_script; - if (!ZCG(enabled) || !accel_startup_ok || !ZCSG(accelerator_enabled) || accelerator_shm_read_lock(TSRMLS_C) != SUCCESS) { + if (!ZCG(enabled) || !accel_startup_ok || !ZCSG(accelerator_enabled) || accelerator_shm_read_lock() != SUCCESS) { return FAILURE; } - realpath = accelerator_orig_zend_resolve_path(filename, filename_len TSRMLS_CC); + realpath = accelerator_orig_zend_resolve_path(filename, filename_len); if (!realpath) { return FAILURE; @@ -1070,9 +1070,9 @@ int zend_accel_invalidate(const char *filename, int filename_len, zend_bool forc if (force || !ZCG(accel_directives).validate_timestamps || - do_validate_timestamps(persistent_script, &file_handle TSRMLS_CC) == FAILURE) { + do_validate_timestamps(persistent_script, &file_handle) == FAILURE) { SHM_UNPROTECT(); - zend_shared_alloc_lock(TSRMLS_C); + zend_shared_alloc_lock(); if (!persistent_script->corrupted) { persistent_script->corrupted = 1; persistent_script->timestamp = 0; @@ -1080,28 +1080,28 @@ int zend_accel_invalidate(const char *filename, int filename_len, zend_bool forc if (ZSMMG(memory_exhausted)) { zend_accel_restart_reason reason = zend_accel_hash_is_full(&ZCSG(hash)) ? ACCEL_RESTART_HASH : ACCEL_RESTART_OOM; - zend_accel_schedule_restart_if_necessary(reason TSRMLS_CC); + zend_accel_schedule_restart_if_necessary(reason); } } - zend_shared_alloc_unlock(TSRMLS_C); + zend_shared_alloc_unlock(); SHM_PROTECT(); } } - accelerator_shm_read_unlock(TSRMLS_C); + accelerator_shm_read_unlock(); efree(realpath); return SUCCESS; } /* Adds another key for existing cached script */ -static void zend_accel_add_key(char *key, unsigned int key_length, zend_accel_hash_entry *bucket TSRMLS_DC) +static void zend_accel_add_key(char *key, unsigned int key_length, zend_accel_hash_entry *bucket) { if (!zend_accel_hash_find(&ZCSG(hash), key, key_length)) { if (zend_accel_hash_is_full(&ZCSG(hash))) { zend_accel_error(ACCEL_LOG_DEBUG, "No more entries in hash table!"); ZSMMG(memory_exhausted) = 1; - zend_accel_schedule_restart_if_necessary(ACCEL_RESTART_HASH TSRMLS_CC); + zend_accel_schedule_restart_if_necessary(ACCEL_RESTART_HASH); } else { char *new_key = zend_shared_alloc(key_length + 1); if (new_key) { @@ -1110,13 +1110,13 @@ static void zend_accel_add_key(char *key, unsigned int key_length, zend_accel_ha zend_accel_error(ACCEL_LOG_INFO, "Added key '%s'", new_key); } } else { - zend_accel_schedule_restart_if_necessary(ACCEL_RESTART_OOM TSRMLS_CC); + zend_accel_schedule_restart_if_necessary(ACCEL_RESTART_OOM); } } } } -static zend_persistent_script *cache_script_in_shared_memory(zend_persistent_script *new_persistent_script, char *key, unsigned int key_length, int *from_shared_memory TSRMLS_DC) +static zend_persistent_script *cache_script_in_shared_memory(zend_persistent_script *new_persistent_script, char *key, unsigned int key_length, int *from_shared_memory) { zend_accel_hash_entry *bucket; uint memory_used; @@ -1126,18 +1126,18 @@ static zend_persistent_script *cache_script_in_shared_memory(zend_persistent_scr return new_persistent_script; } - if (!zend_accel_script_optimize(new_persistent_script TSRMLS_CC)) { + if (!zend_accel_script_optimize(new_persistent_script)) { return new_persistent_script; } /* exclusive lock */ - zend_shared_alloc_lock(TSRMLS_C); + zend_shared_alloc_lock(); if (zend_accel_hash_is_full(&ZCSG(hash))) { zend_accel_error(ACCEL_LOG_DEBUG, "No more entries in hash table!"); ZSMMG(memory_exhausted) = 1; - zend_accel_schedule_restart_if_necessary(ACCEL_RESTART_HASH TSRMLS_CC); - zend_shared_alloc_unlock(TSRMLS_C); + zend_accel_schedule_restart_if_necessary(ACCEL_RESTART_HASH); + zend_shared_alloc_unlock(); return new_persistent_script; } @@ -1152,26 +1152,26 @@ static zend_persistent_script *cache_script_in_shared_memory(zend_persistent_scr if (!ZCG(accel_directives).revalidate_path && (!ZCG(accel_directives).validate_timestamps || (new_persistent_script->timestamp == existing_persistent_script->timestamp))) { - zend_accel_add_key(key, key_length, bucket TSRMLS_CC); + zend_accel_add_key(key, key_length, bucket); } - zend_shared_alloc_unlock(TSRMLS_C); + zend_shared_alloc_unlock(); return new_persistent_script; } } /* Calculate the required memory size */ - memory_used = zend_accel_script_persist_calc(new_persistent_script, key, key_length TSRMLS_CC); + memory_used = zend_accel_script_persist_calc(new_persistent_script, key, key_length); /* Allocate shared memory */ ZCG(mem) = zend_shared_alloc(memory_used); if (!ZCG(mem)) { - zend_accel_schedule_restart_if_necessary(ACCEL_RESTART_OOM TSRMLS_CC); - zend_shared_alloc_unlock(TSRMLS_C); + zend_accel_schedule_restart_if_necessary(ACCEL_RESTART_OOM); + zend_shared_alloc_unlock(); return new_persistent_script; } /* Copy into shared memory */ - new_persistent_script = zend_accel_script_persist(new_persistent_script, &key, key_length TSRMLS_CC); + new_persistent_script = zend_accel_script_persist(new_persistent_script, &key, key_length); /* Consistency check */ if ((char*)new_persistent_script->mem + new_persistent_script->size != (char*)ZCG(mem)) { @@ -1201,14 +1201,14 @@ static zend_persistent_script *cache_script_in_shared_memory(zend_persistent_scr } else { zend_accel_error(ACCEL_LOG_DEBUG, "No more entries in hash table!"); ZSMMG(memory_exhausted) = 1; - zend_accel_schedule_restart_if_necessary(ACCEL_RESTART_HASH TSRMLS_CC); + zend_accel_schedule_restart_if_necessary(ACCEL_RESTART_HASH); } } } new_persistent_script->dynamic_members.memory_consumption = ZEND_ALIGNED_SIZE(new_persistent_script->size); - zend_shared_alloc_unlock(TSRMLS_C); + zend_shared_alloc_unlock(); *from_shared_memory = 1; return new_persistent_script; @@ -1227,7 +1227,7 @@ static const struct jit_auto_global_info static zend_string *jit_auto_globals_str[4]; -static int zend_accel_get_auto_globals(TSRMLS_D) +static int zend_accel_get_auto_globals(void) { int i, ag_size = (sizeof(jit_auto_globals_info) / sizeof(jit_auto_globals_info[0])); int n = 1; @@ -1242,7 +1242,7 @@ static int zend_accel_get_auto_globals(TSRMLS_D) return mask; } -static int zend_accel_get_auto_globals_no_jit(TSRMLS_D) +static int zend_accel_get_auto_globals_no_jit(void) { if (zend_hash_exists(&EG(symbol_table).ht, jit_auto_globals_str[3])) { return 8; @@ -1250,7 +1250,7 @@ static int zend_accel_get_auto_globals_no_jit(TSRMLS_D) return 0; } -static void zend_accel_set_auto_globals(int mask TSRMLS_DC) +static void zend_accel_set_auto_globals(int mask) { int i, ag_size = (sizeof(jit_auto_globals_info) / sizeof(jit_auto_globals_info[0])); int n = 1; @@ -1258,24 +1258,24 @@ static void zend_accel_set_auto_globals(int mask TSRMLS_DC) for (i = 0; i < ag_size ; i++) { if ((mask & n) && !(ZCG(auto_globals_mask) & n)) { ZCG(auto_globals_mask) |= n; - zend_is_auto_global(jit_auto_globals_str[i] TSRMLS_CC); + zend_is_auto_global(jit_auto_globals_str[i]); } n += n; } } -static void zend_accel_init_auto_globals(TSRMLS_D) +static void zend_accel_init_auto_globals(void) { 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] = zend_string_init(jit_auto_globals_info[i].name, jit_auto_globals_info[i].len, 1); zend_string_hash_val(jit_auto_globals_str[i]); - jit_auto_globals_str[i] = accel_new_interned_string(jit_auto_globals_str[i] TSRMLS_CC); + jit_auto_globals_str[i] = accel_new_interned_string(jit_auto_globals_str[i]); } } -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) +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) { zend_persistent_script *new_persistent_script; zend_op_array *orig_active_op_array; @@ -1288,7 +1288,7 @@ static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_han /* Try to open file */ if (file_handle->type == ZEND_HANDLE_FILENAME) { - if (accelerator_orig_zend_stream_open_function(file_handle->filename, file_handle TSRMLS_CC) == SUCCESS) { + if (accelerator_orig_zend_stream_open_function(file_handle->filename, file_handle) == SUCCESS) { /* key may be changed by zend_stream_open_function() */ if (key == ZCG(key)) { key_length = ZCG(key_len); @@ -1296,10 +1296,10 @@ static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_han } else { *op_array_p = NULL; if (type == ZEND_REQUIRE) { - zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename TSRMLS_CC); + zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename); zend_bailout(); } else { - zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename TSRMLS_CC); + zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename); } return NULL; } @@ -1308,7 +1308,7 @@ static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_han /* check blacklist right after ensuring that file was opened */ if (file_handle->opened_path && zend_accel_blacklist_is_blacklisted(&accel_blacklist, file_handle->opened_path)) { ZCSG(blacklist_misses)++; - *op_array_p = accelerator_orig_compile_file(file_handle, type TSRMLS_CC); + *op_array_p = accelerator_orig_compile_file(file_handle, type); return NULL; } @@ -1321,7 +1321,7 @@ static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_han /* Stream callbacks needs to be called in context of original * function and class tables (see: https://bugs.php.net/bug.php?id=64353) */ - if (zend_stream_fixup(file_handle, &buf, &size TSRMLS_CC) == FAILURE) { + if (zend_stream_fixup(file_handle, &buf, &size) == FAILURE) { *op_array_p = NULL; return NULL; } @@ -1335,26 +1335,26 @@ static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_han /* Obtain the file timestamps, *before* actually compiling them, * otherwise we have a race-condition. */ - timestamp = zend_get_file_handle_timestamp(file_handle, ZCG(accel_directives).max_file_size > 0 ? &size : NULL TSRMLS_CC); + timestamp = zend_get_file_handle_timestamp(file_handle, ZCG(accel_directives).max_file_size > 0 ? &size : NULL); /* If we can't obtain a timestamp (that means file is possibly socket) * we won't cache it */ if (timestamp == 0) { - *op_array_p = accelerator_orig_compile_file(file_handle, type TSRMLS_CC); + *op_array_p = accelerator_orig_compile_file(file_handle, type); return NULL; } /* check if file is too new (may be it's not written completely yet) */ if (ZCG(accel_directives).file_update_protection && (ZCG(request_time) - ZCG(accel_directives).file_update_protection < timestamp)) { - *op_array_p = accelerator_orig_compile_file(file_handle, type TSRMLS_CC); + *op_array_p = accelerator_orig_compile_file(file_handle, type); return NULL; } if (ZCG(accel_directives).max_file_size > 0 && size > (size_t)ZCG(accel_directives).max_file_size) { ZCSG(blacklist_misses)++; - *op_array_p = accelerator_orig_compile_file(file_handle, type TSRMLS_CC); + *op_array_p = accelerator_orig_compile_file(file_handle, type); return NULL; } } @@ -1378,7 +1378,7 @@ static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_han CG(compiler_options) |= ZEND_COMPILE_IGNORE_INTERNAL_CLASSES; CG(compiler_options) |= ZEND_COMPILE_DELAYED_BINDING; CG(compiler_options) |= ZEND_COMPILE_NO_CONSTANT_SUBSTITUTION; - op_array = *op_array_p = accelerator_orig_compile_file(file_handle, type TSRMLS_CC); + op_array = *op_array_p = accelerator_orig_compile_file(file_handle, type); CG(compiler_options) = orig_compiler_options; } zend_catch { op_array = NULL; @@ -1395,7 +1395,7 @@ static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_han if (!op_array) { /* compilation failed */ free_persistent_script(new_persistent_script, 1); - zend_accel_free_user_functions(&ZCG(function_table) TSRMLS_CC); + zend_accel_free_user_functions(&ZCG(function_table)); if (do_bailout) { zend_bailout(); } @@ -1406,7 +1406,7 @@ static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_han 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 TSRMLS_CC); + zend_accel_move_user_functions(&ZCG(function_table), &new_persistent_script->function_table); new_persistent_script->main_op_array = *op_array; efree(op_array); /* we have valid persistent_script, so it's safe to free op_array */ @@ -1414,9 +1414,9 @@ static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_han /* Fill in the ping_auto_globals_mask for the new script. If jit for auto globals is enabled we will have to ping the used auto global variables before execution */ if (PG(auto_globals_jit)) { - new_persistent_script->ping_auto_globals_mask = zend_accel_get_auto_globals(TSRMLS_C); + new_persistent_script->ping_auto_globals_mask = zend_accel_get_auto_globals(); } else { - new_persistent_script->ping_auto_globals_mask = zend_accel_get_auto_globals_no_jit(TSRMLS_C); + new_persistent_script->ping_auto_globals_mask = zend_accel_get_auto_globals_no_jit(); } if (ZCG(accel_directives).validate_timestamps) { @@ -1435,11 +1435,11 @@ static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_han zend_string_hash_val(new_persistent_script->full_path); /* Now persistent_script structure is ready in process memory */ - return cache_script_in_shared_memory(new_persistent_script, key, key_length, from_shared_memory TSRMLS_CC); + return cache_script_in_shared_memory(new_persistent_script, key, key_length, from_shared_memory); } /* zend_compile() replacement */ -zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type TSRMLS_DC) +zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type) { zend_persistent_script *persistent_script = NULL; char *key = NULL; @@ -1449,11 +1449,11 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type T if (!file_handle->filename || !ZCG(enabled) || !accel_startup_ok || (!ZCG(counted) && !ZCSG(accelerator_enabled)) || - (ZCSG(restart_in_progress) && accel_restart_is_active(TSRMLS_C)) || + (ZCSG(restart_in_progress) && accel_restart_is_active()) || (is_stream_path(file_handle->filename) && !is_cacheable_stream_path(file_handle->filename))) { /* The Accelerator is disabled, act as if without the Accelerator */ - return accelerator_orig_compile_file(file_handle, type TSRMLS_CC); + return accelerator_orig_compile_file(file_handle, type); } /* Make sure we only increase the currently running processes semaphore @@ -1462,7 +1462,7 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type T */ if (!ZCG(counted)) { ZCG(counted) = 1; - accel_activate_add(TSRMLS_C); + accel_activate_add(); } /* In case this callback is called from include_once, require_once or it's @@ -1480,7 +1480,7 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type T (EG(current_execute_data)->opline->extended_value == ZEND_INCLUDE_ONCE || EG(current_execute_data)->opline->extended_value == ZEND_REQUIRE_ONCE))) { if (!ZCG(key_len)) { - return accelerator_orig_compile_file(file_handle, type TSRMLS_CC); + return accelerator_orig_compile_file(file_handle, type); } /* persistent script was already found by overridden open() or * resolve_path() callbacks */ @@ -1489,8 +1489,8 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type T key_length = ZCG(key_len); } else { /* try to find cached script by key */ - if ((key = accel_make_persistent_key(file_handle, &key_length TSRMLS_CC)) == NULL) { - return accelerator_orig_compile_file(file_handle, type TSRMLS_CC); + if ((key = accel_make_persistent_key(file_handle, &key_length)) == NULL) { + return accelerator_orig_compile_file(file_handle, type); } persistent_script = zend_accel_hash_find(&ZCSG(hash), key, key_length); if (!persistent_script) { @@ -1499,12 +1499,12 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type T /* open file to resolve the path */ if (file_handle->type == ZEND_HANDLE_FILENAME && - accelerator_orig_zend_stream_open_function(file_handle->filename, file_handle TSRMLS_CC) == FAILURE) { + accelerator_orig_zend_stream_open_function(file_handle->filename, file_handle) == FAILURE) { if (type == ZEND_REQUIRE) { - zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename TSRMLS_CC); + zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename); zend_bailout(); } else { - zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename TSRMLS_CC); + zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename); } return NULL; } @@ -1516,9 +1516,9 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type T if (!ZCG(accel_directives).revalidate_path && !persistent_script->corrupted) { SHM_UNPROTECT(); - zend_shared_alloc_lock(TSRMLS_C); - zend_accel_add_key(key, key_length, bucket TSRMLS_CC); - zend_shared_alloc_unlock(TSRMLS_C); + zend_shared_alloc_lock(); + zend_accel_add_key(key, key_length, bucket); + zend_shared_alloc_unlock(); SHM_PROTECT(); } } @@ -1537,8 +1537,8 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type T /* If script is found then validate_timestamps if option is enabled */ if (persistent_script && ZCG(accel_directives).validate_timestamps) { - if (validate_timestamp_and_record(persistent_script, file_handle TSRMLS_CC) == FAILURE) { - zend_shared_alloc_lock(TSRMLS_C); + if (validate_timestamp_and_record(persistent_script, file_handle) == FAILURE) { + zend_shared_alloc_lock(); if (!persistent_script->corrupted) { persistent_script->corrupted = 1; persistent_script->timestamp = 0; @@ -1546,10 +1546,10 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type T if (ZSMMG(memory_exhausted)) { zend_accel_restart_reason reason = zend_accel_hash_is_full(&ZCSG(hash)) ? ACCEL_RESTART_HASH : ACCEL_RESTART_OOM; - zend_accel_schedule_restart_if_necessary(reason TSRMLS_CC); + zend_accel_schedule_restart_if_necessary(reason); } } - zend_shared_alloc_unlock(TSRMLS_C); + zend_shared_alloc_unlock(); persistent_script = NULL; } } @@ -1563,7 +1563,7 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type T /* 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); - zend_shared_alloc_lock(TSRMLS_C); + zend_shared_alloc_lock(); if (!persistent_script->corrupted) { persistent_script->corrupted = 1; persistent_script->timestamp = 0; @@ -1571,10 +1571,10 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type T if (ZSMMG(memory_exhausted)) { zend_accel_restart_reason reason = zend_accel_hash_is_full(&ZCSG(hash)) ? ACCEL_RESTART_HASH : ACCEL_RESTART_OOM; - zend_accel_schedule_restart_if_necessary(reason TSRMLS_CC); + zend_accel_schedule_restart_if_necessary(reason); } } - zend_shared_alloc_unlock(TSRMLS_C); + zend_shared_alloc_unlock(); persistent_script = NULL; } } @@ -1590,14 +1590,14 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type T /* No memory left. Behave like without the Accelerator */ if (ZSMMG(memory_exhausted) || ZCSG(restart_pending)) { SHM_PROTECT(); - return accelerator_orig_compile_file(file_handle, type TSRMLS_CC); + return accelerator_orig_compile_file(file_handle, type); } /* Try and cache the script and assume that it is returned from_shared_memory. * If it isn't compile_and_cache_file() changes the flag to 0 */ from_shared_memory = 0; - persistent_script = compile_and_cache_file(file_handle, type, key, key_length, &op_array, &from_shared_memory TSRMLS_CC); + persistent_script = compile_and_cache_file(file_handle, type, key, key_length, &op_array, &from_shared_memory); /* Caching is disabled, returning op_array; * or something went wrong during compilation, returning NULL @@ -1646,7 +1646,7 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type T } } } - zend_file_handle_dtor(file_handle TSRMLS_CC); + zend_file_handle_dtor(file_handle); from_shared_memory = 1; } @@ -1656,14 +1656,14 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type T /* Fetch jit auto globals used in the script before execution */ if (persistent_script->ping_auto_globals_mask) { - zend_accel_set_auto_globals(persistent_script->ping_auto_globals_mask TSRMLS_CC); + zend_accel_set_auto_globals(persistent_script->ping_auto_globals_mask); } - return zend_accel_load_script(persistent_script, from_shared_memory TSRMLS_CC); + return zend_accel_load_script(persistent_script, from_shared_memory); } /* zend_stream_open_function() replacement for PHP 5.3 and above */ -static int persistent_stream_open_function(const char *filename, zend_file_handle *handle TSRMLS_DC) +static int persistent_stream_open_function(const char *filename, zend_file_handle *handle) { if (ZCG(enabled) && accel_startup_ok && (ZCG(counted) || ZCSG(accelerator_enabled)) && @@ -1718,11 +1718,11 @@ static int persistent_stream_open_function(const char *filename, zend_file_handl } ZCG(cache_opline) = NULL; ZCG(cache_persistent_script) = NULL; - return accelerator_orig_zend_stream_open_function(filename, handle TSRMLS_CC); + return accelerator_orig_zend_stream_open_function(filename, handle); } /* zend_resolve_path() replacement for PHP 5.3 and above */ -static char* persistent_zend_resolve_path(const char *filename, int filename_len TSRMLS_DC) +static char* persistent_zend_resolve_path(const char *filename, int filename_len) { if (ZCG(enabled) && accel_startup_ok && (ZCG(counted) || ZCSG(accelerator_enabled)) && @@ -1763,7 +1763,7 @@ static char* persistent_zend_resolve_path(const char *filename, int filename_len handle.filename = (char*)filename; handle.free_filename = 0; handle.opened_path = NULL; - key = accel_make_persistent_key_ex(&handle, filename_len, &key_length TSRMLS_CC); + key = accel_make_persistent_key_ex(&handle, filename_len, &key_length); if (!ZCG(accel_directives).revalidate_path && key && (persistent_script = zend_accel_hash_find(&ZCSG(hash), key, key_length)) != NULL && @@ -1776,7 +1776,7 @@ static char* persistent_zend_resolve_path(const char *filename, int filename_len } /* find the full real path */ - resolved_path = accelerator_orig_zend_resolve_path(filename, filename_len TSRMLS_CC); + resolved_path = accelerator_orig_zend_resolve_path(filename, filename_len); /* Check if requested file already cached (by real path) */ if (resolved_path && @@ -1787,9 +1787,9 @@ static char* persistent_zend_resolve_path(const char *filename, int filename_len if (key && !ZCG(accel_directives).revalidate_path) { /* add another "key" for the same bucket */ SHM_UNPROTECT(); - zend_shared_alloc_lock(TSRMLS_C); - zend_accel_add_key(key, key_length, bucket TSRMLS_CC); - zend_shared_alloc_unlock(TSRMLS_C); + zend_shared_alloc_lock(); + zend_accel_add_key(key, key_length, bucket); + zend_shared_alloc_unlock(); SHM_PROTECT(); } ZCG(cache_opline) = (EG(current_execute_data) && key) ? EG(current_execute_data)->opline : NULL; @@ -1804,10 +1804,10 @@ static char* persistent_zend_resolve_path(const char *filename, int filename_len } ZCG(cache_opline) = NULL; ZCG(cache_persistent_script) = NULL; - return accelerator_orig_zend_resolve_path(filename, filename_len TSRMLS_CC); + return accelerator_orig_zend_resolve_path(filename, filename_len); } -static void zend_reset_cache_vars(TSRMLS_D) +static void zend_reset_cache_vars(void) { ZSMMG(memory_exhausted) = 0; ZCSG(hits) = 0; @@ -1820,7 +1820,6 @@ static void zend_reset_cache_vars(TSRMLS_D) static void accel_activate(void) { - TSRMLS_FETCH(); if (!ZCG(enabled) || !accel_startup_ok) { return; @@ -1829,7 +1828,7 @@ static void accel_activate(void) SHM_UNPROTECT(); /* PHP-5.4 and above return "double", but we use 1 sec precision */ ZCG(auto_globals_mask) = 0; - ZCG(request_time) = (time_t)sapi_get_request_time(TSRMLS_C); + ZCG(request_time) = (time_t)sapi_get_request_time(); ZCG(cache_opline) = NULL; ZCG(cache_persistent_script) = NULL; ZCG(include_path_check) = !ZCG(include_path_key); @@ -1840,14 +1839,14 @@ static void accel_activate(void) #else zend_accel_error(ACCEL_LOG_WARNING, "Stuck count for pid %d", getpid()); #endif - accel_unlock_all(TSRMLS_C); + accel_unlock_all(); ZCG(counted) = 0; } if (ZCSG(restart_pending)) { - zend_shared_alloc_lock(TSRMLS_C); + zend_shared_alloc_lock(); if (ZCSG(restart_pending) != 0) { /* check again, to ensure that the cache wasn't already cleaned by another process */ - if (accel_is_inactive(TSRMLS_C) == SUCCESS) { + if (accel_is_inactive() == SUCCESS) { zend_accel_error(ACCEL_LOG_DEBUG, "Restarting!"); ZCSG(restart_pending) = 0; switch ZCSG(restart_reason) { @@ -1861,9 +1860,9 @@ static void accel_activate(void) ZCSG(manual_restarts)++; break; } - accel_restart_enter(TSRMLS_C); + accel_restart_enter(); - zend_reset_cache_vars(TSRMLS_C); + zend_reset_cache_vars(); zend_accel_hash_clean(&ZCSG(hash)); /* include_paths keeps only the first path */ @@ -1876,17 +1875,17 @@ static void accel_activate(void) #if !defined(ZTS) if (ZCG(accel_directives).interned_strings_buffer) { - accel_interned_strings_restore_state(TSRMLS_C); + accel_interned_strings_restore_state(); } #endif zend_shared_alloc_restore_state(); ZCSG(accelerator_enabled) = ZCSG(cache_status_before_restart); ZCSG(last_restart_time) = ZCG(request_time); - accel_restart_leave(TSRMLS_C); + accel_restart_leave(); } } - zend_shared_alloc_unlock(TSRMLS_C); + zend_shared_alloc_unlock(); } /* check if ZCG(function_table) wasn't somehow polluted on the way */ @@ -1926,8 +1925,7 @@ static void accel_fast_zval_dtor(zval *zvalue) if (Z_REFCOUNTED_P(zvalue) && Z_DELREF_P(zvalue) == 0) { switch (Z_TYPE_P(zvalue)) { case IS_ARRAY: { - TSRMLS_FETCH(); - GC_REMOVE_FROM_BUFFER(Z_ARR_P(zvalue)); + GC_REMOVE_FROM_BUFFER(Z_ARR_P(zvalue)); if (Z_ARR_P(zvalue) != &EG(symbol_table)) { /* break possible cycles */ ZVAL_NULL(zvalue); @@ -1937,15 +1935,13 @@ static void accel_fast_zval_dtor(zval *zvalue) break; case IS_OBJECT: { - TSRMLS_FETCH(); - + OBJ_RELEASE(Z_OBJ_P(zvalue)); } break; case IS_RESOURCE: { - TSRMLS_FETCH(); - + /* destroy resource */ zend_list_delete(Z_RES_P(zvalue)); } @@ -1964,7 +1960,7 @@ static void accel_fast_zval_dtor(zval *zvalue) } } -static int accel_clean_non_persistent_function(zval *zv TSRMLS_DC) +static int accel_clean_non_persistent_function(zval *zv) { zend_function *function = Z_PTR_P(zv); @@ -1998,7 +1994,7 @@ static inline void zend_accel_fast_del_bucket(HashTable *ht, uint32_t idx, Bucke } } -static void zend_accel_fast_shutdown(TSRMLS_D) +static void zend_accel_fast_shutdown(void) { if (EG(full_tables_cleanup)) { EG(symbol_table).ht.pDestructor = accel_fast_zval_dtor; @@ -2081,19 +2077,18 @@ static void accel_deactivate(void) * In general, they're restored by persistent_compile_file(), but in case * the script is aborted abnormally, they may become messed up. */ - TSRMLS_FETCH(); if (!ZCG(enabled) || !accel_startup_ok) { return; } - zend_shared_alloc_safe_unlock(TSRMLS_C); /* be sure we didn't leave cache locked */ - accel_unlock_all(TSRMLS_C); + zend_shared_alloc_safe_unlock(); /* be sure we didn't leave cache locked */ + accel_unlock_all(); ZCG(counted) = 0; #if !ZEND_DEBUG if (ZCG(accel_directives).fast_shutdown) { - zend_accel_fast_shutdown(TSRMLS_C); + zend_accel_fast_shutdown(); } #endif @@ -2127,7 +2122,7 @@ static int accelerator_remove_cb(zend_extension *element1, zend_extension *eleme return 0; } -static void zps_startup_failure(char *reason, char *api_reason, int (*cb)(zend_extension *, zend_extension *) TSRMLS_DC) +static void zps_startup_failure(char *reason, char *api_reason, int (*cb)(zend_extension *, zend_extension *)) { accel_startup_ok = 0; zps_failure_reason = reason; @@ -2135,7 +2130,7 @@ static void zps_startup_failure(char *reason, char *api_reason, int (*cb)(zend_e zend_llist_del_element(&zend_extensions, NULL, (int (*)(void *, void *))cb); } -static inline int accel_find_sapi(TSRMLS_D) +static inline int accel_find_sapi(void) { static const char *supported_sapis[] = { "apache", @@ -2166,9 +2161,9 @@ static inline int accel_find_sapi(TSRMLS_D) return FAILURE; } -static int zend_accel_init_shm(TSRMLS_D) +static int zend_accel_init_shm(void) { - zend_shared_alloc_lock(TSRMLS_C); + zend_shared_alloc_lock(); accel_shared_globals = zend_shared_alloc(sizeof(zend_accel_shared_globals)); if (!accel_shared_globals) { @@ -2212,12 +2207,12 @@ static int zend_accel_init_shm(TSRMLS_D) # ifndef ZTS if (ZCG(accel_directives).interned_strings_buffer) { - accel_use_shm_interned_strings(TSRMLS_C); - accel_interned_strings_save_state(TSRMLS_C); + accel_use_shm_interned_strings(); + accel_interned_strings_save_state(); } # endif - zend_reset_cache_vars(TSRMLS_C); + zend_reset_cache_vars(); ZCSG(oom_restarts) = 0; ZCSG(hash_restarts) = 0; @@ -2228,19 +2223,19 @@ static int zend_accel_init_shm(TSRMLS_D) ZCSG(last_restart_time) = 0; ZCSG(restart_in_progress) = 0; - zend_shared_alloc_unlock(TSRMLS_C); + zend_shared_alloc_unlock(); return SUCCESS; } -static void accel_globals_ctor(zend_accel_globals *accel_globals TSRMLS_DC) +static void accel_globals_ctor(zend_accel_globals *accel_globals) { #if defined(COMPILE_DL_OPCACHE) && defined(ZTS) ZEND_TSRMLS_CACHE_UPDATE; #endif memset(accel_globals, 0, sizeof(zend_accel_globals)); zend_hash_init(&accel_globals->function_table, zend_hash_num_elements(CG(function_table)), NULL, ZEND_FUNCTION_DTOR, 1); - zend_accel_copy_internal_functions(TSRMLS_C); + zend_accel_copy_internal_functions(); } static void accel_globals_internal_func_dtor(zval *zv) @@ -2248,7 +2243,7 @@ static void accel_globals_internal_func_dtor(zval *zv) free(Z_PTR_P(zv)); } -static void accel_globals_dtor(zend_accel_globals *accel_globals TSRMLS_DC) +static void accel_globals_dtor(zend_accel_globals *accel_globals) { accel_globals->function_table.pDestructor = accel_globals_internal_func_dtor; zend_hash_destroy(&accel_globals->function_table); @@ -2258,7 +2253,6 @@ static int accel_startup(zend_extension *extension) { zend_function *func; zend_ini_entry *ini_entry; - TSRMLS_FETCH(); #ifdef ZTS accel_globals_id = ts_allocate_id(&accel_globals_id, sizeof(zend_accel_globals), (ts_allocate_ctor) accel_globals_ctor, (ts_allocate_dtor) accel_globals_dtor); @@ -2270,20 +2264,20 @@ static int accel_startup(zend_extension *extension) _setmaxstdio(2048); /* The default configuration is limited to 512 stdio files */ #endif - if (start_accel_module(TSRMLS_C) == FAILURE) { + if (start_accel_module() == FAILURE) { accel_startup_ok = 0; zend_error(E_WARNING, ACCELERATOR_PRODUCT_NAME ": module registration failed!"); return FAILURE; } /* no supported SAPI found - disable acceleration and stop initialization */ - if (accel_find_sapi(TSRMLS_C) == FAILURE) { + if (accel_find_sapi() == FAILURE) { accel_startup_ok = 0; if (!ZCG(accel_directives).enable_cli && strcmp(sapi_module.name, "cli") == 0) { - zps_startup_failure("Opcode Caching is disabled for CLI", NULL, accelerator_remove_cb TSRMLS_CC); + zps_startup_failure("Opcode Caching is disabled for CLI", NULL, accelerator_remove_cb); } else { - zps_startup_failure("Opcode Caching is only supported in Apache, ISAPI, FPM, FastCGI and LiteSpeed SAPIs", NULL, accelerator_remove_cb TSRMLS_CC); + zps_startup_failure("Opcode Caching is only supported in Apache, ISAPI, FPM, FastCGI and LiteSpeed SAPIs", NULL, accelerator_remove_cb); } return SUCCESS; } @@ -2296,7 +2290,7 @@ static int accel_startup(zend_extension *extension) /********************************************/ switch (zend_shared_alloc_startup(ZCG(accel_directives).memory_consumption)) { case ALLOC_SUCCESS: - if (zend_accel_init_shm(TSRMLS_C) == FAILURE) { + if (zend_accel_init_shm() == FAILURE) { accel_startup_ok = 0; return FAILURE; } @@ -2307,7 +2301,7 @@ static int accel_startup(zend_extension *extension) return SUCCESS; case SUCCESSFULLY_REATTACHED: accel_shared_globals = (zend_accel_shared_globals *) ZSMMG(app_shared_globals); - zend_shared_alloc_lock(TSRMLS_C); + zend_shared_alloc_lock(); orig_new_interned_string = zend_new_interned_string; orig_interned_strings_snapshot = zend_interned_strings_snapshot; orig_interned_strings_restore = zend_interned_strings_restore; @@ -2316,9 +2310,9 @@ static int accel_startup(zend_extension *extension) zend_interned_strings_snapshot = accel_interned_strings_snapshot_for_php; zend_interned_strings_restore = accel_interned_strings_restore_for_php; #ifndef ZTS - accel_use_shm_interned_strings(TSRMLS_C); + accel_use_shm_interned_strings(); #endif - zend_shared_alloc_unlock(TSRMLS_C); + zend_shared_alloc_unlock(); break; case FAILED_REATTACHED: accel_startup_ok = 0; @@ -2330,7 +2324,7 @@ 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); + zend_accel_init_auto_globals(); /* Override compiler */ accelerator_orig_compile_file = zend_compile_file; @@ -2365,7 +2359,7 @@ static int accel_startup(zend_extension *extension) !zend_accel_hash_is_full(&ZCSG(include_paths))) { char *key; - zend_shared_alloc_lock(TSRMLS_C); + zend_shared_alloc_lock(); key = zend_shared_alloc(ZCG(include_path_len) + 2); if (key) { memcpy(key, ZCG(include_path), ZCG(include_path_len) + 1); @@ -2373,9 +2367,9 @@ static int accel_startup(zend_extension *extension) ZCG(include_path_key) = key + ZCG(include_path_len) + 1; zend_accel_hash_update(&ZCSG(include_paths), key, ZCG(include_path_len), 0, ZCG(include_path_key)); } else { - zend_accel_schedule_restart_if_necessary(ACCEL_RESTART_OOM TSRMLS_CC); + zend_accel_schedule_restart_if_necessary(ACCEL_RESTART_OOM); } - zend_shared_alloc_unlock(TSRMLS_C); + zend_shared_alloc_unlock(); } } else { ZCG(include_path) = ""; @@ -2385,16 +2379,16 @@ static int accel_startup(zend_extension *extension) ini_entry->on_modify = accel_include_path_on_modify; } - zend_shared_alloc_lock(TSRMLS_C); + zend_shared_alloc_lock(); zend_shared_alloc_save_state(); - zend_shared_alloc_unlock(TSRMLS_C); + zend_shared_alloc_unlock(); SHM_PROTECT(); accel_startup_ok = 1; /* Override file_exists(), is_file() and is_readable() */ - zend_accel_override_file_functions(TSRMLS_C); + zend_accel_override_file_functions(); /* Load black list */ accel_blacklist.entries = NULL; @@ -2407,7 +2401,7 @@ static int accel_startup(zend_extension *extension) #if 0 /* FIXME: We probably don't need it here */ - zend_accel_copy_internal_functions(TSRMLS_C); + zend_accel_copy_internal_functions(); #endif return SUCCESS; @@ -2422,7 +2416,7 @@ static void accel_free_ts_resources() #endif } -void accel_shutdown(TSRMLS_D) +void accel_shutdown(void) { zend_ini_entry *ini_entry; @@ -2455,7 +2449,7 @@ void accel_shutdown(TSRMLS_D) } } -void zend_accel_schedule_restart(zend_accel_restart_reason reason TSRMLS_DC) +void zend_accel_schedule_restart(zend_accel_restart_reason reason) { if (ZCSG(restart_pending)) { /* don't schedule twice */ @@ -2479,9 +2473,9 @@ void zend_accel_schedule_restart(zend_accel_restart_reason reason TSRMLS_DC) /* this is needed because on WIN32 lock is not decreased unless ZCG(counted) is set */ #ifdef ZEND_WIN32 -#define accel_deactivate_now() ZCG(counted) = 1; accel_deactivate_sub(TSRMLS_C) +#define accel_deactivate_now() ZCG(counted) = 1; accel_deactivate_sub() #else -#define accel_deactivate_now() accel_deactivate_sub(TSRMLS_C) +#define accel_deactivate_now() accel_deactivate_sub() #endif /* ensures it is OK to read SHM @@ -2489,7 +2483,7 @@ void zend_accel_schedule_restart(zend_accel_restart_reason reason TSRMLS_DC) if OK returns SUCCESS MUST call accelerator_shm_read_unlock after done lock operations */ -int accelerator_shm_read_lock(TSRMLS_D) +int accelerator_shm_read_lock(void) { if (ZCG(counted)) { /* counted means we are holding read lock for SHM, so that nothing bad can happen */ @@ -2497,7 +2491,7 @@ int accelerator_shm_read_lock(TSRMLS_D) } else { /* here accelerator is active but we do not hold SHM lock. This means restart was scheduled or is in progress now */ - accel_activate_add(TSRMLS_C); /* acquire usage lock */ + accel_activate_add(); /* acquire usage lock */ /* Now if we weren't inside restart, restart would not begin until we remove usage lock */ if (ZCSG(restart_in_progress)) { /* we already were inside restart this means it's not safe to touch shm */ @@ -2509,7 +2503,7 @@ int accelerator_shm_read_lock(TSRMLS_D) } /* must be called ONLY after SUCCESSFUL accelerator_shm_read_lock */ -void accelerator_shm_read_unlock(TSRMLS_D) +void accelerator_shm_read_unlock(void) { if (!ZCG(counted)) { /* counted is 0 - meaning we had to readlock manually, release readlock now */ diff --git a/ext/opcache/ZendAccelerator.h b/ext/opcache/ZendAccelerator.h index 119148aa27..9b478ae158 100644 --- a/ext/opcache/ZendAccelerator.h +++ b/ext/opcache/ZendAccelerator.h @@ -296,17 +296,17 @@ extern zend_accel_globals accel_globals; extern char *zps_api_failure_reason; -void accel_shutdown(TSRMLS_D); -void zend_accel_schedule_restart(zend_accel_restart_reason reason TSRMLS_DC); -void zend_accel_schedule_restart_if_necessary(zend_accel_restart_reason reason TSRMLS_DC); -int validate_timestamp_and_record(zend_persistent_script *persistent_script, zend_file_handle *file_handle TSRMLS_DC); -int zend_accel_invalidate(const char *filename, int filename_len, zend_bool force TSRMLS_DC); -int zend_accel_script_optimize(zend_persistent_script *persistent_script TSRMLS_DC); -int accelerator_shm_read_lock(TSRMLS_D); -void accelerator_shm_read_unlock(TSRMLS_D); - -char *accel_make_persistent_key_ex(zend_file_handle *file_handle, int path_length, int *key_len TSRMLS_DC); -zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type TSRMLS_DC); +void accel_shutdown(void); +void zend_accel_schedule_restart(zend_accel_restart_reason reason); +void zend_accel_schedule_restart_if_necessary(zend_accel_restart_reason reason); +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_ex(zend_file_handle *file_handle, 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 @@ -317,7 +317,7 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type T #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 TSRMLS_DC); +zend_string *accel_new_interned_string(zend_string *str); # define ZEND_RESULT_TYPE(opline) (opline)->result_type # define ZEND_RESULT(opline) (opline)->result diff --git a/ext/opcache/shared_alloc_win32.c b/ext/opcache/shared_alloc_win32.c index 37431fb18a..cab33b5b38 100644 --- a/ext/opcache/shared_alloc_win32.c +++ b/ext/opcache/shared_alloc_win32.c @@ -188,7 +188,6 @@ static int create_segments(size_t requested_size, zend_shared_segment ***shared_ void *vista_mapping_base_set[] = { (void *) 0x20000000, (void *) 0x21000000, (void *) 0x30000000, (void *) 0x31000000, (void *) 0x50000000, 0 }; #endif void **wanted_mapping_base = default_mapping_base_set; - TSRMLS_FETCH(); zend_shared_alloc_lock_win32(); /* Mapping retries: When Apache2 restarts, the parent process startup routine diff --git a/ext/opcache/zend_accelerator_blacklist.c b/ext/opcache/zend_accelerator_blacklist.c index 7263ed3c93..cbf0ada9bb 100644 --- a/ext/opcache/zend_accelerator_blacklist.c +++ b/ext/opcache/zend_accelerator_blacklist.c @@ -237,7 +237,6 @@ void zend_accel_blacklist_load(zend_blacklist *blacklist, char *filename) char buf[MAXPATHLEN + 1], real_path[MAXPATHLEN + 1], *blacklist_path = NULL; FILE *fp; int path_length, blacklist_path_length; - TSRMLS_FETCH(); if ((fp = fopen(filename, "r")) == NULL) { zend_accel_error(ACCEL_LOG_WARNING, "Cannot load blacklist file: %s\n", filename); @@ -288,9 +287,9 @@ void zend_accel_blacklist_load(zend_blacklist *blacklist, char *filename) path_dup = zend_strndup(pbuf, path_length); if (blacklist_path) { - expand_filepath_ex(path_dup, real_path, blacklist_path, blacklist_path_length TSRMLS_CC); + expand_filepath_ex(path_dup, real_path, blacklist_path, blacklist_path_length); } else { - expand_filepath(path_dup, real_path TSRMLS_CC); + expand_filepath(path_dup, real_path); } path_length = strlen(real_path); @@ -358,11 +357,11 @@ zend_bool zend_accel_blacklist_is_blacklisted(zend_blacklist *blacklist, char *v return ret; } -void zend_accel_blacklist_apply(zend_blacklist *blacklist, blacklist_apply_func_arg_t func, void *argument TSRMLS_DC) +void zend_accel_blacklist_apply(zend_blacklist *blacklist, blacklist_apply_func_arg_t func, void *argument) { int i; for (i = 0; i < blacklist->pos; i++) { - func(&blacklist->entries[i], argument TSRMLS_CC); + func(&blacklist->entries[i], argument); } } diff --git a/ext/opcache/zend_accelerator_blacklist.h b/ext/opcache/zend_accelerator_blacklist.h index 1990e414b9..60d6cac925 100644 --- a/ext/opcache/zend_accelerator_blacklist.h +++ b/ext/opcache/zend_accelerator_blacklist.h @@ -37,7 +37,7 @@ typedef struct _zend_blacklist { zend_regexp_list *regexp_list; } zend_blacklist; -typedef int (*blacklist_apply_func_arg_t)(zend_blacklist_entry *, zval * TSRMLS_DC); +typedef int (*blacklist_apply_func_arg_t)(zend_blacklist_entry *, zval *); extern zend_blacklist accel_blacklist; @@ -46,6 +46,6 @@ void zend_accel_blacklist_shutdown(zend_blacklist *blacklist); void zend_accel_blacklist_load(zend_blacklist *blacklist, char *filename); zend_bool zend_accel_blacklist_is_blacklisted(zend_blacklist *blacklist, char *verify_path); -void zend_accel_blacklist_apply(zend_blacklist *blacklist, blacklist_apply_func_arg_t func, void *argument TSRMLS_DC); +void zend_accel_blacklist_apply(zend_blacklist *blacklist, blacklist_apply_func_arg_t func, void *argument); #endif /* ZEND_ACCELERATOR_BLACKLIST_H */ diff --git a/ext/opcache/zend_accelerator_debug.c b/ext/opcache/zend_accelerator_debug.c index 2a386b812b..feed711bf5 100644 --- a/ext/opcache/zend_accelerator_debug.c +++ b/ext/opcache/zend_accelerator_debug.c @@ -34,7 +34,6 @@ void zend_accel_error(int type, const char *format, ...) time_t timestamp; char *time_string; FILE * fLog = NULL; - TSRMLS_FETCH(); if (type > ZCG(accel_directives).log_verbosity_level) { return; diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index 3cde5188ca..03afd4468d 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -83,7 +83,7 @@ static zend_function_entry accel_functions[] = { { NULL, NULL, NULL, 0, 0 } }; -static int validate_api_restriction(TSRMLS_D) +static int validate_api_restriction(void) { if (ZCG(accel_directives).restrict_api && *ZCG(accel_directives).restrict_api) { int len = strlen(ZCG(accel_directives).restrict_api); @@ -217,7 +217,7 @@ static ZEND_INI_MH(OnEnable) if (stage == ZEND_INI_STAGE_STARTUP || stage == ZEND_INI_STAGE_SHUTDOWN || stage == ZEND_INI_STAGE_DEACTIVATE) { - return OnUpdateBool(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); + return OnUpdateBool(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage); } else { /* It may be only temporary disabled */ zend_bool *p; @@ -278,7 +278,7 @@ ZEND_INI_BEGIN() #endif ZEND_INI_END() -static int filename_is_in_cache(char *filename, int filename_len TSRMLS_DC) +static int filename_is_in_cache(char *filename, int filename_len) { char *key; int key_length; @@ -292,14 +292,14 @@ static int filename_is_in_cache(char *filename, int filename_len TSRMLS_DC) persistent_script = zend_accel_hash_find(&ZCSG(hash), filename, filename_len); if (persistent_script) { return !persistent_script->corrupted && - validate_timestamp_and_record(persistent_script, &handle TSRMLS_CC) == SUCCESS; + validate_timestamp_and_record(persistent_script, &handle) == SUCCESS; } } - if ((key = accel_make_persistent_key_ex(&handle, filename_len, &key_length TSRMLS_CC)) != NULL) { + if ((key = accel_make_persistent_key_ex(&handle, filename_len, &key_length)) != NULL) { persistent_script = zend_accel_hash_find(&ZCSG(hash), key, key_length); return persistent_script && !persistent_script->corrupted && - validate_timestamp_and_record(persistent_script, &handle TSRMLS_CC) == SUCCESS; + validate_timestamp_and_record(persistent_script, &handle) == SUCCESS; } return 0; @@ -315,7 +315,7 @@ static int accel_file_in_cache(INTERNAL_FUNCTION_PARAMETERS) Z_STRLEN(zfilename) == 0) { return 0; } - return filename_is_in_cache(Z_STRVAL(zfilename), Z_STRLEN(zfilename) TSRMLS_CC); + return filename_is_in_cache(Z_STRVAL(zfilename), Z_STRLEN(zfilename)); } static void accel_file_exists(INTERNAL_FUNCTION_PARAMETERS) @@ -354,7 +354,7 @@ static ZEND_MINIT_FUNCTION(zend_accelerator) return SUCCESS; } -void zend_accel_override_file_functions(TSRMLS_D) +void zend_accel_override_file_functions(void) { zend_function *old_function; if (ZCG(enabled) && accel_startup_ok && ZCG(accel_directives).file_override_enabled) { @@ -379,7 +379,7 @@ static ZEND_MSHUTDOWN_FUNCTION(zend_accelerator) (void)type; /* keep the compiler happy */ UNREGISTER_INI_ENTRIES(); - accel_shutdown(TSRMLS_C); + accel_shutdown(); return SUCCESS; } @@ -452,14 +452,14 @@ static zend_module_entry accel_module_entry = { STANDARD_MODULE_PROPERTIES }; -int start_accel_module(TSRMLS_D) +int start_accel_module(void) { - return zend_startup_module(&accel_module_entry TSRMLS_CC); + return zend_startup_module(&accel_module_entry); } /* {{{ proto array accelerator_get_scripts() Get the scripts which are accelerated by ZendAccelerator */ -static int accelerator_get_scripts(zval *return_value TSRMLS_DC) +static int accelerator_get_scripts(zval *return_value) { uint i; zval persistent_script_report; @@ -468,7 +468,7 @@ static int accelerator_get_scripts(zval *return_value TSRMLS_DC) struct timeval exec_time; struct timeval fetch_time; - if (!ZCG(enabled) || !accel_startup_ok || !ZCSG(accelerator_enabled) || accelerator_shm_read_lock(TSRMLS_C) != SUCCESS) { + if (!ZCG(enabled) || !accel_startup_ok || !ZCSG(accelerator_enabled) || accelerator_shm_read_lock() != SUCCESS) { return 0; } @@ -502,7 +502,7 @@ static int accelerator_get_scripts(zval *return_value TSRMLS_DC) zend_hash_str_update(Z_ARRVAL_P(return_value), cache_entry->key, cache_entry->key_length, &persistent_script_report); } } - accelerator_shm_read_unlock(TSRMLS_C); + accelerator_shm_read_unlock(); return 1; } @@ -515,11 +515,11 @@ static ZEND_FUNCTION(opcache_get_status) zval memory_usage, statistics, scripts; zend_bool fetch_scripts = 1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &fetch_scripts) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &fetch_scripts) == FAILURE) { return; } - if (!validate_api_restriction(TSRMLS_C)) { + if (!validate_api_restriction()) { RETURN_FALSE; } @@ -574,13 +574,13 @@ static ZEND_FUNCTION(opcache_get_status) if (fetch_scripts) { /* accelerated scripts */ - if (accelerator_get_scripts(&scripts TSRMLS_CC)) { + if (accelerator_get_scripts(&scripts)) { add_assoc_zval(return_value, "scripts", &scripts); } } } -static int add_blacklist_path(zend_blacklist_entry *p, zval *return_value TSRMLS_DC) +static int add_blacklist_path(zend_blacklist_entry *p, zval *return_value) { add_next_index_stringl(return_value, p->path, p->path_length); return 0; @@ -596,7 +596,7 @@ static ZEND_FUNCTION(opcache_get_configuration) RETURN_FALSE; } - if (!validate_api_restriction(TSRMLS_C)) { + if (!validate_api_restriction()) { RETURN_FALSE; } @@ -642,7 +642,7 @@ static ZEND_FUNCTION(opcache_get_configuration) /* blacklist */ array_init(&blacklist); - zend_accel_blacklist_apply(&accel_blacklist, add_blacklist_path, &blacklist TSRMLS_CC); + zend_accel_blacklist_apply(&accel_blacklist, add_blacklist_path, &blacklist); add_assoc_zval(return_value, "blacklist", &blacklist); } @@ -654,7 +654,7 @@ static ZEND_FUNCTION(opcache_reset) RETURN_FALSE; } - if (!validate_api_restriction(TSRMLS_C)) { + if (!validate_api_restriction()) { RETURN_FALSE; } @@ -662,7 +662,7 @@ static ZEND_FUNCTION(opcache_reset) RETURN_FALSE; } - zend_accel_schedule_restart(ACCEL_RESTART_USER TSRMLS_CC); + zend_accel_schedule_restart(ACCEL_RESTART_USER); RETURN_TRUE; } @@ -674,15 +674,15 @@ static ZEND_FUNCTION(opcache_invalidate) size_t script_name_len; zend_bool force = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &script_name, &script_name_len, &force) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|b", &script_name, &script_name_len, &force) == FAILURE) { return; } - if (!validate_api_restriction(TSRMLS_C)) { + if (!validate_api_restriction()) { RETURN_FALSE; } - if (zend_accel_invalidate(script_name, script_name_len, force TSRMLS_CC) == SUCCESS) { + if (zend_accel_invalidate(script_name, script_name_len, force) == SUCCESS) { RETURN_TRUE; } else { RETURN_FALSE; @@ -697,7 +697,7 @@ static ZEND_FUNCTION(opcache_compile_file) zend_op_array *op_array = NULL; zend_execute_data *orig_execute_data = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &script_name, &script_name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &script_name, &script_name_len) == FAILURE) { return; } @@ -714,20 +714,20 @@ static ZEND_FUNCTION(opcache_compile_file) orig_execute_data = EG(current_execute_data); zend_try { - op_array = persistent_compile_file(&handle, ZEND_INCLUDE TSRMLS_CC); + op_array = persistent_compile_file(&handle, ZEND_INCLUDE); } zend_catch { EG(current_execute_data) = orig_execute_data; zend_error(E_WARNING, ACCELERATOR_PRODUCT_NAME " could not compile file %s", handle.filename); } zend_end_try(); if(op_array != NULL) { - destroy_op_array(op_array TSRMLS_CC); + destroy_op_array(op_array); efree(op_array); RETVAL_TRUE; } else { RETVAL_FALSE; } - zend_destroy_file_handle(&handle TSRMLS_CC); + zend_destroy_file_handle(&handle); } /* {{{ proto bool opcache_is_script_cached(string $script) @@ -737,7 +737,7 @@ static ZEND_FUNCTION(opcache_is_script_cached) char *script_name; size_t script_name_len; - if (!validate_api_restriction(TSRMLS_C)) { + if (!validate_api_restriction()) { RETURN_FALSE; } @@ -745,9 +745,9 @@ static ZEND_FUNCTION(opcache_is_script_cached) RETURN_FALSE; } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &script_name, &script_name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &script_name, &script_name_len) == FAILURE) { return; } - RETURN_BOOL(filename_is_in_cache(script_name, script_name_len TSRMLS_CC)); + RETURN_BOOL(filename_is_in_cache(script_name, script_name_len)); } diff --git a/ext/opcache/zend_accelerator_module.h b/ext/opcache/zend_accelerator_module.h index c7fe7d8e17..65b984a036 100644 --- a/ext/opcache/zend_accelerator_module.h +++ b/ext/opcache/zend_accelerator_module.h @@ -22,8 +22,8 @@ #ifndef ZEND_ACCELERATOR_MODULE_H #define ZEND_ACCELERATOR_MODULE_H -int start_accel_module(TSRMLS_D); +int start_accel_module(void); -void zend_accel_override_file_functions(TSRMLS_D); +void zend_accel_override_file_functions(void); #endif /* _ZEND_ACCELERATOR_MODULE_H */ diff --git a/ext/opcache/zend_accelerator_util_funcs.c b/ext/opcache/zend_accelerator_util_funcs.c index 22683245f6..860e18a299 100644 --- a/ext/opcache/zend_accelerator_util_funcs.c +++ b/ext/opcache/zend_accelerator_util_funcs.c @@ -48,12 +48,11 @@ static const uint32_t uninitialized_bucket = {INVALID_IDX}; static int zend_prepare_function_for_execution(zend_op_array *op_array); static void zend_hash_clone_zval(HashTable *ht, HashTable *source, int bind); -static zend_ast *zend_ast_clone(zend_ast *ast TSRMLS_DC); +static zend_ast *zend_ast_clone(zend_ast *ast); static void zend_accel_destroy_zend_function(zval *zv) { zend_function *function = Z_PTR_P(zv); - TSRMLS_FETCH(); if (function->type == ZEND_USER_FUNCTION) { if (function->op_array.static_variables) { @@ -63,7 +62,7 @@ static void zend_accel_destroy_zend_function(zval *zv) } } - destroy_zend_function(function TSRMLS_CC); + destroy_zend_function(function); } static void zend_accel_destroy_zend_class(zval *zv) @@ -114,16 +113,16 @@ static int is_not_internal_function(zval *zv) return(function->type != ZEND_INTERNAL_FUNCTION); } -void zend_accel_free_user_functions(HashTable *ht TSRMLS_DC) +void zend_accel_free_user_functions(HashTable *ht) { dtor_func_t orig_dtor = ht->pDestructor; ht->pDestructor = NULL; - zend_hash_apply(ht, (apply_func_t) is_not_internal_function TSRMLS_CC); + zend_hash_apply(ht, (apply_func_t) is_not_internal_function); ht->pDestructor = orig_dtor; } -static int move_user_function(zval *zv TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) +static int move_user_function(zval *zv, int num_args, va_list args, zend_hash_key *hash_key) { zend_function *function = Z_PTR_P(zv); HashTable *function_table = va_arg(args, HashTable *); @@ -137,16 +136,16 @@ static int move_user_function(zval *zv TSRMLS_DC, int num_args, va_list args, ze } } -void zend_accel_move_user_functions(HashTable *src, HashTable *dst TSRMLS_DC) +void zend_accel_move_user_functions(HashTable *src, HashTable *dst) { dtor_func_t orig_dtor = src->pDestructor; src->pDestructor = NULL; - zend_hash_apply_with_arguments(src TSRMLS_CC, (apply_func_args_t)move_user_function, 1, dst); + zend_hash_apply_with_arguments(src, (apply_func_args_t)move_user_function, 1, dst); src->pDestructor = orig_dtor; } -static int copy_internal_function(zval *zv, HashTable *function_table TSRMLS_DC) +static int copy_internal_function(zval *zv, HashTable *function_table) { zend_internal_function *function = Z_PTR_P(zv); if (function->type == ZEND_INTERNAL_FUNCTION) { @@ -155,9 +154,9 @@ static int copy_internal_function(zval *zv, HashTable *function_table TSRMLS_DC) return 0; } -void zend_accel_copy_internal_functions(TSRMLS_D) +void zend_accel_copy_internal_functions(void) { - zend_hash_apply_with_argument(CG(function_table), (apply_func_arg_t)copy_internal_function, &ZCG(function_table) TSRMLS_CC); + zend_hash_apply_with_argument(CG(function_table), (apply_func_arg_t)copy_internal_function, &ZCG(function_table)); ZCG(internal_functions_count) = zend_hash_num_elements(&ZCG(function_table)); } @@ -171,7 +170,7 @@ static void zend_destroy_property_info(zval *zv) } } -static inline zend_string *zend_clone_str(zend_string *str TSRMLS_DC) +static inline zend_string *zend_clone_str(zend_string *str) { zend_string *ret; @@ -189,7 +188,7 @@ static inline zend_string *zend_clone_str(zend_string *str TSRMLS_DC) return ret; } -static inline void zend_clone_zval(zval *src, int bind TSRMLS_DC) +static inline void zend_clone_zval(zval *src, int bind) { void *ptr; @@ -200,7 +199,7 @@ static inline void zend_clone_zval(zval *src, int bind TSRMLS_DC) switch (Z_TYPE_P(src)) { case IS_STRING: case IS_CONSTANT: - Z_STR_P(src) = zend_clone_str(Z_STR_P(src) TSRMLS_CC); + Z_STR_P(src) = zend_clone_str(Z_STR_P(src)); break; case IS_ARRAY: if (Z_ARR_P(src) != &EG(symbol_table)) { @@ -228,7 +227,7 @@ static inline void zend_clone_zval(zval *src, int bind TSRMLS_DC) if (bind && Z_REFCOUNT_P(src) > 1) { accel_xlat_set(old, Z_REF_P(src)); } - zend_clone_zval(Z_REFVAL_P(src), bind TSRMLS_CC); + zend_clone_zval(Z_REFVAL_P(src), bind); } break; case IS_CONSTANT_AST: @@ -242,13 +241,13 @@ static inline void zend_clone_zval(zval *src, int bind TSRMLS_DC) if (bind && Z_REFCOUNT_P(src) > 1) { accel_xlat_set(old, Z_AST_P(src)); } - Z_ASTVAL_P(src) = zend_ast_clone(Z_ASTVAL_P(src) TSRMLS_CC); + Z_ASTVAL_P(src) = zend_ast_clone(Z_ASTVAL_P(src)); } break; } } -static zend_ast *zend_ast_clone(zend_ast *ast TSRMLS_DC) +static zend_ast *zend_ast_clone(zend_ast *ast) { uint32_t i; @@ -257,7 +256,7 @@ static zend_ast *zend_ast_clone(zend_ast *ast TSRMLS_DC) copy->kind = ZEND_AST_ZVAL; copy->attr = ast->attr; ZVAL_COPY_VALUE(©->val, zend_ast_get_zval(ast)); - zend_clone_zval(©->val, 0 TSRMLS_CC); + zend_clone_zval(©->val, 0); return (zend_ast *) copy; } else if (zend_ast_is_list(ast)) { zend_ast_list *list = zend_ast_get_list(ast); @@ -268,7 +267,7 @@ static zend_ast *zend_ast_clone(zend_ast *ast TSRMLS_DC) copy->children = list->children; for (i = 0; i < list->children; i++) { if (list->child[i]) { - copy->child[i] = zend_ast_clone(list->child[i] TSRMLS_CC); + copy->child[i] = zend_ast_clone(list->child[i]); } else { copy->child[i] = NULL; } @@ -281,7 +280,7 @@ static zend_ast *zend_ast_clone(zend_ast *ast TSRMLS_DC) copy->attr = ast->attr; for (i = 0; i < children; i++) { if (ast->child[i]) { - copy->child[i] = zend_ast_clone(ast->child[i] TSRMLS_CC); + copy->child[i] = zend_ast_clone(ast->child[i]); } else { copy->child[i] = NULL; } @@ -295,7 +294,6 @@ static void zend_hash_clone_zval(HashTable *ht, HashTable *source, int bind) uint idx; Bucket *p, *q, *r; zend_ulong nIndex; - TSRMLS_FETCH(); ht->nTableSize = source->nTableSize; ht->nTableMask = source->nTableMask; @@ -337,7 +335,7 @@ static void zend_hash_clone_zval(HashTable *ht, HashTable *source, int bind) /* Copy data */ ZVAL_COPY_VALUE(&q->val, &p->val); - zend_clone_zval(&q->val, bind TSRMLS_CC); + zend_clone_zval(&q->val, bind); } } else { ht->arData = (Bucket *) emalloc(ht->nTableSize * (sizeof(Bucket) + sizeof(uint32_t))); @@ -359,17 +357,17 @@ static void zend_hash_clone_zval(HashTable *ht, HashTable *source, int bind) if (!p->key) { q->key = NULL; } else { - q->key = zend_clone_str(p->key TSRMLS_CC); + q->key = zend_clone_str(p->key); } /* Copy data */ ZVAL_COPY_VALUE(&q->val, &p->val); - zend_clone_zval(&q->val, bind TSRMLS_CC); + zend_clone_zval(&q->val, bind); } } } -static void zend_hash_clone_methods(HashTable *ht, HashTable *source, zend_class_entry *old_ce, zend_class_entry *ce TSRMLS_DC) +static void zend_hash_clone_methods(HashTable *ht, HashTable *source, zend_class_entry *old_ce, zend_class_entry *ce) { uint idx; Bucket *p, *q; @@ -411,7 +409,7 @@ static void zend_hash_clone_methods(HashTable *ht, HashTable *source, zend_class /* Initialize key */ q->h = p->h; ZEND_ASSERT(p->key != NULL); - q->key = zend_clone_str(p->key TSRMLS_CC); + q->key = zend_clone_str(p->key); /* Copy data */ ZVAL_PTR(&q->val, ARENA_REALLOC(Z_PTR(p->val))); @@ -446,7 +444,7 @@ static void zend_hash_clone_methods(HashTable *ht, HashTable *source, zend_class } } -static void zend_hash_clone_prop_info(HashTable *ht, HashTable *source, zend_class_entry *old_ce, zend_class_entry *ce TSRMLS_DC) +static void zend_hash_clone_prop_info(HashTable *ht, HashTable *source, zend_class_entry *old_ce, zend_class_entry *ce) { uint idx; Bucket *p, *q; @@ -487,14 +485,14 @@ static void zend_hash_clone_prop_info(HashTable *ht, HashTable *source, zend_cla /* Initialize key */ q->h = p->h; ZEND_ASSERT(p->key != NULL); - q->key = zend_clone_str(p->key TSRMLS_CC); + q->key = zend_clone_str(p->key); /* Copy data */ ZVAL_PTR(&q->val, ARENA_REALLOC(Z_PTR(p->val))); prop_info = Z_PTR(q->val); /* Copy constructor */ - prop_info->name = zend_clone_str(prop_info->name TSRMLS_CC); + prop_info->name = zend_clone_str(prop_info->name); if (prop_info->doc_comment) { if (ZCG(accel_directives).load_comments) { prop_info->doc_comment = zend_string_dup(prop_info->doc_comment, 0); @@ -548,7 +546,6 @@ static void zend_class_copy_ctor(zend_class_entry **pce) zend_class_entry *old_ce = ce; zend_class_entry *new_ce; zend_function *new_func; - TSRMLS_FETCH(); *pce = ce = ARENA_REALLOC(old_ce); ce->refcount = 1; @@ -564,11 +561,11 @@ static void zend_class_copy_ctor(zend_class_entry **pce) ce->default_properties_table = emalloc(sizeof(zval) * old_ce->default_properties_count); for (i = 0; i < old_ce->default_properties_count; i++) { ZVAL_COPY_VALUE(&ce->default_properties_table[i], &old_ce->default_properties_table[i]); - zend_clone_zval(&ce->default_properties_table[i], 1 TSRMLS_CC); + zend_clone_zval(&ce->default_properties_table[i], 1); } } - zend_hash_clone_methods(&ce->function_table, &old_ce->function_table, old_ce, ce TSRMLS_CC); + zend_hash_clone_methods(&ce->function_table, &old_ce->function_table, old_ce, ce); /* static members */ if (old_ce->default_static_members_table) { @@ -577,19 +574,19 @@ static void zend_class_copy_ctor(zend_class_entry **pce) ce->default_static_members_table = emalloc(sizeof(zval) * old_ce->default_static_members_count); for (i = 0; i < old_ce->default_static_members_count; i++) { ZVAL_COPY_VALUE(&ce->default_static_members_table[i], &old_ce->default_static_members_table[i]); - zend_clone_zval(&ce->default_static_members_table[i], 1 TSRMLS_CC); + zend_clone_zval(&ce->default_static_members_table[i], 1); } } ce->static_members_table = ce->default_static_members_table; /* properties_info */ - zend_hash_clone_prop_info(&ce->properties_info, &old_ce->properties_info, old_ce, ce TSRMLS_CC); + zend_hash_clone_prop_info(&ce->properties_info, &old_ce->properties_info, old_ce, ce); /* constants table */ zend_hash_clone_zval(&ce->constants_table, &old_ce->constants_table, 1); ce->constants_table.u.flags &= ~HASH_FLAG_APPLY_PROTECTION; - ce->name = zend_clone_str(ce->name TSRMLS_CC); + ce->name = zend_clone_str(ce->name); /* interfaces aren't really implemented, so we create a new table */ if (ce->num_interfaces) { @@ -650,17 +647,17 @@ static void zend_class_copy_ctor(zend_class_entry **pce) if (trait_aliases[i]->trait_method) { if (trait_aliases[i]->trait_method->method_name) { trait_aliases[i]->trait_method->method_name = - zend_clone_str(trait_aliases[i]->trait_method->method_name TSRMLS_CC); + zend_clone_str(trait_aliases[i]->trait_method->method_name); } if (trait_aliases[i]->trait_method->class_name) { trait_aliases[i]->trait_method->class_name = - zend_clone_str(trait_aliases[i]->trait_method->class_name TSRMLS_CC); + zend_clone_str(trait_aliases[i]->trait_method->class_name); } } if (trait_aliases[i]->alias) { trait_aliases[i]->alias = - zend_clone_str(trait_aliases[i]->alias TSRMLS_CC); + zend_clone_str(trait_aliases[i]->alias); } i++; } @@ -684,9 +681,9 @@ static void zend_class_copy_ctor(zend_class_entry **pce) memcpy(trait_precedences[i]->trait_method, ce->trait_precedences[i]->trait_method, sizeof(zend_trait_method_reference)); trait_precedences[i]->trait_method->method_name = - zend_clone_str(trait_precedences[i]->trait_method->method_name TSRMLS_CC); + zend_clone_str(trait_precedences[i]->trait_method->method_name); trait_precedences[i]->trait_method->class_name = - zend_clone_str(trait_precedences[i]->trait_method->class_name TSRMLS_CC); + zend_clone_str(trait_precedences[i]->trait_method->class_name); if (trait_precedences[i]->exclude_from_classes) { zend_string **exclude_from_classes; @@ -699,7 +696,7 @@ static void zend_class_copy_ctor(zend_class_entry **pce) j = 0; while (trait_precedences[i]->exclude_from_classes[j].class_name) { exclude_from_classes[j] = - zend_clone_str(trait_precedences[i]->exclude_from_classes[j].class_name TSRMLS_CC); + zend_clone_str(trait_precedences[i]->exclude_from_classes[j].class_name); j++; } exclude_from_classes[j] = NULL; @@ -712,7 +709,7 @@ static void zend_class_copy_ctor(zend_class_entry **pce) } } -static void zend_accel_function_hash_copy(HashTable *target, HashTable *source, unique_copy_ctor_func_t pCopyConstructor TSRMLS_DC) +static void zend_accel_function_hash_copy(HashTable *target, HashTable *source, unique_copy_ctor_func_t pCopyConstructor) { zend_function *function1, *function2; uint idx; @@ -752,7 +749,7 @@ failure: function1 = Z_PTR(p->val); function2 = Z_PTR_P(t); CG(in_compilation) = 1; - zend_set_compiled_filename(function1->op_array.filename TSRMLS_CC); + zend_set_compiled_filename(function1->op_array.filename); CG(zend_lineno) = function1->op_array.opcodes[0].lineno; if (function2->type == ZEND_USER_FUNCTION && function2->op_array.last > 0) { @@ -765,7 +762,7 @@ failure: } } -static void zend_accel_class_hash_copy(HashTable *target, HashTable *source, unique_copy_ctor_func_t pCopyConstructor TSRMLS_DC) +static void zend_accel_class_hash_copy(HashTable *target, HashTable *source, unique_copy_ctor_func_t pCopyConstructor) { zend_class_entry *ce1; uint idx; @@ -805,12 +802,12 @@ static void zend_accel_class_hash_copy(HashTable *target, HashTable *source, uni failure: ce1 = Z_PTR(p->val); CG(in_compilation) = 1; - zend_set_compiled_filename(ce1->info.user.filename TSRMLS_CC); + zend_set_compiled_filename(ce1->info.user.filename); CG(zend_lineno) = ce1->info.user.line_start; zend_error(E_ERROR, "Cannot redeclare class %s", ce1->name->val); } -zend_op_array* zend_accel_load_script(zend_persistent_script *persistent_script, int from_shared_memory TSRMLS_DC) +zend_op_array* zend_accel_load_script(zend_persistent_script *persistent_script, int from_shared_memory) { zend_op_array *op_array; @@ -829,12 +826,12 @@ 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 TSRMLS_CC); + zend_accel_class_hash_copy(CG(class_table), &persistent_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(CG(function_table), &persistent_script->function_table, (unique_copy_ctor_func_t)zend_prepare_function_for_execution TSRMLS_CC); + zend_accel_function_hash_copy(CG(function_table), &persistent_script->function_table, (unique_copy_ctor_func_t)zend_prepare_function_for_execution); } zend_prepare_function_for_execution(op_array); @@ -847,7 +844,7 @@ zend_op_array* zend_accel_load_script(zend_persistent_script *persistent_script, name = zend_mangle_property_name(haltoff, sizeof(haltoff) - 1, persistent_script->full_path->val, persistent_script->full_path->len, 0); if (!zend_hash_exists(EG(zend_constants), name)) { - zend_register_long_constant(name->val, name->len, persistent_script->compiler_halt_offset, CONST_CS, 0 TSRMLS_CC); + zend_register_long_constant(name->val, name->len, persistent_script->compiler_halt_offset, CONST_CS, 0); } zend_string_release(name); } @@ -856,17 +853,17 @@ zend_op_array* zend_accel_load_script(zend_persistent_script *persistent_script, 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, NULL TSRMLS_CC); + zend_accel_function_hash_copy(CG(function_table), &persistent_script->function_table, NULL); } if (zend_hash_num_elements(&persistent_script->class_table) > 0) { - zend_accel_class_hash_copy(CG(class_table), &persistent_script->class_table, NULL TSRMLS_CC); + zend_accel_class_hash_copy(CG(class_table), &persistent_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; - zend_do_delayed_early_binding(op_array TSRMLS_CC); + zend_do_delayed_early_binding(op_array); CG(compiled_filename) = orig_compiled_filename; } diff --git a/ext/opcache/zend_accelerator_util_funcs.h b/ext/opcache/zend_accelerator_util_funcs.h index cbcb2ffa8e..7b3f099e65 100644 --- a/ext/opcache/zend_accelerator_util_funcs.h +++ b/ext/opcache/zend_accelerator_util_funcs.h @@ -25,15 +25,15 @@ #include "zend.h" #include "ZendAccelerator.h" -void zend_accel_copy_internal_functions(TSRMLS_D); +void zend_accel_copy_internal_functions(void); zend_persistent_script* create_persistent_script(void); void free_persistent_script(zend_persistent_script *persistent_script, int destroy_elements); -void zend_accel_free_user_functions(HashTable *ht TSRMLS_DC); -void zend_accel_move_user_functions(HashTable *str, HashTable *dst TSRMLS_DC); +void zend_accel_free_user_functions(HashTable *ht); +void zend_accel_move_user_functions(HashTable *str, HashTable *dst); -zend_op_array* zend_accel_load_script(zend_persistent_script *persistent_script, int from_shared_memory TSRMLS_DC); +zend_op_array* zend_accel_load_script(zend_persistent_script *persistent_script, int from_shared_memory); #define ADLER32_INIT 1 /* initial Adler-32 value */ diff --git a/ext/opcache/zend_persist.c b/ext/opcache/zend_persist.c index f790a5d778..cb4f63b0ef 100644 --- a/ext/opcache/zend_persist.c +++ b/ext/opcache/zend_persist.c @@ -29,9 +29,9 @@ #include "zend_operators.h" #define zend_accel_store(p, size) \ - (p = _zend_shared_memdup((void*)p, size, 1 TSRMLS_CC)) + (p = _zend_shared_memdup((void*)p, size, 1)) #define zend_accel_memdup(p, size) \ - _zend_shared_memdup((void*)p, size, 0 TSRMLS_CC) + _zend_shared_memdup((void*)p, size, 0) #define zend_accel_store_string(str) do { \ zend_string *new_str = zend_shared_alloc_get_xlat_entry(str); \ @@ -62,14 +62,14 @@ } \ } while (0) -typedef void (*zend_persist_func_t)(zval* TSRMLS_DC); +typedef void (*zend_persist_func_t)(zval*); -static void zend_persist_zval(zval *z TSRMLS_DC); -static void zend_persist_zval_const(zval *z TSRMLS_DC); +static void zend_persist_zval(zval *z); +static void zend_persist_zval_const(zval *z); static const uint32_t uninitialized_bucket = {INVALID_IDX}; -static void zend_hash_persist(HashTable *ht, zend_persist_func_t pPersistElement TSRMLS_DC) +static void zend_hash_persist(HashTable *ht, zend_persist_func_t pPersistElement) { uint idx; Bucket *p; @@ -102,11 +102,11 @@ static void zend_hash_persist(HashTable *ht, zend_persist_func_t pPersistElement } /* persist the data itself */ - pPersistElement(&p->val TSRMLS_CC); + pPersistElement(&p->val); } } -static void zend_hash_persist_immutable(HashTable *ht TSRMLS_DC) +static void zend_hash_persist_immutable(HashTable *ht) { uint idx; Bucket *p; @@ -138,18 +138,18 @@ static void zend_hash_persist_immutable(HashTable *ht TSRMLS_DC) } /* persist the data itself */ - zend_persist_zval_const(&p->val TSRMLS_CC); + zend_persist_zval_const(&p->val); } } -static zend_ast *zend_persist_ast(zend_ast *ast TSRMLS_DC) +static zend_ast *zend_persist_ast(zend_ast *ast) { uint32_t i; zend_ast *node; if (ast->kind == ZEND_AST_ZVAL) { zend_ast_zval *copy = zend_accel_memdup(ast, sizeof(zend_ast_zval)); - zend_persist_zval(©->val TSRMLS_CC); + zend_persist_zval(©->val); node = (zend_ast *) copy; } else if (zend_ast_is_list(ast)) { zend_ast_list *list = zend_ast_get_list(ast); @@ -157,7 +157,7 @@ static zend_ast *zend_persist_ast(zend_ast *ast TSRMLS_DC) sizeof(zend_ast_list) - sizeof(zend_ast *) + sizeof(zend_ast *) * list->children); for (i = 0; i < list->children; i++) { if (copy->child[i]) { - copy->child[i] = zend_persist_ast(copy->child[i] TSRMLS_CC); + copy->child[i] = zend_persist_ast(copy->child[i]); } } node = (zend_ast *) copy; @@ -166,7 +166,7 @@ static zend_ast *zend_persist_ast(zend_ast *ast TSRMLS_DC) node = zend_accel_memdup(ast, sizeof(zend_ast) - sizeof(zend_ast *) + sizeof(zend_ast *) * children); for (i = 0; i < children; i++) { if (node->child[i]) { - node->child[i] = zend_persist_ast(node->child[i] TSRMLS_CC); + node->child[i] = zend_persist_ast(node->child[i]); } } } @@ -175,7 +175,7 @@ static zend_ast *zend_persist_ast(zend_ast *ast TSRMLS_DC) return node; } -static void zend_persist_zval(zval *z TSRMLS_DC) +static void zend_persist_zval(zval *z) { zend_uchar flags; void *new_ptr; @@ -196,11 +196,11 @@ static void zend_persist_zval(zval *z TSRMLS_DC) } else { if (Z_IMMUTABLE_P(z)) { Z_ARR_P(z) = zend_accel_memdup(Z_ARR_P(z), sizeof(zend_array)); - zend_hash_persist_immutable(Z_ARRVAL_P(z) TSRMLS_CC); + zend_hash_persist_immutable(Z_ARRVAL_P(z)); } else { GC_REMOVE_FROM_BUFFER(Z_ARR_P(z)); zend_accel_store(Z_ARR_P(z), sizeof(zend_array)); - zend_hash_persist(Z_ARRVAL_P(z), zend_persist_zval TSRMLS_CC); + zend_hash_persist(Z_ARRVAL_P(z), zend_persist_zval); /* make immutable array */ Z_TYPE_FLAGS_P(z) = IS_TYPE_IMMUTABLE; GC_REFCOUNT(Z_COUNTED_P(z)) = 2; @@ -214,7 +214,7 @@ static void zend_persist_zval(zval *z TSRMLS_DC) Z_REF_P(z) = new_ptr; } else { zend_accel_store(Z_REF_P(z), sizeof(zend_reference)); - zend_persist_zval(Z_REFVAL_P(z) TSRMLS_CC); + zend_persist_zval(Z_REFVAL_P(z)); } break; case IS_CONSTANT_AST: @@ -223,13 +223,13 @@ static void zend_persist_zval(zval *z TSRMLS_DC) Z_AST_P(z) = new_ptr; } else { zend_accel_store(Z_AST_P(z), sizeof(zend_ast_ref)); - Z_ASTVAL_P(z) = zend_persist_ast(Z_ASTVAL_P(z) TSRMLS_CC); + Z_ASTVAL_P(z) = zend_persist_ast(Z_ASTVAL_P(z)); } break; } } -static void zend_persist_zval_const(zval *z TSRMLS_DC) +static void zend_persist_zval_const(zval *z) { zend_uchar flags; void *new_ptr; @@ -250,11 +250,11 @@ static void zend_persist_zval_const(zval *z TSRMLS_DC) } else { if (Z_IMMUTABLE_P(z)) { Z_ARR_P(z) = zend_accel_memdup(Z_ARR_P(z), sizeof(zend_array)); - zend_hash_persist_immutable(Z_ARRVAL_P(z) TSRMLS_CC); + zend_hash_persist_immutable(Z_ARRVAL_P(z)); } else { GC_REMOVE_FROM_BUFFER(Z_ARR_P(z)); zend_accel_store(Z_ARR_P(z), sizeof(zend_array)); - zend_hash_persist(Z_ARRVAL_P(z), zend_persist_zval TSRMLS_CC); + zend_hash_persist(Z_ARRVAL_P(z), zend_persist_zval); /* make immutable array */ Z_TYPE_FLAGS_P(z) = IS_TYPE_IMMUTABLE; GC_REFCOUNT(Z_COUNTED_P(z)) = 2; @@ -268,7 +268,7 @@ static void zend_persist_zval_const(zval *z TSRMLS_DC) Z_REF_P(z) = new_ptr; } else { zend_accel_store(Z_REF_P(z), sizeof(zend_reference)); - zend_persist_zval(Z_REFVAL_P(z) TSRMLS_CC); + zend_persist_zval(Z_REFVAL_P(z)); } break; case IS_CONSTANT_AST: @@ -277,13 +277,13 @@ static void zend_persist_zval_const(zval *z TSRMLS_DC) Z_AST_P(z) = new_ptr; } else { zend_accel_store(Z_AST_P(z), sizeof(zend_ast_ref)); - Z_ASTVAL_P(z) = zend_persist_ast(Z_ASTVAL_P(z) TSRMLS_CC); + Z_ASTVAL_P(z) = zend_persist_ast(Z_ASTVAL_P(z)); } break; } } -static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_script* main_persistent_script TSRMLS_DC) +static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_script* main_persistent_script) { int already_stored = 0; zend_op *persist_ptr; @@ -306,14 +306,14 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc memset(&fake_execute_data, 0, sizeof(fake_execute_data)); fake_execute_data.func = (zend_function*)op_array; EG(current_execute_data) = &fake_execute_data; - if ((offset = zend_get_constant_str("__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__") - 1 TSRMLS_CC)) != NULL) { + if ((offset = zend_get_constant_str("__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__") - 1)) != NULL) { main_persistent_script->compiler_halt_offset = Z_LVAL_P(offset); } EG(current_execute_data) = orig_execute_data; } if (op_array->static_variables) { - zend_hash_persist(op_array->static_variables, zend_persist_zval TSRMLS_CC); + zend_hash_persist(op_array->static_variables, zend_persist_zval); zend_accel_store(op_array->static_variables, sizeof(HashTable)); } @@ -332,7 +332,7 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc orig_literals = op_array->literals; op_array->literals = p; while (p < end) { - zend_persist_zval(p TSRMLS_CC); + zend_persist_zval(p); p++; } efree(orig_literals); @@ -487,16 +487,16 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc } } -static void zend_persist_op_array(zval *zv TSRMLS_DC) +static void zend_persist_op_array(zval *zv) { memcpy(ZCG(arena_mem), Z_PTR_P(zv), sizeof(zend_op_array)); zend_shared_alloc_register_xlat_entry(Z_PTR_P(zv), ZCG(arena_mem)); Z_PTR_P(zv) = ZCG(arena_mem); ZCG(arena_mem) = (void*)((char*)ZCG(arena_mem) + ZEND_ALIGNED_SIZE(sizeof(zend_op_array))); - zend_persist_op_array_ex(Z_PTR_P(zv), NULL TSRMLS_CC); + zend_persist_op_array_ex(Z_PTR_P(zv), NULL); } -static void zend_persist_property_info(zval *zv TSRMLS_DC) +static void zend_persist_property_info(zval *zv) { zend_property_info *prop; @@ -518,7 +518,7 @@ static void zend_persist_property_info(zval *zv TSRMLS_DC) } } -static void zend_persist_class_entry(zval *zv TSRMLS_DC) +static void zend_persist_class_entry(zval *zv) { zend_class_entry *ce = Z_PTR_P(zv); @@ -528,13 +528,13 @@ static void zend_persist_class_entry(zval *zv TSRMLS_DC) ce = Z_PTR_P(zv) = ZCG(arena_mem); ZCG(arena_mem) = (void*)((char*)ZCG(arena_mem) + ZEND_ALIGNED_SIZE(sizeof(zend_class_entry))); zend_accel_store_interned_string(ce->name); - zend_hash_persist(&ce->function_table, zend_persist_op_array TSRMLS_CC); + zend_hash_persist(&ce->function_table, zend_persist_op_array); if (ce->default_properties_table) { int i; zend_accel_store(ce->default_properties_table, sizeof(zval) * ce->default_properties_count); for (i = 0; i < ce->default_properties_count; i++) { - zend_persist_zval(&ce->default_properties_table[i] TSRMLS_CC); + zend_persist_zval(&ce->default_properties_table[i]); } } if (ce->default_static_members_table) { @@ -542,12 +542,12 @@ static void zend_persist_class_entry(zval *zv TSRMLS_DC) zend_accel_store(ce->default_static_members_table, sizeof(zval) * ce->default_static_members_count); for (i = 0; i < ce->default_static_members_count; i++) { - zend_persist_zval(&ce->default_static_members_table[i] TSRMLS_CC); + zend_persist_zval(&ce->default_static_members_table[i]); } } ce->static_members_table = NULL; - zend_hash_persist(&ce->constants_table, zend_persist_zval TSRMLS_CC); + zend_hash_persist(&ce->constants_table, zend_persist_zval); if (ZEND_CE_FILENAME(ce)) { /* do not free! PHP has centralized filename storage, compiler will free it */ @@ -564,7 +564,7 @@ static void zend_persist_class_entry(zval *zv TSRMLS_DC) ZEND_CE_DOC_COMMENT(ce) = NULL; } } - zend_hash_persist(&ce->properties_info, zend_persist_property_info TSRMLS_CC); + zend_hash_persist(&ce->properties_info, zend_persist_property_info); if (ce->num_interfaces && ce->interfaces) { efree(ce->interfaces); } @@ -631,7 +631,7 @@ static void zend_persist_class_entry(zval *zv TSRMLS_DC) } } -static int zend_update_property_info_ce(zval *zv TSRMLS_DC) +static int zend_update_property_info_ce(zval *zv) { zend_property_info *prop = Z_PTR_P(zv); @@ -639,7 +639,7 @@ static int zend_update_property_info_ce(zval *zv TSRMLS_DC) return 0; } -static int zend_update_parent_ce(zval *zv TSRMLS_DC) +static int zend_update_parent_ce(zval *zv) { zend_class_entry *ce = Z_PTR_P(zv); @@ -703,17 +703,17 @@ static int zend_update_parent_ce(zval *zv TSRMLS_DC) ce->__debugInfo = zend_shared_alloc_get_xlat_entry(ce->__debugInfo); ce->__debugInfo->op_array.refcount++; } - zend_hash_apply(&ce->properties_info, (apply_func_t) zend_update_property_info_ce TSRMLS_CC); + zend_hash_apply(&ce->properties_info, (apply_func_t) zend_update_property_info_ce); return 0; } -static void zend_accel_persist_class_table(HashTable *class_table TSRMLS_DC) +static void zend_accel_persist_class_table(HashTable *class_table) { - zend_hash_persist(class_table, zend_persist_class_entry TSRMLS_CC); - zend_hash_apply(class_table, (apply_func_t) zend_update_parent_ce TSRMLS_CC); + zend_hash_persist(class_table, zend_persist_class_entry); + zend_hash_apply(class_table, (apply_func_t) zend_update_parent_ce); } -zend_persistent_script *zend_accel_script_persist(zend_persistent_script *script, char **key, unsigned int key_length TSRMLS_DC) +zend_persistent_script *zend_accel_script_persist(zend_persistent_script *script, char **key, unsigned int key_length) { script->mem = ZCG(mem); @@ -726,9 +726,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 TSRMLS_CC); - zend_hash_persist(&script->function_table, zend_persist_op_array TSRMLS_CC); - zend_persist_op_array_ex(&script->main_op_array, script TSRMLS_CC); + 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); return script; } diff --git a/ext/opcache/zend_persist.h b/ext/opcache/zend_persist.h index 1b95a4ab04..1ae7fabf4e 100644 --- a/ext/opcache/zend_persist.h +++ b/ext/opcache/zend_persist.h @@ -23,7 +23,7 @@ #define ZEND_PERSIST_H int zend_accel_script_persistable(zend_persistent_script *script); -uint zend_accel_script_persist_calc(zend_persistent_script *script, char *key, unsigned int key_length TSRMLS_DC); -zend_persistent_script *zend_accel_script_persist(zend_persistent_script *script, char **key, unsigned int key_length TSRMLS_DC); +uint zend_accel_script_persist_calc(zend_persistent_script *script, char *key, unsigned int key_length); +zend_persistent_script *zend_accel_script_persist(zend_persistent_script *script, char **key, unsigned int key_length); #endif /* ZEND_PERSIST_H */ diff --git a/ext/opcache/zend_persist_calc.c b/ext/opcache/zend_persist_calc.c index 6a35c5ca9b..9e96d5da42 100644 --- a/ext/opcache/zend_persist_calc.c +++ b/ext/opcache/zend_persist_calc.c @@ -35,7 +35,7 @@ ADD_DUP_SIZE((str), _STR_HEADER_SIZE + (str)->len + 1) # define ADD_INTERNED_STRING(str, do_free) do { \ if (!IS_ACCEL_INTERNED(str)) { \ - zend_string *tmp = accel_new_interned_string(str TSRMLS_CC); \ + zend_string *tmp = accel_new_interned_string(str); \ if (tmp != (str)) { \ if (do_free) { \ /*zend_string_release(str);*/ \ @@ -47,9 +47,9 @@ } \ } while (0) -static void zend_persist_zval_calc(zval *z TSRMLS_DC); +static void zend_persist_zval_calc(zval *z); -static void zend_hash_persist_calc(HashTable *ht, void (*pPersistElement)(zval *pElement TSRMLS_DC) TSRMLS_DC) +static void zend_hash_persist_calc(HashTable *ht, void (*pPersistElement)(zval *pElement)) { uint idx; Bucket *p; @@ -74,23 +74,23 @@ static void zend_hash_persist_calc(HashTable *ht, void (*pPersistElement)(zval * GC_FLAGS(p->key) |= flags; } - pPersistElement(&p->val TSRMLS_CC); + pPersistElement(&p->val); } } -static void zend_persist_ast_calc(zend_ast *ast TSRMLS_DC) +static void zend_persist_ast_calc(zend_ast *ast) { uint32_t i; if (ast->kind == ZEND_AST_ZVAL) { ADD_SIZE(sizeof(zend_ast_zval)); - zend_persist_zval_calc(zend_ast_get_zval(ast) TSRMLS_CC); + zend_persist_zval_calc(zend_ast_get_zval(ast)); } else if (zend_ast_is_list(ast)) { zend_ast_list *list = zend_ast_get_list(ast); ADD_SIZE(sizeof(zend_ast_list) - sizeof(zend_ast *) + sizeof(zend_ast *) * list->children); for (i = 0; i < list->children; i++) { if (list->child[i]) { - zend_persist_ast_calc(list->child[i] TSRMLS_CC); + zend_persist_ast_calc(list->child[i]); } } } else { @@ -98,13 +98,13 @@ static void zend_persist_ast_calc(zend_ast *ast TSRMLS_DC) ADD_SIZE(sizeof(zend_ast) - sizeof(zend_ast *) + sizeof(zend_ast *) * children); for (i = 0; i < children; i++) { if (ast->child[i]) { - zend_persist_ast_calc(ast->child[i] TSRMLS_CC); + zend_persist_ast_calc(ast->child[i]); } } } } -static void zend_persist_zval_calc(zval *z TSRMLS_DC) +static void zend_persist_zval_calc(zval *z) { zend_uchar flags; uint size; @@ -123,27 +123,27 @@ static void zend_persist_zval_calc(zval *z TSRMLS_DC) size = zend_shared_memdup_size(Z_ARR_P(z), sizeof(zend_array)); if (size) { ADD_SIZE(size); - zend_hash_persist_calc(Z_ARRVAL_P(z), zend_persist_zval_calc TSRMLS_CC); + zend_hash_persist_calc(Z_ARRVAL_P(z), zend_persist_zval_calc); } break; case IS_REFERENCE: size = zend_shared_memdup_size(Z_REF_P(z), sizeof(zend_reference)); if (size) { ADD_SIZE(size); - zend_persist_zval_calc(Z_REFVAL_P(z) TSRMLS_CC); + zend_persist_zval_calc(Z_REFVAL_P(z)); } break; case IS_CONSTANT_AST: size = zend_shared_memdup_size(Z_AST_P(z), sizeof(zend_ast_ref)); if (size) { ADD_SIZE(size); - zend_persist_ast_calc(Z_ASTVAL_P(z) TSRMLS_CC); + zend_persist_ast_calc(Z_ASTVAL_P(z)); } break; } } -static void zend_persist_op_array_calc_ex(zend_op_array *op_array TSRMLS_DC) +static void zend_persist_op_array_calc_ex(zend_op_array *op_array) { if (op_array->type != ZEND_USER_FUNCTION) { return; @@ -151,7 +151,7 @@ static void zend_persist_op_array_calc_ex(zend_op_array *op_array TSRMLS_DC) if (op_array->static_variables) { ADD_DUP_SIZE(op_array->static_variables, sizeof(HashTable)); - zend_hash_persist_calc(op_array->static_variables, zend_persist_zval_calc TSRMLS_CC); + zend_hash_persist_calc(op_array->static_variables, zend_persist_zval_calc); } if (zend_shared_alloc_get_xlat_entry(op_array->opcodes)) { @@ -170,7 +170,7 @@ static void zend_persist_op_array_calc_ex(zend_op_array *op_array TSRMLS_DC) zval *end = p + op_array->last_literal; ADD_DUP_SIZE(op_array->literals, sizeof(zval) * op_array->last_literal); while (p < end) { - zend_persist_zval_calc(p TSRMLS_CC); + zend_persist_zval_calc(p); p++; } } @@ -230,13 +230,13 @@ static void zend_persist_op_array_calc_ex(zend_op_array *op_array TSRMLS_DC) } } -static void zend_persist_op_array_calc(zval *zv TSRMLS_DC) +static void zend_persist_op_array_calc(zval *zv) { ADD_ARENA_SIZE(sizeof(zend_op_array)); - zend_persist_op_array_calc_ex(Z_PTR_P(zv) TSRMLS_CC); + zend_persist_op_array_calc_ex(Z_PTR_P(zv)); } -static void zend_persist_property_info_calc(zval *zv TSRMLS_DC) +static void zend_persist_property_info_calc(zval *zv) { zend_property_info *prop = Z_PTR_P(zv); @@ -247,20 +247,20 @@ static void zend_persist_property_info_calc(zval *zv TSRMLS_DC) } } -static void zend_persist_class_entry_calc(zval *zv TSRMLS_DC) +static void zend_persist_class_entry_calc(zval *zv) { zend_class_entry *ce = Z_PTR_P(zv); if (ce->type == ZEND_USER_CLASS) { ADD_ARENA_SIZE(sizeof(zend_class_entry)); ADD_INTERNED_STRING(ce->name, 0); - zend_hash_persist_calc(&ce->function_table, zend_persist_op_array_calc TSRMLS_CC); + zend_hash_persist_calc(&ce->function_table, zend_persist_op_array_calc); if (ce->default_properties_table) { int i; ADD_SIZE(sizeof(zval) * ce->default_properties_count); for (i = 0; i < ce->default_properties_count; i++) { - zend_persist_zval_calc(&ce->default_properties_table[i] TSRMLS_CC); + zend_persist_zval_calc(&ce->default_properties_table[i]); } } if (ce->default_static_members_table) { @@ -268,10 +268,10 @@ static void zend_persist_class_entry_calc(zval *zv TSRMLS_DC) ADD_SIZE(sizeof(zval) * ce->default_static_members_count); for (i = 0; i < ce->default_static_members_count; i++) { - zend_persist_zval_calc(&ce->default_static_members_table[i] TSRMLS_CC); + zend_persist_zval_calc(&ce->default_static_members_table[i]); } } - zend_hash_persist_calc(&ce->constants_table, zend_persist_zval_calc TSRMLS_CC); + zend_hash_persist_calc(&ce->constants_table, zend_persist_zval_calc); if (ZEND_CE_FILENAME(ce)) { ADD_STRING(ZEND_CE_FILENAME(ce)); @@ -280,7 +280,7 @@ static void zend_persist_class_entry_calc(zval *zv TSRMLS_DC) ADD_STRING(ZEND_CE_DOC_COMMENT(ce)); } - zend_hash_persist_calc(&ce->properties_info, zend_persist_property_info_calc TSRMLS_CC); + zend_hash_persist_calc(&ce->properties_info, zend_persist_property_info_calc); if (ce->trait_aliases) { int i = 0; @@ -329,12 +329,12 @@ static void zend_persist_class_entry_calc(zval *zv TSRMLS_DC) } } -static void zend_accel_persist_class_table_calc(HashTable *class_table TSRMLS_DC) +static void zend_accel_persist_class_table_calc(HashTable *class_table) { - zend_hash_persist_calc(class_table, zend_persist_class_entry_calc TSRMLS_CC); + zend_hash_persist_calc(class_table, zend_persist_class_entry_calc); } -uint zend_accel_script_persist_calc(zend_persistent_script *new_persistent_script, char *key, unsigned int key_length TSRMLS_DC) +uint zend_accel_script_persist_calc(zend_persistent_script *new_persistent_script, char *key, unsigned int key_length) { new_persistent_script->mem = NULL; new_persistent_script->size = 0; @@ -346,9 +346,9 @@ uint zend_accel_script_persist_calc(zend_persistent_script *new_persistent_scrip ADD_DUP_SIZE(key, key_length + 1); ADD_STRING(new_persistent_script->full_path); - zend_accel_persist_class_table_calc(&new_persistent_script->class_table TSRMLS_CC); - zend_hash_persist_calc(&new_persistent_script->function_table, zend_persist_op_array_calc TSRMLS_CC); - zend_persist_op_array_calc_ex(&new_persistent_script->main_op_array TSRMLS_CC); + 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); new_persistent_script->size += new_persistent_script->arena_size; diff --git a/ext/opcache/zend_shared_alloc.c b/ext/opcache/zend_shared_alloc.c index 43a0263ee5..4036abe06f 100644 --- a/ext/opcache/zend_shared_alloc.c +++ b/ext/opcache/zend_shared_alloc.c @@ -157,7 +157,6 @@ int zend_shared_alloc_startup(size_t requested_size) const zend_shared_memory_handler_entry *he; int res = ALLOC_FAILURE; - TSRMLS_FETCH(); /* shared_free must be valid before we call zend_shared_alloc() * - make it temporarily point to a local variable @@ -298,7 +297,6 @@ void *zend_shared_alloc(size_t size) { int i; unsigned int block_size = ZEND_ALIGNED_SIZE(size); - TSRMLS_FETCH(); #if 1 if (!ZCG(locked)) { @@ -335,7 +333,7 @@ int zend_shared_memdup_size(void *source, size_t size) return ZEND_ALIGNED_SIZE(size); } -void *_zend_shared_memdup(void *source, size_t size, zend_bool free_source TSRMLS_DC) +void *_zend_shared_memdup(void *source, size_t size, zend_bool free_source) { void *old_p, *retval; @@ -353,10 +351,10 @@ void *_zend_shared_memdup(void *source, size_t size, zend_bool free_source TSRML return retval; } -void zend_shared_alloc_safe_unlock(TSRMLS_D) +void zend_shared_alloc_safe_unlock(void) { if (ZCG(locked)) { - zend_shared_alloc_unlock(TSRMLS_C); + zend_shared_alloc_unlock(); } } @@ -366,7 +364,7 @@ static FLOCK_STRUCTURE(mem_write_lock, F_WRLCK, SEEK_SET, 0, 1); static FLOCK_STRUCTURE(mem_write_unlock, F_UNLCK, SEEK_SET, 0, 1); #endif -void zend_shared_alloc_lock(TSRMLS_D) +void zend_shared_alloc_lock(void) { #ifndef ZEND_WIN32 @@ -405,7 +403,7 @@ void zend_shared_alloc_lock(TSRMLS_D) zend_hash_init(&xlat_table, 128, NULL, NULL, 1); } -void zend_shared_alloc_unlock(TSRMLS_D) +void zend_shared_alloc_unlock(void) { /* Destroy translation table */ zend_hash_destroy(&xlat_table); @@ -476,7 +474,7 @@ const char *zend_accel_get_shared_model(void) return g_shared_model; } -void zend_accel_shared_protect(int mode TSRMLS_DC) +void zend_accel_shared_protect(int mode) { #ifdef HAVE_MPROTECT int i; diff --git a/ext/opcache/zend_shared_alloc.h b/ext/opcache/zend_shared_alloc.h index ec7cc14d07..1476073f71 100644 --- a/ext/opcache/zend_shared_alloc.h +++ b/ext/opcache/zend_shared_alloc.h @@ -124,7 +124,7 @@ void zend_shared_alloc_shutdown(void); void *zend_shared_alloc(size_t size); /* copy into shared memory */ -void *_zend_shared_memdup(void *p, size_t size, zend_bool free_source TSRMLS_DC); +void *_zend_shared_memdup(void *p, size_t size, zend_bool free_source); int zend_shared_memdup_size(void *p, size_t size); typedef union _align_test { @@ -143,9 +143,9 @@ typedef union _align_test { ((size + PLATFORM_ALIGNMENT - 1) & ~(PLATFORM_ALIGNMENT - 1)) /* exclusive locking */ -void zend_shared_alloc_lock(TSRMLS_D); -void zend_shared_alloc_unlock(TSRMLS_D); /* returns the allocated size during lock..unlock */ -void zend_shared_alloc_safe_unlock(TSRMLS_D); +void zend_shared_alloc_lock(void); +void zend_shared_alloc_unlock(void); /* returns the allocated size during lock..unlock */ +void zend_shared_alloc_safe_unlock(void); /* old/new mapping functions */ void zend_shared_alloc_clear_xlat_table(void); @@ -158,7 +158,7 @@ void zend_shared_alloc_restore_state(void); const char *zend_accel_get_shared_model(void); /* memory write protection */ -void zend_accel_shared_protect(int mode TSRMLS_DC); +void zend_accel_shared_protect(int mode); #ifdef USE_MMAP extern zend_shared_memory_handlers zend_alloc_mmap_handlers; |