summaryrefslogtreecommitdiff
path: root/Zend/zend_opcode.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2008-03-18 08:36:30 +0000
committerDmitry Stogov <dmitry@php.net>2008-03-18 08:36:30 +0000
commit8c885b89130e3549297316c0769b27d9d3657902 (patch)
treefb311427f56f1cf255c0065bf1720aa4275fd1b9 /Zend/zend_opcode.c
parent7c8ff91218425d8976ada68b7743eef8a1b4ba5c (diff)
downloadphp-git-8c885b89130e3549297316c0769b27d9d3657902.tar.gz
Implemented concept of "delayed early binding" that allows opcode caches to perform class declaration (early and/or run-time binding) in exactly the same order as vanila php.
The following pseudo-code explains how it should be used in opcode cache. function cache_compile_file($filename) { if (!is_cached($filename)) { ... orig_compiler_options = CG(compiler_optins); CG(compiler_options) |= ZEND_COMPILE_IGNORE_INTERNAL_CLASSES | ZEND_COMPILE_DELAYED_BINDING; $op_array = orig_compile_file($filename); CG(compiler_options) = orig_copiler_options; ... } else { $op_array = restore_from_cache($filename); } zend_do_delayed_early_binding($op_array); }
Diffstat (limited to 'Zend/zend_opcode.c')
-rw-r--r--Zend/zend_opcode.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c
index bc9b2ab5bb..f1c4e1d4bb 100644
--- a/Zend/zend_opcode.c
+++ b/Zend/zend_opcode.c
@@ -101,6 +101,8 @@ void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_siz
op_array->fn_flags = CG(interactive)?ZEND_ACC_INTERACTIVE:0;
+ op_array->early_binding = -1;
+
memset(op_array->reserved, 0, ZEND_MAX_RESERVED_RESOURCES * sizeof(void*));
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_ctor_handler, op_array TSRMLS_CC);
@@ -364,10 +366,10 @@ int pass_two(zend_op_array *op_array TSRMLS_DC)
if (op_array->type!=ZEND_USER_FUNCTION && op_array->type!=ZEND_EVAL_CODE) {
return 0;
}
- if (CG(extended_info)) {
+ if (CG(compiler_options) & ZEND_COMPILE_EXTENDED_INFO) {
zend_update_extended_info(op_array TSRMLS_CC);
}
- if (CG(handle_op_arrays)) {
+ if (CG(compiler_options) & ZEND_COMPILE_HANDLE_OP_ARRAY) {
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_handler, op_array TSRMLS_CC);
}