@@ -753,6 +753,36 @@ static inline void zend_end_loop(int cont_addr, const znode *var_node) /* {{{ */
753753}
754754/* }}} */
755755
756+ bool zend_op_may_elide_result (uint8_t opcode )
757+ {
758+ switch (opcode ) {
759+ case ZEND_ASSIGN :
760+ case ZEND_ASSIGN_DIM :
761+ case ZEND_ASSIGN_OBJ :
762+ case ZEND_ASSIGN_STATIC_PROP :
763+ case ZEND_ASSIGN_OP :
764+ case ZEND_ASSIGN_DIM_OP :
765+ case ZEND_ASSIGN_OBJ_OP :
766+ case ZEND_ASSIGN_STATIC_PROP_OP :
767+ case ZEND_PRE_INC_STATIC_PROP :
768+ case ZEND_PRE_DEC_STATIC_PROP :
769+ case ZEND_PRE_INC_OBJ :
770+ case ZEND_PRE_DEC_OBJ :
771+ case ZEND_PRE_INC :
772+ case ZEND_PRE_DEC :
773+ case ZEND_DO_FCALL :
774+ case ZEND_DO_ICALL :
775+ case ZEND_DO_UCALL :
776+ case ZEND_DO_FCALL_BY_NAME :
777+ case ZEND_YIELD :
778+ case ZEND_YIELD_FROM :
779+ case ZEND_INCLUDE_OR_EVAL :
780+ return true;
781+ default :
782+ return false;
783+ }
784+ }
785+
756786static void zend_do_free (znode * op1 ) /* {{{ */
757787{
758788 if (op1 -> op_type == IS_TMP_VAR ) {
@@ -779,29 +809,12 @@ static void zend_do_free(znode *op1) /* {{{ */
779809 opline -> opcode -= 2 ;
780810 SET_UNUSED (opline -> result );
781811 return ;
782- case ZEND_ASSIGN :
783- case ZEND_ASSIGN_DIM :
784- case ZEND_ASSIGN_OBJ :
785- case ZEND_ASSIGN_STATIC_PROP :
786- case ZEND_ASSIGN_OP :
787- case ZEND_ASSIGN_DIM_OP :
788- case ZEND_ASSIGN_OBJ_OP :
789- case ZEND_ASSIGN_STATIC_PROP_OP :
790- case ZEND_PRE_INC_STATIC_PROP :
791- case ZEND_PRE_DEC_STATIC_PROP :
792- case ZEND_PRE_INC_OBJ :
793- case ZEND_PRE_DEC_OBJ :
794- case ZEND_PRE_INC :
795- case ZEND_PRE_DEC :
796- case ZEND_DO_FCALL :
797- case ZEND_DO_ICALL :
798- case ZEND_DO_UCALL :
799- case ZEND_DO_FCALL_BY_NAME :
800- case ZEND_YIELD :
801- case ZEND_YIELD_FROM :
802- case ZEND_INCLUDE_OR_EVAL :
803- SET_UNUSED (opline -> result );
804- return ;
812+ default :
813+ if (zend_op_may_elide_result (opline -> opcode )) {
814+ SET_UNUSED (opline -> result );
815+ return ;
816+ }
817+ break ;
805818 }
806819 }
807820
0 commit comments