com php-src: Don't issue FETCH_CLASS for anon classes : Zend/zend_compile.c Zend/zend_vm_def.h Zend /zend_vm_execute.h
| From: | Dmitry Stogov | Date: | Sun, 26 Apr 2015 13:44:48 +0000 |
| Subject: | com php-src: Don't issue FETCH_CLASS for anon classes : Zend/zend_compile.c Zend/zend_vm_def.h Zend /zend_vm_execute.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-86497@lists.php.net to get a copy of this message | ||
Commit: 03d7042d5cd8b080eb945860626f6ab47b0658f8
Author: Nikita Popov <nikic@php.net> Sun, 26 Apr 2015 15:36:40 +0200
Parents: 929fdc1c1ae9610ea08689c5dbe84819261ff1eb
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=03d7042d5cd8b080eb945860626f6ab47b0658f8
Log:
Don't issue FETCH_CLASS for anon classes
Changed paths:
M Zend/zend_compile.c
M Zend/zend_vm_def.h
M Zend/zend_vm_execute.h
Diff:
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index e596f5b..f4f8e77 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -3257,22 +3257,9 @@ void zend_compile_new(znode *result, zend_ast *ast) /* {{{ */
class_node.op_type = IS_CONST;
ZVAL_STR(&class_node.u.constant, zend_resolve_class_name_ast(class_ast));
} else if (class_ast->kind == ZEND_AST_CLASS) {
- zend_class_entry *ce =
- zend_compile_class_decl(class_ast TSRMLS_CC);
- zend_string *name = ce->name;
- uint32_t fetch_type = zend_get_class_fetch_type(name);
-
- opline = zend_emit_op(&class_node,
- ZEND_FETCH_CLASS, NULL, NULL TSRMLS_CC);
- opline->extended_value = fetch_type;
-
- if (fetch_type == ZEND_FETCH_CLASS_DEFAULT) {
- opline->op2_type = IS_CONST;
- opline->op2.constant = zend_add_class_name_literal(CG(active_op_array),
- zend_resolve_class_name(name, ZEND_NAME_FQ TSRMLS_CC) TSRMLS_CC);
- }
-
- zend_string_release(name);
+ zend_class_entry *ce = zend_compile_class_decl(class_ast TSRMLS_CC);
+ class_node.op_type = IS_CONST;
+ ZVAL_STR_COPY(&class_node.u.constant, ce->name);
} else {
zend_compile_class_ref(&class_node, class_ast, 1);
}
@@ -4938,7 +4925,7 @@ zend_class_entry *zend_compile_class_decl(zend_ast *ast) /* {{{ */
zend_class_entry *active = CG(active_class_entry);
if (decl->flags & ZEND_ACC_ANON_CLASS) {
- name = zend_generate_anon_class_name();
+ decl->name = name = zend_generate_anon_class_name();
/* Serialization is not supported for anonymous classes */
ce->serialize = zend_class_serialize_deny;
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index 4c8f988..6835906 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -6725,7 +6725,7 @@ ZEND_VM_HANDLER(139, ZEND_DECLARE_CLASS, ANY, ANY)
Z_CE_P(EX_VAR(opline->result.var)) = do_bind_class(&EX(func)->op_array, opline,
EG(class_table), 0);
if (Z_CE_P(EX_VAR(opline->result.var))->ce_flags & ZEND_ACC_ANON_CLASS) {
if (Z_CE_P(EX_VAR(opline->result.var))->ce_flags & ZEND_ACC_ANON_BOUND) {
- while (opline->opcode != ZEND_FETCH_CLASS) {
+ while (opline->opcode != ZEND_NEW) {
opline++;
}
ZEND_VM_JMP(opline);
@@ -6743,7 +6743,7 @@ ZEND_VM_HANDLER(140, ZEND_DECLARE_INHERITED_CLASS, ANY, ANY)
Z_CE_P(EX_VAR(opline->result.var)) = do_bind_inherited_class(&EX(func)->op_array,
opline, EG(class_table), Z_CE_P(EX_VAR(opline->extended_value)), 0);
if (Z_CE_P(EX_VAR(opline->result.var))->ce_flags & ZEND_ACC_ANON_CLASS) {
if (Z_CE_P(EX_VAR(opline->result.var))->ce_flags & ZEND_ACC_ANON_BOUND) {
- while (opline->opcode != ZEND_FETCH_CLASS) {
+ while (opline->opcode != ZEND_NEW) {
opline++;
}
ZEND_VM_JMP(opline);
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index 0dfe42a..6a0c4bb 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -1307,7 +1307,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL
ZEND_DECLARE_CLASS_SPEC_HANDLER(ZEN
Z_CE_P(EX_VAR(opline->result.var)) = do_bind_class(&EX(func)->op_array, opline,
EG(class_table), 0);
if (Z_CE_P(EX_VAR(opline->result.var))->ce_flags & ZEND_ACC_ANON_CLASS) {
if (Z_CE_P(EX_VAR(opline->result.var))->ce_flags & ZEND_ACC_ANON_BOUND) {
- while (opline->opcode != ZEND_FETCH_CLASS) {
+ while (opline->opcode != ZEND_NEW) {
opline++;
}
ZEND_VM_JMP(opline);
@@ -1325,7 +1325,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL
ZEND_DECLARE_INHERITED_CLASS_SPEC_H
Z_CE_P(EX_VAR(opline->result.var)) = do_bind_inherited_class(&EX(func)->op_array,
opline, EG(class_table), Z_CE_P(EX_VAR(opline->extended_value)), 0);
if (Z_CE_P(EX_VAR(opline->result.var))->ce_flags & ZEND_ACC_ANON_CLASS) {
if (Z_CE_P(EX_VAR(opline->result.var))->ce_flags & ZEND_ACC_ANON_BOUND) {
- while (opline->opcode != ZEND_FETCH_CLASS) {
+ while (opline->opcode != ZEND_NEW) {
opline++;
}
ZEND_VM_JMP(opline);