@@ -164,7 +164,7 @@ protected List<? extends NodeFactory<? extends PythonBuiltinBaseNode>> getNodeFa
164
164
@ ImportStatic (SpecialAttributeNames .class )
165
165
public abstract static class ReprNode extends PythonUnaryBuiltinNode {
166
166
@ Specialization
167
- String repr (VirtualFrame frame , Object self ,
167
+ static String repr (VirtualFrame frame , Object self ,
168
168
@ Cached ("create(__MODULE__)" ) GetFixedAttributeNode readModuleNode ,
169
169
@ Cached ("create(__QUALNAME__)" ) GetFixedAttributeNode readQualNameNode ) {
170
170
Object moduleName = readModuleNode .executeObject (frame , self );
@@ -249,7 +249,6 @@ public abstract static class CallNode extends PythonVarargsBuiltinNode {
249
249
@ Child private LookupSpecialMethodNode lookupInit = LookupSpecialMethodNode .create (__INIT__ );
250
250
@ Child private IsSubtypeNode isSubTypeNode ;
251
251
@ Child private TypeNodes .GetNameNode getNameNode ;
252
- @ Child private IsBuiltinClassProfile isClassClassProfile = IsBuiltinClassProfile .create ();
253
252
254
253
@ CompilationFinal private boolean newWasDescriptor = false ;
255
254
@@ -325,9 +324,10 @@ protected Object doIt0BuiltinSingle(VirtualFrame frame, @SuppressWarnings("unuse
325
324
return op (frame , cachedSelf .getType (), arguments , keywords , true , plib );
326
325
}
327
326
328
- @ Specialization (limit = "getCallSiteInlineCacheMaxDepth()" , guards = {"self == cachedSelf" , "!isPythonBuiltinClass(cachedSelf)" }, assumptions = "singleContextAssumption()" )
329
- protected Object doIt0User (VirtualFrame frame , @ SuppressWarnings ("unused" ) PythonAbstractClass self , Object [] arguments , PKeyword [] keywords ,
330
- @ Cached ("self" ) PythonAbstractClass cachedSelf ,
327
+ @ Specialization (limit = "getCallSiteInlineCacheMaxDepth()" , guards = {"self == cachedSelf" , "isPythonClass(cachedSelf)" ,
328
+ "!isPythonBuiltinClass(cachedSelf)" }, assumptions = "singleContextAssumption()" )
329
+ protected Object doIt0User (VirtualFrame frame , @ SuppressWarnings ("unused" ) Object self , Object [] arguments , PKeyword [] keywords ,
330
+ @ Cached ("self" ) Object cachedSelf ,
331
331
@ CachedLibrary (limit = "3" ) PythonObjectLibrary plib ) {
332
332
return op (frame , cachedSelf , arguments , keywords , true , plib );
333
333
}
@@ -605,7 +605,7 @@ Object setBases(VirtualFrame frame, PythonClass cls, PTuple value,
605
605
for (int i = 0 ; i < a .length ; i ++) {
606
606
if (PGuards .isPythonClass (a [i ])) {
607
607
if (isSubtypeNode .execute (frame , a [i ], cls ) ||
608
- hasMRO (getMroNode , ( PythonAbstractClass ) a [i ]) && typeIsSubtypeBaseChain (( PythonAbstractClass ) a [i ], cls , getBase , isSameTypeNode )) {
608
+ hasMRO (getMroNode , a [i ]) && typeIsSubtypeBaseChain (a [i ], cls , getBase , isSameTypeNode )) {
609
609
throw raise (TypeError , ErrorMessages .BASES_ITEM_CAUSES_INHERITANCE_CYCLE );
610
610
}
611
611
baseClasses [i ] = (PythonAbstractClass ) a [i ];
@@ -627,18 +627,18 @@ Object setBases(VirtualFrame frame, PythonClass cls, PTuple value,
627
627
return PNone .NONE ;
628
628
}
629
629
630
- private static boolean hasMRO (GetMroNode getMroNode , PythonAbstractClass i ) {
630
+ private static boolean hasMRO (GetMroNode getMroNode , Object i ) {
631
631
PythonAbstractClass [] mro = getMroNode .execute (i );
632
632
return mro != null && mro .length > 0 ;
633
633
}
634
634
635
- private static boolean typeIsSubtypeBaseChain (PythonAbstractClass a , PythonAbstractClass b , GetBaseClassNode getBaseNode , IsSameTypeNode isSameTypeNode ) {
636
- PythonAbstractClass base = a ;
635
+ private static boolean typeIsSubtypeBaseChain (Object a , Object b , GetBaseClassNode getBaseNode , IsSameTypeNode isSameTypeNode ) {
636
+ Object base = a ;
637
637
do {
638
638
if (isSameTypeNode .execute (base , b )) {
639
639
return true ;
640
640
}
641
- base = ( PythonAbstractClass ) getBaseNode .execute (base );
641
+ base = getBaseNode .execute (base );
642
642
} while (base != null );
643
643
644
644
return (isSameTypeNode .execute (b , PythonBuiltinClassType .PythonObject ));
@@ -699,7 +699,7 @@ Object doManaged(PythonManagedClass self,
699
699
}
700
700
701
701
@ Specialization
702
- Object doNative (PythonNativeClass self ,
702
+ static Object doNative (PythonNativeClass self ,
703
703
@ Cached CExtNodes .GetTypeMemberNode getTpDictNode ) {
704
704
return getTpDictNode .execute (self , NativeMember .TP_DICT );
705
705
}
@@ -838,12 +838,12 @@ abstract static class AbstractSlotNode extends PythonBinaryBuiltinNode {
838
838
@ Builtin (name = __NAME__ , minNumOfPositionalArgs = 1 , maxNumOfPositionalArgs = 2 , isGetter = true , isSetter = true )
839
839
abstract static class NameNode extends AbstractSlotNode {
840
840
@ Specialization (guards = "isNoValue(value)" )
841
- String getNameType (PythonBuiltinClassType cls , @ SuppressWarnings ("unused" ) PNone value ) {
841
+ static String getNameType (PythonBuiltinClassType cls , @ SuppressWarnings ("unused" ) PNone value ) {
842
842
return cls .getName ();
843
843
}
844
844
845
845
@ Specialization (guards = "isNoValue(value)" )
846
- String getNameBuiltin (PythonManagedClass cls , @ SuppressWarnings ("unused" ) PNone value ) {
846
+ static String getNameBuiltin (PythonManagedClass cls , @ SuppressWarnings ("unused" ) PNone value ) {
847
847
return cls .getName ();
848
848
}
849
849
@@ -873,7 +873,7 @@ Object setName(PythonClass cls, Object value,
873
873
}
874
874
875
875
@ Specialization (guards = "isNoValue(value)" )
876
- Object getModule (PythonAbstractNativeObject cls , @ SuppressWarnings ("unused" ) PNone value ,
876
+ static Object getModule (PythonAbstractNativeObject cls , @ SuppressWarnings ("unused" ) PNone value ,
877
877
@ Cached GetTypeMemberNode getTpNameNode ) {
878
878
// 'tp_name' contains the fully-qualified name, i.e., 'module.A.B...'
879
879
String tpName = (String ) getTpNameNode .execute (cls , NativeMember .TP_NAME );
@@ -900,13 +900,13 @@ private static String getQualName(String fqname) {
900
900
abstract static class ModuleNode extends AbstractSlotNode {
901
901
902
902
@ Specialization (guards = "isNoValue(value)" )
903
- Object getModuleType (PythonBuiltinClassType cls , @ SuppressWarnings ("unused" ) PNone value ) {
903
+ static Object getModuleType (PythonBuiltinClassType cls , @ SuppressWarnings ("unused" ) PNone value ) {
904
904
String module = cls .getPublicInModule ();
905
905
return module == null ? BuiltinNames .BUILTINS : module ;
906
906
}
907
907
908
908
@ Specialization (guards = "isNoValue(value)" )
909
- Object getModuleBuiltin (PythonBuiltinClass cls , @ SuppressWarnings ("unused" ) PNone value ) {
909
+ static Object getModuleBuiltin (PythonBuiltinClass cls , @ SuppressWarnings ("unused" ) PNone value ) {
910
910
return getModuleType (cls .getType (), value );
911
911
}
912
912
@@ -921,14 +921,14 @@ Object getModule(PythonClass cls, @SuppressWarnings("unused") PNone value,
921
921
}
922
922
923
923
@ Specialization (guards = "!isNoValue(value)" )
924
- Object setModule (PythonClass cls , Object value ,
924
+ static Object setModule (PythonClass cls , Object value ,
925
925
@ Cached ("create()" ) WriteAttributeToObjectNode writeAttrNode ) {
926
926
writeAttrNode .execute (cls , __MODULE__ , value );
927
927
return PNone .NONE ;
928
928
}
929
929
930
930
@ Specialization (guards = "isNoValue(value)" )
931
- Object getModule (PythonNativeClass cls , @ SuppressWarnings ("unused" ) PNone value ,
931
+ static Object getModule (PythonNativeClass cls , @ SuppressWarnings ("unused" ) PNone value ,
932
932
@ Cached GetTypeMemberNode getTpNameNode ) {
933
933
// 'tp_name' contains the fully-qualified name, i.e., 'module.A.B...'
934
934
String tpName = (String ) getTpNameNode .execute (cls , NativeMember .TP_NAME );
@@ -953,12 +953,12 @@ private static Object getModuleName(String fqname) {
953
953
@ Builtin (name = __QUALNAME__ , minNumOfPositionalArgs = 1 , maxNumOfPositionalArgs = 2 , isGetter = true , isSetter = true )
954
954
abstract static class QualNameNode extends AbstractSlotNode {
955
955
@ Specialization (guards = "isNoValue(value)" )
956
- String getName (PythonBuiltinClassType cls , @ SuppressWarnings ("unused" ) PNone value ) {
956
+ static String getName (PythonBuiltinClassType cls , @ SuppressWarnings ("unused" ) PNone value ) {
957
957
return cls .getQualifiedName ();
958
958
}
959
959
960
960
@ Specialization (guards = "isNoValue(value)" )
961
- String getName (PythonManagedClass cls , @ SuppressWarnings ("unused" ) PNone value ) {
961
+ static String getName (PythonManagedClass cls , @ SuppressWarnings ("unused" ) PNone value ) {
962
962
return cls .getQualName ();
963
963
}
964
964
@@ -979,7 +979,7 @@ Object setName(PythonClass cls, Object value,
979
979
}
980
980
981
981
@ Specialization (guards = "isNoValue(value)" )
982
- String getNative (PythonNativeClass cls , @ SuppressWarnings ("unused" ) PNone value ,
982
+ static String getNative (PythonNativeClass cls , @ SuppressWarnings ("unused" ) PNone value ,
983
983
@ Cached GetTypeMemberNode getTpNameNode ) {
984
984
// 'tp_name' contains the fully-qualified name, i.e., 'module.A.B...'
985
985
String tpName = (String ) getTpNameNode .execute (cls , NativeMember .TP_NAME );
@@ -1011,7 +1011,7 @@ Object getDictoffsetType(PythonBuiltinClassType cls, @SuppressWarnings("unused")
1011
1011
}
1012
1012
1013
1013
@ Specialization (guards = "isNoValue(value)" )
1014
- Object getDictoffsetManaged (PythonManagedClass cls , @ SuppressWarnings ("unused" ) PNone value ,
1014
+ static Object getDictoffsetManaged (PythonManagedClass cls , @ SuppressWarnings ("unused" ) PNone value ,
1015
1015
@ Cached ("create()" ) IsBuiltinClassProfile profile ,
1016
1016
@ Cached ("create()" ) ReadAttributeFromObjectNode getName ) {
1017
1017
// recursion anchor; since the metaclass of 'type' is 'type'
@@ -1032,13 +1032,13 @@ Object setDictoffsetBuiltin(@SuppressWarnings("unused") PythonBuiltinClass cls,
1032
1032
}
1033
1033
1034
1034
@ Specialization (guards = {"!isNoValue(value)" , "!isPythonBuiltinClass(cls)" })
1035
- Object setDictoffsetClass (PythonClass cls , Object value ,
1035
+ static Object setDictoffsetClass (PythonClass cls , Object value ,
1036
1036
@ Cached ("create()" ) WriteAttributeToObjectNode setName ) {
1037
1037
return setName .execute (cls , __DICTOFFSET__ , value );
1038
1038
}
1039
1039
1040
1040
@ Specialization (guards = "isNoValue(value)" )
1041
- Object getNative (PythonNativeClass cls , @ SuppressWarnings ("unused" ) PNone value ,
1041
+ static Object getNative (PythonNativeClass cls , @ SuppressWarnings ("unused" ) PNone value ,
1042
1042
@ Cached GetTypeMemberNode getTpDictoffsetNode ) {
1043
1043
return getTpDictoffsetNode .execute (cls , NativeMember .TP_DICTOFFSET );
1044
1044
}
@@ -1060,7 +1060,7 @@ Object getItemsizeType(PythonBuiltinClassType cls, @SuppressWarnings("unused") P
1060
1060
}
1061
1061
1062
1062
@ Specialization (guards = "isNoValue(value)" )
1063
- Object getItemsizeManaged (PythonManagedClass cls , @ SuppressWarnings ("unused" ) PNone value ,
1063
+ static Object getItemsizeManaged (PythonManagedClass cls , @ SuppressWarnings ("unused" ) PNone value ,
1064
1064
@ Cached ("create()" ) IsBuiltinClassProfile profile ,
1065
1065
@ Cached ("create()" ) ReadAttributeFromObjectNode getName ) {
1066
1066
// recursion anchor; since the metaclass of 'type' is 'type'
@@ -1081,13 +1081,13 @@ Object setItemsizeBuiltin(@SuppressWarnings("unused") PythonBuiltinClass cls, @S
1081
1081
}
1082
1082
1083
1083
@ Specialization (guards = {"!isNoValue(value)" , "!isPythonBuiltinClass(cls)" })
1084
- Object setItemsize (PythonClass cls , Object value ,
1084
+ static Object setItemsize (PythonClass cls , Object value ,
1085
1085
@ Cached ("create()" ) WriteAttributeToObjectNode setName ) {
1086
1086
return setName .execute (cls , __ITEMSIZE__ , value );
1087
1087
}
1088
1088
1089
1089
@ Specialization (guards = "isNoValue(value)" )
1090
- Object getNative (PythonNativeClass cls , @ SuppressWarnings ("unused" ) PNone value ,
1090
+ static Object getNative (PythonNativeClass cls , @ SuppressWarnings ("unused" ) PNone value ,
1091
1091
@ Cached GetTypeMemberNode getTpDictoffsetNode ) {
1092
1092
return getTpDictoffsetNode .execute (cls , NativeMember .TP_ITEMSIZE );
1093
1093
}
@@ -1108,7 +1108,7 @@ Object getBasicsizeType(PythonBuiltinClassType cls, @SuppressWarnings("unused")
1108
1108
}
1109
1109
1110
1110
@ Specialization (guards = "isNoValue(value)" )
1111
- Object getBasicsizeManaged (PythonManagedClass cls , @ SuppressWarnings ("unused" ) PNone value ,
1111
+ static Object getBasicsizeManaged (PythonManagedClass cls , @ SuppressWarnings ("unused" ) PNone value ,
1112
1112
@ Cached ("create()" ) IsBuiltinClassProfile profile ,
1113
1113
@ Cached ("create()" ) ReadAttributeFromObjectNode getName ) {
1114
1114
// recursion anchor; since the metaclass of 'type' is 'type'
@@ -1129,13 +1129,13 @@ Object setBasicsizeBuiltin(@SuppressWarnings("unused") PythonBuiltinClass cls, @
1129
1129
}
1130
1130
1131
1131
@ Specialization (guards = {"!isNoValue(value)" , "!isPythonBuiltinClass(cls)" })
1132
- Object setBasicsize (PythonClass cls , Object value ,
1132
+ static Object setBasicsize (PythonClass cls , Object value ,
1133
1133
@ Cached ("create()" ) WriteAttributeToObjectNode setName ) {
1134
1134
return setName .execute (cls , __BASICSIZE__ , value );
1135
1135
}
1136
1136
1137
1137
@ Specialization (guards = "isNoValue(value)" )
1138
- Object getNative (PythonNativeClass cls , @ SuppressWarnings ("unused" ) PNone value ,
1138
+ static Object getNative (PythonNativeClass cls , @ SuppressWarnings ("unused" ) PNone value ,
1139
1139
@ Cached ("create()" ) GetTypeMemberNode getTpDictoffsetNode ) {
1140
1140
return getTpDictoffsetNode .execute (cls , NativeMember .TP_BASICSIZE );
1141
1141
}
0 commit comments