1
0
mirror of https://github.com/php/php-src.git synced 2026-04-18 13:31:27 +02:00

- Start splitting up different kinds of function calls into different

- opcodes.
This commit is contained in:
Andi Gutmans
2002-01-04 06:44:19 +00:00
parent 0d1ce8b710
commit 0ab9d11225
3 changed files with 30 additions and 26 deletions

View File

@@ -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 *));
}

View File

@@ -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)

View File

@@ -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) {