121
121
import com .oracle .graal .python .nodes .classes .IsSubtypeNode ;
122
122
import com .oracle .graal .python .nodes .expression .CastToListExpressionNode .CastToListInteropNode ;
123
123
import com .oracle .graal .python .nodes .interop .PForeignToPTypeNode ;
124
+ import com .oracle .graal .python .nodes .object .BuiltinClassProfiles .IsBuiltinObjectProfile ;
124
125
import com .oracle .graal .python .nodes .object .GetClassNode ;
125
126
import com .oracle .graal .python .nodes .object .GetDictIfExistsNode ;
126
127
import com .oracle .graal .python .nodes .object .IsBuiltinClassProfile ;
136
137
import com .oracle .truffle .api .CompilerDirectives ;
137
138
import com .oracle .truffle .api .CompilerDirectives .TruffleBoundary ;
138
139
import com .oracle .truffle .api .TruffleLanguage ;
140
+ import com .oracle .truffle .api .dsl .Bind ;
139
141
import com .oracle .truffle .api .dsl .Cached ;
140
142
import com .oracle .truffle .api .dsl .Cached .Exclusive ;
141
143
import com .oracle .truffle .api .dsl .Cached .Shared ;
161
163
import com .oracle .truffle .api .object .HiddenKey ;
162
164
import com .oracle .truffle .api .object .Shape ;
163
165
import com .oracle .truffle .api .profiles .ConditionProfile ;
166
+ import com .oracle .truffle .api .profiles .InlinedConditionProfile ;
164
167
import com .oracle .truffle .api .strings .TruffleString ;
165
168
import com .oracle .truffle .api .strings .TruffleString .RegionEqualNode ;
166
169
import com .oracle .truffle .api .utilities .TriState ;
@@ -212,15 +215,16 @@ public final void clearNativeWrapper(ConditionProfile hasHandleValidAssumptionPr
212
215
213
216
@ ExportMessage
214
217
public void writeMember (String key , Object value ,
218
+ @ Bind ("$node" ) Node inliningTarget ,
215
219
@ Shared ("js2ts" ) @ Cached TruffleString .FromJavaStringNode fromJavaStringNode ,
216
220
@ Cached PInteropSetAttributeNode setAttributeNode ,
217
- @ Shared ("attributeErrorProfile" ) @ Cached IsBuiltinClassProfile attrErrorProfile ,
221
+ @ Shared ("attributeErrorProfile" ) @ Cached IsBuiltinObjectProfile attrErrorProfile ,
218
222
@ Exclusive @ Cached GilNode gil ) throws UnsupportedMessageException , UnknownIdentifierException {
219
223
boolean mustRelease = gil .acquire ();
220
224
try {
221
225
setAttributeNode .execute (this , fromJavaStringNode .execute (key , TS_ENCODING ), value );
222
226
} catch (PException e ) {
223
- e .expectAttributeError (attrErrorProfile );
227
+ e .expectAttributeError (inliningTarget , attrErrorProfile );
224
228
// TODO(fa) not accurate; distinguish between read-only and non-existing
225
229
throw UnknownIdentifierException .create (key );
226
230
} finally {
@@ -487,13 +491,14 @@ public boolean hasMemberWriteSideEffects(String member,
487
491
488
492
@ ExportMessage
489
493
public Object invokeMember (String member , Object [] arguments ,
494
+ @ Bind ("$node" ) Node inliningTarget ,
490
495
@ Shared ("js2ts" ) @ Cached TruffleString .FromJavaStringNode fromJavaStringNode ,
491
496
@ Exclusive @ Cached LookupInheritedAttributeNode .Dynamic lookupGetattributeNode ,
492
497
@ Exclusive @ Cached CallBinaryMethodNode callGetattributeNode ,
493
498
@ Exclusive @ Cached PExecuteNode executeNode ,
494
499
@ Exclusive @ Cached ConditionProfile profileGetattribute ,
495
500
@ Exclusive @ Cached ConditionProfile profileMember ,
496
- @ Shared ("attributeErrorProfile" ) @ Cached IsBuiltinClassProfile attributeErrorProfile ,
501
+ @ Shared ("attributeErrorProfile" ) @ Cached IsBuiltinObjectProfile attributeErrorProfile ,
497
502
@ Exclusive @ Cached GilNode gil )
498
503
throws UnknownIdentifierException , UnsupportedMessageException {
499
504
boolean mustRelease = gil .acquire ();
@@ -509,7 +514,7 @@ public Object invokeMember(String member, Object[] arguments,
509
514
throw UnknownIdentifierException .create (member );
510
515
}
511
516
} catch (PException e ) {
512
- e .expect (AttributeError , attributeErrorProfile );
517
+ e .expect (inliningTarget , AttributeError , attributeErrorProfile );
513
518
throw UnknownIdentifierException .create (member );
514
519
}
515
520
return executeNode .execute (memberObj , arguments );
@@ -598,14 +603,15 @@ public Object getMembers(boolean includeInternal,
598
603
599
604
@ ExportMessage
600
605
public void removeMember (String member ,
606
+ @ Bind ("$node" ) Node inliningTarget ,
601
607
@ Cached PInteropDeleteAttributeNode deleteAttributeNode ,
602
- @ Shared ("attributeErrorProfile" ) @ Cached IsBuiltinClassProfile attrErrorProfile ,
608
+ @ Shared ("attributeErrorProfile" ) @ Cached IsBuiltinObjectProfile attrErrorProfile ,
603
609
@ Exclusive @ Cached GilNode gil ) throws UnsupportedMessageException , UnknownIdentifierException {
604
610
boolean mustRelease = gil .acquire ();
605
611
try {
606
612
deleteAttributeNode .execute (this , member );
607
613
} catch (PException e ) {
608
- e .expectAttributeError (attrErrorProfile );
614
+ e .expectAttributeError (inliningTarget , attrErrorProfile );
609
615
// TODO(fa) not accurate; distinguish between read-only and non-existing
610
616
throw UnknownIdentifierException .create (member );
611
617
} finally {
@@ -1366,17 +1372,18 @@ public abstract static class PInteropSetAttributeNode extends Node {
1366
1372
1367
1373
@ Specialization
1368
1374
public static void doSpecialObject (PythonAbstractObject primary , TruffleString attrName , Object value ,
1375
+ @ Bind ("this" ) Node inliningTarget ,
1369
1376
@ Cached PForeignToPTypeNode convert ,
1370
1377
@ Cached LookupInheritedAttributeNode .Dynamic lookupSetAttrNode ,
1371
1378
@ Cached CallTernaryMethodNode callSetAttrNode ,
1372
- @ Cached ConditionProfile profile ,
1373
- @ Cached IsBuiltinClassProfile attrErrorProfile ) throws UnsupportedMessageException , UnknownIdentifierException {
1379
+ @ Cached InlinedConditionProfile profile ,
1380
+ @ Cached IsBuiltinObjectProfile attrErrorProfile ) throws UnsupportedMessageException , UnknownIdentifierException {
1374
1381
Object attrSetattr = lookupSetAttrNode .execute (primary , SpecialMethodNames .T___SETATTR__ );
1375
- if (profile .profile (attrSetattr != PNone .NO_VALUE )) {
1382
+ if (profile .profile (inliningTarget , attrSetattr != PNone .NO_VALUE )) {
1376
1383
try {
1377
1384
callSetAttrNode .execute (null , attrSetattr , primary , attrName , convert .executeConvert (value ));
1378
1385
} catch (PException e ) {
1379
- e .expectAttributeError (attrErrorProfile );
1386
+ e .expectAttributeError (inliningTarget , attrErrorProfile );
1380
1387
// TODO(fa) not accurate; distinguish between read-only and non-existing
1381
1388
throw UnknownIdentifierException .create (attrName .toJavaStringUncached ());
1382
1389
}
@@ -1428,17 +1435,18 @@ public abstract static class PInteropDeleteAttributeNode extends Node {
1428
1435
1429
1436
@ Specialization
1430
1437
public void doSpecialObject (PythonAbstractObject primary , String attrName ,
1438
+ @ Bind ("this" ) Node inliningTarget ,
1431
1439
@ Cached TruffleString .FromJavaStringNode fromJavaStringNode ,
1432
1440
@ Cached LookupInheritedAttributeNode .Dynamic lookupSetAttrNode ,
1433
1441
@ Cached CallBinaryMethodNode callSetAttrNode ,
1434
- @ Cached ConditionProfile profile ,
1435
- @ Cached IsBuiltinClassProfile attrErrorProfile ) throws UnsupportedMessageException , UnknownIdentifierException {
1442
+ @ Cached InlinedConditionProfile profile ,
1443
+ @ Cached IsBuiltinObjectProfile attrErrorProfile ) throws UnsupportedMessageException , UnknownIdentifierException {
1436
1444
Object attrDelattr = lookupSetAttrNode .execute (primary , SpecialMethodNames .T___DELATTR__ );
1437
- if (profile .profile (attrDelattr != PNone .NO_VALUE )) {
1445
+ if (profile .profile (inliningTarget , attrDelattr != PNone .NO_VALUE )) {
1438
1446
try {
1439
1447
callSetAttrNode .executeObject (attrDelattr , primary , fromJavaStringNode .execute (attrName , TS_ENCODING ));
1440
1448
} catch (PException e ) {
1441
- e .expectAttributeError (attrErrorProfile );
1449
+ e .expectAttributeError (inliningTarget , attrErrorProfile );
1442
1450
// TODO(fa) not accurate; distinguish between read-only and non-existing
1443
1451
throw UnknownIdentifierException .create (attrName );
1444
1452
}
0 commit comments