@@ -5543,6 +5543,27 @@ private static <T> void moveFromStack(VirtualFrame virtualFrame, int start, int
5543
5543
}
5544
5544
}
5545
5545
5546
+ @ ExplodeLoop
5547
+ private static void moveFromStack (VirtualFrame virtualFrame , int start , int stop , PSet target , HashingCollectionNodes .SetItemNode setItem ) {
5548
+ CompilerAsserts .partialEvaluationConstant (start );
5549
+ CompilerAsserts .partialEvaluationConstant (stop );
5550
+ for (int i = start ; i < stop ; i ++) {
5551
+ setItem .executeCached (virtualFrame , target , virtualFrame .getObject (i ), PNone .NONE );
5552
+ virtualFrame .setObject (i , null );
5553
+ }
5554
+ }
5555
+
5556
+ @ ExplodeLoop
5557
+ private static void moveFromStack (VirtualFrame virtualFrame , int start , int stop , PDict target , HashingCollectionNodes .SetItemNode setItem ) {
5558
+ CompilerAsserts .partialEvaluationConstant (start );
5559
+ CompilerAsserts .partialEvaluationConstant (stop );
5560
+ for (int i = start ; i + 1 < stop ; i += 2 ) {
5561
+ setItem .executeCached (virtualFrame , target , virtualFrame .getObject (i ), virtualFrame .getObject (i + 1 ));
5562
+ virtualFrame .setObject (i , null );
5563
+ virtualFrame .setObject (i + 1 , null );
5564
+ }
5565
+ }
5566
+
5546
5567
@ BytecodeInterpreterSwitch
5547
5568
private int bytecodeCollectionFromStack (VirtualFrame virtualFrame , int type , int count , int oldStackTop , Node [] localNodes , int nodeIndex , boolean useCachedNodes ) {
5548
5569
int stackTop = oldStackTop ;
@@ -5564,10 +5585,7 @@ private int bytecodeCollectionFromStack(VirtualFrame virtualFrame, int type, int
5564
5585
PSet set = factory .createSet ();
5565
5586
HashingCollectionNodes .SetItemNode newNode = insertChildNode (localNodes , nodeIndex , UNCACHED_SET_ITEM , HashingCollectionNodesFactory .SetItemNodeGen .class , NODE_SET_ITEM ,
5566
5587
useCachedNodes );
5567
- for (int i = stackTop - count + 1 ; i <= stackTop ; i ++) {
5568
- newNode .executeCached (virtualFrame , set , virtualFrame .getObject (i ), PNone .NONE );
5569
- virtualFrame .setObject (i , null );
5570
- }
5588
+ moveFromStack (virtualFrame , stackTop - count + 1 , stackTop + 1 , set , newNode );
5571
5589
res = set ;
5572
5590
break ;
5573
5591
}
@@ -5576,11 +5594,7 @@ private int bytecodeCollectionFromStack(VirtualFrame virtualFrame, int type, int
5576
5594
HashingCollectionNodes .SetItemNode setItem = insertChildNode (localNodes , nodeIndex , UNCACHED_SET_ITEM , HashingCollectionNodesFactory .SetItemNodeGen .class , NODE_SET_ITEM ,
5577
5595
useCachedNodes );
5578
5596
assert count % 2 == 0 ;
5579
- for (int i = stackTop - count + 1 ; i <= stackTop ; i += 2 ) {
5580
- setItem .executeCached (virtualFrame , dict , virtualFrame .getObject (i ), virtualFrame .getObject (i + 1 ));
5581
- virtualFrame .setObject (i , null );
5582
- virtualFrame .setObject (i + 1 , null );
5583
- }
5597
+ moveFromStack (virtualFrame , stackTop - count + 1 , stackTop + 1 , dict , setItem );
5584
5598
res = dict ;
5585
5599
break ;
5586
5600
}
0 commit comments