@@ -5479,8 +5479,28 @@ private static <T> void moveFromStack(VirtualFrame virtualFrame, int start, int
54795479 }
54805480 }
54815481
5482- @ BytecodeInterpreterSwitch
54835482 @ ExplodeLoop
5483+ private static void moveFromStack (VirtualFrame virtualFrame , int start , int stop , PSet target , HashingCollectionNodes .SetItemNode setItem ) {
5484+ CompilerAsserts .partialEvaluationConstant (start );
5485+ CompilerAsserts .partialEvaluationConstant (stop );
5486+ for (int i = start ; i < stop ; i ++) {
5487+ setItem .executeCached (virtualFrame , target , virtualFrame .getObject (i ), PNone .NONE );
5488+ virtualFrame .setObject (i , null );
5489+ }
5490+ }
5491+
5492+ @ ExplodeLoop
5493+ private static void moveFromStack (VirtualFrame virtualFrame , int start , int stop , PDict target , HashingCollectionNodes .SetItemNode setItem ) {
5494+ CompilerAsserts .partialEvaluationConstant (start );
5495+ CompilerAsserts .partialEvaluationConstant (stop );
5496+ for (int i = start ; i + 1 < stop ; i += 2 ) {
5497+ setItem .executeCached (virtualFrame , target , virtualFrame .getObject (i ), virtualFrame .getObject (i + 1 ));
5498+ virtualFrame .setObject (i , null );
5499+ virtualFrame .setObject (i + 1 , null );
5500+ }
5501+ }
5502+
5503+ @ BytecodeInterpreterSwitch
54845504 private int bytecodeCollectionFromStack (VirtualFrame virtualFrame , int type , int count , int oldStackTop , Node [] localNodes , int nodeIndex , boolean useCachedNodes ) {
54855505 int stackTop = oldStackTop ;
54865506 Object res = null ;
@@ -5501,10 +5521,7 @@ private int bytecodeCollectionFromStack(VirtualFrame virtualFrame, int type, int
55015521 PSet set = factory .createSet ();
55025522 HashingCollectionNodes .SetItemNode newNode = insertChildNode (localNodes , nodeIndex , UNCACHED_SET_ITEM , HashingCollectionNodesFactory .SetItemNodeGen .class , NODE_SET_ITEM ,
55035523 useCachedNodes );
5504- for (int i = stackTop - count + 1 ; i <= stackTop ; i ++) {
5505- newNode .executeCached (virtualFrame , set , virtualFrame .getObject (i ), PNone .NONE );
5506- virtualFrame .setObject (i , null );
5507- }
5524+ moveFromStack (virtualFrame , stackTop - count + 1 , stackTop + 1 , set , newNode );
55085525 res = set ;
55095526 break ;
55105527 }
@@ -5513,11 +5530,7 @@ private int bytecodeCollectionFromStack(VirtualFrame virtualFrame, int type, int
55135530 HashingCollectionNodes .SetItemNode setItem = insertChildNode (localNodes , nodeIndex , UNCACHED_SET_ITEM , HashingCollectionNodesFactory .SetItemNodeGen .class , NODE_SET_ITEM ,
55145531 useCachedNodes );
55155532 assert count % 2 == 0 ;
5516- for (int i = stackTop - count + 1 ; i <= stackTop ; i += 2 ) {
5517- setItem .executeCached (virtualFrame , dict , virtualFrame .getObject (i ), virtualFrame .getObject (i + 1 ));
5518- virtualFrame .setObject (i , null );
5519- virtualFrame .setObject (i + 1 , null );
5520- }
5533+ moveFromStack (virtualFrame , stackTop - count + 1 , stackTop + 1 , dict , setItem );
55215534 res = dict ;
55225535 break ;
55235536 }
0 commit comments