@@ -901,10 +901,11 @@ private void setCustomGlobals(VirtualFrame frame, Node inliningTarget, PDict glo
901
901
}
902
902
903
903
@ Specialization
904
+ @ SuppressWarnings ("truffle-static-method" )
904
905
Object execInheritGlobalsInheritLocals (VirtualFrame frame , Object source , @ SuppressWarnings ("unused" ) PNone globals , @ SuppressWarnings ("unused" ) PNone locals ,
905
906
@ 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 ,
908
909
@ Cached GetFrameLocalsNode getFrameLocalsNode ) {
909
910
PCode code = createAndCheckCode (frame , source );
910
911
PFrame callerFrame = readCallerFrameNode .executeWith (frame , 0 );
@@ -932,12 +933,12 @@ Object execCustomGlobalsGlobalLocals(VirtualFrame frame, Object source, PDict gl
932
933
return invokeNode .execute (frame , rootCallTarget , args );
933
934
}
934
935
935
- @ Specialization (guards = {"isMapping(inliningTarget, mappingCheckNode, locals)" }, limit = "1" )
936
+ @ Specialization (guards = {"isMapping(inliningTarget, mappingCheckNode, locals)" })
936
937
@ SuppressWarnings ("truffle-static-method" )
937
938
Object execInheritGlobalsCustomLocals (VirtualFrame frame , Object source , @ SuppressWarnings ("unused" ) PNone globals , Object locals ,
938
939
@ Bind ("this" ) Node inliningTarget ,
939
940
@ SuppressWarnings ("unused" ) @ Shared @ Cached PyMappingCheckNode mappingCheckNode ,
940
- @ Shared @ Cached ReadCallerFrameNode readCallerFrameNode ,
941
+ @ Exclusive @ Cached ReadCallerFrameNode readCallerFrameNode ,
941
942
@ Shared ("getCt" ) @ Cached CodeNodes .GetCodeCallTargetNode getCt ) {
942
943
PCode code = createAndCheckCode (frame , source );
943
944
PFrame callerFrame = readCallerFrameNode .executeWith (frame , 0 );
@@ -948,7 +949,7 @@ Object execInheritGlobalsCustomLocals(VirtualFrame frame, Object source, @Suppre
948
949
return invokeNode .execute (frame , getCt .execute (inliningTarget , code ), args );
949
950
}
950
951
951
- @ Specialization (guards = {"isMapping(inliningTarget, mappingCheckNode, locals)" }, limit = "1" )
952
+ @ Specialization (guards = {"isMapping(inliningTarget, mappingCheckNode, locals)" })
952
953
@ SuppressWarnings ("truffle-static-method" )
953
954
Object execCustomGlobalsCustomLocals (VirtualFrame frame , Object source , PDict globals , Object locals ,
954
955
@ Bind ("this" ) Node inliningTarget ,
@@ -969,7 +970,7 @@ PNone badGlobals(@SuppressWarnings("unused") Object source, Object globals, @Sup
969
970
throw raise (TypeError , ErrorMessages .GLOBALS_MUST_BE_DICT , getMode (), globals );
970
971
}
971
972
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)" })
973
974
@ SuppressWarnings ("truffle-static-method" )
974
975
PNone badLocals (@ SuppressWarnings ("unused" ) Object source , @ SuppressWarnings ("unused" ) PDict globals , Object locals ,
975
976
@ SuppressWarnings ("unused" ) @ Bind ("this" ) Node inliningTarget ,
@@ -1084,7 +1085,7 @@ protected abstract Object executeInternal(VirtualFrame frame, Object source, Tru
1084
1085
@ Specialization
1085
1086
Object doCompile (VirtualFrame frame , TruffleString expression , TruffleString filename , TruffleString mode , int flags , boolean dontInherit , int optimize ,
1086
1087
int featureVersion ,
1087
- @ Cached ReadCallerFrameNode readCallerFrame ) {
1088
+ @ Shared @ Cached ReadCallerFrameNode readCallerFrame ) {
1088
1089
if (!dontInherit ) {
1089
1090
PFrame fr = readCallerFrame .executeWith (frame , 0 );
1090
1091
PCode code = factory ().createCode (fr .getTarget ());
@@ -1167,7 +1168,7 @@ Object generic(VirtualFrame frame, Object wSource, Object wFilename, TruffleStri
1167
1168
@ Cached WarnNode warnNode ,
1168
1169
@ Cached TruffleString .FromByteArrayNode fromByteArrayNode ,
1169
1170
@ Cached TruffleString .SwitchEncodingNode switchEncodingNode ,
1170
- @ Cached ReadCallerFrameNode readCallerFrame ) {
1171
+ @ Shared @ Cached ReadCallerFrameNode readCallerFrame ) {
1171
1172
if (wSource instanceof PCode ) {
1172
1173
return wSource ;
1173
1174
}
@@ -1336,8 +1337,8 @@ abstract static class GetAttrNode extends PythonTernaryBuiltinNode {
1336
1337
@ Specialization (guards = "isNoValue(defaultValue)" )
1337
1338
static Object getAttrNoDefault (VirtualFrame frame , Object primary , Object nameObj , @ SuppressWarnings ("unused" ) Object defaultValue ,
1338
1339
@ 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 ,
1341
1342
@ Cached PyObjectGetAttr getAttr ) {
1342
1343
TruffleString name = castName (inliningTarget , nameObj , cast , raiseNode );
1343
1344
return getAttr .execute (frame , inliningTarget , primary , name );
@@ -1346,8 +1347,8 @@ static Object getAttrNoDefault(VirtualFrame frame, Object primary, Object nameOb
1346
1347
@ Specialization (guards = "!isNoValue(defaultValue)" )
1347
1348
static Object getAttrWithDefault (VirtualFrame frame , Object primary , Object nameObj , Object defaultValue ,
1348
1349
@ 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 ,
1351
1352
@ Cached InlinedConditionProfile noValueProfile ,
1352
1353
@ Cached PyObjectLookupAttr lookupAttr ) {
1353
1354
TruffleString name = castName (inliningTarget , nameObj , cast , raiseNode );
@@ -1359,12 +1360,12 @@ static Object getAttrWithDefault(VirtualFrame frame, Object primary, Object name
1359
1360
}
1360
1361
}
1361
1362
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 ) {
1363
1364
TruffleString name ;
1364
1365
try {
1365
1366
name = cast .execute (inliningTarget , nameObj );
1366
1367
} 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 );
1368
1369
}
1369
1370
return name ;
1370
1371
}
@@ -1518,7 +1519,7 @@ private static TriState isInstanceCheckInternal(VirtualFrame frame, Node inlinin
1518
1519
static boolean isInstance (VirtualFrame frame , Object instance , Object cls ,
1519
1520
@ Bind ("this" ) Node inliningTarget ,
1520
1521
@ Shared ("instanceCheck" ) @ Cached ("create(InstanceCheck)" ) LookupAndCallBinaryNode instanceCheckNode ,
1521
- @ Shared ( "boolCast" ) @ Cached CoerceToBooleanNode .YesNode castToBooleanNode ,
1522
+ @ Exclusive @ Cached CoerceToBooleanNode .YesNode castToBooleanNode ,
1522
1523
@ Cached GetClassNode getClassNode ,
1523
1524
@ Cached IsSameTypeNode isSameTypeNode ,
1524
1525
@ Cached IsSubtypeNode isSubtypeNode ) {
@@ -1531,7 +1532,7 @@ static boolean isInstance(VirtualFrame frame, Object instance, Object cls,
1531
1532
static boolean isInstance (VirtualFrame frame , Object instance , Object cls ,
1532
1533
@ Bind ("this" ) Node inliningTarget ,
1533
1534
@ Shared ("instanceCheck" ) @ Cached ("create(InstanceCheck)" ) LookupAndCallBinaryNode instanceCheckNode ,
1534
- @ Shared ( "boolCast" ) @ Cached CoerceToBooleanNode .YesNode castToBooleanNode ,
1535
+ @ Exclusive @ Cached CoerceToBooleanNode .YesNode castToBooleanNode ,
1535
1536
@ Cached TypeBuiltins .InstanceCheckNode typeInstanceCheckNode ) {
1536
1537
TriState check = isInstanceCheckInternal (frame , inliningTarget , instance , cls , instanceCheckNode , castToBooleanNode );
1537
1538
if (check == TriState .UNDEFINED ) {
@@ -1631,11 +1632,11 @@ protected final BinaryComparisonNode createComparison() {
1631
1632
@ Specialization (guards = "args.length == 0" )
1632
1633
Object minmaxSequenceWithKey (VirtualFrame frame , Object arg1 , @ SuppressWarnings ("unused" ) Object [] args , Object keywordArgIn , Object defaultVal ,
1633
1634
@ Bind ("this" ) Node inliningTarget ,
1634
- @ Cached PyObjectGetIter getIter ,
1635
+ @ Exclusive @ Cached PyObjectGetIter getIter ,
1635
1636
@ Cached GetNextNode nextNode ,
1636
1637
@ 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 ,
1639
1640
@ Exclusive @ Cached InlinedBranchProfile seenNonBoolean ,
1640
1641
@ Exclusive @ Cached InlinedConditionProfile keywordArgIsNone ,
1641
1642
@ Exclusive @ Cached IsBuiltinObjectProfile errorProfile1 ,
@@ -1696,11 +1697,12 @@ private String getName() {
1696
1697
}
1697
1698
1698
1699
@ Specialization (guards = {"args.length != 0" })
1700
+ @ SuppressWarnings ("truffle-static-method" )
1699
1701
Object minmaxBinaryWithKey (VirtualFrame frame , Object arg1 , Object [] args , Object keywordArgIn , Object defaultVal ,
1700
1702
@ Bind ("this" ) Node inliningTarget ,
1701
1703
@ 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 ,
1704
1706
@ Exclusive @ Cached InlinedBranchProfile seenNonBoolean ,
1705
1707
@ Exclusive @ Cached InlinedConditionProfile keywordArgIsNone ,
1706
1708
@ Exclusive @ Cached InlinedConditionProfile moreThanTwo ,
@@ -1926,10 +1928,10 @@ PNone printGeneric(VirtualFrame frame, Object[] values, Object sepIn, Object end
1926
1928
@ Cached CastToTruffleStringNode castEnd ,
1927
1929
@ Cached CoerceToBooleanNode .YesNode castFlush ,
1928
1930
@ 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 ) {
1933
1935
TruffleString sep ;
1934
1936
try {
1935
1937
sep = sepIn instanceof PNone ? T_SPACE : castSep .execute (inliningTarget , sepIn );
@@ -2236,6 +2238,8 @@ private int sumIntInternal(VirtualFrame frame, Object arg1, int start, PyObjectG
2236
2238
@ Shared @ Cached IsBuiltinObjectProfile errorProfile1 ,
2237
2239
@ Shared @ Cached IsBuiltinObjectProfile errorProfile2 ,
2238
2240
@ Shared @ Cached IsBuiltinObjectProfile errorProfile3 ,
2241
+ // dummy inline profile, so it can be @Shared, to optimize generated code:
2242
+ @ SuppressWarnings ("unused" ) @ Shared @ Cached InlinedConditionProfile hasStart ,
2239
2243
@ Shared ("getIter" ) @ Cached PyObjectGetIter getIter ) throws UnexpectedResultException {
2240
2244
return sumDoubleInternal (frame , arg1 , start , getIter , inliningTarget , errorProfile1 , errorProfile2 , errorProfile3 );
2241
2245
}
@@ -2269,7 +2273,7 @@ Object sum(VirtualFrame frame, Object arg1, Object start,
2269
2273
@ Bind ("this" ) Node inliningTarget ,
2270
2274
@ Shared @ Cached IsBuiltinObjectProfile errorProfile1 ,
2271
2275
@ Shared ("getIter" ) @ Cached PyObjectGetIter getIter ,
2272
- @ Cached InlinedConditionProfile hasStart ) {
2276
+ @ Shared @ Cached InlinedConditionProfile hasStart ) {
2273
2277
if (PGuards .isString (start )) {
2274
2278
throw raise (TypeError , ErrorMessages .CANT_SUM_STRINGS );
2275
2279
} else if (start instanceof PBytes ) {
0 commit comments