@@ -664,7 +664,6 @@ protected RubyArray concatManyGeneral(RubyArray array, Object first, Object[] re
664
664
@ ImportStatic (ArrayGuards .class )
665
665
public abstract static class DeleteNode extends CoreMethodArrayArgumentsNode {
666
666
667
- @ Child private SameOrEqualNode sameOrEqualNode = SameOrEqualNode .create ();
668
667
@ Child private TypeNodes .CheckFrozenNode raiseIfFrozenNode ;
669
668
670
669
@ Specialization (
@@ -673,12 +672,13 @@ public abstract static class DeleteNode extends CoreMethodArrayArgumentsNode {
673
672
protected Object delete (RubyArray array , Object value , Object maybeBlock ,
674
673
@ Bind ("array.getStore()" ) Object store ,
675
674
@ CachedLibrary ("store" ) ArrayStoreLibrary stores ,
676
- @ Cached @ Shared IntValueProfile arraySizeProfile ,
677
- @ Cached @ Shared LoopConditionProfile loopProfile ,
675
+ @ Cached @ Shared SameOrEqualNode sameOrEqualNode ,
676
+ @ Cached @ Shared InlinedIntValueProfile arraySizeProfile ,
677
+ @ Cached @ Shared InlinedLoopConditionProfile loopProfile ,
678
678
@ Cached @ Shared CallBlockNode yieldNode ) {
679
679
680
680
return delete (array , value , maybeBlock , true , store , store , stores , stores , arraySizeProfile , loopProfile ,
681
- yieldNode );
681
+ yieldNode , sameOrEqualNode );
682
682
}
683
683
684
684
@ Specialization (
@@ -688,13 +688,14 @@ protected Object delete(RubyArray array, Object value, Object maybeBlock,
688
688
@ Bind ("array.getStore()" ) Object store ,
689
689
@ CachedLibrary ("store" ) ArrayStoreLibrary stores ,
690
690
@ CachedLibrary (limit = "1" ) ArrayStoreLibrary newStores ,
691
- @ Cached @ Shared IntValueProfile arraySizeProfile ,
692
- @ Cached @ Shared LoopConditionProfile loopProfile ,
691
+ @ Cached @ Shared SameOrEqualNode sameOrEqualNode ,
692
+ @ Cached @ Shared InlinedIntValueProfile arraySizeProfile ,
693
+ @ Cached @ Shared InlinedLoopConditionProfile loopProfile ,
693
694
@ Cached @ Shared CallBlockNode yieldNode ) {
694
695
695
- final Object newStore = stores .allocator (store ).allocate (arraySizeProfile .profile (array .size ));
696
+ final Object newStore = stores .allocator (store ).allocate (arraySizeProfile .profile (this , array .size ));
696
697
return delete (array , value , maybeBlock , false , store , newStore , stores , newStores , arraySizeProfile ,
697
- loopProfile , yieldNode );
698
+ loopProfile , yieldNode , sameOrEqualNode );
698
699
}
699
700
700
701
private Object delete (RubyArray array , Object value , Object maybeBlock ,
@@ -703,22 +704,23 @@ private Object delete(RubyArray array, Object value, Object maybeBlock,
703
704
Object newStore ,
704
705
ArrayStoreLibrary oldStores ,
705
706
ArrayStoreLibrary newStores ,
706
- IntValueProfile arraySizeProfile ,
707
- LoopConditionProfile loopProfile ,
708
- CallBlockNode yieldNode ) {
707
+ InlinedIntValueProfile arraySizeProfile ,
708
+ InlinedLoopConditionProfile loopProfile ,
709
+ CallBlockNode yieldNode ,
710
+ SameOrEqualNode sameOrEqualNode ) {
709
711
710
712
assert !sameStores || (oldStore == newStore && oldStores == newStores );
711
713
712
- final int size = arraySizeProfile .profile (array .size );
714
+ final int size = arraySizeProfile .profile (this , array .size );
713
715
Object found = nil ;
714
716
715
717
int i = 0 ;
716
718
int n = 0 ;
717
719
try {
718
- while (loopProfile .inject (n < size )) {
720
+ while (loopProfile .inject (this , n < size )) {
719
721
final Object stored = oldStores .read (oldStore , n );
720
722
721
- if (sameOrEqualNode .executeSameOrEqual ( stored , value )) {
723
+ if (sameOrEqualNode .execute ( this , stored , value )) {
722
724
checkFrozen (array );
723
725
found = stored ;
724
726
n ++;
@@ -731,7 +733,7 @@ private Object delete(RubyArray array, Object value, Object maybeBlock,
731
733
TruffleSafepoint .poll (this );
732
734
}
733
735
} finally {
734
- profileAndReportLoopCount (loopProfile , n );
736
+ profileAndReportLoopCount (this , loopProfile , n );
735
737
}
736
738
737
739
if (i != n ) {
@@ -865,45 +867,45 @@ public void accept(CallBlockNode yieldNode, RubyArray array, Object state, Objec
865
867
@ ImportStatic (ArrayGuards .class )
866
868
public abstract static class EqualNode extends PrimitiveArrayArgumentsNode {
867
869
868
- @ Child private SameOrEqualNode sameOrEqualNode = SameOrEqualNode .create ();
869
-
870
870
@ Specialization (
871
871
guards = { "stores.accepts(bStore)" , "stores.isPrimitive(aStore)" },
872
872
limit = "storageStrategyLimit()" )
873
- protected boolean equalSamePrimitiveType (RubyArray a , RubyArray b ,
873
+ protected static boolean equalSamePrimitiveType (RubyArray a , RubyArray b ,
874
874
@ Bind ("a.getStore()" ) Object aStore ,
875
875
@ Bind ("b.getStore()" ) Object bStore ,
876
876
@ CachedLibrary ("aStore" ) ArrayStoreLibrary stores ,
877
- @ Cached ConditionProfile sameProfile ,
878
- @ Cached IntValueProfile arraySizeProfile ,
879
- @ Cached ConditionProfile sameSizeProfile ,
880
- @ Cached BranchProfile trueProfile ,
881
- @ Cached BranchProfile falseProfile ,
882
- @ Cached LoopConditionProfile loopProfile ) {
877
+ @ Cached InlinedConditionProfile sameProfile ,
878
+ @ Cached InlinedIntValueProfile arraySizeProfile ,
879
+ @ Cached InlinedConditionProfile sameSizeProfile ,
880
+ @ Cached InlinedBranchProfile trueProfile ,
881
+ @ Cached InlinedBranchProfile falseProfile ,
882
+ @ Cached InlinedLoopConditionProfile loopProfile ,
883
+ @ Cached SameOrEqualNode sameOrEqualNode ,
884
+ @ Bind ("this" ) Node node ) {
883
885
884
- if (sameProfile .profile (a == b )) {
886
+ if (sameProfile .profile (node , a == b )) {
885
887
return true ;
886
888
}
887
889
888
- final int size = arraySizeProfile .profile (a .size );
890
+ final int size = arraySizeProfile .profile (node , a .size );
889
891
890
- if (!sameSizeProfile .profile (size == b .size )) {
892
+ if (!sameSizeProfile .profile (node , size == b .size )) {
891
893
return false ;
892
894
}
893
895
894
896
int i = 0 ;
895
897
try {
896
- for (; loopProfile .inject (i < size ); i ++) {
897
- if (!sameOrEqualNode .executeSameOrEqual ( stores .read (aStore , i ), stores .read (bStore , i ))) {
898
- falseProfile .enter ();
898
+ for (; loopProfile .inject (node , i < size ); i ++) {
899
+ if (!sameOrEqualNode .execute ( node , stores .read (aStore , i ), stores .read (bStore , i ))) {
900
+ falseProfile .enter (node );
899
901
return false ;
900
902
}
901
- TruffleSafepoint .poll (this );
903
+ TruffleSafepoint .poll (node );
902
904
}
903
905
} finally {
904
- profileAndReportLoopCount (loopProfile , i );
906
+ profileAndReportLoopCount (node , loopProfile , i );
905
907
}
906
- trueProfile .enter ();
908
+ trueProfile .enter (node );
907
909
return true ;
908
910
}
909
911
@@ -1091,27 +1093,27 @@ protected static long hash(VirtualFrame frame, RubyArray array,
1091
1093
@ ReportPolymorphism
1092
1094
public abstract static class IncludeNode extends ArrayCoreMethodNode {
1093
1095
1094
- @ Child private SameOrEqualNode sameOrEqualNode = SameOrEqualNode .create ();
1095
-
1096
1096
@ Specialization (limit = "storageStrategyLimit()" )
1097
- protected boolean include (RubyArray array , Object value ,
1097
+ protected static boolean include (RubyArray array , Object value ,
1098
1098
@ Bind ("array.getStore()" ) Object store ,
1099
1099
@ CachedLibrary ("store" ) ArrayStoreLibrary stores ,
1100
- @ Cached IntValueProfile arraySizeProfile ,
1101
- @ Cached LoopConditionProfile loopProfile ) {
1100
+ @ Cached SameOrEqualNode sameOrEqualNode ,
1101
+ @ Cached InlinedIntValueProfile arraySizeProfile ,
1102
+ @ Cached InlinedLoopConditionProfile loopProfile ,
1103
+ @ Bind ("this" ) Node node ) {
1102
1104
1103
1105
int n = 0 ;
1104
1106
try {
1105
- for (; loopProfile .inject (n < arraySizeProfile .profile (array .size )); n ++) {
1107
+ for (; loopProfile .inject (node , n < arraySizeProfile .profile (node , array .size )); n ++) {
1106
1108
final Object stored = stores .read (store , n );
1107
1109
1108
- if (sameOrEqualNode .executeSameOrEqual ( stored , value )) {
1110
+ if (sameOrEqualNode .execute ( node , stored , value )) {
1109
1111
return true ;
1110
1112
}
1111
- TruffleSafepoint .poll (this );
1113
+ TruffleSafepoint .poll (node );
1112
1114
}
1113
1115
} finally {
1114
- profileAndReportLoopCount (loopProfile , n );
1116
+ profileAndReportLoopCount (node , loopProfile , n );
1115
1117
}
1116
1118
1117
1119
return false ;
0 commit comments