cvs: ZendEngine2 / zend_compile.h zend_execute.c zend_opcode.c

From: Date: Thu, 24 Oct 2002 18:04:13 +0000
Subject: cvs: ZendEngine2 / zend_compile.h zend_execute.c zend_opcode.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-533@lists.php.net to get a copy of this message
andi Thu Oct 24 14:04:13 2002 EDT Modified files: /ZendEngine2 zend_compile.h zend_execute.c zend_opcode.c Log: - Improve performance of part of the jmps. More to follow. Index: ZendEngine2/zend_compile.h diff -u ZendEngine2/zend_compile.h:1.187 ZendEngine2/zend_compile.h:1.188 --- ZendEngine2/zend_compile.h:1.187 Tue Oct 22 15:31:53 2002 +++ ZendEngine2/zend_compile.h Thu Oct 24 14:04:11 2002 @@ -41,6 +41,7 @@ #define HANDLE_INTERACTIVE() if (CG(interactive)) { execute_new_code(TSRMLS_C); } typedef struct _zend_op_array zend_op_array; +typedef struct _zend_op zend_op; typedef struct _znode { int op_type; @@ -52,6 +53,7 @@ zend_uint opline_num; /* Needs to be signed */ zend_op_array *op_array; zend_class_entry *previously_active_class_entry; /* Used at compile-time */ + zend_op *jmp_addr; struct { zend_uint var; /* dummy */ zend_uint type; @@ -68,7 +70,7 @@ extern opcode_handler_t zend_opcode_handlers[512]; -typedef struct _zend_op { +struct _zend_op { zend_uchar opcode; znode result; znode op1; @@ -76,7 +78,7 @@ ulong extended_value; uint lineno; opcode_handler_t handler; -} zend_op; +}; typedef struct _zend_brk_cont_element { Index: ZendEngine2/zend_execute.c diff -u ZendEngine2/zend_execute.c:1.384 ZendEngine2/zend_execute.c:1.385 --- ZendEngine2/zend_execute.c:1.384 Wed Oct 23 16:40:07 2002 +++ ZendEngine2/zend_execute.c Thu Oct 24 14:04:12 2002 @@ -5,7 +5,7 @@ | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) | +----------------------------------------------------------------------+ | This source file is subject to version 2.00 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | + | that is bundled with this package in the file LICENSE, and is | | available at through the world-wide-web at | | http://www.zend.com/license/2_00.txt. | | If you did not receive a copy of the Zend license and are unable to | @@ -1869,7 +1869,7 @@ #if DEBUG_ZEND>=2 printf("Jumping to %d\n", EX(opline)->op1.u.opline_num); #endif - EX(opline) = &op_array->opcodes[EX(opline)->op1.u.opline_num]; + EX(opline) = EX(opline)->op1.u.jmp_addr; return 0; /* CHECK_ME */ } @@ -1881,7 +1881,7 @@ #if DEBUG_ZEND>=2 printf("Conditional jmp to %d\n", EX(opline)->op2.u.opline_num); #endif - EX(opline) = &op_array->opcodes[EX(opline)->op2.u.opline_num]; + EX(opline) = EX(opline)->op2.u.jmp_addr; FREE_OP(EX(Ts), op1, EG(free_op1)); return 0; /* CHECK_ME */ } @@ -1898,7 +1898,7 @@ #if DEBUG_ZEND>=2 printf("Conditional jmp to %d\n", EX(opline)->op2.u.opline_num); #endif - EX(opline) = &op_array->opcodes[EX(opline)->op2.u.opline_num]; + EX(opline) = EX(opline)->op2.u.jmp_addr; FREE_OP(EX(Ts), op1, EG(free_op1)); return 0; /* CHECK_ME */ } Index: ZendEngine2/zend_opcode.c diff -u ZendEngine2/zend_opcode.c:1.73 ZendEngine2/zend_opcode.c:1.74 --- ZendEngine2/zend_opcode.c:1.73 Sat Oct 19 05:45:51 2002 +++ ZendEngine2/zend_opcode.c Thu Oct 24 14:04:12 2002 @@ -295,6 +295,9 @@ zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_handler, op_array TSRMLS_CC); } + op_array->opcodes = (zend_op *) erealloc(op_array->opcodes, sizeof(zend_op)*op_array->last); + op_array->size = op_array->last; + opline = op_array->opcodes; end = opline + op_array->last; while (opline < end) { @@ -306,11 +309,16 @@ opline->op2.u.constant.is_ref = 1; opline->op2.u.constant.refcount = 2; } + if (opline->opcode == ZEND_JMP) { + opline->op1.u.jmp_addr = &op_array->opcodes[opline->op1.u.opline_num]; + } + if (opline->opcode == ZEND_JMPZ || opline->opcode == ZEND_JMPNZ) { + opline->op2.u.jmp_addr = &op_array->opcodes[opline->op2.u.opline_num]; + } opline->handler = zend_opcode_handlers[opline->opcode]; opline++; } - op_array->opcodes = (zend_op *) erealloc(op_array->opcodes, sizeof(zend_op)*op_array->last); - op_array->size = op_array->last; + op_array->done_pass_two = 1; return 0; }

« previous php.zend-engine.cvs (#533) next »