222
222
import com .oracle .graal .python .nodes .object .BuiltinClassProfiles .IsAnyBuiltinClassProfile ;
223
223
import com .oracle .graal .python .nodes .object .BuiltinClassProfiles .IsBuiltinObjectProfile ;
224
224
import com .oracle .graal .python .nodes .object .GetClassNode ;
225
- import com .oracle .graal .python .nodes .object .IsBuiltinClassProfile ;
226
225
import com .oracle .graal .python .nodes .util .CannotCastException ;
227
226
import com .oracle .graal .python .nodes .util .CastToJavaIntExactNode ;
228
227
import com .oracle .graal .python .nodes .util .CastToJavaStringNode ;
@@ -1831,69 +1830,76 @@ public abstract static class RangeNode extends PythonQuaternaryBuiltinNode {
1831
1830
// stop
1832
1831
@ Specialization (guards = "isStop(start, stop, step)" )
1833
1832
Object doIntStop (Object cls , int stop , @ SuppressWarnings ("unused" ) PNone start , @ SuppressWarnings ("unused" ) PNone step ,
1834
- @ Shared ("stepZeroProfile" ) @ Cached ConditionProfile stepZeroProfile ,
1833
+ @ Bind ("this" ) Node inliningTarget ,
1834
+ @ Shared ("stepZeroProfile" ) @ Cached InlinedConditionProfile stepZeroProfile ,
1835
1835
@ Shared ("exceptionProfile" ) @ Cached InlinedBranchProfile exceptionProfile ,
1836
1836
@ Shared ("lenOfRangeNodeExact" ) @ Cached LenOfIntRangeNodeExact lenOfRangeNodeExact ,
1837
1837
@ Shared ("createBigRangeNode" ) @ Cached RangeNodes .CreateBigRangeNode createBigRangeNode ) {
1838
- return doInt (cls , 0 , stop , 1 , stepZeroProfile , exceptionProfile , lenOfRangeNodeExact , createBigRangeNode );
1838
+ return doInt (cls , 0 , stop , 1 , inliningTarget , stepZeroProfile , exceptionProfile , lenOfRangeNodeExact , createBigRangeNode );
1839
1839
}
1840
1840
1841
1841
@ Specialization (guards = "isStop(start, stop, step)" )
1842
1842
Object doPintStop (Object cls , PInt stop , @ SuppressWarnings ("unused" ) PNone start , @ SuppressWarnings ("unused" ) PNone step ,
1843
- @ Shared ("stepZeroProfile" ) @ Cached ConditionProfile stepZeroProfile ,
1843
+ @ Bind ("this" ) Node inliningTarget ,
1844
+ @ Shared ("stepZeroProfile" ) @ Cached InlinedConditionProfile stepZeroProfile ,
1844
1845
@ Shared ("lenOfRangeNode" ) @ Cached RangeNodes .LenOfRangeNode lenOfRangeNode ) {
1845
- return doPint (cls , factory ().createInt (0 ), stop , factory ().createInt (1 ), stepZeroProfile , lenOfRangeNode );
1846
+ return doPint (cls , factory ().createInt (0 ), stop , factory ().createInt (1 ), inliningTarget , stepZeroProfile , lenOfRangeNode );
1846
1847
}
1847
1848
1848
1849
@ Specialization (guards = "isStop(start, stop, step)" )
1849
1850
Object doGenericStop (VirtualFrame frame , Object cls , Object stop , @ SuppressWarnings ("unused" ) PNone start , @ SuppressWarnings ("unused" ) PNone step ,
1850
- @ Shared ("stepZeroProfile" ) @ Cached ConditionProfile stepZeroProfile ,
1851
+ @ Bind ("this" ) Node inliningTarget ,
1852
+ @ Shared ("stepZeroProfile" ) @ Cached InlinedConditionProfile stepZeroProfile ,
1851
1853
@ Shared ("exceptionProfile" ) @ Cached InlinedBranchProfile exceptionProfile ,
1852
1854
@ Shared ("lenOfRangeNodeExact" ) @ Cached LenOfIntRangeNodeExact lenOfRangeNodeExact ,
1853
1855
@ Shared ("createBigRangeNode" ) @ Cached RangeNodes .CreateBigRangeNode createBigRangeNode ,
1854
1856
@ Shared ("cast" ) @ Cached CastToJavaIntExactNode cast ,
1855
- @ Shared ("overflowProfile" ) @ Cached IsBuiltinClassProfile overflowProfile ,
1857
+ @ Shared ("overflowProfile" ) @ Cached IsBuiltinObjectProfile overflowProfile ,
1856
1858
@ Shared ("indexNode" ) @ Cached PyNumberIndexNode indexNode ) {
1857
- return doGeneric (frame , cls , 0 , stop , 1 , stepZeroProfile , exceptionProfile , lenOfRangeNodeExact , createBigRangeNode , cast , overflowProfile , indexNode );
1859
+ return doGeneric (frame , cls , 0 , stop , 1 , inliningTarget , stepZeroProfile , exceptionProfile , lenOfRangeNodeExact , createBigRangeNode , cast , overflowProfile , indexNode );
1858
1860
}
1859
1861
1860
1862
// start stop
1861
1863
@ Specialization (guards = "isStartStop(start, stop, step)" )
1862
1864
Object doIntStartStop (Object cls , int start , int stop , @ SuppressWarnings ("unused" ) PNone step ,
1863
- @ Shared ("stepZeroProfile" ) @ Cached ConditionProfile stepZeroProfile ,
1865
+ @ Bind ("this" ) Node inliningTarget ,
1866
+ @ Shared ("stepZeroProfile" ) @ Cached InlinedConditionProfile stepZeroProfile ,
1864
1867
@ Shared ("exceptionProfile" ) @ Cached InlinedBranchProfile exceptionProfile ,
1865
1868
@ Shared ("lenOfRangeNodeExact" ) @ Cached LenOfIntRangeNodeExact lenOfRangeNodeExact ,
1866
1869
@ Shared ("createBigRangeNode" ) @ Cached RangeNodes .CreateBigRangeNode createBigRangeNode ) {
1867
- return doInt (cls , start , stop , 1 , stepZeroProfile , exceptionProfile , lenOfRangeNodeExact , createBigRangeNode );
1870
+ return doInt (cls , start , stop , 1 , inliningTarget , stepZeroProfile , exceptionProfile , lenOfRangeNodeExact , createBigRangeNode );
1868
1871
}
1869
1872
1870
1873
@ Specialization (guards = "isStartStop(start, stop, step)" )
1871
1874
Object doPintStartStop (Object cls , PInt start , PInt stop , @ SuppressWarnings ("unused" ) PNone step ,
1872
- @ Shared ("stepZeroProfile" ) @ Cached ConditionProfile stepZeroProfile ,
1875
+ @ Bind ("this" ) Node inliningTarget ,
1876
+ @ Shared ("stepZeroProfile" ) @ Cached InlinedConditionProfile stepZeroProfile ,
1873
1877
@ Shared ("lenOfRangeNode" ) @ Cached RangeNodes .LenOfRangeNode lenOfRangeNode ) {
1874
- return doPint (cls , start , stop , factory ().createInt (1 ), stepZeroProfile , lenOfRangeNode );
1878
+ return doPint (cls , start , stop , factory ().createInt (1 ), inliningTarget , stepZeroProfile , lenOfRangeNode );
1875
1879
}
1876
1880
1877
1881
@ Specialization (guards = "isStartStop(start, stop, step)" )
1878
1882
Object doGenericStartStop (VirtualFrame frame , Object cls , Object start , Object stop , @ SuppressWarnings ("unused" ) PNone step ,
1879
- @ Shared ("stepZeroProfile" ) @ Cached ConditionProfile stepZeroProfile ,
1883
+ @ Bind ("this" ) Node inliningTarget ,
1884
+ @ Shared ("stepZeroProfile" ) @ Cached InlinedConditionProfile stepZeroProfile ,
1880
1885
@ Shared ("exceptionProfile" ) @ Cached InlinedBranchProfile exceptionProfile ,
1881
1886
@ Shared ("lenOfRangeNodeExact" ) @ Cached LenOfIntRangeNodeExact lenOfRangeNodeExact ,
1882
1887
@ Shared ("createBigRangeNode" ) @ Cached RangeNodes .CreateBigRangeNode createBigRangeNode ,
1883
1888
@ Shared ("cast" ) @ Cached CastToJavaIntExactNode cast ,
1884
- @ Shared ("overflowProfile" ) @ Cached IsBuiltinClassProfile overflowProfile ,
1889
+ @ Shared ("overflowProfile" ) @ Cached IsBuiltinObjectProfile overflowProfile ,
1885
1890
@ Shared ("indexNode" ) @ Cached PyNumberIndexNode indexNode ) {
1886
- return doGeneric (frame , cls , start , stop , 1 , stepZeroProfile , exceptionProfile , lenOfRangeNodeExact , createBigRangeNode , cast , overflowProfile , indexNode );
1891
+ return doGeneric (frame , cls , start , stop , 1 , inliningTarget , stepZeroProfile , exceptionProfile , lenOfRangeNodeExact , createBigRangeNode , cast , overflowProfile , indexNode );
1887
1892
}
1888
1893
1889
1894
// start stop step
1890
1895
@ Specialization
1891
1896
Object doInt (@ SuppressWarnings ("unused" ) Object cls , int start , int stop , int step ,
1892
- @ Shared ("stepZeroProfile" ) @ Cached ConditionProfile stepZeroProfile ,
1897
+ @ Bind ("this" ) Node inliningTarget ,
1898
+ @ Shared ("stepZeroProfile" ) @ Cached InlinedConditionProfile stepZeroProfile ,
1893
1899
@ Shared ("exceptionProfile" ) @ Cached InlinedBranchProfile exceptionProfile ,
1894
1900
@ Shared ("lenOfRangeNodeExact" ) @ Cached LenOfIntRangeNodeExact lenOfRangeNode ,
1895
1901
@ Shared ("createBigRangeNode" ) @ Cached RangeNodes .CreateBigRangeNode createBigRangeNode ) {
1896
- if (stepZeroProfile .profile (step == 0 )) {
1902
+ if (stepZeroProfile .profile (inliningTarget , step == 0 )) {
1897
1903
throw raise (ValueError , ARG_MUST_NOT_BE_ZERO , "range()" , 3 );
1898
1904
}
1899
1905
try {
@@ -1907,9 +1913,10 @@ Object doInt(@SuppressWarnings("unused") Object cls, int start, int stop, int st
1907
1913
1908
1914
@ Specialization
1909
1915
Object doPint (@ SuppressWarnings ("unused" ) Object cls , PInt start , PInt stop , PInt step ,
1910
- @ Shared ("stepZeroProfile" ) @ Cached ConditionProfile stepZeroProfile ,
1916
+ @ Bind ("this" ) Node inliningTarget ,
1917
+ @ Shared ("stepZeroProfile" ) @ Cached InlinedConditionProfile stepZeroProfile ,
1911
1918
@ Shared ("lenOfRangeNode" ) @ Cached RangeNodes .LenOfRangeNode lenOfRangeNode ) {
1912
- if (stepZeroProfile .profile (step .isZero ())) {
1919
+ if (stepZeroProfile .profile (inliningTarget , step .isZero ())) {
1913
1920
throw raise (ValueError , ARG_MUST_NOT_BE_ZERO , "range()" , 3 );
1914
1921
}
1915
1922
BigInteger len = lenOfRangeNode .execute (start .getValue (), stop .getValue (), step .getValue ());
@@ -1918,12 +1925,13 @@ Object doPint(@SuppressWarnings("unused") Object cls, PInt start, PInt stop, PIn
1918
1925
1919
1926
@ Specialization (guards = "isStartStopStep(start, stop, step)" )
1920
1927
Object doGeneric (VirtualFrame frame , @ SuppressWarnings ("unused" ) Object cls , Object start , Object stop , Object step ,
1921
- @ Shared ("stepZeroProfile" ) @ Cached ConditionProfile stepZeroProfile ,
1928
+ @ Bind ("this" ) Node inliningTarget ,
1929
+ @ Shared ("stepZeroProfile" ) @ Cached InlinedConditionProfile stepZeroProfile ,
1922
1930
@ Shared ("exceptionProfile" ) @ Cached InlinedBranchProfile exceptionProfile ,
1923
1931
@ Shared ("lenOfRangeNodeExact" ) @ Cached LenOfIntRangeNodeExact lenOfRangeNodeExact ,
1924
1932
@ Shared ("createBigRangeNode" ) @ Cached RangeNodes .CreateBigRangeNode createBigRangeNode ,
1925
1933
@ Shared ("cast" ) @ Cached CastToJavaIntExactNode cast ,
1926
- @ Shared ("overflowProfile" ) @ Cached IsBuiltinClassProfile overflowProfile ,
1934
+ @ Shared ("overflowProfile" ) @ Cached IsBuiltinObjectProfile overflowProfile ,
1927
1935
@ Shared ("indexNode" ) @ Cached PyNumberIndexNode indexNode ) {
1928
1936
Object lstart = indexNode .execute (frame , start );
1929
1937
Object lstop = indexNode .execute (frame , stop );
@@ -1933,9 +1941,9 @@ Object doGeneric(VirtualFrame frame, @SuppressWarnings("unused") Object cls, Obj
1933
1941
int istart = cast .execute (lstart );
1934
1942
int istop = cast .execute (lstop );
1935
1943
int istep = cast .execute (lstep );
1936
- return doInt (cls , istart , istop , istep , stepZeroProfile , exceptionProfile , lenOfRangeNodeExact , createBigRangeNode );
1944
+ return doInt (cls , istart , istop , istep , inliningTarget , stepZeroProfile , exceptionProfile , lenOfRangeNodeExact , createBigRangeNode );
1937
1945
} catch (PException e ) {
1938
- e .expect (OverflowError , overflowProfile );
1946
+ e .expect (inliningTarget , OverflowError , overflowProfile );
1939
1947
return createBigRangeNode .execute (lstart , lstop , lstep , factory ());
1940
1948
}
1941
1949
}
0 commit comments