daniellansun commented on PR #3226:
URL: https://github.com/apache/groovy/pull/3226#issuecomment-6723607542

   @blackdrag  Thanks, you're right: the temporary in 
`testSubscriptAssignment1` is unnecessary. I have removed the receiver and 
index temporaries from plain subscript assignment. The receiver, index and RHS 
are now evaluated directly in that order as the store arguments, so the 
statement form needs neither a temporary nor a null-out.
   
   When an array assignment is used as a value, the RHS is preserved on the 
operand stack with `DUP_X2` (or `DUP2_X2` for `long`/`double`), before the 
component conversion. A `putAt` assignment expression still needs to preserve 
the RHS across the call, since the assignment must return the RHS rather than 
`putAt`'s return value. That path retains one temporary and clears it 
immediately afterwards; a stack-dup implementation cannot be shared directly 
with the classic callsite backend because of its additional `CallSite` stack 
operand.
   
   Safe-subscript and compound-assignment evaluation behavior is unchanged. I 
added bytecode assertions and regression checks for evaluation order and 
assignment results, including primitive/reference arrays and category-2 values. 
The targeted tests passed, including an indy-disabled run, as did Checkstyle 
and CodeNarc. Full CI is still pending.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to