Skip to content

Commit e2c3c7a

Browse files
committed
Clenaup deprecated namespace code
1 parent 5dc46cc commit e2c3c7a

File tree

3 files changed

+11
-90
lines changed

3 files changed

+11
-90
lines changed

Zend/zend_compile.c

-46
Original file line numberDiff line numberDiff line change
@@ -1990,25 +1990,6 @@ int zend_do_begin_class_member_function_call(znode *class_name, znode *method_na
19901990
zend_op *opline;
19911991
ulong fetch_type = 0;
19921992

1993-
#if 0
1994-
if (class_name->op_type == IS_CONST &&
1995-
Z_TYPE(class_name->u.constant) == IS_STRING &&
1996-
Z_STRLEN(class_name->u.constant) == 0) {
1997-
/* namespace\func() not in namespace */
1998-
zval_dtor(&class_name->u.constant);
1999-
if (CG(current_namespace)) {
2000-
znode tmp;
2001-
2002-
tmp.op_type = IS_CONST;
2003-
tmp.u.constant = *CG(current_namespace);
2004-
zval_copy_ctor(&tmp.u.constant);
2005-
zend_do_build_namespace_name(&tmp, &tmp, method_name TSRMLS_CC);
2006-
*method_name = tmp;
2007-
}
2008-
return zend_do_begin_function_call(method_name, 0 TSRMLS_CC);
2009-
}
2010-
#endif
2011-
20121993
if (method_name->op_type == IS_CONST) {
20131994
char *lcname = zend_str_tolower_dup(Z_STRVAL(method_name->u.constant), Z_STRLEN(method_name->u.constant));
20141995
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
20202001
}
20212002

20222003
if (class_name->op_type == IS_CONST &&
2023-
method_name->op_type == IS_CONST &&
20242004
ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant))) {
20252005
fetch_type = ZEND_FETCH_CLASS_GLOBAL;
20262006
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
20332013
opline->op1 = class_node;
20342014
opline->op2 = *method_name;
20352015

2036-
if (class_node.op_type == IS_CONST &&
2037-
method_name->op_type == IS_CONST) {
2038-
/* Prebuild ns\func name to speedup run-time check.
2039-
The additional names are stored in additional OP_DATA opcode. */
2040-
char *nsname, *fname;
2041-
unsigned int nsname_len, len;
2042-
2043-
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
2044-
opline->opcode = ZEND_OP_DATA;
2045-
opline->op1.op_type = IS_CONST;
2046-
SET_UNUSED(opline->op2);
2047-
2048-
nsname = Z_STRVAL(class_node.u.constant);
2049-
nsname_len = Z_STRLEN(class_node.u.constant);
2050-
len = nsname_len + 1 + Z_STRLEN(method_name->u.constant);
2051-
fname = emalloc(len + 1);
2052-
memcpy(fname, nsname, nsname_len);
2053-
fname[nsname_len] = '\\';
2054-
memcpy(fname + nsname_len + 1,
2055-
Z_STRVAL(method_name->u.constant),
2056-
Z_STRLEN(method_name->u.constant)+1);
2057-
zend_str_tolower(fname, len);
2058-
opline->extended_value = zend_hash_func(fname, len + 1);
2059-
ZVAL_STRINGL(&opline->op1.u.constant, fname, len, 0);
2060-
}
2061-
20622016
zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(zend_function *));
20632017
zend_do_extended_fcall_begin(TSRMLS_C);
20642018
return 1; /* Dynamic */

Zend/zend_vm_def.h

+1-4
Original file line numberDiff line numberDiff line change
@@ -1961,10 +1961,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUS
19611961

19621962
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope));
19631963

