diff options
-rw-r--r-- | Zend/zend_compile.c | 13 | ||||
-rw-r--r-- | Zend/zend_compile.h | 2 | ||||
-rw-r--r-- | Zend/zend_execute.c | 13 | ||||
-rw-r--r-- | Zend/zend_execute_API.c | 10 | ||||
-rw-r--r-- | Zend/zend_language_parser.y | 6 | ||||
-rw-r--r-- | Zend/zend_opcode.c | 2 |
6 files changed, 14 insertions, 32 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 55a3e5e756..2a02ac60f6 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -82,6 +82,7 @@ void zend_init_compiler_data_structures(TSRMLS_D) CG(in_compilation) = 0; init_compiler_declarables(TSRMLS_C); CG(throw_list) = NULL; + zend_register_auto_global("GLOBALS", sizeof("GLOBALS")-1 TSRMLS_CC); } @@ -195,18 +196,6 @@ void zend_do_binary_assign_op(int op, znode *result, znode *op1, znode *op2 TSRM } - -void zend_do_fetch_globals(znode *varname TSRMLS_DC) -{ - if (!CG(active_op_array)->uses_globals - && varname->op_type == IS_CONST - && varname->u.constant.type == IS_STRING - && varname->u.constant.value.str.len == (sizeof("GLOBALS")-1) - && !memcmp(varname->u.constant.value.str.val, "GLOBALS", sizeof("GLOBALS")-1)) { - CG(active_op_array)->uses_globals = 1; - } -} - void fetch_simple_variable_ex(znode *result, znode *varname, int bp, int op TSRMLS_DC) { zend_op opline; diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 621bd8b5f8..6dfa738d58 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -93,7 +93,6 @@ struct _zend_op_array { zend_brk_cont_element *brk_cont_array; zend_uint last_brk_cont; zend_uint current_brk_cont; - zend_bool uses_globals; /* static variables support */ HashTable *static_variables; @@ -227,7 +226,6 @@ void fetch_simple_variable(znode *result, znode *varname, int bp TSRMLS_DC); void fetch_simple_variable_ex(znode *result, znode *varname, int bp, int op TSRMLS_DC); void zend_do_indirect_references(znode *result, znode *num_references, znode *variable TSRMLS_DC); void zend_do_fetch_global_or_static_variable(znode *varname, znode *static_assignment, int fetch_type TSRMLS_DC); -void zend_do_fetch_globals(znode *varname TSRMLS_DC); void fetch_array_begin(znode *result, znode *varname, znode *first_dim TSRMLS_DC); void fetch_array_dim(znode *result, znode *parent, znode *dim TSRMLS_DC); diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index e89038f31e..cc1e07a7cb 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -1063,19 +1063,6 @@ ZEND_API void execute(zend_op_array *op_array TSRMLS_DC) EX(function_state).function_symbol_table = NULL; #endif - if (op_array->uses_globals) { - zval *globals; - - ALLOC_ZVAL(globals); - globals->refcount=1; - globals->is_ref=1; - globals->type = IS_ARRAY; - globals->value.ht = &EG(symbol_table); - if (zend_hash_add(EG(active_symbol_table), "GLOBALS", sizeof("GLOBALS"), &globals, sizeof(zval *), NULL)==FAILURE) { - FREE_ZVAL(globals); - } - } - while (1) { #ifdef ZEND_WIN32 if (EG(timed_out)) { diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 8927b37084..12d28b1789 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -135,6 +135,16 @@ void init_executor(TSRMLS_D) zend_ptr_stack_init(&EG(argument_stack)); zend_hash_init(&EG(symbol_table), 50, NULL, ZVAL_PTR_DTOR, 0); + { + zval *globals; + + ALLOC_ZVAL(globals); + globals->refcount=1; + globals->is_ref=1; + globals->type = IS_ARRAY; + globals->value.ht = &EG(symbol_table); + zend_hash_update(&EG(symbol_table), "GLOBALS", sizeof("GLOBALS"), &globals, sizeof(zval *), NULL); + } EG(active_symbol_table) = &EG(symbol_table); zend_llist_apply(&zend_extensions, (llist_apply_func_t) zend_extension_activator TSRMLS_CC); diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index 49c560c20d..8d61e973ca 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -677,7 +677,7 @@ base_cvar_without_objects: reference_variable: reference_variable '[' dim_offset ']' { fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); } | reference_variable '{' expr '}' { fetch_string_offset(&$$, &$1, &$3 TSRMLS_CC); } - | compound_variable { zend_do_fetch_globals(&$1 TSRMLS_CC); zend_do_begin_variable_parse(TSRMLS_C); fetch_simple_variable(&$$, &$1, 1 TSRMLS_CC); } + | compound_variable { zend_do_begin_variable_parse(TSRMLS_C); fetch_simple_variable(&$$, &$1, 1 TSRMLS_CC); } ; @@ -761,8 +761,8 @@ encaps_list: encaps_var: - T_VARIABLE { zend_do_fetch_globals(&$1 TSRMLS_CC); zend_do_begin_variable_parse(TSRMLS_C); fetch_simple_variable(&$$, &$1, 1 TSRMLS_CC); } - | T_VARIABLE '[' { zend_do_begin_variable_parse(TSRMLS_C); } encaps_var_offset ']' { zend_do_fetch_globals(&$1 TSRMLS_CC); fetch_array_begin(&$$, &$1, &$4 TSRMLS_CC); } + T_VARIABLE { zend_do_begin_variable_parse(TSRMLS_C); fetch_simple_variable(&$$, &$1, 1 TSRMLS_CC); } + | T_VARIABLE '[' { zend_do_begin_variable_parse(TSRMLS_C); } encaps_var_offset ']' { fetch_array_begin(&$$, &$1, &$4 TSRMLS_CC); } | T_VARIABLE T_OBJECT_OPERATOR T_STRING { zend_do_begin_variable_parse(TSRMLS_C); fetch_simple_variable(&$2, &$1, 1 TSRMLS_CC); zend_do_fetch_property(&$$, &$2, &$3 TSRMLS_CC); } | T_DOLLAR_OPEN_CURLY_BRACES expr '}' { zend_do_begin_variable_parse(TSRMLS_C); fetch_simple_variable(&$$, &$2, 1 TSRMLS_CC); } | T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr ']' '}' { zend_do_begin_variable_parse(TSRMLS_C); fetch_array_begin(&$$, &$2, &$4 TSRMLS_CC); } diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c index b41da55d72..d79e0f7b22 100644 --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@ -82,8 +82,6 @@ void init_op_array(zend_op_array *op_array, int type, int initial_ops_size TSRML op_array->static_variables = NULL; - op_array->uses_globals = 0; - op_array->return_reference = 0; op_array->done_pass_two = 0; |