cvs: ZendEngine2 / zend_execute.c zend_vm_def.h zend_vm_execute.h

[email protected] ("Dmitry Stogov")
Newsgroups php.zend-engine.cvs
Message-ID <cvsdmitry1209051988@cvsserver>
dmitry		Thu Apr 24 15:46:28 2008 UTC

  Modified files:              
    /ZendEngine2	zend_execute.c zend_vm_def.h zend_vm_execute.h 
  Log:
  Optimized handlers for ZEND_RECV and ZEND_RECV_INIT opocdes
  
  
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute.c?r1=1.792&r2=1.793&diff_format=u
Index: ZendEngine2/zend_execute.c
diff -u ZendEngine2/zend_execute.c:1.792 ZendEngine2/zend_execute.c:1.793
--- ZendEngine2/zend_execute.c:1.792	Sat Mar  8 11:49:24 2008
+++ ZendEngine2/zend_execute.c	Thu Apr 24 15:46:28 2008
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_execute.c,v 1.792 2008/03/08 11:49:24 felipe Exp $ */
+/* $Id: zend_execute.c,v 1.793 2008/04/24 15:46:28 dmitry Exp $ */
 
 #define ZEND_INTENSIVE_DEBUGGING 0
 
@@ -814,14 +814,6 @@
 }
 /* }}} */
 