1964-
if (OP1_TYPE == IS_CONST && OP2_TYPE == IS_CONST) {
1965-
1966-
ZEND_VM_INC_OPCODE();
1967-
1964+
if (OP1_TYPE == IS_CONST) {
19681965
/* no function found. try a static method in class */
19691966
ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC);
19701967
if (!ce) {

Zend/zend_vm_execute.h

+10-40
Original file line numberDiff line numberDiff line change
@@ -2593,10 +2593,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER(
25932593

25942594
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope));
25952595

2596-
if (IS_CONST == IS_CONST && IS_CONST == IS_CONST) {
2597-
2598-
ZEND_VM_INC_OPCODE();
2599-
2596+
if (IS_CONST == IS_CONST) {
26002597
/* no function found. try a static method in class */
26012598
ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC);
26022599
if (!ce) {
@@ -3169,10 +3166,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_TMP_HANDLER(ZE
31693166

31703167
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope));
31713168

3172-
if (IS_CONST == IS_CONST && IS_TMP_VAR == IS_CONST) {
3173-
3174-
ZEND_VM_INC_OPCODE();
3175-
3169+
if (IS_CONST == IS_CONST) {
31763170
/* no function found. try a static method in class */
31773171
ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC);
31783172
if (!ce) {
@@ -3640,10 +3634,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_VAR_HANDLER(ZE
36403634

36413635
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope));
36423636

3643-
if (IS_CONST == IS_CONST && IS_VAR == IS_CONST) {
3644-
3645-
ZEND_VM_INC_OPCODE();
3646-
3637+
if (IS_CONST == IS_CONST) {
36473638
/* no function found. try a static method in class */
36483639
ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC);
36493640
if (!ce) {
@@ -3867,10 +3858,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_UNUSED_HANDLER
38673858

38683859
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope));
38693860

3870-
if (IS_CONST == IS_CONST && IS_UNUSED == IS_CONST) {
3871-
3872-
ZEND_VM_INC_OPCODE();
3873-
3861+
if (IS_CONST == IS_CONST) {
38743862
/* no function found. try a static method in class */
38753863
ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC);
38763864
if (!ce) {
@@ -4306,10 +4294,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CV_HANDLER(ZEN
43064294

43074295
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope));
43084296

4309-
if (IS_CONST == IS_CONST && IS_CV == IS_CONST) {
4310-
4311-
ZEND_VM_INC_OPCODE();
4312-
4297+
if (IS_CONST == IS_CONST) {
43134298
/* no function found. try a static method in class */
43144299
ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC);
43154300
if (!ce) {
@@ -10323,10 +10308,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZE
1032310308

1032410309
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope));
1032510310

10326-
if (IS_VAR == IS_CONST && IS_CONST == IS_CONST) {
10327-
10328-
ZEND_VM_INC_OPCODE();
10329-
10311+
if (IS_VAR == IS_CONST) {
1033010312
/* no function found. try a static method in class */
1033110313
ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC);
1033210314
if (!ce) {
@@ -12162,10 +12144,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND
1216212144

1216312145
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope));
1216412146

12165-
if (IS_VAR == IS_CONST && IS_TMP_VAR == IS_CONST) {
12166-
12167-
ZEND_VM_INC_OPCODE();
12168-
12147+
if (IS_VAR == IS_CONST) {
1216912148
/* no function found. try a static method in class */
1217012149
ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC);
1217112150
if (!ce) {
@@ -13996,10 +13975,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND
1399613975

1399713976
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope));
1399813977

13999-
if (IS_VAR == IS_CONST && IS_VAR == IS_CONST) {
14000-
14001-
ZEND_VM_INC_OPCODE();
14002-
13978+
if (IS_VAR == IS_CONST) {
1400313979
/* no function found. try a static method in class */
1400413980
ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC);
1400513981
if (!ce) {
@@ -14918,10 +14894,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_UNUSED_HANDLER(Z
1491814894

1491914895
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope));
1492014896

14921-
if (IS_VAR == IS_CONST && IS_UNUSED == IS_CONST) {
14922-
14923-
ZEND_VM_INC_OPCODE();
14924-
14897+
if (IS_VAR == IS_CONST) {
1492514898
/* no function found. try a static method in class */
1492614899
ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC);
1492714900
if (!ce) {
@@ -16439,10 +16412,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_
1643916412

1644016413
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope));
1644116414

16442-
if (IS_VAR == IS_CONST && IS_CV == IS_CONST) {
16443-
16444-
ZEND_VM_INC_OPCODE();
16445-
16415+
if (IS_VAR == IS_CONST) {
1644616416
/* no function found. try a static method in class */
1644716417
ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC);
1644816418
if (!ce) {

0 commit comments

Comments
 (0)