From: Dmitry Stogov Date: Tue, 10 Mar 2009 10:01:28 +0000 (+0000) Subject: Clenaup deprecated namespace code X-Git-Tag: php-5.4.0alpha1~191^2~4173 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4d616e7474865cbea38ebb1ce767e4f08315690e;p=php Clenaup deprecated namespace code --- diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index e83e48ff14..e45fef2a20 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2095,7 +2095,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_TYPE(class_name->u.constant), Z_UNIVAL(class_name->u.constant), Z_UNILEN(class_name->u.constant))) { fetch_type = ZEND_FETCH_CLASS_GLOBAL; zend_resolve_class_name(class_name, &fetch_type, 1 TSRMLS_CC); @@ -2108,45 +2107,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. */ - zstr nsname, fname, lcname; - unsigned int nsname_len, len, lcname_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_UNIVAL(class_node.u.constant); - nsname_len = Z_UNILEN(class_node.u.constant); - len = nsname_len + 1 + Z_UNILEN(method_name->u.constant); - if (UG(unicode)) { - fname.u = eumalloc(len + 1); - memcpy(fname.u, nsname.u, UBYTES(nsname_len)); - fname.u[nsname_len] = '\\'; - memcpy(fname.u + nsname_len + 1, - Z_USTRVAL(method_name->u.constant), - UBYTES(Z_USTRLEN(method_name->u.constant)+1)); - lcname = zend_u_str_case_fold(IS_UNICODE, fname, len, 1, &lcname_len); - opline->extended_value = zend_u_hash_func(IS_UNICODE, lcname, lcname_len + 1); - ZVAL_UNICODEL(&opline->op1.u.constant, lcname.u, lcname_len, 0); - } else { - fname.s = emalloc(len + 1); - memcpy(fname.s, nsname.s, nsname_len); - fname.s[nsname_len] = '\\'; - memcpy(fname.s + nsname_len + 1, - Z_STRVAL(method_name->u.constant), - Z_STRLEN(method_name->u.constant)+1); - lcname = zend_u_str_case_fold(IS_STRING, fname, len, 1, &lcname_len); - opline->extended_value = zend_u_hash_func(IS_STRING, lcname, lcname_len + 1); - ZVAL_STRINGL(&opline->op1.u.constant, lcname.s, lcname_len, 0); - } - efree(fname.v); - } - 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 de438eb647..2901007c5c 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -2016,17 +2016,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) { - /* try a function in namespace */ - zend_op *op_data = opline+1; - - ZEND_VM_INC_OPCODE(); - - if (zend_u_hash_quick_find(EG(function_table), Z_TYPE(op_data->op1.u.constant), Z_UNIVAL(op_data->op1.u.constant), Z_UNILEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { - EX(object) = NULL; - ZEND_VM_NEXT_OPCODE(); - } - + if (OP1_TYPE == IS_CONST) { /* no function found. try a static method in class */ ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(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 ae97d6e65c..b1fd26d296 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -2671,17 +2671,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) { - /* try a function in namespace */ - zend_op *op_data = opline+1; - - ZEND_VM_INC_OPCODE(); - - if (zend_u_hash_quick_find(EG(function_table), Z_TYPE(op_data->op1.u.constant), Z_UNIVAL(op_data->op1.u.constant), Z_UNILEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { - EX(object) = NULL; - ZEND_VM_NEXT_OPCODE(); - } - + if (IS_CONST == IS_CONST) { /* no function found. try a static method in class */ ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) { @@ -3274,17 +3264,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) { - /* try a function in namespace */ - zend_op *op_data = opline+1; - - ZEND_VM_INC_OPCODE(); - - if (zend_u_hash_quick_find(EG(function_table), Z_TYPE(op_data->op1.u.constant), Z_UNIVAL(op_data->op1.u.constant), Z_UNILEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { - EX(object) = NULL; - ZEND_VM_NEXT_OPCODE(); - } - + if (IS_CONST == IS_CONST) { /* no function found. try a static method in class */ ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) { @@ -3756,17 +3736,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) { - /* try a function in namespace */ - zend_op *op_data = opline+1; - - ZEND_VM_INC_OPCODE(); - - if (zend_u_hash_quick_find(EG(function_table), Z_TYPE(op_data->op1.u.constant), Z_UNIVAL(op_data->op1.u.constant), Z_UNILEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { - EX(object) = NULL; - ZEND_VM_NEXT_OPCODE(); - } - + if (IS_CONST == IS_CONST) { /* no function found. try a static method in class */ ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) { @@ -3994,17 +3964,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) { - /* try a function in namespace */ - zend_op *op_data = opline+1; - - ZEND_VM_INC_OPCODE(); - - if (zend_u_hash_quick_find(EG(function_table), Z_TYPE(op_data->op1.u.constant), Z_UNIVAL(op_data->op1.u.constant), Z_UNILEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { - EX(object) = NULL; - ZEND_VM_NEXT_OPCODE(); - } - + if (IS_CONST == IS_CONST) { /* no function found. try a static method in class */ ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) { @@ -4444,17 +4404,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) { - /* try a function in namespace */ - zend_op *op_data = opline+1; - - ZEND_VM_INC_OPCODE(); - - if (zend_u_hash_quick_find(EG(function_table), Z_TYPE(op_data->op1.u.constant), Z_UNIVAL(op_data->op1.u.constant), Z_UNILEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { - EX(object) = NULL; - ZEND_VM_NEXT_OPCODE(); - } - + if (IS_CONST == IS_CONST) { /* no function found. try a static method in class */ ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) { @@ -10771,17 +10721,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) { - /* try a function in namespace */ - zend_op *op_data = opline+1; - - ZEND_VM_INC_OPCODE(); - - if (zend_u_hash_quick_find(EG(function_table), Z_TYPE(op_data->op1.u.constant), Z_UNIVAL(op_data->op1.u.constant), Z_UNILEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { - EX(object) = NULL; - ZEND_VM_NEXT_OPCODE(); - } - + if (IS_VAR == IS_CONST) { /* no function found. try a static method in class */ ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) { @@ -12690,17 +12630,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) { - /* try a function in namespace */ - zend_op *op_data = opline+1; - - ZEND_VM_INC_OPCODE(); - - if (zend_u_hash_quick_find(EG(function_table), Z_TYPE(op_data->op1.u.constant), Z_UNIVAL(op_data->op1.u.constant), Z_UNILEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { - EX(object) = NULL; - ZEND_VM_NEXT_OPCODE(); - } - + if (IS_VAR == IS_CONST) { /* no function found. try a static method in class */ ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) { @@ -14592,17 +14522,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) { - /* try a function in namespace */ - zend_op *op_data = opline+1; - - ZEND_VM_INC_OPCODE(); - - if (zend_u_hash_quick_find(EG(function_table), Z_TYPE(op_data->op1.u.constant), Z_UNIVAL(op_data->op1.u.constant), Z_UNILEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { - EX(object) = NULL; - ZEND_VM_NEXT_OPCODE(); - } - + if (IS_VAR == IS_CONST) { /* no function found. try a static method in class */ ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) { @@ -15577,17 +15497,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) { - /* try a function in namespace */ - zend_op *op_data = opline+1; - - ZEND_VM_INC_OPCODE(); - - if (zend_u_hash_quick_find(EG(function_table), Z_TYPE(op_data->op1.u.constant), Z_UNIVAL(op_data->op1.u.constant), Z_UNILEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { - EX(object) = NULL; - ZEND_VM_NEXT_OPCODE(); - } - + if (IS_VAR == IS_CONST) { /* no function found. try a static method in class */ ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) { @@ -17113,17 +17023,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) { - /* try a function in namespace */ - zend_op *op_data = opline+1; - - ZEND_VM_INC_OPCODE(); - - if (zend_u_hash_quick_find(EG(function_table), Z_TYPE(op_data->op1.u.constant), Z_UNIVAL(op_data->op1.u.constant), Z_UNILEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { - EX(object) = NULL; - ZEND_VM_NEXT_OPCODE(); - } - + if (IS_VAR == IS_CONST) { /* no function found. try a static method in class */ ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) {