Skip to content

Commit 4d616e7

Browse files
committed
Clenaup deprecated namespace code
1 parent fdaba80 commit 4d616e7

File tree

3 files changed

+11
-161
lines changed

3 files changed

+11
-161
lines changed

Zend/zend_compile.c

-40
Original file line numberDiff line numberDiff line change
@@ -2095,7 +2095,6 @@ int zend_do_begin_class_member_function_call(znode *class_name, znode *method_na
20952095
}
20962096

20972097
if (class_name->op_type == IS_CONST &&
2098-
method_name->op_type == IS_CONST &&
20992098
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))) {
21002099
fetch_type = ZEND_FETCH_CLASS_GLOBAL;
21012100
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
21082107
opline->op1 = class_node;
21092108
opline->op2 = *method_name;
21102109

2111-
if (class_node.op_type == IS_CONST &&
2112-
method_name->op_type == IS_CONST) {
2113-
/* Prebuild ns\func name to speedup run-time check.
2114-
The additional names are stored in additional OP_DATA opcode. */
2115-
zstr nsname, fname, lcname;
2116-
unsigned int nsname_len, len, lcname_len;
2117-
2118-
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
2119-
opline->opcode = ZEND_OP_DATA;
2120-
opline->op1.op_type = IS_CONST;
2121-
SET_UNUSED(opline->op2);
2122-
2123-
nsname = Z_UNIVAL(class_node.u.constant);
2124-
nsname_len = Z_UNILEN(class_node.u.constant);
2125-
len = nsname_len + 1 + Z_UNILEN(method_name->u.constant);
2126-
if (UG(unicode)) {
2127-
fname.u = eumalloc(len + 1);
2128-
memcpy(fname.u, nsname.u, UBYTES(nsname_len));
2129-
fname.u[nsname_len] = '\\';
2130-
memcpy(fname.u + nsname_len + 1,
2131-
Z_USTRVAL(method_name->u.constant),
2132-
UBYTES(Z_USTRLEN(method_name->u.constant)+1));
2133-
lcname = zend_u_str_case_fold(IS_UNICODE, fname, len, 1, &lcname_len);
2134-
opline->extended_value = zend_u_hash_func(IS_UNICODE, lcname, lcname_len + 1);
2135-
ZVAL_UNICODEL(&opline->op1.u.constant, lcname.u, lcname_len, 0);
2136-
} else {
2137-
fname.s = emalloc(len + 1);
2138-
memcpy(fname.s, nsname.s, nsname_len);
2139-
fname.s[nsname_len] = '\\';
2140-
memcpy(fname.s + nsname_len + 1,
2141-
Z_STRVAL(method_name->u.constant),
2142-
Z_STRLEN(method_name->u.constant)+1);
2143-
lcname = zend_u_str_case_fold(IS_STRING, fname, len, 1, &lcname_len);
2144-
opline->extended_value = zend_u_hash_func(IS_STRING, lcname, lcname_len + 1);
2145-
ZVAL_STRINGL(&opline->op1.u.constant, lcname.s, lcname_len, 0);
2146-
}
2147-
efree(fname.v);
2148-
}
2149-
21502110
zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(zend_function *));
21512111
zend_do_extended_fcall_begin(TSRMLS_C);
21522112
return 1; /* Dynamic */

Zend/zend_vm_def.h

+1-11
Original file line numberDiff line numberDiff line change
@@ -2016,17 +2016,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUS
20162016

20172017
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope));
20182018

2019-
if (OP1_TYPE == IS_CONST && OP2_TYPE == IS_CONST) {
2020-
/* try a function in namespace */
2021-
zend_op *op_data = opline+1;
2022-
2023-
ZEND_VM_INC_OPCODE();
2024-
2025-
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) {
2026-
EX(object) = NULL;
2027-
ZEND_VM_NEXT_OPCODE();
2028-
}
2029-
2019+
if (OP1_TYPE == IS_CONST) {
20302020
/* no function found. try a static method in class */
20312021
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);
20322022
if (!ce) {

Zend/zend_vm_execute.h

+10-110
Original file line numberDiff line numberDiff line change
@@ -2671,17 +2671,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER(
26712671

26722672
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope));
26732673

2674-
if (IS_CONST == IS_CONST && IS_CONST == IS_CONST) {
2675-
/* try a function in namespace */
2676-
zend_op *op_data = opline+1;
2677-
2678-
ZEND_VM_INC_OPCODE();
2679-
2680-
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) {
2681-
EX(object) = NULL;
2682-
ZEND_VM_NEXT_OPCODE();
2683-
}
2684-
2674+
if (IS_CONST == IS_CONST) {
26852675
/* no function found. try a static method in class */
26862676
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);
26872677
if (!ce) {
@@ -3274,17 +3264,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_TMP_HANDLER(ZE
32743264

32753265
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope));
32763266

3277-
if (IS_CONST == IS_CONST && IS_TMP_VAR == IS_CONST) {
3278-
/* try a function in namespace */
3279-
zend_op *op_data = opline+1;
3280-
3281-
ZEND_VM_INC_OPCODE();
3282-
3283-
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) {
3284-
EX(object) = NULL;
3285-
ZEND_VM_NEXT_OPCODE();
3286-
}
3287-
3267+
if (IS_CONST == IS_CONST) {
32883268
/* no function found. try a static method in class */
32893269
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);
32903270
if (!ce) {
@@ -3756,17 +3736,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_VAR_HANDLER(ZE
37563736

37573737
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope));
37583738

