From e2c3c7aa44afafaef96880a32d38ebad1161e07d Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Tue, 10 Mar 2009 10:01:44 +0000 Subject: [PATCH] Clenaup deprecated namespace code --- Zend/zend_compile.c | 46 -------------------------------------- Zend/zend_vm_def.h | 5 +---- Zend/zend_vm_execute.h | 50 +++++++++--------------------------------- 3 files changed, 11 insertions(+), 90 deletions(-) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 8349ed7ca3..c255b50234 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -1990,25 +1990,6 @@ int zend_do_begin_class_member_function_call(znode *class_name, znode *method_na zend_op *opline; ulong fetch_type = 0; -#if 0 - if (class_name->op_type == IS_CONST && - Z_TYPE(class_name->u.constant) == IS_STRING && - Z_STRLEN(class_name->u.constant) == 0) { - /* namespace\func() not in namespace */ - zval_dtor(&class_name->u.constant); - if (CG(current_namespace)) { - znode tmp; - - tmp.op_type = IS_CONST; - tmp.u.constant = *CG(current_namespace); - zval_copy_ctor(&tmp.u.constant); - zend_do_build_namespace_name(&tmp, &tmp, method_name TSRMLS_CC); - *method_name = tmp; - } - return zend_do_begin_function_call(method_name, 0 TSRMLS_CC); - } -#endif - if (method_name->op_type == IS_CONST) { char *lcname = zend_str_tolower_dup(Z_STRVAL(method_name->u.constant), Z_STRLEN(method_name->u.constant)); if ((sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) == Z_STRLEN(method_name->u.constant) && @@ -2020,7 +2001,6 @@ int zend_do_begin_class_member_function_call(znode *class_name, znode *method_na } if (class_name->op_type == IS_CONST && - method_name->op_type == IS_CONST && ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant))) { fetch_type = ZEND_FETCH_CLASS_GLOBAL; zend_resolve_class_name(class_name, &fetch_type, 1 TSRMLS_CC); @@ -2033,32 +2013,6 @@ int zend_do_begin_class_member_function_call(znode *class_name, znode *method_na opline->op1 = class_node; opline->op2 = *method_name; - if (class_node.op_type == IS_CONST && - method_name->op_type == IS_CONST) { - /* Prebuild ns\func name to speedup run-time check. - The additional names are stored in additional OP_DATA opcode. */ - char *nsname, *fname; - unsigned int nsname_len, len; - - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - opline->opcode = ZEND_OP_DATA; - opline->op1.op_type = IS_CONST; - SET_UNUSED(opline->op2); - - nsname = Z_STRVAL(class_node.u.constant); - nsname_len = Z_STRLEN(class_node.u.constant); - len = nsname_len + 1 + Z_STRLEN(method_name->u.constant); - fname = emalloc(len + 1); - memcpy(fname, nsname, nsname_len); - fname[nsname_len] = '\\'; - memcpy(fname + nsname_len + 1, - Z_STRVAL(method_name->u.constant), - Z_STRLEN(method_name->u.constant)+1); - zend_str_tolower(fname, len); - opline->extended_value = zend_hash_func(fname, len + 1); - ZVAL_STRINGL(&opline->op1.u.constant, fname, len, 0); - } - zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(zend_function *)); zend_do_extended_fcall_begin(TSRMLS_C); return 1; /* Dynamic */ diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 8e084ad473..6c37ca5e19 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -1961,10 +1961,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUS zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); - if (OP1_TYPE == IS_CONST && OP2_TYPE == IS_CONST) { - - ZEND_VM_INC_OPCODE(); - + if (OP1_TYPE == IS_CONST) { /* no function found. try a static method in class */ ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) { diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 0bc2f73048..2b4f9e7a7b 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -2593,10 +2593,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER( zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); - if (IS_CONST == IS_CONST && IS_CONST == IS_CONST) { - - ZEND_VM_INC_OPCODE(); - + if (IS_CONST == IS_CONST) { /* no function found. try a static method in class */ ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) { @@ -3169,10 +3166,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_TMP_HANDLER(ZE zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); - if (IS_CONST == IS_CONST && IS_TMP_VAR == IS_CONST) { - - ZEND_VM_INC_OPCODE(); - + if (IS_CONST == IS_CONST) { /* no function found. try a static method in class */ ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) { @@ -3640,10 +3634,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_VAR_HANDLER(ZE zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); - if (IS_CONST == IS_CONST && IS_VAR == IS_CONST) { - - ZEND_VM_INC_OPCODE(); - + if (IS_CONST == IS_CONST) { /* no function found. try a static method in class */ ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) { @@ -3867,10 +3858,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_UNUSED_HANDLER zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); - if (IS_CONST == IS_CONST && IS_UNUSED == IS_CONST) { - - ZEND_VM_INC_OPCODE(); - + if (IS_CONST == IS_CONST) { /* no function found. try a static method in class */ ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) { @@ -4306,10 +4294,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CV_HANDLER(ZEN zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); - if (IS_CONST == IS_CONST && IS_CV == IS_CONST) { - - ZEND_VM_INC_OPCODE(); - + if (IS_CONST == IS_CONST) { /* no function found. try a static method in class */ ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) { @@ -10323,10 +10308,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZE zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); - if (IS_VAR == IS_CONST && IS_CONST == IS_CONST) { - - ZEND_VM_INC_OPCODE(); - + if (IS_VAR == IS_CONST) { /* no function found. try a static method in class */ ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) { @@ -12162,10 +12144,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); - if (IS_VAR == IS_CONST && IS_TMP_VAR == IS_CONST) { - - ZEND_VM_INC_OPCODE(); - + if (IS_VAR == IS_CONST) { /* no function found. try a static method in class */ ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) { @@ -13996,10 +13975,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); - if (IS_VAR == IS_CONST && IS_VAR == IS_CONST) { - - ZEND_VM_INC_OPCODE(); - + if (IS_VAR == IS_CONST) { /* no function found. try a static method in class */ ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) { @@ -14918,10 +14894,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_UNUSED_HANDLER(Z zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); - if (IS_VAR == IS_CONST && IS_UNUSED == IS_CONST) { - - ZEND_VM_INC_OPCODE(); - + if (IS_VAR == IS_CONST) { /* no function found. try a static method in class */ ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) { @@ -16439,10 +16412,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_ zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); - if (IS_VAR == IS_CONST && IS_CV == IS_CONST) { - - ZEND_VM_INC_OPCODE(); - + if (IS_VAR == IS_CONST) { /* no function found. try a static method in class */ ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) { -- 2.50.1