123
123
import com .oracle .graal .python .nodes .object .BuiltinClassProfiles .IsBuiltinObjectProfile ;
124
124
import com .oracle .graal .python .nodes .object .GetClassNode ;
125
125
import com .oracle .graal .python .nodes .object .GetDictIfExistsNode ;
126
+ import com .oracle .graal .python .nodes .object .InlinedGetClassNode ;
126
127
import com .oracle .graal .python .nodes .object .IsNode ;
127
128
import com .oracle .graal .python .nodes .util .CannotCastException ;
128
129
import com .oracle .graal .python .nodes .util .CastToJavaIntExactNode ;
@@ -1028,13 +1029,14 @@ public abstract static class PKeyInfoNode extends Node {
1028
1029
1029
1030
@ Specialization
1030
1031
static boolean access (Object object , TruffleString attrKeyName , int type ,
1032
+ @ Bind ("this" ) Node inliningTarget ,
1031
1033
@ Cached ("createForceType()" ) ReadAttributeFromObjectNode readTypeAttrNode ,
1032
1034
@ Cached ReadAttributeFromObjectNode readObjectAttrNode ,
1033
1035
@ Cached PyCallableCheckNode callableCheck ,
1034
1036
@ Cached LookupInheritedAttributeNode .Dynamic getGetNode ,
1035
1037
@ Cached LookupInheritedAttributeNode .Dynamic getSetNode ,
1036
1038
@ Cached LookupInheritedAttributeNode .Dynamic getDeleteNode ,
1037
- @ Cached GetClassNode getClassNode ,
1039
+ @ Cached InlinedGetClassNode getClassNode ,
1038
1040
@ Cached IsImmutable isImmutable ,
1039
1041
@ Cached GetMroNode getMroNode ,
1040
1042
@ Cached GilNode gil ) {
@@ -1043,7 +1045,7 @@ static boolean access(Object object, TruffleString attrKeyName, int type,
1043
1045
Object owner = object ;
1044
1046
Object attr = PNone .NO_VALUE ;
1045
1047
1046
- Object klass = getClassNode .execute (object );
1048
+ Object klass = getClassNode .execute (inliningTarget , object );
1047
1049
for (PythonAbstractClass c : getMroNode .execute (klass )) {
1048
1050
// n.b. we need to use a different node because it makes a difference if the
1049
1051
// type is native
@@ -1124,15 +1126,16 @@ public abstract static class IsImmutable extends Node {
1124
1126
1125
1127
@ Specialization
1126
1128
public boolean isImmutable (Object object ,
1127
- @ Cached GetClassNode getClassNode ) {
1129
+ @ Bind ("this" ) Node inliningTarget ,
1130
+ @ Cached InlinedGetClassNode getClassNode ) {
1128
1131
// TODO(fa) The first condition is too general; we should check if the object's type is
1129
1132
// 'type'
1130
1133
if (object instanceof PythonBuiltinClass || object instanceof PythonBuiltinObject || PGuards .isNativeClass (object ) || PGuards .isNativeObject (object )) {
1131
1134
return true ;
1132
1135
} else if (object instanceof PythonClass || object instanceof PythonModule ) {
1133
1136
return false ;
1134
1137
} else {
1135
- Object klass = getClassNode .execute (object );
1138
+ Object klass = getClassNode .execute (inliningTarget , object );
1136
1139
return klass instanceof PythonBuiltinClassType || klass instanceof PythonBuiltinClass || PGuards .isNativeClass (object );
1137
1140
}
1138
1141
}
@@ -1154,13 +1157,14 @@ public abstract static class PInteropSubscriptNode extends Node {
1154
1157
1155
1158
@ Specialization
1156
1159
static Object doSpecialObject (Object primary , Object index ,
1157
- @ Cached GetClassNode getClassNode ,
1160
+ @ Bind ("this" ) Node inliningTarget ,
1161
+ @ Cached InlinedGetClassNode getClassNode ,
1158
1162
@ Cached (parameters = "GetItem" ) LookupCallableSlotInMRONode lookupInMRONode ,
1159
1163
@ Cached CallBinaryMethodNode callGetItemNode ,
1160
1164
@ Cached PRaiseNode raiseNode ,
1161
- @ Cached ConditionProfile profile ) {
1162
- Object attrGetItem = lookupInMRONode .execute (getClassNode .execute (primary ));
1163
- if (profile .profile (attrGetItem == PNone .NO_VALUE )) {
1165
+ @ Cached InlinedConditionProfile profile ) {
1166
+ Object attrGetItem = lookupInMRONode .execute (getClassNode .execute (inliningTarget , primary ));
1167
+ if (profile .profile (inliningTarget , attrGetItem == PNone .NO_VALUE )) {
1164
1168
throw raiseNode .raise (PythonBuiltinClassType .TypeError , ErrorMessages .OBJ_NOT_SUBSCRIPTABLE , primary );
1165
1169
}
1166
1170
return callGetItemNode .executeObject (attrGetItem , primary , index );
@@ -1347,13 +1351,14 @@ public abstract static class PInteropSubscriptAssignNode extends Node {
1347
1351
1348
1352
@ Specialization
1349
1353
static void doSpecialObject (PythonAbstractObject primary , Object key , Object value ,
1354
+ @ Bind ("this" ) Node inliningTarget ,
1350
1355
@ Cached PForeignToPTypeNode convert ,
1351
1356
@ Cached PInteropGetAttributeNode getAttributeNode ,
1352
1357
@ Cached CallBinaryMethodNode callSetItemNode ,
1353
- @ Cached ConditionProfile profile ) throws UnsupportedMessageException {
1358
+ @ Cached InlinedConditionProfile profile ) throws UnsupportedMessageException {
1354
1359
1355
1360
Object attrSetitem = getAttributeNode .execute (primary , T___SETITEM__ );
1356
- if (profile .profile (attrSetitem != PNone .NO_VALUE )) {
1361
+ if (profile .profile (inliningTarget , attrSetitem != PNone .NO_VALUE )) {
1357
1362
callSetItemNode .executeObject (attrSetitem , key , convert .executeConvert (value ));
1358
1363
} else {
1359
1364
throw UnsupportedMessageException .create ();
@@ -1408,11 +1413,12 @@ public abstract static class PInteropDeleteItemNode extends Node {
1408
1413
1409
1414
@ Specialization
1410
1415
public void doSpecialObject (PythonAbstractObject primary , Object key ,
1416
+ @ Bind ("this" ) Node inliningTarget ,
1411
1417
@ Cached LookupInheritedAttributeNode .Dynamic lookupSetAttrNode ,
1412
1418
@ Cached CallBinaryMethodNode callSetAttrNode ,
1413
- @ Cached ConditionProfile profile ) throws UnsupportedMessageException {
1419
+ @ Cached InlinedConditionProfile profile ) throws UnsupportedMessageException {
1414
1420
Object attrDelattr = lookupSetAttrNode .execute (primary , T___DELITEM__ );
1415
- if (profile .profile (attrDelattr != PNone .NO_VALUE )) {
1421
+ if (profile .profile (inliningTarget , attrDelattr != PNone .NO_VALUE )) {
1416
1422
callSetAttrNode .executeObject (attrDelattr , primary , key );
1417
1423
} else {
1418
1424
throw UnsupportedMessageException .create ();
@@ -1478,10 +1484,11 @@ public abstract static class ToDisplaySideEffectingNode extends Node {
1478
1484
1479
1485
@ Specialization
1480
1486
public TruffleString doDefault (PythonAbstractObject receiver ,
1487
+ @ Bind ("this" ) Node inliningTarget ,
1481
1488
@ Cached ReadAttributeFromObjectNode readStr ,
1482
1489
@ Cached CallNode callNode ,
1483
1490
@ Cached CastToTruffleStringNode castStr ,
1484
- @ Cached ConditionProfile toStringUsed ) {
1491
+ @ Cached InlinedConditionProfile toStringUsed ) {
1485
1492
Object toStrAttr ;
1486
1493
TruffleString names ;
1487
1494
PythonContext context = PythonContext .get (this );
@@ -1493,15 +1500,15 @@ public TruffleString doDefault(PythonAbstractObject receiver,
1493
1500
1494
1501
TruffleString result = null ;
1495
1502
PythonModule builtins = context .getBuiltins ();
1496
- if (toStringUsed .profile (builtins != null )) {
1503
+ if (toStringUsed .profile (inliningTarget , builtins != null )) {
1497
1504
toStrAttr = readStr .execute (builtins , names );
1498
1505
try {
1499
1506
result = castStr .execute (callNode .execute (toStrAttr , receiver ));
1500
1507
} catch (CannotCastException e ) {
1501
1508
// do nothing
1502
1509
}
1503
1510
}
1504
- if (toStringUsed .profile (result != null )) {
1511
+ if (toStringUsed .profile (inliningTarget , result != null )) {
1505
1512
return result ;
1506
1513
} else {
1507
1514
return receiver .toStringBoundary ();
0 commit comments