@@ -1941,9 +1941,29 @@ protected boolean isListSubtype(VirtualFrame frame, Object obj, GetClassNode get
1941
1941
}
1942
1942
1943
1943
@ Builtin (name = "PyList_GetSlice" , minNumOfPositionalArgs = 3 )
1944
+ @ TypeSystemReference (PythonTypes .class )
1944
1945
@ GenerateNodeFactory
1945
1946
abstract static class PyListGetSliceNode extends PythonTernaryBuiltinNode {
1946
1947
1948
+ @ Specialization
1949
+ Object getSlice (VirtualFrame frame , PList list , long iLow , long iHigh ,
1950
+ @ Cached com .oracle .graal .python .builtins .objects .list .ListBuiltins .GetItemNode getItemNode ,
1951
+ @ Cached SliceLiteralNode sliceNode ,
1952
+ @ Cached BranchProfile isIntRangeProfile ,
1953
+ @ Cached TransformExceptionToNativeNode transformExceptionToNativeNode ,
1954
+ @ Cached GetNativeNullNode getNativeNullNode ) {
1955
+ try {
1956
+ if (PInt .isIntRange (iLow ) && PInt .isIntRange (iHigh )) {
1957
+ isIntRangeProfile .enter ();
1958
+ return getItemNode .execute (frame , list , sliceNode .execute (frame , (int ) iLow , (int ) iHigh , PNone .NONE ));
1959
+ }
1960
+ return getItemNode .execute (frame , list , sliceNode .execute (frame , iLow , iHigh , PNone .NONE ));
1961
+ } catch (PException e ) {
1962
+ transformExceptionToNativeNode .execute (e );
1963
+ return getNativeNullNode .execute ();
1964
+ }
1965
+ }
1966
+
1947
1967
@ Specialization
1948
1968
Object getSlice (VirtualFrame frame , PList list , Object iLow , Object iHigh ,
1949
1969
@ Cached com .oracle .graal .python .builtins .objects .list .ListBuiltins .GetItemNode getItemNode ,
@@ -1983,9 +2003,29 @@ protected boolean isListSubtype(VirtualFrame frame, Object obj, GetClassNode get
1983
2003
}
1984
2004
1985
2005
@ Builtin (name = "PyList_SetSlice" , minNumOfPositionalArgs = 4 )
2006
+ @ TypeSystemReference (PythonTypes .class )
1986
2007
@ GenerateNodeFactory
1987
2008
abstract static class PyListSetSliceNode extends PythonQuaternaryBuiltinNode {
1988
2009
2010
+ @ Specialization
2011
+ Object getSlice (VirtualFrame frame , PList list , long iLow , long iHigh , Object s ,
2012
+ @ Cached com .oracle .graal .python .builtins .objects .list .ListBuiltins .SetItemNode setItemNode ,
2013
+ @ Cached SliceLiteralNode sliceNode ,
2014
+ @ Cached BranchProfile isIntRangeProfile ,
2015
+ @ Cached TransformExceptionToNativeNode transformExceptionToNativeNode ) {
2016
+ try {
2017
+ if (PInt .isIntRange (iLow ) && PInt .isIntRange (iHigh )) {
2018
+ isIntRangeProfile .enter ();
2019
+ setItemNode .execute (frame , list , sliceNode .execute (frame , (int ) iLow , (int ) iHigh , PNone .NONE ), s );
2020
+ }
2021
+ setItemNode .execute (frame , list , sliceNode .execute (frame , iLow , iHigh , PNone .NONE ), s );
2022
+ return 0 ;
2023
+ } catch (PException e ) {
2024
+ transformExceptionToNativeNode .execute (e );
2025
+ return -1 ;
2026
+ }
2027
+ }
2028
+
1989
2029
@ Specialization
1990
2030
Object getSlice (VirtualFrame frame , PList list , Object iLow , Object iHigh , Object s ,
1991
2031
@ Cached com .oracle .graal .python .builtins .objects .list .ListBuiltins .SetItemNode setItemNode ,
0 commit comments