summaryrefslogtreecommitdiff
path: root/Zend/zend_opcode.c
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/zend_opcode.c')
-rw-r--r--Zend/zend_opcode.c93
1 files changed, 46 insertions, 47 deletions
diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c
index 1bc788a644..82c87c5cd2 100644
--- a/Zend/zend_opcode.c
+++ b/Zend/zend_opcode.c
@@ -29,14 +29,14 @@
#include "zend_vm.h"
-static void zend_extension_op_array_ctor_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC)
+static void zend_extension_op_array_ctor_handler(zend_extension *extension, zend_op_array *op_array)
{
if (extension->op_array_ctor) {
extension->op_array_ctor(op_array);
}
}
-static void zend_extension_op_array_dtor_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC)
+static void zend_extension_op_array_dtor_handler(zend_extension *extension, zend_op_array *op_array)
{
if (extension->op_array_dtor) {
extension->op_array_dtor(op_array);
@@ -48,7 +48,7 @@ static void op_array_alloc_ops(zend_op_array *op_array, uint32_t size)
op_array->opcodes = erealloc(op_array->opcodes, size * sizeof(zend_op));
}
-void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_size TSRMLS_DC)
+void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_size)
{
op_array->type = type;
@@ -64,7 +64,7 @@ void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_siz
op_array->T = 0;
op_array->function_name = NULL;
- op_array->filename = zend_get_compiled_filename(TSRMLS_C);
+ op_array->filename = zend_get_compiled_filename();
op_array->doc_comment = NULL;
op_array->arg_info = NULL;
@@ -95,13 +95,13 @@ void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_siz
memset(op_array->reserved, 0, ZEND_MAX_RESERVED_RESOURCES * sizeof(void*));
- zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_ctor_handler, op_array TSRMLS_CC);
+ zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_ctor_handler, op_array);
}
-ZEND_API void destroy_zend_function(zend_function *function TSRMLS_DC)
+ZEND_API void destroy_zend_function(zend_function *function)
{
if (function->type == ZEND_USER_FUNCTION) {
- destroy_op_array(&function->op_array TSRMLS_CC);
+ destroy_op_array(&function->op_array);
} else {
ZEND_ASSERT(function->type == ZEND_INTERNAL_FUNCTION);
ZEND_ASSERT(function->common.function_name);
@@ -112,11 +112,10 @@ ZEND_API void destroy_zend_function(zend_function *function TSRMLS_DC)
ZEND_API void zend_function_dtor(zval *zv)
{
zend_function *function = Z_PTR_P(zv);
- TSRMLS_FETCH();
if (function->type == ZEND_USER_FUNCTION) {
ZEND_ASSERT(function->common.function_name);
- destroy_op_array(&function->op_array TSRMLS_CC);
+ destroy_op_array(&function->op_array);
/* op_arrays are allocated on arena, so we don't have to free them */
//??? efree_size(function, sizeof(zend_op_array));
} else {
@@ -136,7 +135,7 @@ ZEND_API void zend_cleanup_op_array_data(zend_op_array *op_array)
}
}
-ZEND_API void zend_cleanup_user_class_data(zend_class_entry *ce TSRMLS_DC)
+ZEND_API void zend_cleanup_user_class_data(zend_class_entry *ce)
{
/* Clean all parts that can contain run-time data */
/* Note that only run-time accessed data need to be cleaned up, pre-defined data can
@@ -166,7 +165,7 @@ ZEND_API void zend_cleanup_user_class_data(zend_class_entry *ce TSRMLS_DC)
}
}
-ZEND_API void zend_cleanup_internal_class_data(zend_class_entry *ce TSRMLS_DC)
+ZEND_API void zend_cleanup_internal_class_data(zend_class_entry *ce)
{
if (CE_STATIC_MEMBERS(ce)) {
int i;
@@ -313,7 +312,7 @@ void zend_class_add_ref(zval *zv)
ce->refcount++;
}
-ZEND_API void destroy_op_array(zend_op_array *op_array TSRMLS_DC)
+ZEND_API void destroy_op_array(zend_op_array *op_array)
{
zval *literal = op_array->literals;
zval *end;
@@ -366,7 +365,7 @@ ZEND_API void destroy_op_array(zend_op_array *op_array TSRMLS_DC)
efree(op_array->try_catch_array);
}
if (op_array->fn_flags & ZEND_ACC_DONE_PASS_TWO) {
- zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_dtor_handler, op_array TSRMLS_CC);
+ zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_dtor_handler, op_array);
}
if (op_array->arg_info) {
for (i=0; i<op_array->num_args; i++) {
@@ -379,14 +378,14 @@ ZEND_API void destroy_op_array(zend_op_array *op_array TSRMLS_DC)
}
}
-void init_op(zend_op *op TSRMLS_DC)
+void init_op(zend_op *op)
{
memset(op, 0, sizeof(zend_op));
op->lineno = CG(zend_lineno);
SET_UNUSED(op->result);
}
-zend_op *get_next_op(zend_op_array *op_array TSRMLS_DC)
+zend_op *get_next_op(zend_op_array *op_array)
{
uint32_t next_op_num = op_array->last++;
zend_op *next_op;
@@ -398,7 +397,7 @@ zend_op *get_next_op(zend_op_array *op_array TSRMLS_DC)
next_op = &(op_array->opcodes[next_op_num]);
- init_op(next_op TSRMLS_CC);
+ init_op(next_op);
return next_op;
}
@@ -415,7 +414,7 @@ zend_brk_cont_element *get_next_brk_cont_element(zend_op_array *op_array)
return &op_array->brk_cont_array[op_array->last_brk_cont-1];
}
-static void zend_update_extended_info(zend_op_array *op_array TSRMLS_DC)
+static void zend_update_extended_info(zend_op_array *op_array)
{
zend_op *opline = op_array->opcodes, *end=opline+op_array->last;
@@ -438,14 +437,14 @@ static void zend_update_extended_info(zend_op_array *op_array TSRMLS_DC)
}
}
-static void zend_extension_op_array_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC)
+static void zend_extension_op_array_handler(zend_extension *extension, zend_op_array *op_array)
{
if (extension->op_array_handler) {
extension->op_array_handler(op_array);
}
}
-static void zend_check_finally_breakout(zend_op_array *op_array, uint32_t op_num, uint32_t dst_num TSRMLS_DC)
+static void zend_check_finally_breakout(zend_op_array *op_array, uint32_t op_num, uint32_t dst_num)
{
int i;
@@ -470,7 +469,7 @@ static void zend_check_finally_breakout(zend_op_array *op_array, uint32_t op_num
}
}
-static void zend_adjust_fast_call(zend_op_array *op_array, uint32_t fast_call, uint32_t start, uint32_t end TSRMLS_DC)
+static void zend_adjust_fast_call(zend_op_array *op_array, uint32_t fast_call, uint32_t start, uint32_t end)
{
int i;
uint32_t op_num = 0;
@@ -491,7 +490,7 @@ static void zend_adjust_fast_call(zend_op_array *op_array, uint32_t fast_call, u
}
}
-static void zend_resolve_fast_call(zend_op_array *op_array, uint32_t fast_call, uint32_t op_num TSRMLS_DC)
+static void zend_resolve_fast_call(zend_op_array *op_array, uint32_t fast_call, uint32_t op_num)
{
int i;
uint32_t finally_op_num = 0;
@@ -513,14 +512,14 @@ static void zend_resolve_fast_call(zend_op_array *op_array, uint32_t fast_call,
}
}
-static void zend_resolve_finally_call(zend_op_array *op_array, uint32_t op_num, uint32_t dst_num TSRMLS_DC)
+static void zend_resolve_finally_call(zend_op_array *op_array, uint32_t op_num, uint32_t dst_num)
{
uint32_t start_op;
zend_op *opline;
uint32_t i = op_array->last_try_catch;
if (dst_num != (uint32_t)-1) {
- zend_check_finally_breakout(op_array, op_num, dst_num TSRMLS_CC);
+ zend_check_finally_breakout(op_array, op_num, dst_num);
}
/* the backward order is mater */
@@ -541,7 +540,7 @@ static void zend_resolve_finally_call(zend_op_array *op_array, uint32_t op_num,
/* generate a FAST_CALL to finally block */
start_op = get_next_op_number(op_array);
- opline = get_next_op(op_array TSRMLS_CC);
+ opline = get_next_op(op_array);
opline->opcode = ZEND_FAST_CALL;
opline->result_type = IS_TMP_VAR;
opline->result.var = fast_call_var;
@@ -549,21 +548,21 @@ static void zend_resolve_finally_call(zend_op_array *op_array, uint32_t op_num,
SET_UNUSED(opline->op2);
zend_adjust_fast_call(op_array, start_op,
op_array->try_catch_array[i].finally_op,
- op_array->try_catch_array[i].finally_end TSRMLS_CC);
+ op_array->try_catch_array[i].finally_end);
if (op_array->try_catch_array[i].catch_op) {
opline->extended_value = ZEND_FAST_CALL_FROM_CATCH;
opline->op2.opline_num = op_array->try_catch_array[i].catch_op;
opline->op1.opline_num = get_next_op_number(op_array);
/* generate a FAST_CALL to hole CALL_FROM_FINALLY */
- opline = get_next_op(op_array TSRMLS_CC);
+ opline = get_next_op(op_array);
opline->opcode = ZEND_FAST_CALL;
opline->result_type = IS_TMP_VAR;
opline->result.var = fast_call_var;
SET_UNUSED(opline->op1);
SET_UNUSED(opline->op2);
- zend_resolve_fast_call(op_array, start_op + 1, op_array->try_catch_array[i].finally_op - 2 TSRMLS_CC);
+ zend_resolve_fast_call(op_array, start_op + 1, op_array->try_catch_array[i].finally_op - 2);
} else {
- zend_resolve_fast_call(op_array, start_op, op_array->try_catch_array[i].finally_op - 2 TSRMLS_CC);
+ zend_resolve_fast_call(op_array, start_op, op_array->try_catch_array[i].finally_op - 2);
}
opline->op1.opline_num = op_array->try_catch_array[i].finally_op;
@@ -576,7 +575,7 @@ static void zend_resolve_finally_call(zend_op_array *op_array, uint32_t op_num,
(dst_num < op_array->try_catch_array[i].try_op ||
dst_num > op_array->try_catch_array[i].finally_end)) {
- opline = get_next_op(op_array TSRMLS_CC);
+ opline = get_next_op(op_array);
opline->opcode = ZEND_FAST_CALL;
opline->result_type = IS_TMP_VAR;
opline->result.var = fast_call_var;
@@ -587,7 +586,7 @@ static void zend_resolve_finally_call(zend_op_array *op_array, uint32_t op_num,
}
/* Finish the sequence with original opcode */
- opline = get_next_op(op_array TSRMLS_CC);
+ opline = get_next_op(op_array);
*opline = op_array->opcodes[op_num];
/* Replace original opcode with jump to this sequence */
@@ -602,7 +601,7 @@ static void zend_resolve_finally_call(zend_op_array *op_array, uint32_t op_num,
}
}
-static void zend_resolve_finally_ret(zend_op_array *op_array, uint32_t op_num TSRMLS_DC)
+static void zend_resolve_finally_ret(zend_op_array *op_array, uint32_t op_num)
{
int i;
uint32_t catch_op_num = 0, finally_op_num = 0;
@@ -630,7 +629,7 @@ static void zend_resolve_finally_ret(zend_op_array *op_array, uint32_t op_num TS
}
}
-static void zend_resolve_finally_calls(zend_op_array *op_array TSRMLS_DC)
+static void zend_resolve_finally_calls(zend_op_array *op_array)
{
uint32_t i, j;
zend_op *opline;
@@ -641,7 +640,7 @@ static void zend_resolve_finally_calls(zend_op_array *op_array TSRMLS_DC)
case ZEND_RETURN:
case ZEND_RETURN_BY_REF:
case ZEND_GENERATOR_RETURN:
- zend_resolve_finally_call(op_array, i, (uint32_t)-1 TSRMLS_CC);
+ zend_resolve_finally_call(op_array, i, (uint32_t)-1);
break;
case ZEND_BRK:
case ZEND_CONT:
@@ -657,7 +656,7 @@ static void zend_resolve_finally_calls(zend_op_array *op_array TSRMLS_DC)
array_offset = jmp_to->parent;
}
} while (--nest_levels > 0);
- zend_resolve_finally_call(op_array, i, opline->opcode == ZEND_BRK ? jmp_to->brk : jmp_to->cont TSRMLS_CC);
+ zend_resolve_finally_call(op_array, i, opline->opcode == ZEND_BRK ? jmp_to->brk : jmp_to->cont);
break;
}
}
@@ -666,18 +665,18 @@ static void zend_resolve_finally_calls(zend_op_array *op_array TSRMLS_DC)
uint32_t num = opline->op2.constant;
ZEND_PASS_TWO_UPDATE_CONSTANT(op_array, opline->op2);
- zend_resolve_goto_label(op_array, opline, 1 TSRMLS_CC);
+ zend_resolve_goto_label(op_array, opline, 1);
opline->op2.constant = num;
}
/* break omitted intentionally */
case ZEND_JMP:
- zend_resolve_finally_call(op_array, i, opline->op1.opline_num TSRMLS_CC);
+ zend_resolve_finally_call(op_array, i, opline->op1.opline_num);
break;
case ZEND_FAST_CALL:
- zend_resolve_fast_call(op_array, i, i TSRMLS_CC);
+ zend_resolve_fast_call(op_array, i, i);
break;
case ZEND_FAST_RET:
- zend_resolve_finally_ret(op_array, i TSRMLS_CC);
+ zend_resolve_finally_ret(op_array, i);
break;
default:
break;
@@ -685,7 +684,7 @@ static void zend_resolve_finally_calls(zend_op_array *op_array TSRMLS_DC)
}
}
-ZEND_API int pass_two(zend_op_array *op_array TSRMLS_DC)
+ZEND_API int pass_two(zend_op_array *op_array)
{
zend_op *opline, *end;
@@ -693,13 +692,13 @@ ZEND_API int pass_two(zend_op_array *op_array TSRMLS_DC)
return 0;
}
if (op_array->fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK) {
- zend_resolve_finally_calls(op_array TSRMLS_CC);
+ zend_resolve_finally_calls(op_array);
}
if (CG(compiler_options) & ZEND_COMPILE_EXTENDED_INFO) {
- zend_update_extended_info(op_array TSRMLS_CC);
+ zend_update_extended_info(op_array);
}
if (CG(compiler_options) & ZEND_COMPILE_HANDLE_OP_ARRAY) {
- zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_handler, op_array TSRMLS_CC);
+ zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_handler, op_array);
}
if (CG(context).vars_size != op_array->last_var) {
@@ -737,7 +736,7 @@ ZEND_API int pass_two(zend_op_array *op_array TSRMLS_DC)
break;
case ZEND_GOTO:
if (Z_TYPE_P(RT_CONSTANT(op_array, opline->op2)) != IS_LONG) {
- zend_resolve_goto_label(op_array, opline, 1 TSRMLS_CC);
+ zend_resolve_goto_label(op_array, opline, 1);
}
/* break omitted intentionally */
case ZEND_JMP:
@@ -779,15 +778,15 @@ ZEND_API int pass_two(zend_op_array *op_array TSRMLS_DC)
return 0;
}
-int pass_two_wrapper(zval *el TSRMLS_DC)
+int pass_two_wrapper(zval *el)
{
- return pass_two((zend_op_array *) Z_PTR_P(el) TSRMLS_CC);
+ return pass_two((zend_op_array *) Z_PTR_P(el));
}
-int print_class(zend_class_entry *class_entry TSRMLS_DC)
+int print_class(zend_class_entry *class_entry)
{
printf("Class %s:\n", class_entry->name->val);
- zend_hash_apply(&class_entry->function_table, pass_two_wrapper TSRMLS_CC);
+ zend_hash_apply(&class_entry->function_table, pass_two_wrapper);
printf("End of class %s.\n\n", class_entry->name->val);
return 0;
}