summaryrefslogtreecommitdiff
path: root/Zend/zend_opcode.c
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>2000-08-09 19:22:35 +0000
committerZeev Suraski <zeev@php.net>2000-08-09 19:22:35 +0000
commitc06692e9ec92bdbe22e7a4149b5365635c4ad950 (patch)
treefb3e7ccb8c5187dd8d39aacd97d2707739982769 /Zend/zend_opcode.c
parent609577d8826e5a23565eb8fdf5033d60ed505c4e (diff)
downloadphp-git-c06692e9ec92bdbe22e7a4149b5365635c4ad950.tar.gz
The patch we promised - redesigned the compilation/execution API:
Advantages: - Smaller memory footprint for the op arrays - Slightly faster compilation times (due to saved erealloc() calls and faster zend_op initialization) - include_once() & require_once() share the same file list - Consistency between include() and require() - this mostly means that return() works inside require()'d files just as it does in include() files (it used to be meaningless in require()'d files, most of the time (see below)) - Made require() consistent with itself. Before, if the argument was not a constant string, require() took the include() behavior (with return()). - Removed lots of duplicate code. Bottom line - require() and include() are very similar now; require() is simply an include() which isn't allowed to fail. Due to the erealloc() calls for large op arrays, require() didn't end up being any faster than include() in the Zend engine.
Diffstat (limited to 'Zend/zend_opcode.c')
-rw-r--r--Zend/zend_opcode.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c
index 294d06cc91..346bd0c7fd 100644
--- a/Zend/zend_opcode.c
+++ b/Zend/zend_opcode.c
@@ -50,7 +50,7 @@ static void op_array_alloc_ops(zend_op_array *op_array)
-void init_op_array(zend_op_array *op_array, int type, int initial_ops_size)
+void init_op_array(zend_op_array *op_array, int type, int initial_ops_size CLS_DC)
{
op_array->type = type;
#if SUPPORT_INTERACTIVE
@@ -78,6 +78,7 @@ void init_op_array(zend_op_array *op_array, int type, int initial_ops_size)
op_array->T = 0;
op_array->function_name = NULL;
+ op_array->filename = zend_get_compiled_filename(CLS_C);
op_array->arg_types = NULL;
@@ -188,7 +189,6 @@ void init_op(zend_op *op CLS_DC)
{
memset(&op->result, 0, sizeof(znode));
op->lineno = CG(zend_lineno);
- op->filename = zend_get_compiled_filename(CLS_C);
op->result.op_type = IS_UNUSED;
op->extended_value = 0;
memset(&op->op1, 0, sizeof(znode));
@@ -252,7 +252,6 @@ static void zend_update_extended_info(zend_op_array *op_array CLS_DC)
continue;
}
opline->lineno = (opline+1)->lineno;
- opline->filename = (opline+1)->filename;
} else {
opline->opcode = ZEND_NOP;
}
@@ -264,7 +263,6 @@ static void zend_update_extended_info(zend_op_array *op_array CLS_DC)
opline->op1.op_type = IS_UNUSED;
opline->op2.op_type = IS_UNUSED;
if (op_array->last>0) {
- opline->filename = op_array->opcodes[op_array->last-2].filename;
opline->lineno= op_array->opcodes[op_array->last-2].lineno;
}
}
@@ -281,6 +279,7 @@ static void zend_extension_op_array_handler(zend_extension *extension, zend_op_a
int pass_two(zend_op_array *op_array)
{
+ zend_op *opline=op_array->opcodes, *end=opline+op_array->last;
CLS_FETCH();
if (op_array->type!=ZEND_USER_FUNCTION && op_array->type!=ZEND_EVAL_CODE) {
@@ -292,15 +291,6 @@ int pass_two(zend_op_array *op_array)
if (CG(handle_op_arrays)) {
zend_llist_apply_with_argument(&zend_extensions, (void (*)(void *, void *)) zend_extension_op_array_handler, op_array);
}
- op_array->done_pass_two = 1;
- return 0;
-}
-
-
-ZEND_API void pass_include_eval(zend_op_array *op_array)
-{
- zend_op *opline=op_array->opcodes, *end=opline+op_array->last;
-
while (opline<end) {
if (opline->op1.op_type==IS_CONST) {
opline->op1.u.constant.is_ref = 1;
@@ -312,6 +302,8 @@ ZEND_API void pass_include_eval(zend_op_array *op_array)
}
opline++;
}
+ op_array->done_pass_two = 1;
+ return 0;
}