67
67
import com .oracle .graal .python .builtins .objects .object .ObjectBuiltins ;
68
68
import com .oracle .graal .python .builtins .objects .str .PString ;
69
69
import com .oracle .graal .python .lib .PyObjectLookupAttr ;
70
+ import com .oracle .graal .python .nodes .attributes .WriteAttributeToObjectNode ;
70
71
import com .oracle .graal .python .nodes .call .CallNode ;
71
72
import com .oracle .graal .python .nodes .classes .IsSubtypeNode ;
72
73
import com .oracle .graal .python .nodes .function .PythonBuiltinBaseNode ;
@@ -202,19 +203,11 @@ public abstract static class PyModuleAddObjectNode extends PythonTernaryBuiltinN
202
203
Object addObject (VirtualFrame frame , Object m , String k , Object o ,
203
204
@ SuppressWarnings ("unused" ) @ Cached GetClassNode getClassNode ,
204
205
@ SuppressWarnings ("unused" ) @ Cached IsSubtypeNode isSubtypeNode ,
205
- @ Cached PyObjectLookupAttr lookupAttrNode ,
206
- @ Cached GetDictIfExistsNode getDictNode ,
207
- @ Cached BranchProfile noDictProfile ,
208
- @ CachedLibrary (limit = "3" ) HashingStorageLibrary lib ,
206
+ @ Cached WriteAttributeToObjectNode writeAtrrNode ,
209
207
@ Cached PRaiseNativeNode raiseNativeNode ,
210
208
@ Cached TransformExceptionToNativeNode transformExceptionToNativeNode ) {
211
209
try {
212
- PDict dict = getDictNode .execute (m );
213
- if (dict == null ) {
214
- noDictProfile .enter ();
215
- return raiseNativeNode .raiseInt (frame , -1 , SystemError , MODULE_S_HAS_NO , lookupAttrNode .execute (frame , m , __NAME__ ), __DICT__ );
216
- }
217
- lib .setItem (dict .getDictStorage (), k , o );
210
+ writeAtrrNode .execute (m , k , o );
218
211
return 0 ;
219
212
} catch (PException e ) {
220
213
transformExceptionToNativeNode .execute (e );
@@ -226,13 +219,10 @@ Object addObject(VirtualFrame frame, Object m, String k, Object o,
226
219
Object addObject (VirtualFrame frame , Object m , PString k , Object o ,
227
220
@ SuppressWarnings ("unused" ) @ Cached GetClassNode getClassNode ,
228
221
@ SuppressWarnings ("unused" ) @ Cached IsSubtypeNode isSubtypeNode ,
229
- @ Cached PyObjectLookupAttr lookupAttrNode ,
230
- @ Cached GetDictIfExistsNode getDictNode ,
231
- @ Cached BranchProfile noDictProfile ,
232
- @ CachedLibrary (limit = "3" ) HashingStorageLibrary lib ,
222
+ @ Cached WriteAttributeToObjectNode writeAtrrNode ,
233
223
@ Cached PRaiseNativeNode raiseNativeNode ,
234
224
@ Cached TransformExceptionToNativeNode transformExceptionToNativeNode ) {
235
- return addObject (frame , m , k .getValue (), o , getClassNode , isSubtypeNode , lookupAttrNode , getDictNode , noDictProfile , lib , raiseNativeNode , transformExceptionToNativeNode );
225
+ return addObject (frame , m , k .getValue (), o , getClassNode , isSubtypeNode , writeAtrrNode , raiseNativeNode , transformExceptionToNativeNode );
236
226
}
237
227
238
228
@ SuppressWarnings ("unused" )
0 commit comments