72
72
import com .oracle .truffle .api .dsl .ImportStatic ;
73
73
import com .oracle .truffle .api .dsl .Specialization ;
74
74
import com .oracle .truffle .api .library .CachedLibrary ;
75
- import com .oracle .truffle .api .object .DynamicObjectLibrary ;
76
75
import com .oracle .truffle .api .profiles .BranchProfile ;
77
76
import com .oracle .truffle .api .profiles .ConditionProfile ;
78
77
@@ -93,12 +92,12 @@ public static WriteAttributeToObjectNode getUncached() {
93
92
return WriteAttributeToObjectNotTypeUncachedNodeGen .getUncached ();
94
93
}
95
94
96
- protected static boolean isAttrWritable (DynamicObjectLibrary dyLib , IsBuiltinClassProfile exactBuiltinInstanceProfile , PythonObject self , Object key ) {
95
+ protected static boolean isAttrWritable (IsBuiltinClassProfile exactBuiltinInstanceProfile , PythonObject self , Object key ) {
97
96
if (isHiddenKey (key ) || self instanceof PythonManagedClass || self instanceof PFunction || self instanceof PDecoratedMethod || self instanceof PythonModule ||
98
97
self instanceof PBaseException ) {
99
98
return true ;
100
99
}
101
- if ((dyLib . getShapeFlags ( self ) & PythonObject .HAS_SLOTS_BUT_NO_DICT_FLAG ) != 0 ) {
100
+ if ((self . getShape (). getFlags ( ) & PythonObject .HAS_SLOTS_BUT_NO_DICT_FLAG ) != 0 ) {
102
101
return false ;
103
102
}
104
103
return !exactBuiltinInstanceProfile .profileIsAnyBuiltinObject (self );
@@ -112,14 +111,13 @@ private static void handlePythonClass(ConditionProfile isClassProfile, PythonObj
112
111
113
112
// write to the DynamicObject
114
113
@ Specialization (guards = {
115
- "isAttrWritable(dyLib, exactBuiltinInstanceProfile, object, key)" ,
114
+ "isAttrWritable(exactBuiltinInstanceProfile, object, key)" ,
116
115
"isHiddenKey(key) || !lib.hasDict(object)"
117
116
}, limit = "1" )
118
117
protected boolean writeToDynamicStorage (PythonObject object , Object key , Object value ,
119
118
@ CachedLibrary ("object" ) @ SuppressWarnings ("unused" ) PythonObjectLibrary lib ,
120
119
@ Cached ("create()" ) WriteAttributeToDynamicObjectNode writeAttributeToDynamicObjectNode ,
121
120
@ Exclusive @ Cached ("createBinaryProfile()" ) ConditionProfile isClassProfile ,
122
- @ CachedLibrary ("object" ) @ SuppressWarnings ("unused" ) DynamicObjectLibrary dyLib ,
123
121
@ Exclusive @ Cached @ SuppressWarnings ("unused" ) IsBuiltinClassProfile exactBuiltinInstanceProfile ) {
124
122
handlePythonClass (isClassProfile , object , key );
125
123
return writeAttributeToDynamicObjectNode .execute (object .getStorage (), key , value );
@@ -156,19 +154,18 @@ private static boolean writeNativeGeneric(PythonAbstractNativeObject object, Obj
156
154
}
157
155
}
158
156
159
- @ Specialization (guards = "isErrorCase(dyLib, exactBuiltinInstanceProfile, lib, object, key)" )
157
+ @ Specialization (guards = "isErrorCase(exactBuiltinInstanceProfile, lib, object, key)" )
160
158
protected static boolean doError (Object object , Object key , @ SuppressWarnings ("unused" ) Object value ,
161
159
@ CachedLibrary (limit = "1" ) @ SuppressWarnings ("unused" ) PythonObjectLibrary lib ,
162
- @ CachedLibrary (limit = "1" ) @ SuppressWarnings ("unused" ) DynamicObjectLibrary dyLib ,
163
160
@ Exclusive @ Cached @ SuppressWarnings ("unused" ) IsBuiltinClassProfile exactBuiltinInstanceProfile ,
164
161
@ Exclusive @ Cached PRaiseNode raiseNode ) {
165
162
throw raiseNode .raise (PythonBuiltinClassType .AttributeError , ErrorMessages .OBJ_P_HAS_NO_ATTR_S , object , key );
166
163
}
167
164
168
- protected static boolean isErrorCase (DynamicObjectLibrary dyLib , IsBuiltinClassProfile exactBuiltinInstanceProfile , PythonObjectLibrary lib , Object object , Object key ) {
165
+ protected static boolean isErrorCase (IsBuiltinClassProfile exactBuiltinInstanceProfile , PythonObjectLibrary lib , Object object , Object key ) {
169
166
if (object instanceof PythonObject ) {
170
167
PythonObject self = (PythonObject ) object ;
171
- if (isAttrWritable (dyLib , exactBuiltinInstanceProfile , self , key ) && (isHiddenKey (key ) || !lib .hasDict (self ))) {
168
+ if (isAttrWritable (exactBuiltinInstanceProfile , self , key ) && (isHiddenKey (key ) || !lib .hasDict (self ))) {
172
169
return false ;
173
170
}
174
171
if (!isHiddenKey (key ) && lib .hasDict (self )) {
0 commit comments