123123import com .oracle .graal .python .nodes .object .BuiltinClassProfiles .IsBuiltinObjectProfile ;
124124import com .oracle .graal .python .nodes .object .GetClassNode ;
125125import com .oracle .graal .python .nodes .object .GetDictIfExistsNode ;
126+ import com .oracle .graal .python .nodes .object .InlinedGetClassNode ;
126127import com .oracle .graal .python .nodes .object .IsNode ;
127128import com .oracle .graal .python .nodes .util .CannotCastException ;
128129import com .oracle .graal .python .nodes .util .CastToJavaIntExactNode ;
@@ -1028,13 +1029,14 @@ public abstract static class PKeyInfoNode extends Node {
10281029
10291030 @ Specialization
10301031 static boolean access (Object object , TruffleString attrKeyName , int type ,
1032+ @ Bind ("this" ) Node inliningTarget ,
10311033 @ Cached ("createForceType()" ) ReadAttributeFromObjectNode readTypeAttrNode ,
10321034 @ Cached ReadAttributeFromObjectNode readObjectAttrNode ,
10331035 @ Cached PyCallableCheckNode callableCheck ,
10341036 @ Cached LookupInheritedAttributeNode .Dynamic getGetNode ,
10351037 @ Cached LookupInheritedAttributeNode .Dynamic getSetNode ,
10361038 @ Cached LookupInheritedAttributeNode .Dynamic getDeleteNode ,
1037- @ Cached GetClassNode getClassNode ,
1039+ @ Cached InlinedGetClassNode getClassNode ,
10381040 @ Cached IsImmutable isImmutable ,
10391041 @ Cached GetMroNode getMroNode ,
10401042 @ Cached GilNode gil ) {
@@ -1043,7 +1045,7 @@ static boolean access(Object object, TruffleString attrKeyName, int type,
10431045 Object owner = object ;
10441046 Object attr = PNone .NO_VALUE ;
10451047
1046- Object klass = getClassNode .execute (object );
1048+ Object klass = getClassNode .execute (inliningTarget , object );
10471049 for (PythonAbstractClass c : getMroNode .execute (klass )) {
10481050 // n.b. we need to use a different node because it makes a difference if the
10491051 // type is native
@@ -1124,15 +1126,16 @@ public abstract static class IsImmutable extends Node {
11241126
11251127 @ Specialization
11261128 public boolean isImmutable (Object object ,
1127- @ Cached GetClassNode getClassNode ) {
1129+ @ Bind ("this" ) Node inliningTarget ,
1130+ @ Cached InlinedGetClassNode getClassNode ) {
11281131 // TODO(fa) The first condition is too general; we should check if the object's type is
11291132 // 'type'
11301133 if (object instanceof PythonBuiltinClass || object instanceof PythonBuiltinObject || PGuards .isNativeClass (object ) || PGuards .isNativeObject (object )) {
11311134 return true ;
11321135 } else if (object instanceof PythonClass || object instanceof PythonModule ) {
11331136 return false ;
11341137 } else {
1135- Object klass = getClassNode .execute (object );
1138+ Object klass = getClassNode .execute (inliningTarget , object );
11361139 return klass instanceof PythonBuiltinClassType || klass instanceof PythonBuiltinClass || PGuards .isNativeClass (object );
11371140 }
11381141 }
@@ -1154,13 +1157,14 @@ public abstract static class PInteropSubscriptNode extends Node {
11541157
11551158 @ Specialization
11561159 static Object doSpecialObject (Object primary , Object index ,
1157- @ Cached GetClassNode getClassNode ,
1160+ @ Bind ("this" ) Node inliningTarget ,
1161+ @ Cached InlinedGetClassNode getClassNode ,
11581162 @ Cached (parameters = "GetItem" ) LookupCallableSlotInMRONode lookupInMRONode ,
11591163 @ Cached CallBinaryMethodNode callGetItemNode ,
11601164 @ 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 )) {
11641168 throw raiseNode .raise (PythonBuiltinClassType .TypeError , ErrorMessages .OBJ_NOT_SUBSCRIPTABLE , primary );
11651169 }
11661170 return callGetItemNode .executeObject (attrGetItem , primary , index );
@@ -1347,13 +1351,14 @@ public abstract static class PInteropSubscriptAssignNode extends Node {
13471351
13481352 @ Specialization
13491353 static void doSpecialObject (PythonAbstractObject primary , Object key , Object value ,
1354+ @ Bind ("this" ) Node inliningTarget ,
13501355 @ Cached PForeignToPTypeNode convert ,
13511356 @ Cached PInteropGetAttributeNode getAttributeNode ,
13521357 @ Cached CallBinaryMethodNode callSetItemNode ,
1353- @ Cached ConditionProfile profile ) throws UnsupportedMessageException {
1358+ @ Cached InlinedConditionProfile profile ) throws UnsupportedMessageException {
13541359
13551360 Object attrSetitem = getAttributeNode .execute (primary , T___SETITEM__ );
1356- if (profile .profile (attrSetitem != PNone .NO_VALUE )) {
1361+ if (profile .profile (inliningTarget , attrSetitem != PNone .NO_VALUE )) {
13571362 callSetItemNode .executeObject (attrSetitem , key , convert .executeConvert (value ));
13581363 } else {
13591364 throw UnsupportedMessageException .create ();
@@ -1408,11 +1413,12 @@ public abstract static class PInteropDeleteItemNode extends Node {
14081413
14091414 @ Specialization
14101415 public void doSpecialObject (PythonAbstractObject primary , Object key ,
1416+ @ Bind ("this" ) Node inliningTarget ,
14111417 @ Cached LookupInheritedAttributeNode .Dynamic lookupSetAttrNode ,
14121418 @ Cached CallBinaryMethodNode callSetAttrNode ,
1413- @ Cached ConditionProfile profile ) throws UnsupportedMessageException {
1419+ @ Cached InlinedConditionProfile profile ) throws UnsupportedMessageException {
14141420 Object attrDelattr = lookupSetAttrNode .execute (primary , T___DELITEM__ );
1415- if (profile .profile (attrDelattr != PNone .NO_VALUE )) {
1421+ if (profile .profile (inliningTarget , attrDelattr != PNone .NO_VALUE )) {
14161422 callSetAttrNode .executeObject (attrDelattr , primary , key );
14171423 } else {
14181424 throw UnsupportedMessageException .create ();
@@ -1478,10 +1484,11 @@ public abstract static class ToDisplaySideEffectingNode extends Node {
14781484
14791485 @ Specialization
14801486 public TruffleString doDefault (PythonAbstractObject receiver ,
1487+ @ Bind ("this" ) Node inliningTarget ,
14811488 @ Cached ReadAttributeFromObjectNode readStr ,
14821489 @ Cached CallNode callNode ,
14831490 @ Cached CastToTruffleStringNode castStr ,
1484- @ Cached ConditionProfile toStringUsed ) {
1491+ @ Cached InlinedConditionProfile toStringUsed ) {
14851492 Object toStrAttr ;
14861493 TruffleString names ;
14871494 PythonContext context = PythonContext .get (this );
@@ -1493,15 +1500,15 @@ public TruffleString doDefault(PythonAbstractObject receiver,
14931500
14941501 TruffleString result = null ;
14951502 PythonModule builtins = context .getBuiltins ();
1496- if (toStringUsed .profile (builtins != null )) {
1503+ if (toStringUsed .profile (inliningTarget , builtins != null )) {
14971504 toStrAttr = readStr .execute (builtins , names );
14981505 try {
14991506 result = castStr .execute (callNode .execute (toStrAttr , receiver ));
15001507 } catch (CannotCastException e ) {
15011508 // do nothing
15021509 }
15031510 }
1504- if (toStringUsed .profile (result != null )) {
1511+ if (toStringUsed .profile (inliningTarget , result != null )) {
15051512 return result ;
15061513 } else {
15071514 return receiver .toStringBoundary ();
0 commit comments