-static inline void zend_receive(zval **variable_ptr_ptr, zval *value TSRMLS_DC) /* {{{ */
-{
-	Z_DELREF_PP(variable_ptr_ptr);
-	*variable_ptr_ptr = value;
-	Z_ADDREF_P(value);
-}
-/* }}} */
-
 /* Utility Functions for Extensions */
 static void zend_extension_statement_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC) /* {{{ */
 {
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_def.h?r1=1.224&r2=1.225&diff_format=u
Index: ZendEngine2/zend_vm_def.h
diff -u ZendEngine2/zend_vm_def.h:1.224 ZendEngine2/zend_vm_def.h:1.225
--- ZendEngine2/zend_vm_def.h:1.224	Mon Apr 21 10:15:26 2008
+++ ZendEngine2/zend_vm_def.h	Thu Apr 24 15:46:28 2008
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_vm_def.h,v 1.224 2008/04/21 10:15:26 dmitry Exp $ */
+/* $Id: zend_vm_def.h,v 1.225 2008/04/24 15:46:28 dmitry Exp $ */
 
 /* If you change this file, please regenerate the zend_vm_execute.h and
  * zend_vm_opcodes.h files by running:
@@ -2612,11 +2612,9 @@
 
 		zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, opline->extended_value TSRMLS_CC);
 		var_ptr = get_zval_ptr_ptr(&opline->result, EX(Ts), &free_res, BP_VAR_W);
-		if (PZVAL_IS_REF(*param)) {
-			zend_assign_to_variable_reference(var_ptr, param TSRMLS_CC);
-		} else {
-			zend_receive(var_ptr, *param TSRMLS_CC);
-		}
+		Z_DELREF_PP(var_ptr);
+		*var_ptr = *param;
+		Z_ADDREF_PP(var_ptr);
 	}
 
 	ZEND_VM_NEXT_OPCODE();
@@ -2625,42 +2623,31 @@
 ZEND_VM_HANDLER(64, ZEND_RECV_INIT, ANY, CONST)
 {
 	zend_op *opline = EX(opline);
-	zval *assignment_value, **var_ptr;
+	zval *assignment_value;
 	zend_uint arg_num = Z_LVAL(opline->op1.u.constant);
 	zend_free_op free_res;
 	zval **param = zend_vm_stack_get_arg(arg_num TSRMLS_CC);
+	zval **var_ptr = get_zval_ptr_ptr(&opline->result, EX(Ts), &free_res, BP_VAR_W);;
 
 	if (param == NULL) {
+		ALLOC_ZVAL(assignment_value);
+		*assignment_value = opline->op2.u.constant;
 		if ((Z_TYPE(opline->op2.u.constant) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT || Z_TYPE(opline->op2.u.constant)==IS_CONSTANT_ARRAY) {
-			zval *default_value;
-
-			ALLOC_ZVAL(default_value);
-			*default_value = opline->op2.u.constant;
-			Z_SET_REFCOUNT_P(default_value, 1);
-			zval_update_constant(&default_value, 0 TSRMLS_CC);
-			Z_SET_REFCOUNT_P(default_value, 0);
-			Z_UNSET_ISREF_P(default_value);
-			param = &default_value;
-			assignment_value = default_value;
+			Z_SET_REFCOUNT_P(assignment_value, 1);
+			zval_update_constant(&assignment_value, 0 TSRMLS_CC);
 		} else {
-			param = NULL;
-			assignment_value = &opline->op2.u.constant;
+			zval_copy_ctor(assignment_value);
 		}
-		zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value, opline->extended_value TSRMLS_CC);
-		
-		var_ptr = get_zval_ptr_ptr(&opline->result, EX(Ts), &free_res, BP_VAR_W);
-		zend_assign_to_variable(var_ptr, assignment_value, 0 TSRMLS_CC);
+		INIT_PZVAL(assignment_value);
 	} else {
-		var_ptr = get_zval_ptr_ptr(&opline->result, EX(Ts), &free_res, BP_VAR_W);
 		assignment_value = *param;
-		zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value, opline->extended_value TSRMLS_CC);
-		if (PZVAL_IS_REF(assignment_value)) {
-			zend_assign_to_variable_reference(var_ptr, param TSRMLS_CC);
-		} else {
-			zend_receive(var_ptr, assignment_value TSRMLS_CC);
-		}
+		Z_ADDREF_P(assignment_value);
 	}
 
+	zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value, opline->extended_value TSRMLS_CC);
+	Z_DELREF_PP(var_ptr);
+	*var_ptr = assignment_value;
+
 	ZEND_VM_NEXT_OPCODE();
 }
 
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_execute.h?r1=1.228&r2=1.229&diff_format=u
Index: ZendEngine2/zend_vm_execute.h
diff -u ZendEngine2/zend_vm_execute.h:1.228 ZendEngine2/zend_vm_execute.h:1.229
--- ZendEngine2/zend_vm_execute.h:1.228	Mon Apr 21 10:15:26 2008
+++ ZendEngine2/zend_vm_execute.h	Thu Apr 24 15:46:28 2008
@@ -358,11 +358,9 @@
 
 		zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, opline->extended_value TSRMLS_CC);
 		var_ptr = get_zval_ptr_ptr(&opline->result, EX(Ts), &free_res, BP_VAR_W);
-		if (PZVAL_IS_REF(*param)) {
-			zend_assign_to_variable_reference(var_ptr, param TSRMLS_CC);
-		} else {
-			zend_receive(var_ptr, *param TSRMLS_CC);
-		}
+		Z_DELREF_PP(var_ptr);
+		*var_ptr = *param;
+		Z_ADDREF_PP(var_ptr);
 	}
 
 	ZEND_VM_NEXT_OPCODE();
@@ -709,42 +707,31 @@
 static int ZEND_RECV_INIT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
 {
 	zend_op *opline = EX(opline);
-	zval *assignment_value, **var_ptr;
+	zval *assignment_value;
 	zend_uint arg_num = Z_LVAL(opline->op1.u.constant);
 	zend_free_op free_res;
 	zval **param = zend_vm_stack_get_arg(arg_num TSRMLS_CC);
+	zval **var_ptr = get_zval_ptr_ptr(&opline->result, EX(Ts), &free_res, BP_VAR_W);;
 
 	if (param == NULL) {
+		ALLOC_ZVAL(assignment_value);
+		*assignment_value = opline->op2.u.constant;
 		if ((Z_TYPE(opline->op2.u.constant) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT || Z_TYPE(opline->op2.u.constant)==IS_CONSTANT_ARRAY) {
-			zval *default_value;
-
-			ALLOC_ZVAL(default_value);
-			*default_value = opline->op2.u.constant;
-			Z_SET_REFCOUNT_P(default_value, 1);
-			zval_update_constant(&default_value, 0 TSRMLS_CC);
-			Z_SET_REFCOUNT_P(default_value, 0);
-			Z_UNSET_ISREF_P(default_value);
-			param = &default_value;
-			assignment_value = default_value;
-		} else {
-			param = NULL;
-			assignment_value = &opline->op2.u.constant;
+			Z_SET_REFCOUNT_P(assignment_value, 1);
+			zval_update_constant(&assignment_value, 0 TSRMLS_CC);
+		} else {
+			zval_copy_ctor(assignment_value);
 		}
-		zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value, opline->extended_value TSRMLS_CC);
-
-		var_ptr = get_zval_ptr_ptr(&opline->result, EX(Ts), &free_res, BP_VAR_W);
-		zend_assign_to_variable(var_ptr, assignment_value, 0 TSRMLS_CC);
+		INIT_PZVAL(assignment_value);
 	} else {
-		var_ptr = get_zval_ptr_ptr(&opline->result, EX(Ts), &free_res, BP_VAR_W);
 		assignment_value = *param;
-		zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value, opline->extended_value TSRMLS_CC);
-		if (PZVAL_IS_REF(assignment_value)) {
-			zend_assign_to_variable_reference(var_ptr, param TSRMLS_CC);
-		} else {
-			zend_receive(var_ptr, assignment_value TSRMLS_CC);
-		}
+		Z_ADDREF_P(assignment_value);
 	}
 
+	zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value, opline->extended_value TSRMLS_CC);
+	Z_DELREF_PP(var_ptr);
+	*var_ptr = assignment_value;
+
 	ZEND_VM_NEXT_OPCODE();
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.