103
103
import com .oracle .graal .python .nodes .attributes .WriteAttributeToPythonObjectNode ;
104
104
import com .oracle .graal .python .nodes .object .GetDictIfExistsNode ;
105
105
import com .oracle .graal .python .nodes .util .CastToTruffleStringNode ;
106
+ import com .oracle .graal .python .runtime .PythonContext ;
106
107
import com .oracle .graal .python .runtime .object .PythonObjectFactory ;
107
108
import com .oracle .graal .python .runtime .sequence .storage .MroSequenceStorage ;
108
109
import com .oracle .graal .python .runtime .sequence .storage .SequenceStorage ;
127
128
import com .oracle .truffle .api .object .DynamicObject ;
128
129
import com .oracle .truffle .api .object .DynamicObjectLibrary ;
129
130
import com .oracle .truffle .api .object .Shape ;
130
- import com .oracle .truffle .api .profiles .InlinedExactClassProfile ;
131
131
import com .oracle .truffle .api .strings .TruffleString ;
132
132
import com .oracle .truffle .api .utilities .CyclicAssumption ;
133
133
@@ -222,12 +222,14 @@ abstract static class PyTruffle_Type_Modified extends CApiTernaryBuiltinNode {
222
222
223
223
@ TruffleBoundary
224
224
@ Specialization (guards = "isNoValue(mroTuple)" )
225
- int doIt (PythonNativeClass clazz , TruffleString name , @ SuppressWarnings ("unused" ) PNone mroTuple ) {
226
- CyclicAssumption nativeClassStableAssumption = getContext ().getNativeClassStableAssumption (clazz , false );
225
+ static int doIt (PythonAbstractNativeObject clazz , TruffleString name , @ SuppressWarnings ("unused" ) PNone mroTuple ,
226
+ @ Bind ("this" ) Node inliningTarget ) {
227
+ PythonContext context = PythonContext .get (inliningTarget );
228
+ CyclicAssumption nativeClassStableAssumption = context .getNativeClassStableAssumption (clazz , false );
227
229
if (nativeClassStableAssumption != null ) {
228
230
nativeClassStableAssumption .invalidate ("PyType_Modified(\" " + name .toJavaStringUncached () + "\" ) (without MRO) called" );
229
231
}
230
- SpecialMethodSlot .reinitializeSpecialMethodSlots (PythonNativeClass . cast ( clazz ), getLanguage ());
232
+ SpecialMethodSlot .reinitializeSpecialMethodSlots (clazz , context . getLanguage ());
231
233
// TODO: this is called from two places: at the end of PyType_Ready, and theoretically
232
234
// could be called from:
233
235
//
@@ -243,22 +245,22 @@ int doIt(PythonNativeClass clazz, TruffleString name, @SuppressWarnings("unused"
243
245
244
246
@ TruffleBoundary
245
247
@ Specialization
246
- int doIt (PythonNativeClass clazz , TruffleString name , PTuple mroTuple ,
247
- @ Bind ("this" ) Node inliningTarget ,
248
- @ Cached InlinedExactClassProfile profile ) {
249
- CyclicAssumption nativeClassStableAssumption = getContext () .getNativeClassStableAssumption (clazz , false );
248
+ static int doIt (PythonAbstractNativeObject clazz , TruffleString name , PTuple mroTuple ,
249
+ @ Bind ("this" ) Node inliningTarget ) {
250
+ PythonContext context = PythonContext . get ( inliningTarget );
251
+ CyclicAssumption nativeClassStableAssumption = context .getNativeClassStableAssumption (clazz , false );
250
252
if (nativeClassStableAssumption != null ) {
251
253
nativeClassStableAssumption .invalidate ("PyType_Modified(\" " + name .toJavaStringUncached () + "\" ) called" );
252
254
}
253
- SequenceStorage sequenceStorage = profile . profile ( inliningTarget , mroTuple .getSequenceStorage () );
255
+ SequenceStorage sequenceStorage = mroTuple .getSequenceStorage ();
254
256
if (sequenceStorage instanceof MroSequenceStorage ) {
255
257
((MroSequenceStorage ) sequenceStorage ).lookupChanged ();
256
258
} else {
257
259
CompilerDirectives .transferToInterpreterAndInvalidate ();
258
260
throw new IllegalStateException ("invalid MRO object for native type \" " + name .toJavaStringUncached () + "\" " );
259
261
}
260
- SpecialMethodSlot .reinitializeSpecialMethodSlots (PythonNativeClass .cast (clazz ), getLanguage ());
261
- TpSlots .updateAllSlots (clazz );
262
+ SpecialMethodSlot .reinitializeSpecialMethodSlots (PythonNativeClass .cast (clazz ), context . getLanguage ());
263
+ clazz . setTpSlots ( TpSlots .fromNative (clazz , context ) );
262
264
return 0 ;
263
265
}
264
266
}
0 commit comments