Change ZEND_RECV and ZEND_RECV_VARIADIC to use extended_value for cache slot (instead of op2), to be consistent with ZEND_RECV_INIT.

This commit is contained in:
Dmitry Stogov 2019-09-23 22:28:56 +03:00
parent 2128c634f6
commit 6e226c188c
6 changed files with 13 additions and 29 deletions

View File

@ -5481,19 +5481,8 @@ void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast) /* {{{ */
}
/* Allocate cache slot to speed-up run-time class resolution */
if (opline->opcode == ZEND_RECV_INIT) {
if (is_class) {
opline->extended_value = zend_alloc_cache_slot();
}
} else if (is_class) {
opline->op2.num = op_array->cache_size;
op_array->cache_size += sizeof(void*);
} else {
opline->op2.num = -1;
}
} else {
if (opline->opcode != ZEND_RECV_INIT) {
opline->op2.num = -1;
if (is_class) {
opline->extended_value = zend_alloc_cache_slot();
}
}
}

View File

@ -5186,7 +5186,7 @@ ZEND_VM_HANDLER(120, ZEND_SEND_USER, CONST|TMP|VAR|CV, NUM)
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
ZEND_VM_HOT_HANDLER(63, ZEND_RECV, NUM, UNUSED|CACHE_SLOT)
ZEND_VM_HOT_HANDLER(63, ZEND_RECV, NUM, UNUSED, CACHE_SLOT)
{
USE_OPLINE
uint32_t arg_num = opline->op1.num;
@ -5199,7 +5199,7 @@ ZEND_VM_HOT_HANDLER(63, ZEND_RECV, NUM, UNUSED|CACHE_SLOT)
zval *param = EX_VAR(opline->result.var);
SAVE_OPLINE();
if (UNEXPECTED(!zend_verify_recv_arg_type(EX(func), arg_num, param, CACHE_ADDR(opline->op2.num)) || EG(exception))) {
if (UNEXPECTED(!zend_verify_recv_arg_type(EX(func), arg_num, param, CACHE_ADDR(opline->extended_value)) || EG(exception))) {
HANDLE_EXCEPTION();
}
}
@ -5254,7 +5254,7 @@ ZEND_VM_HOT_HANDLER(64, ZEND_RECV_INIT, NUM, CONST, CACHE_SLOT)
ZEND_VM_NEXT_OPCODE();
}
ZEND_VM_HANDLER(164, ZEND_RECV_VARIADIC, NUM, UNUSED|CACHE_SLOT)
ZEND_VM_HANDLER(164, ZEND_RECV_VARIADIC, NUM, UNUSED, CACHE_SLOT)
{
USE_OPLINE
uint32_t arg_num = opline->op1.num;
@ -5274,7 +5274,7 @@ ZEND_VM_HANDLER(164, ZEND_RECV_VARIADIC, NUM, UNUSED|CACHE_SLOT)
param = EX_VAR_NUM(EX(func)->op_array.last_var + EX(func)->op_array.T);
if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0)) {
do {
zend_verify_variadic_arg_type(EX(func), arg_num, param, CACHE_ADDR(opline->op2.num));
zend_verify_variadic_arg_type(EX(func), arg_num, param, CACHE_ADDR(opline->extended_value));
if (Z_OPT_REFCOUNTED_P(param)) Z_ADDREF_P(param);
ZEND_HASH_FILL_ADD(param);
param++;

View File

@ -3127,7 +3127,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RECV_SPEC_UNUSED_H
zval *param = EX_VAR(opline->result.var);
SAVE_OPLINE();
if (UNEXPECTED(!zend_verify_recv_arg_type(EX(func), arg_num, param, CACHE_ADDR(opline->op2.num)) || EG(exception))) {
if (UNEXPECTED(!zend_verify_recv_arg_type(EX(func), arg_num, param, CACHE_ADDR(opline->extended_value)) || EG(exception))) {
HANDLE_EXCEPTION();
}
}
@ -3155,7 +3155,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RECV_VARIADIC_SPEC_UNUSED_HAND
param = EX_VAR_NUM(EX(func)->op_array.last_var + EX(func)->op_array.T);
if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0)) {
do {
zend_verify_variadic_arg_type(EX(func), arg_num, param, CACHE_ADDR(opline->op2.num));
zend_verify_variadic_arg_type(EX(func), arg_num, param, CACHE_ADDR(opline->extended_value));
if (Z_OPT_REFCOUNTED_P(param)) Z_ADDREF_P(param);
ZEND_HASH_FILL_ADD(param);
param++;

View File

@ -284,7 +284,7 @@ static uint32_t zend_vm_opcodes_flags[195] = {
0x00000000,
0x01040310,
0x00000003,
0x0000a110,
0x00040110,
0x00040310,
0x00001007,
0x00001001,
@ -385,7 +385,7 @@ static uint32_t zend_vm_opcodes_flags[195] = {
0x00000003,
0x00000020,
0x00003000,
0x0000a110,
0x00040110,
0x00000000,
0x00000003,
0x00000105,

View File

@ -503,15 +503,10 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx
}
switch (opline->opcode) {
case ZEND_RECV_INIT:
if (class_name_type_hint(op_array, opline->op1.num)) {
opline->extended_value = cache_size;
cache_size += sizeof(void *);
}
break;
case ZEND_RECV:
case ZEND_RECV_VARIADIC:
if (class_name_type_hint(op_array, opline->op1.num)) {
opline->op2.num = cache_size;
opline->extended_value = cache_size;
cache_size += sizeof(void *);
}
break;

View File

@ -8980,7 +8980,7 @@ static int zend_jit_recv(dasm_State **Dst, const zend_op *opline, zend_op_array
| jne >9
| mov FCARG1a, r0
| mov r0, EX->run_time_cache
| add r0, opline->op2.num
| add r0, opline->extended_value
| LOAD_ADDR FCARG2a, (ptrdiff_t)op_array
|.if X64WIN
| mov CARG3, arg_num
@ -9011,7 +9011,7 @@ static int zend_jit_recv(dasm_State **Dst, const zend_op *opline, zend_op_array
|9:
| mov FCARG1a, r0
| mov r0, EX->run_time_cache
| add r0, opline->op2.num
| add r0, opline->extended_value
| LOAD_ADDR FCARG2a, (ptrdiff_t)op_array
|.if X64WIN
| mov CARG3, arg_num