@@ -901,10 +901,11 @@ private void setCustomGlobals(VirtualFrame frame, Node inliningTarget, PDict glo
901901 }
902902
903903 @ Specialization
904+ @ SuppressWarnings ("truffle-static-method" )
904905 Object execInheritGlobalsInheritLocals (VirtualFrame frame , Object source , @ SuppressWarnings ("unused" ) PNone globals , @ SuppressWarnings ("unused" ) PNone locals ,
905906 @ Bind ("this" ) Node inliningTarget ,
906- @ Shared @ Cached ReadCallerFrameNode readCallerFrameNode ,
907- @ Shared ( "getCt" ) @ Cached CodeNodes .GetCodeCallTargetNode getCt ,
907+ @ Exclusive @ Cached ReadCallerFrameNode readCallerFrameNode ,
908+ @ Exclusive @ Cached CodeNodes .GetCodeCallTargetNode getCt ,
908909 @ Cached GetFrameLocalsNode getFrameLocalsNode ) {
909910 PCode code = createAndCheckCode (frame , source );
910911 PFrame callerFrame = readCallerFrameNode .executeWith (frame , 0 );
@@ -932,12 +933,12 @@ Object execCustomGlobalsGlobalLocals(VirtualFrame frame, Object source, PDict gl
932933 return invokeNode .execute (frame , rootCallTarget , args );
933934 }
934935
935- @ Specialization (guards = {"isMapping(inliningTarget, mappingCheckNode, locals)" }, limit = "1" )
936+ @ Specialization (guards = {"isMapping(inliningTarget, mappingCheckNode, locals)" })
936937 @ SuppressWarnings ("truffle-static-method" )
937938 Object execInheritGlobalsCustomLocals (VirtualFrame frame , Object source , @ SuppressWarnings ("unused" ) PNone globals , Object locals ,
938939 @ Bind ("this" ) Node inliningTarget ,
939940 @ SuppressWarnings ("unused" ) @ Shared @ Cached PyMappingCheckNode mappingCheckNode ,
940- @ Shared @ Cached ReadCallerFrameNode readCallerFrameNode ,
941+ @ Exclusive @ Cached ReadCallerFrameNode readCallerFrameNode ,
941942 @ Shared ("getCt" ) @ Cached CodeNodes .GetCodeCallTargetNode getCt ) {
942943 PCode code = createAndCheckCode (frame , source );
943944 PFrame callerFrame = readCallerFrameNode .executeWith (frame , 0 );
@@ -948,7 +949,7 @@ Object execInheritGlobalsCustomLocals(VirtualFrame frame, Object source, @Suppre
948949 return invokeNode .execute (frame , getCt .execute (inliningTarget , code ), args );
949950 }
950951
951- @ Specialization (guards = {"isMapping(inliningTarget, mappingCheckNode, locals)" }, limit = "1" )
952+ @ Specialization (guards = {"isMapping(inliningTarget, mappingCheckNode, locals)" })
952953 @ SuppressWarnings ("truffle-static-method" )
953954 Object execCustomGlobalsCustomLocals (VirtualFrame frame , Object source , PDict globals , Object locals ,
954955 @ Bind ("this" ) Node inliningTarget ,
@@ -969,7 +970,7 @@ PNone badGlobals(@SuppressWarnings("unused") Object source, Object globals, @Sup
969970 throw raise (TypeError , ErrorMessages .GLOBALS_MUST_BE_DICT , getMode (), globals );
970971 }
971972
972- @ Specialization (guards = {"isAnyNone(globals) || isDict(globals)" , "!isAnyNone(locals)" , "!isMapping(inliningTarget, mappingCheckNode, locals)" }, limit = "1" )
973+ @ Specialization (guards = {"isAnyNone(globals) || isDict(globals)" , "!isAnyNone(locals)" , "!isMapping(inliningTarget, mappingCheckNode, locals)" })
973974 @ SuppressWarnings ("truffle-static-method" )
974975 PNone badLocals (@ SuppressWarnings ("unused" ) Object source , @ SuppressWarnings ("unused" ) PDict globals , Object locals ,
975976 @ SuppressWarnings ("unused" ) @ Bind ("this" ) Node inliningTarget ,
@@ -1084,7 +1085,7 @@ protected abstract Object executeInternal(VirtualFrame frame, Object source, Tru
10841085 @ Specialization
10851086 Object doCompile (VirtualFrame frame , TruffleString expression , TruffleString filename , TruffleString mode , int flags , boolean dontInherit , int optimize ,
10861087 int featureVersion ,
1087- @ Cached ReadCallerFrameNode readCallerFrame ) {
1088+ @ Shared @ Cached ReadCallerFrameNode readCallerFrame ) {
10881089 if (!dontInherit ) {
10891090 PFrame fr = readCallerFrame .executeWith (frame , 0 );
10901091 PCode code = factory ().createCode (fr .getTarget ());
@@ -1167,7 +1168,7 @@ Object generic(VirtualFrame frame, Object wSource, Object wFilename, TruffleStri
11671168 @ Cached WarnNode warnNode ,
11681169 @ Cached TruffleString .FromByteArrayNode fromByteArrayNode ,
11691170 @ Cached TruffleString .SwitchEncodingNode switchEncodingNode ,
1170- @ Cached ReadCallerFrameNode readCallerFrame ) {
1171+ @ Shared @ Cached ReadCallerFrameNode readCallerFrame ) {
11711172 if (wSource instanceof PCode ) {
11721173 return wSource ;
11731174 }
@@ -1336,8 +1337,8 @@ abstract static class GetAttrNode extends PythonTernaryBuiltinNode {
13361337 @ Specialization (guards = "isNoValue(defaultValue)" )
13371338 static Object getAttrNoDefault (VirtualFrame frame , Object primary , Object nameObj , @ SuppressWarnings ("unused" ) Object defaultValue ,
13381339 @ Bind ("this" ) Node inliningTarget ,
1339- @ Shared @ Cached CastToTruffleStringNode cast ,
1340- @ Shared @ Cached PRaiseNode raiseNode ,
1340+ @ Exclusive @ Cached CastToTruffleStringNode cast ,
1341+ @ Exclusive @ Cached PRaiseNode . Lazy raiseNode ,
13411342 @ Cached PyObjectGetAttr getAttr ) {
13421343 TruffleString name = castName (inliningTarget , nameObj , cast , raiseNode );
13431344 return getAttr .execute (frame , inliningTarget , primary , name );
@@ -1346,8 +1347,8 @@ static Object getAttrNoDefault(VirtualFrame frame, Object primary, Object nameOb
13461347 @ Specialization (guards = "!isNoValue(defaultValue)" )
13471348 static Object getAttrWithDefault (VirtualFrame frame , Object primary , Object nameObj , Object defaultValue ,
13481349 @ Bind ("this" ) Node inliningTarget ,
1349- @ Shared @ Cached CastToTruffleStringNode cast ,
1350- @ Shared @ Cached PRaiseNode raiseNode ,
1350+ @ Exclusive @ Cached CastToTruffleStringNode cast ,
1351+ @ Exclusive @ Cached PRaiseNode . Lazy raiseNode ,
13511352 @ Cached InlinedConditionProfile noValueProfile ,
13521353 @ Cached PyObjectLookupAttr lookupAttr ) {
13531354 TruffleString name = castName (inliningTarget , nameObj , cast , raiseNode );
@@ -1359,12 +1360,12 @@ static Object getAttrWithDefault(VirtualFrame frame, Object primary, Object name
13591360 }
13601361 }
13611362
1362- private static TruffleString castName (Node inliningTarget , Object nameObj , CastToTruffleStringNode cast , PRaiseNode raiseNode ) {
1363+ private static TruffleString castName (Node inliningTarget , Object nameObj , CastToTruffleStringNode cast , PRaiseNode . Lazy raiseNode ) {
13631364 TruffleString name ;
13641365 try {
13651366 name = cast .execute (inliningTarget , nameObj );
13661367 } catch (CannotCastException e ) {
1367- throw raiseNode .raise (TypeError , ErrorMessages .GETATTR_ATTRIBUTE_NAME_MUST_BE_STRING );
1368+ throw raiseNode .get ( inliningTarget ). raise (TypeError , ErrorMessages .GETATTR_ATTRIBUTE_NAME_MUST_BE_STRING );
13681369 }
13691370 return name ;
13701371 }
@@ -1518,7 +1519,7 @@ private static TriState isInstanceCheckInternal(VirtualFrame frame, Node inlinin
15181519 static boolean isInstance (VirtualFrame frame , Object instance , Object cls ,
15191520 @ Bind ("this" ) Node inliningTarget ,
15201521 @ Shared ("instanceCheck" ) @ Cached ("create(InstanceCheck)" ) LookupAndCallBinaryNode instanceCheckNode ,
1521- @ Shared ( "boolCast" ) @ Cached CoerceToBooleanNode .YesNode castToBooleanNode ,
1522+ @ Exclusive @ Cached CoerceToBooleanNode .YesNode castToBooleanNode ,
15221523 @ Cached GetClassNode getClassNode ,
15231524 @ Cached IsSameTypeNode isSameTypeNode ,
15241525 @ Cached IsSubtypeNode isSubtypeNode ) {
@@ -1531,7 +1532,7 @@ static boolean isInstance(VirtualFrame frame, Object instance, Object cls,
15311532 static boolean isInstance (VirtualFrame frame , Object instance , Object cls ,
15321533 @ Bind ("this" ) Node inliningTarget ,
15331534 @ Shared ("instanceCheck" ) @ Cached ("create(InstanceCheck)" ) LookupAndCallBinaryNode instanceCheckNode ,
1534- @ Shared ( "boolCast" ) @ Cached CoerceToBooleanNode .YesNode castToBooleanNode ,
1535+ @ Exclusive @ Cached CoerceToBooleanNode .YesNode castToBooleanNode ,
15351536 @ Cached TypeBuiltins .InstanceCheckNode typeInstanceCheckNode ) {
15361537 TriState check = isInstanceCheckInternal (frame , inliningTarget , instance , cls , instanceCheckNode , castToBooleanNode );
15371538 if (check == TriState .UNDEFINED ) {
@@ -1631,11 +1632,11 @@ protected final BinaryComparisonNode createComparison() {
16311632 @ Specialization (guards = "args.length == 0" )
16321633 Object minmaxSequenceWithKey (VirtualFrame frame , Object arg1 , @ SuppressWarnings ("unused" ) Object [] args , Object keywordArgIn , Object defaultVal ,
16331634 @ Bind ("this" ) Node inliningTarget ,
1634- @ Cached PyObjectGetIter getIter ,
1635+ @ Exclusive @ Cached PyObjectGetIter getIter ,
16351636 @ Cached GetNextNode nextNode ,
16361637 @ Shared @ Cached ("createComparison()" ) BinaryComparisonNode compare ,
1637- @ Shared @ Cached CoerceToBooleanNode .YesNode castToBooleanNode ,
1638- @ Shared @ Cached CallNode .Lazy keyCall ,
1638+ @ Exclusive @ Cached CoerceToBooleanNode .YesNode castToBooleanNode ,
1639+ @ Exclusive @ Cached CallNode .Lazy keyCall ,
16391640 @ Exclusive @ Cached InlinedBranchProfile seenNonBoolean ,
16401641 @ Exclusive @ Cached InlinedConditionProfile keywordArgIsNone ,
16411642 @ Exclusive @ Cached IsBuiltinObjectProfile errorProfile1 ,
@@ -1696,11 +1697,12 @@ private String getName() {
16961697 }
16971698
16981699 @ Specialization (guards = {"args.length != 0" })
1700+ @ SuppressWarnings ("truffle-static-method" )
16991701 Object minmaxBinaryWithKey (VirtualFrame frame , Object arg1 , Object [] args , Object keywordArgIn , Object defaultVal ,
17001702 @ Bind ("this" ) Node inliningTarget ,
17011703 @ Shared @ Cached ("createComparison()" ) BinaryComparisonNode compare ,
1702- @ Shared @ Cached CallNode .Lazy keyCall ,
1703- @ Shared @ Cached CoerceToBooleanNode .YesNode castToBooleanNode ,
1704+ @ Exclusive @ Cached CallNode .Lazy keyCall ,
1705+ @ Exclusive @ Cached CoerceToBooleanNode .YesNode castToBooleanNode ,
17041706 @ Exclusive @ Cached InlinedBranchProfile seenNonBoolean ,
17051707 @ Exclusive @ Cached InlinedConditionProfile keywordArgIsNone ,
17061708 @ Exclusive @ Cached InlinedConditionProfile moreThanTwo ,
@@ -1926,10 +1928,10 @@ PNone printGeneric(VirtualFrame frame, Object[] values, Object sepIn, Object end
19261928 @ Cached CastToTruffleStringNode castEnd ,
19271929 @ Cached CoerceToBooleanNode .YesNode castFlush ,
19281930 @ Cached PRaiseNode raiseNode ,
1929- @ Shared ( "getWriteMethod" ) @ Cached PyObjectGetAttr getWriteMethod ,
1930- @ Shared ( "callWrite" ) @ Cached CallNode callWrite ,
1931- @ Shared ( "callFlush" ) @ Cached PyObjectCallMethodObjArgs callFlush ,
1932- @ Shared ( "strNode" ) @ Cached PyObjectStrAsObjectNode strNode ) {
1931+ @ Exclusive @ Cached PyObjectGetAttr getWriteMethod ,
1932+ @ Exclusive @ Cached CallNode callWrite ,
1933+ @ Exclusive @ Cached PyObjectCallMethodObjArgs callFlush ,
1934+ @ Exclusive @ Cached PyObjectStrAsObjectNode strNode ) {
19331935 TruffleString sep ;
19341936 try {
19351937 sep = sepIn instanceof PNone ? T_SPACE : castSep .execute (inliningTarget , sepIn );
@@ -2236,6 +2238,8 @@ private int sumIntInternal(VirtualFrame frame, Object arg1, int start, PyObjectG
22362238 @ Shared @ Cached IsBuiltinObjectProfile errorProfile1 ,
22372239 @ Shared @ Cached IsBuiltinObjectProfile errorProfile2 ,
22382240 @ Shared @ Cached IsBuiltinObjectProfile errorProfile3 ,
2241+ // dummy inline profile, so it can be @Shared, to optimize generated code:
2242+ @ SuppressWarnings ("unused" ) @ Shared @ Cached InlinedConditionProfile hasStart ,
22392243 @ Shared ("getIter" ) @ Cached PyObjectGetIter getIter ) throws UnexpectedResultException {
22402244 return sumDoubleInternal (frame , arg1 , start , getIter , inliningTarget , errorProfile1 , errorProfile2 , errorProfile3 );
22412245 }
@@ -2269,7 +2273,7 @@ Object sum(VirtualFrame frame, Object arg1, Object start,
22692273 @ Bind ("this" ) Node inliningTarget ,
22702274 @ Shared @ Cached IsBuiltinObjectProfile errorProfile1 ,
22712275 @ Shared ("getIter" ) @ Cached PyObjectGetIter getIter ,
2272- @ Cached InlinedConditionProfile hasStart ) {
2276+ @ Shared @ Cached InlinedConditionProfile hasStart ) {
22732277 if (PGuards .isString (start )) {
22742278 throw raise (TypeError , ErrorMessages .CANT_SUM_STRINGS );
22752279 } else if (start instanceof PBytes ) {
0 commit comments