com php-src: Get rid of memcpy() in MAKE_NOP(): Zend/ zend_compile.h ext/opcache/Optimizer/zend_optimizer_i nternal.h
| From: | Joe Watkins | Date: | Thu, 06 Aug 2015 12:40:40 +0000 |
| Subject: | com php-src: Get rid of memcpy() in MAKE_NOP(): Zend/ zend_compile.h ext/opcache/Optimizer/zend_optimizer_i nternal.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-88598@lists.php.net to get a copy of this message | ||
Commit: 6d681876eed27e4d048b64f51188a64efcd2aff4
Author: Dmitry Stogov <dmitry@zend.com> Thu, 6 Aug 2015 15:40:40 +0300
Parents: ba3eb812401d20c039ee9a165429772651d417e3
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=6d681876eed27e4d048b64f51188a64efcd2aff4
Log:
Get rid of memcpy() in MAKE_NOP()
Changed paths:
M Zend/zend_compile.h
M ext/opcache/Optimizer/zend_optimizer_internal.h
Diff:
diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h
index 2db45e5..e3c2b00 100644
--- a/Zend/zend_compile.h
+++ b/Zend/zend_compile.h
@@ -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 { \
diff --git a/ext/opcache/Optimizer/zend_optimizer_internal.h
b/ext/opcache/Optimizer/zend_optimizer_internal.h
index c2f97ff..ca45267 100644
--- a/ext/opcache/Optimizer/zend_optimizer_internal.h
+++ b/ext/opcache/Optimizer/zend_optimizer_internal.h
@@ -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)