mirror of
https://github.com/php/php-src.git
synced 2025-01-21 11:13:38 +08:00
Drop ZEND_PRINT opcode in favor of ZEND_ECHO
The return value long(1) is an IS_CONST operand now.
This commit is contained in:
parent
4b943c9c0d
commit
0f815642e0
@ -5361,7 +5361,10 @@ void zend_compile_print(znode *result, zend_ast *ast) /* {{{ */
|
||||
znode expr_node;
|
||||
zend_compile_expr(&expr_node, expr_ast);
|
||||
|
||||
zend_emit_op_tmp(result, ZEND_PRINT, &expr_node, NULL);
|
||||
zend_emit_op(NULL, ZEND_ECHO, &expr_node, NULL);
|
||||
|
||||
result->op_type = IS_CONST;
|
||||
ZVAL_LONG(&result->u.constant, 1);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
@ -1085,14 +1085,6 @@ ZEND_VM_HANDLER(40, ZEND_ECHO, CONST|TMPVAR|CV, ANY)
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
ZEND_VM_HANDLER(41, ZEND_PRINT, CONST|TMPVAR|CV, ANY)
|
||||
{
|
||||
USE_OPLINE
|
||||
|
||||
ZVAL_LONG(EX_VAR(opline->result.var), 1);
|
||||
ZEND_VM_DISPATCH_TO_HANDLER(ZEND_ECHO);
|
||||
}
|
||||
|
||||
ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMPVAR|CV, UNUSED|CONST|VAR, int type)
|
||||
{
|
||||
USE_OPLINE
|
||||
|
@ -2319,14 +2319,6 @@ static int ZEND_FASTCALL ZEND_ECHO_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_PRINT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
|
||||
ZVAL_LONG(EX_VAR(opline->result.var), 1);
|
||||
return ZEND_ECHO_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_JMPZ_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
@ -23013,14 +23005,6 @@ static int ZEND_FASTCALL ZEND_ECHO_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_PRINT_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
|
||||
ZVAL_LONG(EX_VAR(opline->result.var), 1);
|
||||
return ZEND_ECHO_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_JMPZ_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
@ -32379,14 +32363,6 @@ static int ZEND_FASTCALL ZEND_ECHO_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_PRINT_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
|
||||
ZVAL_LONG(EX_VAR(opline->result.var), 1);
|
||||
return ZEND_ECHO_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_JMPZ_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
@ -36825,31 +36801,31 @@ void zend_init_opcodes_handlers(void)
|
||||
ZEND_ECHO_SPEC_CV_HANDLER,
|
||||
ZEND_ECHO_SPEC_CV_HANDLER,
|
||||
ZEND_ECHO_SPEC_CV_HANDLER,
|
||||
ZEND_PRINT_SPEC_CONST_HANDLER,
|
||||
ZEND_PRINT_SPEC_CONST_HANDLER,
|
||||
ZEND_PRINT_SPEC_CONST_HANDLER,
|
||||
ZEND_PRINT_SPEC_CONST_HANDLER,
|
||||
ZEND_PRINT_SPEC_CONST_HANDLER,
|
||||
ZEND_PRINT_SPEC_TMPVAR_HANDLER,
|
||||
ZEND_PRINT_SPEC_TMPVAR_HANDLER,
|
||||
ZEND_PRINT_SPEC_TMPVAR_HANDLER,
|
||||
ZEND_PRINT_SPEC_TMPVAR_HANDLER,
|
||||
ZEND_PRINT_SPEC_TMPVAR_HANDLER,
|
||||
ZEND_PRINT_SPEC_TMPVAR_HANDLER,
|
||||
ZEND_PRINT_SPEC_TMPVAR_HANDLER,
|
||||
ZEND_PRINT_SPEC_TMPVAR_HANDLER,
|
||||
ZEND_PRINT_SPEC_TMPVAR_HANDLER,
|
||||
ZEND_PRINT_SPEC_TMPVAR_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_PRINT_SPEC_CV_HANDLER,
|
||||
ZEND_PRINT_SPEC_CV_HANDLER,
|
||||
ZEND_PRINT_SPEC_CV_HANDLER,
|
||||
ZEND_PRINT_SPEC_CV_HANDLER,
|
||||
ZEND_PRINT_SPEC_CV_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_JMP_SPEC_HANDLER,
|
||||
ZEND_JMP_SPEC_HANDLER,
|
||||
ZEND_JMP_SPEC_HANDLER,
|
||||
|
@ -63,7 +63,7 @@ const char *zend_vm_opcodes_map[170] = {
|
||||
"ZEND_ASSIGN",
|
||||
"ZEND_ASSIGN_REF",
|
||||
"ZEND_ECHO",
|
||||
"ZEND_PRINT",
|
||||
NULL,
|
||||
"ZEND_JMP",
|
||||
"ZEND_JMPZ",
|
||||
"ZEND_JMPNZ",
|
||||
|
@ -68,7 +68,6 @@ END_EXTERN_C()
|
||||
#define ZEND_ASSIGN 38
|
||||
#define ZEND_ASSIGN_REF 39
|
||||
#define ZEND_ECHO 40
|
||||
#define ZEND_PRINT 41
|
||||
#define ZEND_JMP 42
|
||||
#define ZEND_JMPZ 43
|
||||
#define ZEND_JMPNZ 44
|
||||
|
@ -645,24 +645,8 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
|
||||
MAKE_NOP(src);
|
||||
}
|
||||
|
||||
/* T = PRINT(X), F(T) => ECHO(X), F(1) */
|
||||
if (ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
|
||||
VAR_SOURCE(opline->op1) &&
|
||||
VAR_SOURCE(opline->op1)->opcode == ZEND_PRINT &&
|
||||
opline->opcode != ZEND_CASE && opline->opcode != ZEND_FREE) {
|
||||
ZEND_OP1_TYPE(opline) = IS_CONST;
|
||||
LITERAL_LONG(opline->op1, 1);
|
||||
}
|
||||
|
||||
if (ZEND_OP2_TYPE(opline) == IS_TMP_VAR &&
|
||||
VAR_SOURCE(opline->op2) &&
|
||||
VAR_SOURCE(opline->op2)->opcode == ZEND_PRINT) {
|
||||
ZEND_OP2_TYPE(opline) = IS_CONST;
|
||||
LITERAL_LONG(opline->op2, 1);
|
||||
}
|
||||
|
||||
/* T = CAST(X, String), ECHO(T) => NOP, ECHO(X) */
|
||||
if ((opline->opcode == ZEND_ECHO || opline->opcode == ZEND_PRINT) &&
|
||||
if (opline->opcode == ZEND_ECHO &&
|
||||
ZEND_OP1_TYPE(opline) & (IS_TMP_VAR|IS_VAR) &&
|
||||
VAR_SOURCE(opline->op1) &&
|
||||
VAR_SOURCE(opline->op1)->opcode == ZEND_CAST &&
|
||||
@ -672,18 +656,6 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
|
||||
MAKE_NOP(src);
|
||||
}
|
||||
|
||||
/* T = PRINT(X), FREE(T) => ECHO(X) */
|
||||
if (opline->opcode == ZEND_FREE &&
|
||||
ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
|
||||
VAR_SOURCE(opline->op1)) {
|
||||
zend_op *src = VAR_SOURCE(opline->op1);
|
||||
if (src->opcode == ZEND_PRINT) {
|
||||
src->opcode = ZEND_ECHO;
|
||||
ZEND_RESULT_TYPE(src) = IS_UNUSED;
|
||||
MAKE_NOP(opline);
|
||||
}
|
||||
}
|
||||
|
||||
/* T = BOOL(X), FREE(T) => NOP */
|
||||
if (opline->opcode == ZEND_FREE &&
|
||||
ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
|
||||
@ -1859,10 +1831,6 @@ static void zend_t_usage(zend_code_block *block, zend_op_array *op_array, char *
|
||||
}
|
||||
MAKE_NOP(opline);
|
||||
break;
|
||||
case ZEND_PRINT:
|
||||
opline->opcode = ZEND_ECHO;
|
||||
ZEND_RESULT_TYPE(opline) = IS_UNUSED;
|
||||
break;
|
||||
case ZEND_JMPZ_EX:
|
||||
case ZEND_JMPNZ_EX:
|
||||
opline->opcode -= 3;
|
||||
|
Loading…
Reference in New Issue
Block a user