From: Andi Gutmans Date: Fri, 4 Jan 2002 06:44:19 +0000 (+0000) Subject: - Start splitting up different kinds of function calls into different X-Git-Tag: PRE_ISSET_PATCH~314 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0ab9d112254e975f1b4cabb164a1f047edf61ce2;p=php - Start splitting up different kinds of function calls into different - opcodes. --- diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 13ffd01944..df80201335 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2037,10 +2037,9 @@ void zend_do_begin_new_object(znode *new_token, znode *class_type TSRMLS_DC) SET_UNUSED(opline->op2); opline = get_next_op(CG(active_op_array) TSRMLS_CC); - opline->opcode = ZEND_INIT_FCALL_BY_NAME; + opline->opcode = ZEND_INIT_CTOR_CALL; opline->op1 = (opline-2)->result; SET_UNUSED(opline->op2); - opline->extended_value = ZEND_MEMBER_FUNC_CALL | ZEND_CTOR_CALL; zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(unsigned char *)); } diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 48bb179d5c..a9f69d9c2f 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -544,6 +544,8 @@ int zendlex(znode *zendlval TSRMLS_DC); #define ZEND_FETCH_CLASS 110 #define ZEND_CLONE 111 + +#define ZEND_INIT_CTOR_CALL 112 /* end of block */ @@ -619,7 +621,6 @@ int zendlex(znode *zendlval TSRMLS_DC); #define ZEND_FETCH_ADD_LOCK 1 #define ZEND_MEMBER_FUNC_CALL 1<<0 -#define ZEND_CTOR_CALL 1<<1 #define ZEND_ARG_SEND_BY_REF (1<<0) #define ZEND_ARG_COMPILE_TIME_BOUND (1<<1) diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 77b4ef6e8c..15202bd6e6 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -1538,6 +1538,31 @@ binary_assign_op_addr: { } NEXT_OPCODE(); } + case ZEND_INIT_CTOR_CALL: + { + zend_ptr_stack_n_push(&EG(arg_types_stack), 2, EX(fbc), EX(object).ptr); + + if (EX(opline)->op1.op_type == IS_VAR) { + SELECTIVE_PZVAL_LOCK(*EX(Ts)[EX(opline)->op1.u.var].var.ptr_ptr, &EX(opline)->op1); + } + + /* We are not handling overloaded classes right now */ + EX(object).ptr = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R); + if (!PZVAL_IS_REF(EX(object).ptr)) { + EX(object).ptr->refcount++; /* For $this pointer */ + } else { + zval *this_ptr; + + ALLOC_ZVAL(this_ptr); + *this_ptr = *EX(object).ptr; + INIT_PZVAL(this_ptr); + zval_copy_ctor(this_ptr); + EX(object).ptr = this_ptr; + } + EX(fbc) = Z_OBJCE_P(EX(object).ptr)->constructor; + EX(calling_namespace) = Z_OBJCE_P(EX(object).ptr); + NEXT_OPCODE(); + } case ZEND_INIT_FCALL_BY_NAME: { zval *function_name; zend_function *function; @@ -1545,29 +1570,7 @@ binary_assign_op_addr: { zval tmp; zend_ptr_stack_n_push(&EG(arg_types_stack), 2, EX(fbc), EX(object).ptr); - if (EX(opline)->extended_value & ZEND_CTOR_CALL) { - /* constructor call */ - if (EX(opline)->op1.op_type == IS_VAR) { - SELECTIVE_PZVAL_LOCK(*EX(Ts)[EX(opline)->op1.u.var].var.ptr_ptr, &EX(opline)->op1); - } - - /* We are not handling overloaded classes right now */ - EX(object).ptr = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R); - if (!PZVAL_IS_REF(EX(object).ptr)) { - EX(object).ptr->refcount++; /* For $this pointer */ - } else { - zval *this_ptr; - ALLOC_ZVAL(this_ptr); - *this_ptr = *EX(object).ptr; - INIT_PZVAL(this_ptr); - zval_copy_ctor(this_ptr); - EX(object).ptr = this_ptr; - } - EX(fbc) = Z_OBJCE_P(EX(object).ptr)->constructor; - EX(calling_namespace) = Z_OBJCE_P(EX(object).ptr); - NEXT_OPCODE(); - } function_name = get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R); tmp = *function_name; @@ -1577,8 +1580,9 @@ binary_assign_op_addr: { zend_str_tolower(tmp.value.str.val, tmp.value.str.len); EX(calling_namespace) = EG(namespace); + if (EX(opline)->op1.op_type != IS_UNUSED) { - if (EX(opline)->op1.op_type==IS_CONST) { /* used for class::function() */ + if (EX(opline)->op1 .op_type==IS_CONST) { /* used for class::function() */ zval **object_ptr_ptr; if (zend_hash_find(EG(active_symbol_table), "this", sizeof("this"), (void **) &object_ptr_ptr)==FAILURE) {