3759-
if (IS_CONST == IS_CONST && IS_VAR == IS_CONST) {
3760-
/* try a function in namespace */
3761-
zend_op *op_data = opline+1;
3762-
3763-
ZEND_VM_INC_OPCODE();
3764-
3765-
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) {
3766-
EX(object) = NULL;
3767-
ZEND_VM_NEXT_OPCODE();
3768-
}
3769-
3739+
if (IS_CONST == IS_CONST) {
37703740
/* no function found. try a static method in class */
37713741
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);
37723742
if (!ce) {
@@ -3994,17 +3964,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_UNUSED_HANDLER
39943964

39953965
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope));
39963966

3997-
if (IS_CONST == IS_CONST && IS_UNUSED == IS_CONST) {
3998-
/* try a function in namespace */
3999-
zend_op *op_data = opline+1;
4000-
4001-
ZEND_VM_INC_OPCODE();
4002-
4003-
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) {
4004-
EX(object) = NULL;
4005-
ZEND_VM_NEXT_OPCODE();
4006-
}
4007-
3967+
if (IS_CONST == IS_CONST) {
40083968
/* no function found. try a static method in class */
40093969
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);
40103970
if (!ce) {
@@ -4444,17 +4404,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CV_HANDLER(ZEN
44444404

44454405
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope));
44464406

4447-
if (IS_CONST == IS_CONST && IS_CV == IS_CONST) {
4448-
/* try a function in namespace */
4449-
zend_op *op_data = opline+1;
4450-
4451-
ZEND_VM_INC_OPCODE();
4452-
4453-
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) {
4454-
EX(object) = NULL;
4455-
ZEND_VM_NEXT_OPCODE();
4456-
}
4457-
4407+
if (IS_CONST == IS_CONST) {
44584408
/* no function found. try a static method in class */
44594409
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);
44604410
if (!ce) {
@@ -10771,17 +10721,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZE
1077110721

1077210722
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope));
1077310723

10774-
if (IS_VAR == IS_CONST && IS_CONST == IS_CONST) {
10775-
/* try a function in namespace */
10776-
zend_op *op_data = opline+1;
10777-
10778-
ZEND_VM_INC_OPCODE();
10779-
10780-
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) {
10781-
EX(object) = NULL;
10782-
ZEND_VM_NEXT_OPCODE();
10783-
}
10784-
10724+
if (IS_VAR == IS_CONST) {
1078510725
/* no function found. try a static method in class */
1078610726
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);
1078710727
if (!ce) {
@@ -12690,17 +12630,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND
1269012630

1269112631
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope));
1269212632

12693-
if (IS_VAR == IS_CONST && IS_TMP_VAR == IS_CONST) {
12694-
/* try a function in namespace */
12695-
zend_op *op_data = opline+1;
12696-
12697-
ZEND_VM_INC_OPCODE();
12698-
12699-
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) {
12700-
EX(object) = NULL;
12701-
ZEND_VM_NEXT_OPCODE();
12702-
}
12703-
12633+
if (IS_VAR == IS_CONST) {
1270412634
/* no function found. try a static method in class */
1270512635
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);
1270612636
if (!ce) {
@@ -14592,17 +14522,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND
1459214522

1459314523
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope));
1459414524

14595-
if (IS_VAR == IS_CONST && IS_VAR == IS_CONST) {
14596-
/* try a function in namespace */
14597-
zend_op *op_data = opline+1;
14598-
14599-
ZEND_VM_INC_OPCODE();
14600-
14601-
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) {
14602-
EX(object) = NULL;
14603-
ZEND_VM_NEXT_OPCODE();
14604-
}
14605-
14525+
if (IS_VAR == IS_CONST) {
1460614526
/* no function found. try a static method in class */
1460714527
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);
1460814528
if (!ce) {
@@ -15577,17 +15497,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_UNUSED_HANDLER(Z
1557715497

1557815498
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope));
1557915499

15580-
if (IS_VAR == IS_CONST && IS_UNUSED == IS_CONST) {
15581-
/* try a function in namespace */
15582-
zend_op *op_data = opline+1;
15583-
15584-
ZEND_VM_INC_OPCODE();
15585-
15586-
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) {
15587-
EX(object) = NULL;
15588-
ZEND_VM_NEXT_OPCODE();
15589-
}
15590-
15500+
if (IS_VAR == IS_CONST) {
1559115501
/* no function found. try a static method in class */
1559215502
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);
1559315503
if (!ce) {
@@ -17113,17 +17023,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_
1711317023

1711417024
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope));
1711517025

17116-
if (IS_VAR == IS_CONST && IS_CV == IS_CONST) {
17117-
/* try a function in namespace */
17118-
zend_op *op_data = opline+1;
17119-
17120-
ZEND_VM_INC_OPCODE();
17121-
17122-
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) {
17123-
EX(object) = NULL;
17124-
ZEND_VM_NEXT_OPCODE();
17125-
}
17126-
17026+
if (IS_VAR == IS_CONST) {
1712717027
/* no function found. try a static method in class */
1712817028
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);
1712917029
if (!ce) {

0 commit comments

Comments
 (0)