@@ -365,18 +365,17 @@ abstract static class AllOrAnySequenceStorageNode extends PNodeWithContext {
365
365
abstract boolean execute (VirtualFrame frame , Node inliningTarget , SequenceStorage storageObj , AnyOrAllNodeType nodeType );
366
366
367
367
@ Specialization
368
- static boolean doBoolSequence (VirtualFrame frame , Node inliningTarget , BoolSequenceStorage sequenceStorage , AnyOrAllNodeType nodeType ,
369
- @ Shared @ Cached InlinedLoopConditionProfile loopConditionProfile ,
370
- @ Shared @ Cached InlinedCountingConditionProfile earlyExitProfile ,
371
- @ Shared @ Cached PyObjectIsTrueNode isTrueNode ) {
368
+ static boolean doBoolSequence (Node inliningTarget , BoolSequenceStorage sequenceStorage , AnyOrAllNodeType nodeType ,
369
+ @ Exclusive @ Cached InlinedLoopConditionProfile loopConditionProfile ,
370
+ @ Exclusive @ Cached InlinedCountingConditionProfile earlyExitProfile ) {
372
371
boolean [] internalArray = sequenceStorage .getInternalBoolArray ();
373
372
int seqLength = sequenceStorage .length ();
374
373
375
374
for (int i = 0 ; loopConditionProfile .profile (inliningTarget , i < seqLength ); i ++) {
376
- if (nodeType == AnyOrAllNodeType .ALL && earlyExitProfile .profile (inliningTarget , !isTrueNode . execute ( frame , inliningTarget , internalArray [i ]) )) {
375
+ if (nodeType == AnyOrAllNodeType .ALL && earlyExitProfile .profile (inliningTarget , !internalArray [i ])) {
377
376
LoopNode .reportLoopCount (inliningTarget , i );
378
377
return false ;
379
- } else if (nodeType == AnyOrAllNodeType .ANY && earlyExitProfile .profile (inliningTarget , isTrueNode . execute ( frame , inliningTarget , internalArray [i ]) )) {
378
+ } else if (nodeType == AnyOrAllNodeType .ANY && earlyExitProfile .profile (inliningTarget , internalArray [i ])) {
380
379
LoopNode .reportLoopCount (inliningTarget , i );
381
380
return true ;
382
381
}
@@ -386,18 +385,17 @@ static boolean doBoolSequence(VirtualFrame frame, Node inliningTarget, BoolSeque
386
385
}
387
386
388
387
@ Specialization
389
- static boolean doIntSequence (VirtualFrame frame , Node inliningTarget , IntSequenceStorage sequenceStorage , AnyOrAllNodeType nodeType ,
390
- @ Shared @ Cached InlinedLoopConditionProfile loopConditionProfile ,
391
- @ Shared @ Cached InlinedCountingConditionProfile earlyExitProfile ,
392
- @ Shared @ Cached PyObjectIsTrueNode isTrueNode ) {
388
+ static boolean doIntSequence (Node inliningTarget , IntSequenceStorage sequenceStorage , AnyOrAllNodeType nodeType ,
389
+ @ Exclusive @ Cached InlinedLoopConditionProfile loopConditionProfile ,
390
+ @ Exclusive @ Cached InlinedCountingConditionProfile earlyExitProfile ) {
393
391
int [] internalArray = sequenceStorage .getInternalIntArray ();
394
392
int seqLength = sequenceStorage .length ();
395
393
396
394
for (int i = 0 ; loopConditionProfile .profile (inliningTarget , i < seqLength ); i ++) {
397
- if (nodeType == AnyOrAllNodeType .ALL && earlyExitProfile .profile (inliningTarget , ! isTrueNode . execute ( frame , inliningTarget , internalArray [i ]) )) {
395
+ if (nodeType == AnyOrAllNodeType .ALL && earlyExitProfile .profile (inliningTarget , internalArray [i ] == 0 )) {
398
396
LoopNode .reportLoopCount (inliningTarget , i );
399
397
return false ;
400
- } else if (nodeType == AnyOrAllNodeType .ANY && earlyExitProfile .profile (inliningTarget , isTrueNode . execute ( frame , inliningTarget , internalArray [i ]) )) {
398
+ } else if (nodeType == AnyOrAllNodeType .ANY && earlyExitProfile .profile (inliningTarget , internalArray [i ] != 0 )) {
401
399
LoopNode .reportLoopCount (inliningTarget , i );
402
400
return true ;
403
401
}
@@ -408,17 +406,19 @@ static boolean doIntSequence(VirtualFrame frame, Node inliningTarget, IntSequenc
408
406
409
407
@ Specialization
410
408
static boolean doGenericSequence (VirtualFrame frame , Node inliningTarget , SequenceStorage sequenceStorage , AnyOrAllNodeType nodeType ,
411
- @ Shared @ Cached InlinedLoopConditionProfile loopConditionProfile ,
412
- @ Shared @ Cached InlinedCountingConditionProfile earlyExitProfile ,
413
- @ Shared @ Cached PyObjectIsTrueNode isTrueNode ) {
414
- Object [] internalArray = sequenceStorage . getInternalArray ();
409
+ @ Exclusive @ Cached InlinedLoopConditionProfile loopConditionProfile ,
410
+ @ Exclusive @ Cached InlinedCountingConditionProfile earlyExitProfile ,
411
+ @ Cached PyObjectIsTrueNode isTrueNode ,
412
+ @ Cached SequenceStorageNodes . GetItemScalarNode getItem ) {
415
413
int seqLength = sequenceStorage .length ();
416
414
417
415
for (int i = 0 ; loopConditionProfile .profile (inliningTarget , i < seqLength ); i ++) {
418
- if (nodeType == AnyOrAllNodeType .ALL && earlyExitProfile .profile (inliningTarget , !isTrueNode .execute (frame , inliningTarget , internalArray [i ]))) {
416
+ if (nodeType == AnyOrAllNodeType .ALL &&
417
+ earlyExitProfile .profile (inliningTarget , !isTrueNode .execute (frame , inliningTarget , getItem .execute (inliningTarget , sequenceStorage , i )))) {
419
418
LoopNode .reportLoopCount (inliningTarget , i );
420
419
return false ;
421
- } else if (nodeType == AnyOrAllNodeType .ANY && earlyExitProfile .profile (inliningTarget , isTrueNode .execute (frame , inliningTarget , internalArray [i ]))) {
420
+ } else if (nodeType == AnyOrAllNodeType .ANY &&
421
+ earlyExitProfile .profile (inliningTarget , isTrueNode .execute (frame , inliningTarget , getItem .execute (inliningTarget , sequenceStorage , i )))) {
422
422
LoopNode .reportLoopCount (inliningTarget , i );
423
423
return true ;
424
424
}
0 commit comments