@@ -5479,8 +5479,28 @@ private static <T> void moveFromStack(VirtualFrame virtualFrame, int start, int
5479
5479
}
5480
5480
}
5481
5481
5482
- @ BytecodeInterpreterSwitch
5483
5482
@ 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
5484
5504
private int bytecodeCollectionFromStack (VirtualFrame virtualFrame , int type , int count , int oldStackTop , Node [] localNodes , int nodeIndex , boolean useCachedNodes ) {
5485
5505
int stackTop = oldStackTop ;
5486
5506
Object res = null ;
@@ -5501,10 +5521,7 @@ private int bytecodeCollectionFromStack(VirtualFrame virtualFrame, int type, int
5501
5521
PSet set = factory .createSet ();
5502
5522
HashingCollectionNodes .SetItemNode newNode = insertChildNode (localNodes , nodeIndex , UNCACHED_SET_ITEM , HashingCollectionNodesFactory .SetItemNodeGen .class , NODE_SET_ITEM ,
5503
5523
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 );
5508
5525
res = set ;
5509
5526
break ;
5510
5527
}
@@ -5513,11 +5530,7 @@ private int bytecodeCollectionFromStack(VirtualFrame virtualFrame, int type, int
5513
5530
HashingCollectionNodes .SetItemNode setItem = insertChildNode (localNodes , nodeIndex , UNCACHED_SET_ITEM , HashingCollectionNodesFactory .SetItemNodeGen .class , NODE_SET_ITEM ,
5514
5531
useCachedNodes );
5515
5532
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 );
5521
5534
res = dict ;
5522
5535
break ;
5523
5536
}
0 commit comments