131131import com .oracle .graal .python .builtins .objects .common .HashingCollectionNodes ;
132132import com .oracle .graal .python .builtins .objects .common .HashingStorage ;
133133import com .oracle .graal .python .builtins .objects .common .SequenceNodes .GetObjectArrayNode ;
134- import com .oracle .graal .python .builtins .objects .common .SequenceNodesFactory .GetObjectArrayNodeGen ;
135134import com .oracle .graal .python .builtins .objects .complex .PComplex ;
136135import com .oracle .graal .python .builtins .objects .dict .PDict ;
137136import com .oracle .graal .python .builtins .objects .ellipsis .PEllipsis ;
@@ -318,13 +317,14 @@ PBytes doCallBytes(VirtualFrame frame, Object cls, Object source, PNone encoding
318317 throw raise (TypeError , ErrorMessages .RETURNED_NONBYTES , T___BYTES__ , bytes );
319318 }
320319 }
321- return factory ().createBytes (cls , bytesInitNode .execute (frame , source , encoding , errors ));
320+ return factory ().createBytes (cls , bytesInitNode .execute (frame , inliningTarget , source , encoding , errors ));
322321 }
323322
324323 @ Specialization (guards = {"isNoValue(source) || (!isNoValue(encoding) || !isNoValue(errors))" })
325324 PBytes dontCallBytes (VirtualFrame frame , Object cls , Object source , Object encoding , Object errors ,
325+ @ Bind ("this" ) Node inliningTarget ,
326326 @ Shared @ Cached BytesNodes .BytesInitNode bytesInitNode ) {
327- return factory ().createBytes (cls , bytesInitNode .execute (frame , source , encoding , errors ));
327+ return factory ().createBytes (cls , bytesInitNode .execute (frame , inliningTarget , source , encoding , errors ));
328328 }
329329 }
330330
@@ -1056,8 +1056,9 @@ public PFrozenSet subFrozensetIdentity(Object cls, PFrozenSet arg,
10561056
10571057 @ Specialization (guards = {"!isNoValue(iterable)" , "!isPFrozenSet(iterable)" })
10581058 public PFrozenSet frozensetIterable (VirtualFrame frame , Object cls , Object iterable ,
1059+ @ Bind ("this" ) Node inliningTarget ,
10591060 @ Cached HashingCollectionNodes .GetClonedHashingStorageNode getHashingStorageNode ) {
1060- HashingStorage storage = getHashingStorageNode .doNoValue (frame , iterable );
1061+ HashingStorage storage = getHashingStorageNode .doNoValue (frame , inliningTarget , iterable );
10611062 return factory ().createFrozenSet (cls , storage );
10621063 }
10631064 }
@@ -2313,8 +2314,9 @@ public PFunction function(@SuppressWarnings("unused") Object cls, PCode code, PD
23132314 @ Specialization
23142315 public PFunction function (@ SuppressWarnings ("unused" ) Object cls , PCode code , PDict globals , @ SuppressWarnings ("unused" ) PNone name , @ SuppressWarnings ("unused" ) PNone defaultArgs ,
23152316 PTuple closure ,
2317+ @ Bind ("this" ) Node inliningTarget ,
23162318 @ Shared ("getObjectArrayNode" ) @ Cached GetObjectArrayNode getObjectArrayNode ) {
2317- return factory ().createFunction (T_LAMBDA_NAME , code , globals , PCell .toCellArray (getObjectArrayNode .execute (closure )));
2319+ return factory ().createFunction (T_LAMBDA_NAME , code , globals , PCell .toCellArray (getObjectArrayNode .execute (inliningTarget , closure )));
23182320 }
23192321
23202322 @ Specialization
@@ -2326,30 +2328,34 @@ public PFunction function(@SuppressWarnings("unused") Object cls, PCode code, PD
23262328
23272329 @ Specialization
23282330 public PFunction function (@ SuppressWarnings ("unused" ) Object cls , PCode code , PDict globals , TruffleString name , @ SuppressWarnings ("unused" ) PNone defaultArgs , PTuple closure ,
2331+ @ Bind ("this" ) Node inliningTarget ,
23292332 @ Shared ("getObjectArrayNode" ) @ Cached GetObjectArrayNode getObjectArrayNode ) {
2330- return factory ().createFunction (name , code , globals , PCell .toCellArray (getObjectArrayNode .execute (closure )));
2333+ return factory ().createFunction (name , code , globals , PCell .toCellArray (getObjectArrayNode .execute (inliningTarget , closure )));
23312334 }
23322335
23332336 @ Specialization
23342337 public PFunction function (@ SuppressWarnings ("unused" ) Object cls , PCode code , PDict globals , @ SuppressWarnings ("unused" ) PNone name , PTuple defaultArgs ,
23352338 @ SuppressWarnings ("unused" ) PNone closure ,
2339+ @ Bind ("this" ) Node inliningTarget ,
23362340 @ Shared ("getObjectArrayNode" ) @ Cached GetObjectArrayNode getObjectArrayNode ) {
23372341 // TODO split defaults of positional args from kwDefaults
2338- return factory ().createFunction (code .getName (), code , globals , getObjectArrayNode .execute (defaultArgs ), null , null );
2342+ return factory ().createFunction (code .getName (), code , globals , getObjectArrayNode .execute (inliningTarget , defaultArgs ), null , null );
23392343 }
23402344
23412345 @ Specialization
23422346 public PFunction function (@ SuppressWarnings ("unused" ) Object cls , PCode code , PDict globals , TruffleString name , PTuple defaultArgs , @ SuppressWarnings ("unused" ) PNone closure ,
2347+ @ Bind ("this" ) Node inliningTarget ,
23432348 @ Shared ("getObjectArrayNode" ) @ Cached GetObjectArrayNode getObjectArrayNode ) {
23442349 // TODO split defaults of positional args from kwDefaults
2345- return factory ().createFunction (name , code , globals , getObjectArrayNode .execute (defaultArgs ), null , null );
2350+ return factory ().createFunction (name , code , globals , getObjectArrayNode .execute (inliningTarget , defaultArgs ), null , null );
23462351 }
23472352
23482353 @ Specialization
23492354 public PFunction function (@ SuppressWarnings ("unused" ) Object cls , PCode code , PDict globals , TruffleString name , PTuple defaultArgs , PTuple closure ,
2355+ @ Bind ("this" ) Node inliningTarget ,
23502356 @ Shared ("getObjectArrayNode" ) @ Cached GetObjectArrayNode getObjectArrayNode ) {
23512357 // TODO split defaults of positional args from kwDefaults
2352- return factory ().createFunction (name , code , globals , getObjectArrayNode .execute (defaultArgs ), null , PCell .toCellArray (getObjectArrayNode .execute (closure )));
2358+ return factory ().createFunction (name , code , globals , getObjectArrayNode .execute (inliningTarget , defaultArgs ), null , PCell .toCellArray (getObjectArrayNode .execute (inliningTarget , closure )));
23532359 }
23542360
23552361 @ Fallback
@@ -2375,7 +2381,6 @@ public PFunction function(Object cls, Object method_def, Object def, Object name
23752381 @ GenerateNodeFactory
23762382 public abstract static class TypeNode extends PythonVarargsBuiltinNode {
23772383 @ Child private IsSubtypeNode isSubtypeNode ;
2378- @ Child private GetObjectArrayNode getObjectArrayNode ;
23792384 @ Child private IsAcceptableBaseNode isAcceptableBaseNode ;
23802385
23812386 public abstract Object execute (VirtualFrame frame , Object cls , Object name , Object bases , Object dict , PKeyword [] kwds );
@@ -2411,11 +2416,12 @@ Object typeNew(VirtualFrame frame, Object cls, Object wName, PTuple bases, PDict
24112416 @ Cached PyObjectLookupAttr lookupMroEntriesNode ,
24122417 @ Cached CastToTruffleStringNode castStr ,
24132418 @ Cached CallNode callNewFuncNode ,
2414- @ Cached CreateTypeNode createType ) {
2419+ @ Cached CreateTypeNode createType ,
2420+ @ Cached GetObjectArrayNode getObjectArrayNode ) {
24152421 // Determine the proper metatype to deal with this
24162422 TruffleString name = castStr .execute (wName );
24172423 Object metaclass = cls ;
2418- Object winner = calculateMetaclass (frame , inliningTarget , metaclass , bases , getClassNode , isTypeNode , lookupMroEntriesNode );
2424+ Object winner = calculateMetaclass (frame , inliningTarget , metaclass , bases , getClassNode , isTypeNode , lookupMroEntriesNode , getObjectArrayNode );
24192425 if (winner != metaclass ) {
24202426 Object newFunc = getNewFuncNode .execute (winner );
24212427 if (newFunc instanceof PBuiltinMethod && (((PBuiltinMethod ) newFunc ).getFunction ().getFunctionRootNode ().getCallTarget () == getRootNode ().getCallTarget ())) {
@@ -2442,9 +2448,9 @@ Object generic(@SuppressWarnings("unused") Object cls, @SuppressWarnings("unused
24422448 }
24432449
24442450 private Object calculateMetaclass (VirtualFrame frame , Node inliningTarget , Object cls , PTuple bases , InlinedGetClassNode getClassNode , IsTypeNode isTypeNode ,
2445- PyObjectLookupAttr lookupMroEntries ) {
2451+ PyObjectLookupAttr lookupMroEntries , GetObjectArrayNode getObjectArrayNode ) {
24462452 Object winner = cls ;
2447- for (Object base : ensureGetObjectArrayNode () .execute (bases )) {
2453+ for (Object base : getObjectArrayNode .execute (inliningTarget , bases )) {
24482454 if (!isTypeNode .execute (base ) && lookupMroEntries .execute (frame , base , T___MRO_ENTRIES__ ) != PNone .NO_VALUE ) {
24492455 throw raise (TypeError , ErrorMessages .TYPE_DOESNT_SUPPORT_MRO_ENTRY_RESOLUTION );
24502456 }
@@ -2493,14 +2499,6 @@ Object typeGeneric(VirtualFrame frame, Object cls, Object name, Object bases, Ob
24932499 return nextTypeNode .execute (frame , cls , name , bases , dict , kwds );
24942500 }
24952501
2496- private GetObjectArrayNode ensureGetObjectArrayNode () {
2497- if (getObjectArrayNode == null ) {
2498- CompilerDirectives .transferToInterpreterAndInvalidate ();
2499- getObjectArrayNode = insert (GetObjectArrayNodeGen .create ());
2500- }
2501- return getObjectArrayNode ;
2502- }
2503-
25042502 private IsAcceptableBaseNode ensureIsAcceptableBaseNode () {
25052503 if (isAcceptableBaseNode == null ) {
25062504 CompilerDirectives .transferToInterpreterAndInvalidate ();
@@ -2792,18 +2790,19 @@ PCode call(VirtualFrame frame, @SuppressWarnings("unused") Object cls, int argco
27922790 PTuple varnames , TruffleString filename , TruffleString name ,
27932791 int firstlineno , PBytes linetable ,
27942792 PTuple freevars , PTuple cellvars ,
2793+ @ Bind ("this" ) Node inliningTarget ,
27952794 @ CachedLibrary (limit = "1" ) PythonBufferAccessLibrary bufferLib ,
27962795 @ Cached CodeNodes .CreateCodeNode createCodeNode ,
27972796 @ Cached GetObjectArrayNode getObjectArrayNode ,
27982797 @ Cached CastToTruffleStringNode castToTruffleStringNode ) {
27992798 byte [] codeBytes = bufferLib .getCopiedByteArray (codestring );
28002799 byte [] linetableBytes = bufferLib .getCopiedByteArray (linetable );
28012800
2802- Object [] constantsArr = getObjectArrayNode .execute (constants );
2803- TruffleString [] namesArr = objectArrayToTruffleStringArray (getObjectArrayNode .execute (names ), castToTruffleStringNode );
2804- TruffleString [] varnamesArr = objectArrayToTruffleStringArray (getObjectArrayNode .execute (varnames ), castToTruffleStringNode );
2805- TruffleString [] freevarsArr = objectArrayToTruffleStringArray (getObjectArrayNode .execute (freevars ), castToTruffleStringNode );
2806- TruffleString [] cellcarsArr = objectArrayToTruffleStringArray (getObjectArrayNode .execute (cellvars ), castToTruffleStringNode );
2801+ Object [] constantsArr = getObjectArrayNode .execute (inliningTarget , constants );
2802+ TruffleString [] namesArr = objectArrayToTruffleStringArray (getObjectArrayNode .execute (inliningTarget , names ), castToTruffleStringNode );
2803+ TruffleString [] varnamesArr = objectArrayToTruffleStringArray (getObjectArrayNode .execute (inliningTarget , varnames ), castToTruffleStringNode );
2804+ TruffleString [] freevarsArr = objectArrayToTruffleStringArray (getObjectArrayNode .execute (inliningTarget , freevars ), castToTruffleStringNode );
2805+ TruffleString [] cellcarsArr = objectArrayToTruffleStringArray (getObjectArrayNode .execute (inliningTarget , cellvars ), castToTruffleStringNode );
28072806
28082807 return createCodeNode .execute (frame , argcount , posonlyargcount , kwonlyargcount ,
28092808 nlocals , stacksize , flags ,
0 commit comments