mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Changed FETCH_CONSTANT instruction format (extended_value moved into op1)
This commit is contained in:
@@ -7724,9 +7724,9 @@ void zend_compile_const(znode *result, zend_ast *ast) /* {{{ */
|
||||
opline->op2.constant = zend_add_const_name_literal(
|
||||
CG(active_op_array), resolved_name, 0);
|
||||
} else {
|
||||
opline->extended_value = IS_CONSTANT_UNQUALIFIED;
|
||||
opline->op1.num = IS_CONSTANT_UNQUALIFIED;
|
||||
if (FC(current_namespace)) {
|
||||
opline->extended_value |= IS_CONSTANT_IN_NAMESPACE;
|
||||
opline->op1.num |= IS_CONSTANT_IN_NAMESPACE;
|
||||
opline->op2.constant = zend_add_const_name_literal(
|
||||
CG(active_op_array), resolved_name, 1);
|
||||
} else {
|
||||
|
||||
@@ -4987,17 +4987,17 @@ ZEND_VM_HANDLER(110, ZEND_CLONE, CONST|TMPVAR|UNUSED|THIS|CV, ANY)
|
||||
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
|
||||
}
|
||||
|
||||
ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, UNUSED, CONST, CONST_FETCH)
|
||||
ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, UNUSED|CONST_FETCH, CONST)
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_constant *c;
|
||||
|
||||
if (EXPECTED(CACHED_PTR(Z_CACHE_SLOT_P(RT_CONSTANT(opline, opline->op2))))) {
|
||||
c = CACHED_PTR(Z_CACHE_SLOT_P(RT_CONSTANT(opline, opline->op2)));
|
||||
} else if ((c = zend_quick_get_constant(RT_CONSTANT(opline, opline->op2) + 1, opline->extended_value)) == NULL) {
|
||||
} else if ((c = zend_quick_get_constant(RT_CONSTANT(opline, opline->op2) + 1, opline->op1.num)) == NULL) {
|
||||
SAVE_OPLINE();
|
||||
|
||||
if ((opline->extended_value & IS_CONSTANT_UNQUALIFIED) != 0) {
|
||||
if ((opline->op1.num & IS_CONSTANT_UNQUALIFIED) != 0) {
|
||||
char *actual = (char *)zend_memrchr(Z_STRVAL_P(RT_CONSTANT(opline, opline->op2)), '\\', Z_STRLEN_P(RT_CONSTANT(opline, opline->op2)));
|
||||
if (!actual) {
|
||||
ZVAL_STR_COPY(EX_VAR(opline->result.var), Z_STR_P(RT_CONSTANT(opline, opline->op2)));
|
||||
|
||||
@@ -33271,10 +33271,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CON
|
||||
|
||||
if (EXPECTED(CACHED_PTR(Z_CACHE_SLOT_P(RT_CONSTANT(opline, opline->op2))))) {
|
||||
c = CACHED_PTR(Z_CACHE_SLOT_P(RT_CONSTANT(opline, opline->op2)));
|
||||
} else if ((c = zend_quick_get_constant(RT_CONSTANT(opline, opline->op2) + 1, opline->extended_value)) == NULL) {
|
||||
} else if ((c = zend_quick_get_constant(RT_CONSTANT(opline, opline->op2) + 1, opline->op1.num)) == NULL) {
|
||||
SAVE_OPLINE();
|
||||
|
||||
if ((opline->extended_value & IS_CONSTANT_UNQUALIFIED) != 0) {
|
||||
if ((opline->op1.num & IS_CONSTANT_UNQUALIFIED) != 0) {
|
||||
char *actual = (char *)zend_memrchr(Z_STRVAL_P(RT_CONSTANT(opline, opline->op2)), '\\', Z_STRLEN_P(RT_CONSTANT(opline, opline->op2)));
|
||||
if (!actual) {
|
||||
ZVAL_STR_COPY(EX_VAR(opline->result.var), Z_STR_P(RT_CONSTANT(opline, opline->op2)));
|
||||
|
||||
@@ -69,6 +69,7 @@ $vm_op_flags = array(
|
||||
"ZEND_VM_OP_NEXT" => 0x60,
|
||||
"ZEND_VM_OP_CLASS_FETCH" => 0x70,
|
||||
"ZEND_VM_OP_CONSTRUCTOR" => 0x80,
|
||||
"ZEND_VM_OP_CONST_FETCH" => 0x90,
|
||||
|
||||
"ZEND_VM_EXT_VAR_FETCH" => 1<<16,
|
||||
"ZEND_VM_EXT_ISSET" => 1<<17,
|
||||
@@ -81,7 +82,7 @@ $vm_op_flags = array(
|
||||
"ZEND_VM_EXT_JMP_ADDR" => 0x03000000,
|
||||
"ZEND_VM_EXT_DIM_OBJ" => 0x04000000,
|
||||
// unused 0x5000000
|
||||
"ZEND_VM_EXT_CONST_FETCH" => 0x06000000,
|
||||
// unused 0x6000000
|
||||
"ZEND_VM_EXT_TYPE" => 0x07000000,
|
||||
"ZEND_VM_EXT_EVAL" => 0x08000000,
|
||||
"ZEND_VM_EXT_TYPE_MASK" => 0x09000000,
|
||||
@@ -113,13 +114,13 @@ $vm_op_decode = array(
|
||||
"NEXT" => ZEND_VM_OP_NEXT,
|
||||
"CLASS_FETCH" => ZEND_VM_OP_CLASS_FETCH,
|
||||
"CONSTRUCTOR" => ZEND_VM_OP_CONSTRUCTOR,
|
||||
"CONST_FETCH" => ZEND_VM_OP_CONST_FETCH,
|
||||
);
|
||||
|
||||
$vm_ext_decode = array(
|
||||
"NUM" => ZEND_VM_EXT_NUM,
|
||||
"JMP_ADDR" => ZEND_VM_EXT_JMP_ADDR,
|
||||
"DIM_OBJ" => ZEND_VM_EXT_DIM_OBJ,
|
||||
"CONST_FETCH" => ZEND_VM_EXT_CONST_FETCH,
|
||||
"VAR_FETCH" => ZEND_VM_EXT_VAR_FETCH,
|
||||
"ARRAY_INIT" => ZEND_VM_EXT_ARRAY_INIT,
|
||||
"TYPE" => ZEND_VM_EXT_TYPE,
|
||||
|
||||
@@ -323,7 +323,7 @@ static uint32_t zend_vm_opcodes_flags[199] = {
|
||||
0x00000701,
|
||||
0x00000751,
|
||||
0x0000070b,
|
||||
0x06000301,
|
||||
0x00000391,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#define ZEND_VM_OP_NEXT 0x00000060
|
||||
#define ZEND_VM_OP_CLASS_FETCH 0x00000070
|
||||
#define ZEND_VM_OP_CONSTRUCTOR 0x00000080
|
||||
#define ZEND_VM_OP_CONST_FETCH 0x00000090
|
||||
#define ZEND_VM_EXT_VAR_FETCH 0x00010000
|
||||
#define ZEND_VM_EXT_ISSET 0x00020000
|
||||
#define ZEND_VM_EXT_ARG_NUM 0x00040000
|
||||
@@ -56,7 +57,6 @@
|
||||
#define ZEND_VM_EXT_NUM 0x01000000
|
||||
#define ZEND_VM_EXT_JMP_ADDR 0x03000000
|
||||
#define ZEND_VM_EXT_DIM_OBJ 0x04000000
|
||||
#define ZEND_VM_EXT_CONST_FETCH 0x06000000
|
||||
#define ZEND_VM_EXT_TYPE 0x07000000
|
||||
#define ZEND_VM_EXT_EVAL 0x08000000
|
||||
#define ZEND_VM_EXT_TYPE_MASK 0x09000000
|
||||
|
||||
@@ -181,7 +181,7 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx
|
||||
LITERAL_INFO(opline->op1.constant, LITERAL_CONST, 1, 1, 2);
|
||||
break;
|
||||
case ZEND_FETCH_CONSTANT:
|
||||
if ((opline->extended_value & (IS_CONSTANT_IN_NAMESPACE|IS_CONSTANT_UNQUALIFIED)) == (IS_CONSTANT_IN_NAMESPACE|IS_CONSTANT_UNQUALIFIED)) {
|
||||
if ((opline->op1.num & (IS_CONSTANT_IN_NAMESPACE|IS_CONSTANT_UNQUALIFIED)) == (IS_CONSTANT_IN_NAMESPACE|IS_CONSTANT_UNQUALIFIED)) {
|
||||
LITERAL_INFO(opline->op2.constant, LITERAL_CONST, 1, 1, 5);
|
||||
} else {
|
||||
LITERAL_INFO(opline->op2.constant, LITERAL_CONST, 1, 1, 3);
|
||||
|
||||
@@ -130,6 +130,13 @@ static void zend_dump_unused_op(const zend_op *opline, znode_op op, uint32_t fla
|
||||
zend_dump_class_fetch_type(op.num);
|
||||
} else if (ZEND_VM_OP_CONSTRUCTOR == (flags & ZEND_VM_OP_MASK)) {
|
||||
fprintf(stderr, " CONSTRUCTOR");
|
||||
} else if (ZEND_VM_OP_CONST_FETCH == (flags & ZEND_VM_EXT_MASK)) {
|
||||
if (op.num & IS_CONSTANT_UNQUALIFIED) {
|
||||
fprintf(stderr, " (unqualified)");
|
||||
}
|
||||
if (op.num & IS_CONSTANT_IN_NAMESPACE) {
|
||||
fprintf(stderr, " (in-namespace)");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -449,13 +456,6 @@ static void zend_dump_op(const zend_op_array *op_array, const zend_basic_block *
|
||||
} else if (opline->extended_value == ZEND_ASSIGN_OBJ) {
|
||||
fprintf(stderr, " (obj)");
|
||||
}
|
||||
} else if (ZEND_VM_EXT_CONST_FETCH == (flags & ZEND_VM_EXT_MASK)) {
|
||||
if (opline->extended_value & IS_CONSTANT_UNQUALIFIED) {
|
||||
fprintf(stderr, " (unqualified)");
|
||||
}
|
||||
if (opline->extended_value & IS_CONSTANT_IN_NAMESPACE) {
|
||||
fprintf(stderr, " (in-namespace)");
|
||||
}
|
||||
} else if (ZEND_VM_EXT_TYPE == (flags & ZEND_VM_EXT_MASK)) {
|
||||
switch (opline->extended_value) {
|
||||
case IS_NULL:
|
||||
|
||||
@@ -276,7 +276,6 @@ int zend_optimizer_update_op1_const(zend_op_array *op_array,
|
||||
return 0;
|
||||
case ZEND_INIT_STATIC_METHOD_CALL:
|
||||
case ZEND_CATCH:
|
||||
case ZEND_FETCH_CONSTANT:
|
||||
case ZEND_FETCH_CLASS_CONSTANT:
|
||||
case ZEND_DEFINED:
|
||||
case ZEND_NEW:
|
||||
|
||||
Reference in New Issue
Block a user