]> granicus.if.org Git - php/commitdiff
- Start splitting up different kinds of function calls into different
authorAndi Gutmans <andi@php.net>
Fri, 4 Jan 2002 06:44:19 +0000 (06:44 +0000)
committerAndi Gutmans <andi@php.net>
Fri, 4 Jan 2002 06:44:19 +0000 (06:44 +0000)
- opcodes.

Zend/zend_compile.c
Zend/zend_compile.h
Zend/zend_execute.c

index 13ffd01944ab54e8c30f716ddc8de802f45599cf..df80201335fb9265eadb602cee60b07afb617ee5 100644 (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 *));
 }
index 48bb179d5cf38464578b44b8d8c9ae4ca4e98f19..a9f69d9c2f5e9de51fb60a726fe7e795d5b4af4f 100644 (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)
index 77b4ef6e8c4777066c521ddaff4f3de480ec8248..15202bd6e653fcc8670d15ec5bd483cf265cb839 100644 (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) {