@@ -833,11 +833,12 @@ public abstract static class EachNode extends CoreMethodArrayArgumentsNode imple
833
833
@ Specialization
834
834
protected Object each (RubyArray array , RubyProc block ,
835
835
@ Cached ArrayEachIteratorNode iteratorNode ) {
836
- return iteratorNode .execute (array , block , 0 , this );
836
+ return iteratorNode .execute (this , array , block , 0 , this );
837
837
}
838
838
839
839
@ Override
840
- public void accept (CallBlockNode yieldNode , RubyArray array , Object state , Object element , int index ) {
840
+ public void accept (Node node , CallBlockNode yieldNode , RubyArray array , Object state , Object element , int index ,
841
+ BooleanCastNode booleanCastNode ) {
841
842
RubyProc block = (RubyProc ) state ;
842
843
yieldNode .yield (block , element );
843
844
}
@@ -852,11 +853,12 @@ public abstract static class EachWithIndexNode extends PrimitiveArrayArgumentsNo
852
853
@ Specialization
853
854
protected Object eachOther (RubyArray array , RubyProc block ,
854
855
@ Cached ArrayEachIteratorNode iteratorNode ) {
855
- return iteratorNode .execute (array , block , 0 , this );
856
+ return iteratorNode .execute (this , array , block , 0 , this );
856
857
}
857
858
858
859
@ Override
859
- public void accept (CallBlockNode yieldNode , RubyArray array , Object state , Object element , int index ) {
860
+ public void accept (Node node , CallBlockNode yieldNode , RubyArray array , Object state , Object element , int index ,
861
+ BooleanCastNode booleanCastNode ) {
860
862
RubyProc block = (RubyProc ) state ;
861
863
yieldNode .yield (block , element , index );
862
864
}
@@ -1389,13 +1391,14 @@ private Object injectBlockHelper(RubyArray array,
1389
1391
Object accumulator = initial ;
1390
1392
State iterationState = new State (accumulator , block );
1391
1393
1392
- iteratorNode .execute (array , iterationState , start , this );
1394
+ iteratorNode .execute (this , array , iterationState , start , this );
1393
1395
1394
1396
return iterationState .accumulator ;
1395
1397
}
1396
1398
1397
1399
@ Override
1398
- public void accept (CallBlockNode yieldNode , RubyArray array , Object stateObject , Object element , int index ) {
1400
+ public void accept (Node node , CallBlockNode yieldNode , RubyArray array , Object stateObject , Object element ,
1401
+ int index , BooleanCastNode booleanCastNode ) {
1399
1402
final State state = (State ) stateObject ;
1400
1403
state .accumulator = yieldNode .yield (state .block , state .accumulator , element );
1401
1404
}
@@ -1499,18 +1502,19 @@ private static class State {
1499
1502
@ Specialization
1500
1503
protected Object map (RubyArray array , RubyProc block ,
1501
1504
@ Cached ArrayEachIteratorNode iteratorNode ,
1502
- @ Cached IntValueProfile arraySizeProfile ) {
1503
- BuilderState builderState = arrayBuilder .start (arraySizeProfile .profile (array .size ));
1505
+ @ Cached InlinedIntValueProfile arraySizeProfile ) {
1506
+ BuilderState builderState = arrayBuilder .start (arraySizeProfile .profile (this , array .size ));
1504
1507
State iterationState = new State (builderState , block );
1505
1508
1506
- iteratorNode .execute (array , iterationState , 0 , this );
1509
+ iteratorNode .execute (this , array , iterationState , 0 , this );
1507
1510
1508
1511
final int size = array .size ;
1509
1512
return createArray (arrayBuilder .finish (iterationState .builderState , size ), size );
1510
1513
}
1511
1514
1512
1515
@ Override
1513
- public void accept (CallBlockNode yieldNode , RubyArray array , Object stateObject , Object element , int index ) {
1516
+ public void accept (Node node , CallBlockNode yieldNode , RubyArray array , Object stateObject , Object element ,
1517
+ int index , BooleanCastNode booleanCastNode ) {
1514
1518
final State state = (State ) stateObject ;
1515
1519
1516
1520
Object value = yieldNode .yield (state .block , element );
@@ -1529,11 +1533,12 @@ public abstract static class MapInPlaceNode extends CoreMethodArrayArgumentsNode
1529
1533
@ Specialization
1530
1534
protected Object map (RubyArray array , RubyProc block ,
1531
1535
@ Cached ArrayEachIteratorNode iteratorNode ) {
1532
- return iteratorNode .execute (array , block , 0 , this );
1536
+ return iteratorNode .execute (this , array , block , 0 , this );
1533
1537
}
1534
1538
1535
1539
@ Override
1536
- public void accept (CallBlockNode yieldNode , RubyArray array , Object state , Object element , int index ) {
1540
+ public void accept (Node node , CallBlockNode yieldNode , RubyArray array , Object state , Object element , int index ,
1541
+ BooleanCastNode booleanCastNode ) {
1537
1542
RubyProc block = (RubyProc ) state ;
1538
1543
writeNode .executeWrite (array , index , yieldNode .yield (block , element ));
1539
1544
}
@@ -1796,18 +1801,19 @@ private static class State {
1796
1801
@ Specialization
1797
1802
protected Object reject (RubyArray array , RubyProc block ,
1798
1803
@ Cached ArrayEachIteratorNode iteratorNode ,
1799
- @ Cached IntValueProfile arraySizeProfile ) {
1800
- BuilderState builderState = arrayBuilder .start (arraySizeProfile .profile (array .size ));
1804
+ @ Cached InlinedIntValueProfile arraySizeProfile ) {
1805
+ BuilderState builderState = arrayBuilder .start (arraySizeProfile .profile (this , array .size ));
1801
1806
State iterationState = new State (builderState , 0 , block );
1802
1807
1803
- iteratorNode .execute (array , iterationState , 0 , this );
1808
+ iteratorNode .execute (this , array , iterationState , 0 , this );
1804
1809
1805
1810
int actualSize = iterationState .newArraySize ;
1806
1811
return createArray (arrayBuilder .finish (builderState , actualSize ), actualSize );
1807
1812
}
1808
1813
1809
1814
@ Override
1810
- public void accept (CallBlockNode yieldNode , RubyArray array , Object stateObject , Object element , int index ) {
1815
+ public void accept (Node node , CallBlockNode yieldNode , RubyArray array , Object stateObject , Object element ,
1816
+ int index , BooleanCastNode booleanCastNode ) {
1811
1817
final State state = (State ) stateObject ;
1812
1818
1813
1819
if (!booleanCastNode .execute (yieldNode .yield (state .block , element ))) {
@@ -2006,18 +2012,19 @@ private static class State {
2006
2012
@ Specialization
2007
2013
protected Object select (RubyArray array , RubyProc block ,
2008
2014
@ Cached ArrayEachIteratorNode iteratorNode ,
2009
- @ Cached IntValueProfile arraySizeProfile ) {
2010
- BuilderState builderState = arrayBuilder .start (arraySizeProfile .profile (array .size ));
2015
+ @ Cached InlinedIntValueProfile arraySizeProfile ) {
2016
+ BuilderState builderState = arrayBuilder .start (arraySizeProfile .profile (this , array .size ));
2011
2017
State iterationState = new State (builderState , 0 , block );
2012
2018
2013
- iteratorNode .execute (array , iterationState , 0 , this );
2019
+ iteratorNode .execute (this , array , iterationState , 0 , this );
2014
2020
2015
2021
int selectedSize = iterationState .selectedSize ;
2016
2022
return createArray (arrayBuilder .finish (builderState , selectedSize ), selectedSize );
2017
2023
}
2018
2024
2019
2025
@ Override
2020
- public void accept (CallBlockNode yieldNode , RubyArray array , Object stateObject , Object element , int index ) {
2026
+ public void accept (Node node , CallBlockNode yieldNode , RubyArray array , Object stateObject , Object element ,
2027
+ int index , BooleanCastNode booleanCastNode ) {
2021
2028
final State state = (State ) stateObject ;
2022
2029
2023
2030
if (booleanCastNode .execute (yieldNode .yield (state .block , element ))) {
0 commit comments