131
131
import com .oracle .graal .python .builtins .objects .common .HashingCollectionNodes ;
132
132
import com .oracle .graal .python .builtins .objects .common .HashingStorage ;
133
133
import com .oracle .graal .python .builtins .objects .common .SequenceNodes .GetObjectArrayNode ;
134
- import com .oracle .graal .python .builtins .objects .common .SequenceNodesFactory .GetObjectArrayNodeGen ;
135
134
import com .oracle .graal .python .builtins .objects .complex .PComplex ;
136
135
import com .oracle .graal .python .builtins .objects .dict .PDict ;
137
136
import com .oracle .graal .python .builtins .objects .ellipsis .PEllipsis ;
@@ -318,13 +317,14 @@ PBytes doCallBytes(VirtualFrame frame, Object cls, Object source, PNone encoding
318
317
throw raise (TypeError , ErrorMessages .RETURNED_NONBYTES , T___BYTES__ , bytes );
319
318
}
320
319
}
321
- return factory ().createBytes (cls , bytesInitNode .execute (frame , source , encoding , errors ));
320
+ return factory ().createBytes (cls , bytesInitNode .execute (frame , inliningTarget , source , encoding , errors ));
322
321
}
323
322
324
323
@ Specialization (guards = {"isNoValue(source) || (!isNoValue(encoding) || !isNoValue(errors))" })
325
324
PBytes dontCallBytes (VirtualFrame frame , Object cls , Object source , Object encoding , Object errors ,
325
+ @ Bind ("this" ) Node inliningTarget ,
326
326
@ 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 ));
328
328
}
329
329
}
330
330
@@ -1056,8 +1056,9 @@ public PFrozenSet subFrozensetIdentity(Object cls, PFrozenSet arg,
1056
1056
1057
1057
@ Specialization (guards = {"!isNoValue(iterable)" , "!isPFrozenSet(iterable)" })
1058
1058
public PFrozenSet frozensetIterable (VirtualFrame frame , Object cls , Object iterable ,
1059
+ @ Bind ("this" ) Node inliningTarget ,
1059
1060
@ Cached HashingCollectionNodes .GetClonedHashingStorageNode getHashingStorageNode ) {
1060
- HashingStorage storage = getHashingStorageNode .doNoValue (frame , iterable );
1061
+ HashingStorage storage = getHashingStorageNode .doNoValue (frame , inliningTarget , iterable );
1061
1062
return factory ().createFrozenSet (cls , storage );
1062
1063
}
1063
1064
}
@@ -2313,8 +2314,9 @@ public PFunction function(@SuppressWarnings("unused") Object cls, PCode code, PD
2313
2314
@ Specialization
2314
2315
public PFunction function (@ SuppressWarnings ("unused" ) Object cls , PCode code , PDict globals , @ SuppressWarnings ("unused" ) PNone name , @ SuppressWarnings ("unused" ) PNone defaultArgs ,
2315
2316
PTuple closure ,
2317
+ @ Bind ("this" ) Node inliningTarget ,
2316
2318
@ 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 )));
2318
2320
}
2319
2321
2320
2322
@ Specialization
@@ -2326,30 +2328,34 @@ public PFunction function(@SuppressWarnings("unused") Object cls, PCode code, PD
2326
2328
2327
2329
@ Specialization
2328
2330
public PFunction function (@ SuppressWarnings ("unused" ) Object cls , PCode code , PDict globals , TruffleString name , @ SuppressWarnings ("unused" ) PNone defaultArgs , PTuple closure ,
2331
+ @ Bind ("this" ) Node inliningTarget ,
2329
2332
@ 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 )));
2331
2334
}
2332
2335
2333
2336
@ Specialization
2334
2337
public PFunction function (@ SuppressWarnings ("unused" ) Object cls , PCode code , PDict globals , @ SuppressWarnings ("unused" ) PNone name , PTuple defaultArgs ,
2335
2338
@ SuppressWarnings ("unused" ) PNone closure ,
2339
+ @ Bind ("this" ) Node inliningTarget ,
2336
2340
@ Shared ("getObjectArrayNode" ) @ Cached GetObjectArrayNode getObjectArrayNode ) {
2337
2341
// 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 );
2339
2343
}
2340
2344
2341
2345
@ Specialization
2342
2346
public PFunction function (@ SuppressWarnings ("unused" ) Object cls , PCode code , PDict globals , TruffleString name , PTuple defaultArgs , @ SuppressWarnings ("unused" ) PNone closure ,
2347
+ @ Bind ("this" ) Node inliningTarget ,
2343
2348
@ Shared ("getObjectArrayNode" ) @ Cached GetObjectArrayNode getObjectArrayNode ) {
2344
2349
// 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 );
2346
2351
}
2347
2352
2348
2353
@ Specialization
2349
2354
public PFunction function (@ SuppressWarnings ("unused" ) Object cls , PCode code , PDict globals , TruffleString name , PTuple defaultArgs , PTuple closure ,
2355
+ @ Bind ("this" ) Node inliningTarget ,
2350
2356
@ Shared ("getObjectArrayNode" ) @ Cached GetObjectArrayNode getObjectArrayNode ) {
2351
2357
// 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 )));
2353
2359
}
2354
2360
2355
2361
@ Fallback
@@ -2375,7 +2381,6 @@ public PFunction function(Object cls, Object method_def, Object def, Object name
2375
2381
@ GenerateNodeFactory
2376
2382
public abstract static class TypeNode extends PythonVarargsBuiltinNode {
2377
2383
@ Child private IsSubtypeNode isSubtypeNode ;
2378
- @ Child private GetObjectArrayNode getObjectArrayNode ;
2379
2384
@ Child private IsAcceptableBaseNode isAcceptableBaseNode ;
2380
2385
2381
2386
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
2411
2416
@ Cached PyObjectLookupAttr lookupMroEntriesNode ,
2412
2417
@ Cached CastToTruffleStringNode castStr ,
2413
2418
@ Cached CallNode callNewFuncNode ,
2414
- @ Cached CreateTypeNode createType ) {
2419
+ @ Cached CreateTypeNode createType ,
2420
+ @ Cached GetObjectArrayNode getObjectArrayNode ) {
2415
2421
// Determine the proper metatype to deal with this
2416
2422
TruffleString name = castStr .execute (wName );
2417
2423
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 );
2419
2425
if (winner != metaclass ) {
2420
2426
Object newFunc = getNewFuncNode .execute (winner );
2421
2427
if (newFunc instanceof PBuiltinMethod && (((PBuiltinMethod ) newFunc ).getFunction ().getFunctionRootNode ().getCallTarget () == getRootNode ().getCallTarget ())) {
@@ -2442,9 +2448,9 @@ Object generic(@SuppressWarnings("unused") Object cls, @SuppressWarnings("unused
2442
2448
}
2443
2449
2444
2450
private Object calculateMetaclass (VirtualFrame frame , Node inliningTarget , Object cls , PTuple bases , InlinedGetClassNode getClassNode , IsTypeNode isTypeNode ,
2445
- PyObjectLookupAttr lookupMroEntries ) {
2451
+ PyObjectLookupAttr lookupMroEntries , GetObjectArrayNode getObjectArrayNode ) {
2446
2452
Object winner = cls ;
2447
- for (Object base : ensureGetObjectArrayNode () .execute (bases )) {
2453
+ for (Object base : getObjectArrayNode .execute (inliningTarget , bases )) {
2448
2454
if (!isTypeNode .execute (base ) && lookupMroEntries .execute (frame , base , T___MRO_ENTRIES__ ) != PNone .NO_VALUE ) {
2449
2455
throw raise (TypeError , ErrorMessages .TYPE_DOESNT_SUPPORT_MRO_ENTRY_RESOLUTION );
2450
2456
}
@@ -2493,14 +2499,6 @@ Object typeGeneric(VirtualFrame frame, Object cls, Object name, Object bases, Ob
2493
2499
return nextTypeNode .execute (frame , cls , name , bases , dict , kwds );
2494
2500
}
2495
2501
2496
- private GetObjectArrayNode ensureGetObjectArrayNode () {
2497
- if (getObjectArrayNode == null ) {
2498
- CompilerDirectives .transferToInterpreterAndInvalidate ();
2499
- getObjectArrayNode = insert (GetObjectArrayNodeGen .create ());
2500
- }
2501
- return getObjectArrayNode ;
2502
- }
2503
-
2504
2502
private IsAcceptableBaseNode ensureIsAcceptableBaseNode () {
2505
2503
if (isAcceptableBaseNode == null ) {
2506
2504
CompilerDirectives .transferToInterpreterAndInvalidate ();
@@ -2792,18 +2790,19 @@ PCode call(VirtualFrame frame, @SuppressWarnings("unused") Object cls, int argco
2792
2790
PTuple varnames , TruffleString filename , TruffleString name ,
2793
2791
int firstlineno , PBytes linetable ,
2794
2792
PTuple freevars , PTuple cellvars ,
2793
+ @ Bind ("this" ) Node inliningTarget ,
2795
2794
@ CachedLibrary (limit = "1" ) PythonBufferAccessLibrary bufferLib ,
2796
2795
@ Cached CodeNodes .CreateCodeNode createCodeNode ,
2797
2796
@ Cached GetObjectArrayNode getObjectArrayNode ,
2798
2797
@ Cached CastToTruffleStringNode castToTruffleStringNode ) {
2799
2798
byte [] codeBytes = bufferLib .getCopiedByteArray (codestring );
2800
2799
byte [] linetableBytes = bufferLib .getCopiedByteArray (linetable );
2801
2800
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 );
2807
2806
2808
2807
return createCodeNode .execute (frame , argcount , posonlyargcount , kwonlyargcount ,
2809
2808
nlocals , stacksize , flags ,
0 commit comments