Get rid of memcpy() in MAKE_NOP()

This commit is contained in:
Dmitry Stogov 2015-08-06 15:40:40 +03:00
parent ba3eb81240
commit 6d681876ee
2 changed files with 17 additions and 12 deletions

View File

@ -36,11 +36,13 @@
#define SET_UNUSED(op) op ## _type = IS_UNUSED
#define MAKE_NOP(opline) do { \
opline->opcode = ZEND_NOP; \
memset(&opline->result, 0, sizeof(opline->result)); \
memset(&opline->op1, 0, sizeof(opline->op1)); \
memset(&opline->op2, 0, sizeof(opline->op2)); \
opline->result_type = opline->op1_type = opline->op2_type = IS_UNUSED; \
(opline)->op1.num = 0; \
(opline)->op2.num = 0; \
(opline)->result.num = 0; \
(opline)->opcode = ZEND_NOP; \
(opline)->op1_type = IS_UNUSED; \
(opline)->op2_type = IS_UNUSED; \
(opline)->result_type = IS_UNUSED; \
} while (0)
#define RESET_DOC_COMMENT() do { \

View File

@ -34,14 +34,17 @@
#undef MAKE_NOP
#define MAKE_NOP(opline) do { \
#define MAKE_NOP(opline) do { \
(opline)->op1.num = 0; \
(opline)->op2.num = 0; \
(opline)->result.num = 0; \
(opline)->opcode = ZEND_NOP; \
memset(&(opline)->result, 0, sizeof((opline)->result)); \
memset(&(opline)->op1, 0, sizeof((opline)->op1)); \
memset(&(opline)->op2, 0, sizeof((opline)->op2)); \
(opline)->result_type = (opline)->op1_type = (opline)->op2_type=IS_UNUSED; \
zend_vm_set_opcode_handler(opline); \
} while (0);
(opline)->op1_type = IS_UNUSED; \
(opline)->op2_type = IS_UNUSED; \
(opline)->result_type = IS_UNUSED; \
zend_vm_set_opcode_handler(opline); \
} while (0)
#define RESULT_USED(op) (((op->result_type & IS_VAR) && !(op->result_type & EXT_TYPE_UNUSED)) || op->result_type == IS_TMP_VAR)
#define RESULT_UNUSED(op) ((op->result_type & EXT_TYPE_UNUSED) != 0)
#define SAME_VAR(op1, op2) ((((op1 ## _type & IS_VAR) && (op2 ## _type & IS_VAR)) || (op1 ## _type == IS_TMP_VAR && op2 ## _type == IS_TMP_VAR)) && op1.var == op2.var)