@@ -993,32 +993,10 @@ public static Object run(Object object,
993
993
994
994
@ GenerateUncached
995
995
public abstract static class GetNativeClassNode extends PNodeWithContext {
996
- public abstract Object execute (PythonAbstractNativeObject object );
997
-
998
- @ Specialization (guards = {"isSingleContext()" , "object == cachedObject" }, limit = "1" )
999
- @ SuppressWarnings ("unused" )
1000
- static Object getNativeClassCachedIdentity (PythonAbstractNativeObject object ,
1001
- @ Cached (value = "object" , weak = true ) PythonAbstractNativeObject cachedObject ,
1002
- @ Cached ("getNativeClassUncached(object)" ) Object cachedClass ) {
1003
- // TODO: (tfel) is this really something we can do? It's so rare for this class to
1004
- // change that it shouldn't be worth the effort, but in native code, anything can
1005
- // happen. OTOH, CPython also has caches that can become invalid when someone just
1006
- // goes and changes the ob_type of an object.
1007
- return cachedClass ;
1008
- }
1009
996
1010
- @ Specialization (guards = {"isSingleContext()" , "isSame(lib, cachedObject, object)" })
1011
- @ SuppressWarnings ("unused" )
1012
- static Object getNativeClassCached (PythonAbstractNativeObject object ,
1013
- @ Cached (value = "object" , weak = true ) PythonAbstractNativeObject cachedObject ,
1014
- @ Cached ("getNativeClassUncached(object)" ) Object cachedClass ,
1015
- @ CachedLibrary (limit = "3" ) @ SuppressWarnings ("unused" ) InteropLibrary lib ) {
1016
- // TODO same as for 'getNativeClassCachedIdentity'
1017
- return cachedClass ;
1018
- }
997
+ public abstract Object execute (PythonAbstractNativeObject object );
1019
998
1020
999
@ Specialization (guards = {"lib.hasMembers(object.getPtr())" }, //
1021
- replaces = {"getNativeClassCached" , "getNativeClassCachedIdentity" }, //
1022
1000
limit = "1" , //
1023
1001
rewriteOn = {UnknownIdentifierException .class , UnsupportedMessageException .class })
1024
1002
static Object getNativeClassByMember (PythonAbstractNativeObject object ,
@@ -1030,7 +1008,7 @@ static Object getNativeClassByMember(PythonAbstractNativeObject object,
1030
1008
}
1031
1009
1032
1010
@ Specialization (guards = {"!lib.hasMembers(object.getPtr())" }, //
1033
- replaces = {"getNativeClassCached" , "getNativeClassCachedIdentity" , " getNativeClassByMember" }, //
1011
+ replaces = {"getNativeClassByMember" }, //
1034
1012
limit = "1" , //
1035
1013
rewriteOn = {UnknownIdentifierException .class , UnsupportedMessageException .class })
1036
1014
static Object getNativeClassByMemberAttachType (PythonAbstractNativeObject object ,
@@ -1043,24 +1021,14 @@ static Object getNativeClassByMemberAttachType(PythonAbstractNativeObject object
1043
1021
return classProfile .profile (toJavaNode .execute (lib .readMember (typedPtr , NativeMember .OB_TYPE .getMemberNameJavaString ())));
1044
1022
}
1045
1023
1046
- @ Specialization (replaces = {"getNativeClassCached" , "getNativeClassCachedIdentity" , " getNativeClassByMember" , "getNativeClassByMemberAttachType" })
1024
+ @ Specialization (replaces = {"getNativeClassByMember" , "getNativeClassByMemberAttachType" })
1047
1025
static Object getNativeClass (PythonAbstractNativeObject object ,
1048
1026
@ Cached PCallCapiFunction callGetObTypeNode ,
1049
1027
@ Cached AsPythonObjectNode toJavaNode ,
1050
1028
@ Cached ProfileClassNode classProfile ) {
1051
1029
// do not convert wrap 'object.object' since that is really the native pointer object
1052
1030
return classProfile .profile (toJavaNode .execute (callGetObTypeNode .call (FUN_GET_OB_TYPE , object .getPtr ())));
1053
1031
}
1054
-
1055
- static boolean isSame (InteropLibrary lib , PythonAbstractNativeObject cachedObject , PythonAbstractNativeObject object ) {
1056
- return lib .isIdentical (cachedObject , object , lib );
1057
- }
1058
-
1059
- public static Object getNativeClassUncached (PythonAbstractNativeObject object ) {
1060
- // do not wrap 'object.object' since that is really the native pointer object
1061
- return getNativeClass (object , PCallCapiFunction .getUncached (), AsPythonObjectNodeGen .getUncached (), ProfileClassNode .getUncached ());
1062
- }
1063
-
1064
1032
}
1065
1033
1066
1034
// -----------------------------------------------------------------------------------------------------------------
0 commit comments