67
67
import com .oracle .graal .python .builtins .objects .PEllipsis ;
68
68
import com .oracle .graal .python .builtins .objects .PNone ;
69
69
import com .oracle .graal .python .builtins .objects .PNotImplemented ;
70
- import com .oracle .graal .python .builtins .objects .bytes .BytesBuiltins ;
71
70
import com .oracle .graal .python .builtins .objects .bytes .BytesBuiltins .ExpectIntNode ;
72
71
import com .oracle .graal .python .builtins .objects .bytes .BytesBuiltins .SepExpectByteNode ;
73
72
import com .oracle .graal .python .builtins .objects .bytes .BytesNodes ;
88
87
import com .oracle .graal .python .nodes .function .builtins .PythonTernaryBuiltinNode ;
89
88
import com .oracle .graal .python .nodes .function .builtins .PythonTernaryClinicBuiltinNode ;
90
89
import com .oracle .graal .python .nodes .function .builtins .PythonUnaryBuiltinNode ;
91
- import com .oracle .graal .python .nodes .function .builtins .clinic .ArgumentCastNode ;
92
90
import com .oracle .graal .python .nodes .function .builtins .clinic .ArgumentClinicProvider ;
93
91
import com .oracle .graal .python .nodes .subscript .SliceLiteralNode ;
94
92
import com .oracle .graal .python .runtime .AsyncHandler ;
@@ -179,7 +177,7 @@ public void postInitialize(PythonCore core) {
179
177
180
178
@ Builtin (name = __GETITEM__ , minNumOfPositionalArgs = 2 )
181
179
@ GenerateNodeFactory
182
- static abstract class GetItemNode extends PythonBinaryBuiltinNode {
180
+ abstract static class GetItemNode extends PythonBinaryBuiltinNode {
183
181
184
182
@ Specialization (guards = {"!isPSlice(index)" , "!isEllipsis(index)" })
185
183
Object getitem (VirtualFrame frame , PMemoryView self , Object index ,
@@ -230,7 +228,7 @@ Object getitemEllipsis(PMemoryView self, @SuppressWarnings("unused") PEllipsis e
230
228
231
229
@ Builtin (name = __SETITEM__ , minNumOfPositionalArgs = 3 )
232
230
@ GenerateNodeFactory
233
- public static abstract class SetItemNode extends PythonTernaryBuiltinNode {
231
+ public abstract static class SetItemNode extends PythonTernaryBuiltinNode {
234
232
@ Specialization (guards = {"!isPSlice(index)" , "!isEllipsis(index)" })
235
233
Object setitem (VirtualFrame frame , PMemoryView self , Object index , Object object ,
236
234
@ Cached MemoryViewNodes .PointerLookupNode pointerFromIndexNode ,
@@ -296,7 +294,7 @@ private void checkReadonly(PMemoryView self) {
296
294
297
295
@ Builtin (name = __EQ__ , minNumOfPositionalArgs = 2 )
298
296
@ GenerateNodeFactory
299
- public static abstract class EqNode extends PythonBinaryBuiltinNode {
297
+ public abstract static class EqNode extends PythonBinaryBuiltinNode {
300
298
@ Child private CExtNodes .PCallCapiFunction callCapiFunction ;
301
299
302
300
@ Specialization
@@ -358,7 +356,9 @@ static Object eq(Object self, Object other) {
358
356
359
357
private boolean recursive (PythonObjectLibrary lib , PMemoryView self , PMemoryView other ,
360
358
MemoryViewNodes .ReadItemAtNode readSelf , MemoryViewNodes .ReadItemAtNode readOther ,
361
- int dim , int ndim , Object selfPtr , int selfOffset , Object otherPtr , int otherOffset ) {
359
+ int dim , int ndim , Object selfPtr , int initialSelfOffset , Object otherPtr , int initialOtherOffset ) {
360
+ int selfOffset = initialSelfOffset ;
361
+ int otherOffset = initialOtherOffset ;
362
362
for (int i = 0 ; i < self .getBufferShape ()[dim ]; i ++) {
363
363
Object selfXPtr = selfPtr ;
364
364
int selfXOffset = selfOffset ;
@@ -400,7 +400,7 @@ private CExtNodes.PCallCapiFunction getCallCapiFunction() {
400
400
401
401
@ Builtin (name = __DELITEM__ , minNumOfPositionalArgs = 1 )
402
402
@ GenerateNodeFactory
403
- public static abstract class DelItemNode extends PythonUnaryBuiltinNode {
403
+ public abstract static class DelItemNode extends PythonUnaryBuiltinNode {
404
404
@ Specialization
405
405
Object error (@ SuppressWarnings ("unused" ) PMemoryView self ) {
406
406
throw raise (TypeError , ErrorMessages .CANNOT_DELETE_MEMORY );
@@ -409,7 +409,7 @@ Object error(@SuppressWarnings("unused") PMemoryView self) {
409
409
410
410
@ Builtin (name = "tolist" , minNumOfPositionalArgs = 1 )
411
411
@ GenerateNodeFactory
412
- public static abstract class ToListNode extends PythonUnaryBuiltinNode {
412
+ public abstract static class ToListNode extends PythonUnaryBuiltinNode {
413
413
@ Child private CExtNodes .PCallCapiFunction callCapiFunction ;
414
414
415
415
@ Specialization (guards = {"self.getDimensions() == cachedDimensions" , "cachedDimensions < 8" })
@@ -441,7 +441,8 @@ private PList recursiveBoundary(PMemoryView self, MemoryViewNodes.ReadItemAtNode
441
441
return recursive (self , readItemAtNode , dim , ndim , ptr , offset );
442
442
}
443
443
444
- private PList recursive (PMemoryView self , MemoryViewNodes .ReadItemAtNode readItemAtNode , int dim , int ndim , Object ptr , int offset ) {
444
+ private PList recursive (PMemoryView self , MemoryViewNodes .ReadItemAtNode readItemAtNode , int dim , int ndim , Object ptr , int initialOffset ) {
445
+ int offset = initialOffset ;
445
446
Object [] objects = new Object [self .getBufferShape ()[dim ]];
446
447
for (int i = 0 ; i < self .getBufferShape ()[dim ]; i ++) {
447
448
Object xptr = ptr ;
@@ -472,7 +473,7 @@ private CExtNodes.PCallCapiFunction getCallCapiFunction() {
472
473
@ Builtin (name = "tobytes" , minNumOfPositionalArgs = 1 , parameterNames = {"$self" , "order" })
473
474
@ ArgumentClinic (name = "order" , conversion = ArgumentClinic .ClinicConversion .String , defaultValue = "\" C\" " , useDefaultForNone = true )
474
475
@ GenerateNodeFactory
475
- public static abstract class ToBytesNode extends PythonBinaryClinicBuiltinNode {
476
+ public abstract static class ToBytesNode extends PythonBinaryClinicBuiltinNode {
476
477
@ Child private MemoryViewNodes .ToJavaBytesNode toJavaBytesNode ;
477
478
@ Child private MemoryViewNodes .ToJavaBytesFortranOrderNode toJavaBytesFortranOrderNode ;
478
479
@@ -548,7 +549,7 @@ protected ArgumentClinicProvider getArgumentClinic() {
548
549
549
550
@ Builtin (name = "toreadonly" , minNumOfPositionalArgs = 1 )
550
551
@ GenerateNodeFactory
551
- public static abstract class ToReadonlyNode extends PythonUnaryBuiltinNode {
552
+ public abstract static class ToReadonlyNode extends PythonUnaryBuiltinNode {
552
553
@ Specialization
553
554
PMemoryView toreadonly (PMemoryView self ,
554
555
@ Cached MemoryViewNodes .GetBufferReferences getQueue ) {
@@ -562,7 +563,7 @@ PMemoryView toreadonly(PMemoryView self,
562
563
@ Builtin (name = "cast" , minNumOfPositionalArgs = 2 , parameterNames = {"$self" , "format" , "shape" })
563
564
@ ArgumentClinic (name = "format" , conversion = ArgumentClinic .ClinicConversion .String )
564
565
@ GenerateNodeFactory
565
- public static abstract class CastNode extends PythonTernaryClinicBuiltinNode {
566
+ public abstract static class CastNode extends PythonTernaryClinicBuiltinNode {
566
567
567
568
@ Specialization
568
569
PMemoryView cast (PMemoryView self , String formatString , @ SuppressWarnings ("unused" ) PNone none ,
@@ -663,7 +664,7 @@ protected ArgumentClinicProvider getArgumentClinic() {
663
664
664
665
@ Builtin (name = __LEN__ , minNumOfPositionalArgs = 1 )
665
666
@ GenerateNodeFactory
666
- public static abstract class LenNode extends PythonUnaryBuiltinNode {
667
+ public abstract static class LenNode extends PythonUnaryBuiltinNode {
667
668
@ Specialization
668
669
int len (PMemoryView self ,
669
670
@ Cached ConditionProfile zeroDimProfile ) {
@@ -674,7 +675,7 @@ int len(PMemoryView self,
674
675
675
676
@ Builtin (name = __REPR__ , minNumOfPositionalArgs = 1 )
676
677
@ GenerateNodeFactory
677
- public static abstract class ReprNode extends PythonUnaryBuiltinNode {
678
+ public abstract static class ReprNode extends PythonUnaryBuiltinNode {
678
679
@ Specialization
679
680
@ TruffleBoundary
680
681
static String repr (PMemoryView self ) {
@@ -688,7 +689,7 @@ static String repr(PMemoryView self) {
688
689
689
690
@ Builtin (name = __HASH__ , minNumOfPositionalArgs = 1 )
690
691
@ GenerateNodeFactory
691
- public static abstract class HashNode extends PythonUnaryBuiltinNode {
692
+ public abstract static class HashNode extends PythonUnaryBuiltinNode {
692
693
@ Specialization
693
694
int hash (PMemoryView self ,
694
695
@ Cached ConditionProfile cachedProfile ,
@@ -716,7 +717,7 @@ private static int hashArray(byte[] array) {
716
717
717
718
@ Builtin (name = __ENTER__ , minNumOfPositionalArgs = 1 )
718
719
@ GenerateNodeFactory
719
- public static abstract class EnterNode extends PythonUnaryBuiltinNode {
720
+ public abstract static class EnterNode extends PythonUnaryBuiltinNode {
720
721
@ Specialization
721
722
Object enter (PMemoryView self ) {
722
723
self .checkReleased (this );
@@ -726,7 +727,7 @@ Object enter(PMemoryView self) {
726
727
727
728
@ Builtin (name = __EXIT__ , minNumOfPositionalArgs = 4 )
728
729
@ GenerateNodeFactory
729
- public static abstract class ExitNode extends PythonQuaternaryBuiltinNode {
730
+ public abstract static class ExitNode extends PythonQuaternaryBuiltinNode {
730
731
@ Specialization
731
732
@ SuppressWarnings ("unused" )
732
733
static Object exit (VirtualFrame frame , PMemoryView self , Object type , Object val , Object tb ,
@@ -738,7 +739,7 @@ static Object exit(VirtualFrame frame, PMemoryView self, Object type, Object val
738
739
739
740
@ Builtin (name = "release" , minNumOfPositionalArgs = 1 )
740
741
@ GenerateNodeFactory
741
- public static abstract class ReleaseNode extends PythonUnaryBuiltinNode {
742
+ public abstract static class ReleaseNode extends PythonUnaryBuiltinNode {
742
743
public abstract Object execute (VirtualFrame frame , PMemoryView self );
743
744
744
745
@ Specialization (guards = "self.getReference() == null" )
@@ -793,7 +794,7 @@ private void checkExports(PMemoryView self) {
793
794
794
795
@ Builtin (name = "itemsize" , minNumOfPositionalArgs = 1 , isGetter = true )
795
796
@ GenerateNodeFactory
796
- public static abstract class ItemSizeNode extends PythonUnaryBuiltinNode {
797
+ public abstract static class ItemSizeNode extends PythonUnaryBuiltinNode {
797
798
@ Specialization
798
799
int get (PMemoryView self ) {
799
800
self .checkReleased (this );
@@ -803,7 +804,7 @@ int get(PMemoryView self) {
803
804
804
805
@ Builtin (name = "nbytes" , minNumOfPositionalArgs = 1 , isGetter = true )
805
806
@ GenerateNodeFactory
806
- public static abstract class NBytesNode extends PythonUnaryBuiltinNode {
807
+ public abstract static class NBytesNode extends PythonUnaryBuiltinNode {
807
808
@ Specialization
808
809
int get (PMemoryView self ) {
809
810
self .checkReleased (this );
@@ -813,7 +814,7 @@ int get(PMemoryView self) {
813
814
814
815
@ Builtin (name = "obj" , minNumOfPositionalArgs = 1 , isGetter = true )
815
816
@ GenerateNodeFactory
816
- public static abstract class ObjNode extends PythonUnaryBuiltinNode {
817
+ public abstract static class ObjNode extends PythonUnaryBuiltinNode {
817
818
@ Specialization
818
819
Object get (PMemoryView self ) {
819
820
self .checkReleased (this );
@@ -823,7 +824,7 @@ Object get(PMemoryView self) {
823
824
824
825
@ Builtin (name = "format" , minNumOfPositionalArgs = 1 , isGetter = true )
825
826
@ GenerateNodeFactory
826
- public static abstract class FormatNode extends PythonUnaryBuiltinNode {
827
+ public abstract static class FormatNode extends PythonUnaryBuiltinNode {
827
828
@ Specialization
828
829
Object get (PMemoryView self ) {
829
830
self .checkReleased (this );
@@ -833,7 +834,7 @@ Object get(PMemoryView self) {
833
834
834
835
@ Builtin (name = "shape" , minNumOfPositionalArgs = 1 , isGetter = true )
835
836
@ GenerateNodeFactory
836
- public static abstract class ShapeNode extends PythonUnaryBuiltinNode {
837
+ public abstract static class ShapeNode extends PythonUnaryBuiltinNode {
837
838
@ Specialization
838
839
Object get (PMemoryView self ,
839
840
@ Cached ConditionProfile nullProfile ) {
@@ -847,7 +848,7 @@ Object get(PMemoryView self,
847
848
848
849
@ Builtin (name = "strides" , minNumOfPositionalArgs = 1 , isGetter = true )
849
850
@ GenerateNodeFactory
850
- public static abstract class StridesNode extends PythonUnaryBuiltinNode {
851
+ public abstract static class StridesNode extends PythonUnaryBuiltinNode {
851
852
@ Specialization
852
853
Object get (PMemoryView self ,
853
854
@ Cached ConditionProfile nullProfile ) {
@@ -861,7 +862,7 @@ Object get(PMemoryView self,
861
862
862
863
@ Builtin (name = "suboffsets" , minNumOfPositionalArgs = 1 , isGetter = true )
863
864
@ GenerateNodeFactory
864
- public static abstract class SuboffsetsNode extends PythonUnaryBuiltinNode {
865
+ public abstract static class SuboffsetsNode extends PythonUnaryBuiltinNode {
865
866
@ Specialization
866
867
Object get (PMemoryView self ,
867
868
@ Cached ConditionProfile nullProfile ) {
@@ -875,7 +876,7 @@ Object get(PMemoryView self,
875
876
876
877
@ Builtin (name = "readonly" , minNumOfPositionalArgs = 1 , isGetter = true )
877
878
@ GenerateNodeFactory
878
- public static abstract class ReadonlyNode extends PythonUnaryBuiltinNode {
879
+ public abstract static class ReadonlyNode extends PythonUnaryBuiltinNode {
879
880
@ Specialization
880
881
boolean get (PMemoryView self ) {
881
882
self .checkReleased (this );
@@ -885,7 +886,7 @@ boolean get(PMemoryView self) {
885
886
886
887
@ Builtin (name = "ndim" , minNumOfPositionalArgs = 1 , isGetter = true )
887
888
@ GenerateNodeFactory
888
- public static abstract class NDimNode extends PythonUnaryBuiltinNode {
889
+ public abstract static class NDimNode extends PythonUnaryBuiltinNode {
889
890
@ Specialization
890
891
int get (PMemoryView self ) {
891
892
self .checkReleased (this );
@@ -895,7 +896,7 @@ int get(PMemoryView self) {
895
896
896
897
@ Builtin (name = "c_contiguous" , minNumOfPositionalArgs = 1 , isGetter = true )
897
898
@ GenerateNodeFactory
898
- public static abstract class CContiguousNode extends PythonUnaryBuiltinNode {
899
+ public abstract static class CContiguousNode extends PythonUnaryBuiltinNode {
899
900
@ Specialization
900
901
boolean get (PMemoryView self ) {
901
902
self .checkReleased (this );
@@ -905,7 +906,7 @@ boolean get(PMemoryView self) {
905
906
906
907
@ Builtin (name = "f_contiguous" , minNumOfPositionalArgs = 1 , isGetter = true )
907
908
@ GenerateNodeFactory
908
- public static abstract class FContiguousNode extends PythonUnaryBuiltinNode {
909
+ public abstract static class FContiguousNode extends PythonUnaryBuiltinNode {
909
910
@ Specialization
910
911
boolean get (PMemoryView self ) {
911
912
self .checkReleased (this );
@@ -915,7 +916,7 @@ boolean get(PMemoryView self) {
915
916
916
917
@ Builtin (name = "contiguous" , minNumOfPositionalArgs = 1 , isGetter = true )
917
918
@ GenerateNodeFactory
918
- public static abstract class ContiguousNode extends PythonUnaryBuiltinNode {
919
+ public abstract static class ContiguousNode extends PythonUnaryBuiltinNode {
919
920
@ Specialization
920
921
boolean get (PMemoryView self ) {
921
922
self .checkReleased (this );
0 commit comments