diff options
-rw-r--r-- | Zend/zend.h | 1 | ||||
-rw-r--r-- | Zend/zend_compile.c | 57 | ||||
-rw-r--r-- | Zend/zend_compile.h | 4 | ||||
-rw-r--r-- | Zend/zend_execute.c | 130 | ||||
-rw-r--r-- | Zend/zend_globals.h | 1 | ||||
-rw-r--r-- | Zend/zend_opcode.c | 3 |
6 files changed, 1 insertions, 195 deletions
diff --git a/Zend/zend.h b/Zend/zend.h index c5f896ffa5..6fe55a05c3 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -304,7 +304,6 @@ struct _zend_class_entry { HashTable function_table; HashTable default_properties; HashTable properties_info; - HashTable class_table; HashTable *static_members; HashTable constants_table; zend_function_entry *builtin_functions; diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 595a27c4c5..b62a696591 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -678,62 +678,6 @@ zend_bool zend_is_function_or_method_call(znode *variable) return ((type & ZEND_PARSED_METHOD_CALL) || (type == ZEND_PARSED_FUNCTION_CALL)); } - -void zend_do_begin_import(TSRMLS_D) -{ - zend_llist_init(&CG(import_commands), sizeof(zend_op), NULL, 0); -} - - -void zend_do_import(int type, znode *what TSRMLS_DC) -{ - zend_op opline; - - init_op(&opline TSRMLS_CC); - - switch (type) { - case T_FUNCTION: - opline.opcode = ZEND_IMPORT_FUNCTION; - break; - case T_CLASS: - opline.opcode = ZEND_IMPORT_CLASS; - break; - case T_CONST: - opline.opcode = ZEND_IMPORT_CONST; - break; - } - - if (what) { - if (type == T_FUNCTION || type == T_CLASS) { - zend_str_tolower(what->u.constant.value.str.val, what->u.constant.value.str.len); - } - opline.op2 = *what; - } else { - SET_UNUSED(opline.op2); - } - - zend_llist_add_element(&CG(import_commands), &opline); -} - - -void zend_do_end_import(znode *import_from TSRMLS_DC) -{ - zend_llist_element *le; - zend_op *opline, *opline_ptr; - - le = CG(import_commands).head; - - while (le) { - opline_ptr = (zend_op *)le->data; - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - memcpy(opline, opline_ptr, sizeof(zend_op)); - opline->op1 = *import_from; - le = le->next; - } - zend_llist_destroy(&CG(import_commands)); -} - - void zend_do_begin_variable_parse(TSRMLS_D) { zend_llist fetch_list; @@ -3413,7 +3357,6 @@ void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify_handlers zend_hash_init_ex(ce->static_members, 0, NULL, ZVAL_PTR_DTOR, persistent_hashes, 0); zend_hash_init_ex(&ce->constants_table, 0, NULL, ZVAL_PTR_DTOR, persistent_hashes, 0); zend_hash_init_ex(&ce->function_table, 0, NULL, ZEND_FUNCTION_DTOR, persistent_hashes, 0); - zend_hash_init_ex(&ce->class_table, 10, NULL, ZEND_CLASS_DTOR, persistent_hashes, 0); if (nullify_handlers) { ce->constructor = NULL; diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 06b70eca4b..1e3ebb1439 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -429,10 +429,6 @@ void zend_do_extended_fcall_end(TSRMLS_D); void zend_do_ticks(TSRMLS_D); -void zend_do_begin_import(TSRMLS_D); -void zend_do_import(int type, znode *what TSRMLS_DC); -void zend_do_end_import(znode *import_from TSRMLS_DC); - void zend_do_abstract_method(znode *function_name, znode *modifiers, znode *body TSRMLS_DC); ZEND_API void function_add_ref(zend_function *function); diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 204d69d4a3..4d2685a8ea 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -2214,131 +2214,6 @@ int zend_add_var_handler(ZEND_OPCODE_HANDLER_ARGS) NEXT_OPCODE(); } -static int zend_import_check_function(HashTable *target_ht, zend_function *function, zend_hash_key *hash_key, void *param) -{ - if (zend_hash_quick_exists(target_ht, hash_key->arKey, hash_key->nKeyLength, hash_key->h)) { - zend_error(E_ERROR, "Import: function %s() already exists in current scope", function->common.function_name?function->common.function_name:"main"); - } - return 1; /* OK */ -} - -int zend_import_function_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_class_entry *ce; - zend_function *function; - - ce = EX_T(EX(opline)->op1.u.var).EA.class_entry; - - if (EX(opline)->op2.op_type != IS_UNUSED) { - char *function_name_strval; - int function_name_strlen; - - function_name_strval = EX(opline)->op2.u.constant.value.str.val; - function_name_strlen = EX(opline)->op2.u.constant.value.str.len; - - if (zend_hash_find(&ce->function_table, function_name_strval, function_name_strlen + 1, (void **) &function)==FAILURE) { - zend_error(E_ERROR, "Import: function %s() not found", function_name_strval); - } - if (zend_hash_add(EG(function_table), function_name_strval, function_name_strlen + 1, function, sizeof(zend_function), NULL) == FAILURE) { - zend_error(E_ERROR, "Import: function %s() already exists in current scope", function_name_strval); - } - function_add_ref(function); - } else { - zend_hash_merge_ex(EG(function_table), &ce->function_table, (copy_ctor_func_t) function_add_ref, sizeof(zend_function), (merge_checker_func_t)zend_import_check_function, NULL); - } - NEXT_OPCODE(); -} - -static int zend_import_check_class(HashTable *target_ht, zend_class_entry **ce, zend_hash_key *hash_key, void *param) -{ - if (zend_hash_quick_exists(target_ht, hash_key->arKey, hash_key->nKeyLength, hash_key->h)) { - zend_error(E_ERROR, "Import: class '%s' already exists in current scope", (*ce)->name); - } - return 1; /* OK */ -} - -int zend_import_class_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_class_entry *ce; - zend_class_entry **import_ce; - - ce = EX_T(EX(opline)->op1.u.var).EA.class_entry; - - if (EX(opline)->op2.op_type != IS_UNUSED) { - char *class_name_strval; - int class_name_strlen; - - class_name_strval = EX(opline)->op2.u.constant.value.str.val; - class_name_strlen = EX(opline)->op2.u.constant.value.str.len; - - if (zend_hash_find(&ce->class_table, class_name_strval, class_name_strlen + 1, (void **) &import_ce)==FAILURE) { - zend_error(E_ERROR, "Import: class %s not found", class_name_strval); - } - if (zend_hash_add(EG(class_table), class_name_strval, class_name_strlen + 1, import_ce, sizeof(zend_class_entry *), NULL) == FAILURE) { - zend_error(E_ERROR, "Import: class %s already exists in current scope", class_name_strval); - } - zend_class_add_ref(import_ce); - } else { - zend_hash_merge_ex(EG(class_table), &ce->class_table, (copy_ctor_func_t) zend_class_add_ref, sizeof(zend_class_entry *), (merge_checker_func_t)zend_import_check_class, NULL); - } - - NEXT_OPCODE(); -} - - -int zend_import_const_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_class_entry *ce; - zval **import_constant; - zend_constant c; - - ce = EX_T(EX(opline)->op1.u.var).EA.class_entry; - if (EX(opline)->op2.op_type != IS_UNUSED) { - char *const_name_strval; - int const_name_strlen; - - const_name_strval = EX(opline)->op2.u.constant.value.str.val; - const_name_strlen = EX(opline)->op2.u.constant.value.str.len; - - if (zend_hash_find(&ce->constants_table, const_name_strval, const_name_strlen + 1, (void **) &import_constant)==FAILURE) { - zend_error(E_ERROR, "Import: constant %s not found", const_name_strval); - } - c.value = **import_constant; - zval_copy_ctor(&c.value); - c.flags = CONST_CS; - c.name = zend_strndup(const_name_strval, const_name_strlen); - c.name_len = const_name_strlen + 1; - - if (zend_register_constant(&c TSRMLS_CC) == FAILURE) { - zend_error(E_ERROR, "Import: unable to register constant %s", const_name_strval); - } - } else { - HashPosition pos; - char *key; - uint key_length; - int key_type; - ulong dummy; - - zend_hash_internal_pointer_reset_ex(&ce->constants_table, &pos); - while (zend_hash_get_current_data_ex(&ce->constants_table, (void **)&import_constant, &pos) == SUCCESS) { - key_type = zend_hash_get_current_key_ex(&ce->constants_table, &key, &key_length, &dummy, 0, &pos); - - c.value = **import_constant; - zval_copy_ctor(&c.value); - c.flags = CONST_CS; - c.name = zend_strndup(key, key_length - 1); - c.name_len = key_length; - - if (zend_register_constant(&c TSRMLS_CC) == FAILURE) { - zend_error(E_ERROR, "Import: unable to register constant %s", key); - } - zend_hash_move_forward_ex(&ce->constants_table, &pos); - } - } - NEXT_OPCODE(); -} - - int zend_fetch_class_handler(ZEND_OPCODE_HANDLER_ARGS) { zend_class_entry **pce; @@ -2381,6 +2256,7 @@ int zend_fetch_class_handler(ZEND_OPCODE_HANDLER_ARGS) ce = Z_OBJCE_P(class_name); break; case IS_STRING: + convert_to_string_ex(&class_name); class_name_strval = zend_str_tolower_dup(class_name->value.str.val, class_name->value.str.len); class_name_strlen = class_name->value.str.len; free_class_name = 1; @@ -4205,10 +4081,6 @@ void zend_init_opcodes_handlers() zend_opcode_handlers[ZEND_ISSET_ISEMPTY_VAR] = zend_isset_isempty_var_handler; zend_opcode_handlers[ZEND_ISSET_ISEMPTY_DIM_OBJ] = zend_isset_isempty_dim_obj_handler; - zend_opcode_handlers[ZEND_IMPORT_FUNCTION] = zend_import_function_handler; - zend_opcode_handlers[ZEND_IMPORT_CLASS] = zend_import_class_handler; - zend_opcode_handlers[ZEND_IMPORT_CONST] = zend_import_const_handler; - zend_opcode_handlers[ZEND_PRE_INC_OBJ] = zend_pre_inc_obj_handler; zend_opcode_handlers[ZEND_PRE_DEC_OBJ] = zend_pre_dec_obj_handler; zend_opcode_handlers[ZEND_POST_INC_OBJ] = zend_post_inc_obj_handler; diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h index ceb636c437..1152290409 100644 --- a/Zend/zend_globals.h +++ b/Zend/zend_globals.h @@ -121,7 +121,6 @@ struct _zend_compiler_globals { zend_uint start_lineno; zend_bool increment_lineno; - zend_llist import_commands; znode implementing_class; zend_uint access_type; diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c index 54d8295485..ea3732f56e 100644 --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@ -132,7 +132,6 @@ ZEND_API int zend_cleanup_class_data(zend_class_entry **pce TSRMLS_DC) /* Note that only run-time accessed data need to be cleaned up, pre-defined data can not contain objects and thus are not probelmatic */ zend_hash_clean((*pce)->static_members); - zend_hash_apply(&(*pce)->class_table, (apply_func_t) zend_cleanup_class_data TSRMLS_CC); zend_hash_apply(&(*pce)->function_table, (apply_func_t) zend_cleanup_function_data TSRMLS_CC); } return 0; @@ -154,7 +153,6 @@ ZEND_API void destroy_zend_class(zend_class_entry **pce) zend_hash_destroy(&ce->function_table); FREE_HASHTABLE(ce->static_members); zend_hash_destroy(&ce->constants_table); - zend_hash_destroy(&ce->class_table); if (ce->num_interfaces > 0 && ce->interfaces) { efree(ce->interfaces); } @@ -171,7 +169,6 @@ ZEND_API void destroy_zend_class(zend_class_entry **pce) zend_hash_destroy(&ce->function_table); free(ce->static_members); zend_hash_destroy(&ce->constants_table); - zend_hash_destroy(&ce->class_table); if (ce->num_interfaces > 0) { free(ce->interfaces); } |