Skip to content

Commit 24134d6

Browse files
committed
[GR-67249] Address all reminaining Truffle warnings
PullRequest: graalpython/3910
2 parents d815716 + eabc4d2 commit 24134d6

File tree

148 files changed

+466
-374
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

148 files changed

+466
-374
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/BuiltinFunctions.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2111,7 +2111,7 @@ static Object sumLongIterator(VirtualFrame frame, Node inliningTarget, PLongSequ
21112111

21122112
@Specialization(guards = "isDouble(start) || isInt(start)")
21132113
static Object sumDoubleIterator(Node inliningTarget, PDoubleSequenceIterator iterator, Object start,
2114-
@Cached InlinedConditionProfile startIsDouble,
2114+
@Cached @Exclusive InlinedConditionProfile startIsDouble,
21152115
@Shared @Cached InlinedLoopConditionProfile loopProfilePrimitive) {
21162116
/*
21172117
* Need to make sure we keep start type if the iterator was empty
@@ -2126,13 +2126,14 @@ static Object sumDoubleIterator(Node inliningTarget, PDoubleSequenceIterator ite
21262126
return result;
21272127
}
21282128

2129+
// @Exclusive for truffle-interpreted-performance
21292130
@Fallback
21302131
static Object sumGeneric(VirtualFrame frame, Node inliningTarget, Object iterator, Object start,
2131-
@Shared @Cached InlinedLoopConditionProfile loopProfilePrimitive,
2132-
@Shared @Cached InlinedLoopConditionProfile loopProfileGeneric,
2132+
@Exclusive @Cached InlinedLoopConditionProfile loopProfilePrimitive,
2133+
@Exclusive @Cached InlinedLoopConditionProfile loopProfileGeneric,
21332134
@Cached PyIterNextNode nextNode,
21342135
@Shared @Cached PyNumberAddNode addNode,
2135-
@Shared @Cached InlinedConditionProfile resultFitsInInt,
2136+
@Exclusive @Cached InlinedConditionProfile resultFitsInInt,
21362137
@Exclusive @Cached InlinedBranchProfile seenObject,
21372138
@Exclusive @Cached InlinedBranchProfile seenInt,
21382139
@Exclusive @Cached InlinedBranchProfile seenDouble,
@@ -2308,7 +2309,7 @@ protected ArgumentClinicProvider getArgumentClinic() {
23082309
}
23092310

23102311
@ImportStatic(SpecialMethodNames.class)
2311-
@SuppressWarnings("truffle-inlining") // footprint reduction 72 -> 53
2312+
@GenerateInline(false) // footprint reduction 72 -> 53
23122313
abstract static class UpdateBasesNode extends Node {
23132314

23142315
abstract PTuple execute(PTuple bases, Object[] arguments, int nargs);
@@ -2365,7 +2366,7 @@ static PTuple update(PTuple bases, Object[] arguments, int nargs,
23652366
}
23662367
}
23672368

2368-
@SuppressWarnings("truffle-inlining") // footprint reduction 36 -> 19
2369+
@GenerateInline(false) // footprint reduction 36 -> 19
23692370
abstract static class CalculateMetaclassNode extends Node {
23702371

23712372
abstract Object execute(Object metatype, PTuple bases);

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/CodecsModuleBuiltins.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ static void handle(Node inliningTarget, TruffleEncoder encoder, TruffleString er
250250
int end = start + encoder.getErrorLength();
251251
Object exception = lazyCallNode.executeWithoutFrame(UnicodeEncodeError, encoder.getEncodingName(), inputObject, start, end, encoder.getErrorReason());
252252
if (exception instanceof PBaseException) {
253-
throw raiseNode.raiseExceptionObject(inliningTarget, (PBaseException) exception);
253+
throw raiseNode.raiseExceptionObject(inliningTarget, exception);
254254
} else {
255255
// Shouldn't happen unless the user manually replaces the method, which is
256256
// really

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/PosixModuleBuiltins.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1997,7 +1997,7 @@ static Object dupAndFdopendir(VirtualFrame frame, Node inliningTarget, PosixSupp
19971997
}
19981998

19991999
@ImportStatic(PGuards.class)
2000-
@SuppressWarnings("truffle-inlining") // footprint reduction 36 -> 17
2000+
@GenerateInline(false) // footprint reduction 36 -> 17
20012001
abstract static class UtimeArgsToTimespecNode extends Node {
20022002
abstract long[] execute(VirtualFrame frame, Object times, Object ns);
20032003

@@ -2043,7 +2043,7 @@ static long[] bothSpecified(VirtualFrame frame, Object times, Object ns,
20432043
@SuppressWarnings("unused")
20442044
static long[] timesNotATuple(VirtualFrame frame, Object times, PNone ns,
20452045
@Bind Node inliningTarget,
2046-
@Cached PRaiseNode raiseNode) {
2046+
@Exclusive @Cached PRaiseNode raiseNode) {
20472047
throw timesTupleError(inliningTarget, raiseNode);
20482048
}
20492049

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/SREModuleBuiltins.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ private RuntimeException handleCompilationError(Node node, RuntimeException e, I
423423
PythonModule module = context.lookupBuiltinModule(BuiltinNames.T__SRE);
424424
Object errorConstructor = PyObjectLookupAttr.executeUncached(module, T_ERROR);
425425
PBaseException exception = (PBaseException) CallNode.executeUncached(errorConstructor, reason, originalPattern, position);
426-
return PRaiseNode.raiseExceptionObject(node, exception);
426+
return PRaiseNode.raiseExceptionObjectStatic(node, exception);
427427
}
428428
}
429429
}
@@ -547,7 +547,7 @@ protected TRegexCache getTRegexCache(PythonObject pattern) {
547547
}
548548
}
549549

550-
@SuppressWarnings("truffle-inlining") // footprint reduction 36 -> 17
550+
@GenerateInline(false) // footprint reduction 36 -> 17
551551
abstract static class RECheckInputTypeNode extends Node {
552552

553553
private static final TruffleString T_UNSUPPORTED_INPUT_TYPE = tsLiteral("expected string or bytes-like object");

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/ThreadModuleBuiltins.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ static long start(VirtualFrame frame, Object callable, Object args, Object kwarg
224224

225225
Thread thread = threadBuilder.build();
226226
startThread(thread);
227-
return thread.getId();
227+
return PThread.getThreadId(thread);
228228
}
229229

230230
@TruffleBoundary

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/WarningsModuleBuiltins.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,7 @@ private void warnExplicitPart2(PythonContext context, PythonModule warnings, Tru
834834
if (!PyExceptionInstanceCheckNode.executeUncached(message)) {
835835
throw PRaiseNode.raiseStatic(this, PythonBuiltinClassType.SystemError, ErrorMessages.EXCEPTION_NOT_BASEEXCEPTION, PyObjectReprAsTruffleStringNode.executeUncached(message));
836836
} else {
837-
throw PRaiseNode.raiseExceptionObject(this, message);
837+
throw PRaiseNode.raiseExceptionObjectStatic(this, message);
838838
}
839839
}
840840

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/bz2/Bz2Nodes.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public class Bz2Nodes {
9595

9696
protected static final int INITIAL_BUFFER_SIZE = 8192;
9797

98-
@SuppressWarnings("truffle-inlining") // footprint reduction 40 -> 21
98+
@GenerateInline(false) // footprint reduction 40 -> 21
9999
public abstract static class Bz2NativeCompress extends Node {
100100

101101
public abstract byte[] execute(BZ2Object.BZ2Compressor self, PythonContext context, byte[] bytes, int len, int action);
@@ -222,7 +222,7 @@ static byte[] nativeDecompress(Node inliningTarget, BZ2Object.BZ2Decompressor se
222222
}
223223
}
224224

225-
@SuppressWarnings("truffle-inlining") // footprint reduction 40 -> 21
225+
@GenerateInline(false) // footprint reduction 40 -> 21
226226
public abstract static class Bz2NativeInternalDecompress extends Node {
227227

228228
public abstract byte[] execute(BZ2Object.BZ2Decompressor self, int maxLength);

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/cext/PythonCextDictBuiltins.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -524,8 +524,8 @@ abstract static class PyDict_Merge extends CApiTernaryBuiltinNode {
524524
@Specialization(guards = {"override != 0"})
525525
static int merge(PDict a, Object b, @SuppressWarnings("unused") int override,
526526
@Bind Node inliningTarget,
527-
@Shared @Cached PyObjectGetAttr getKeys,
528-
@Cached PyObjectGetAttr getUpdate,
527+
@Exclusive @Cached PyObjectGetAttr getKeys,
528+
@Exclusive @Cached PyObjectGetAttr getUpdate,
529529
@Shared @Cached CallNode callNode,
530530
@Cached PRaiseNode raiseNode) {
531531
// lookup "keys" to raise the right error:
@@ -561,10 +561,11 @@ static int merge(PDict a, PDict b, @SuppressWarnings("unused") int override,
561561
return 0;
562562
}
563563

564+
// @Exclusive for truffle-interpreted-performance
564565
@Specialization(guards = {"override == 0", "!isDict(b)"})
565566
static int merge(PDict a, Object b, @SuppressWarnings("unused") int override,
566567
@Bind Node inliningTarget,
567-
@Shared @Cached PyObjectGetAttr getKeys,
568+
@Exclusive @Cached PyObjectGetAttr getKeys,
568569
@Shared @Cached CallNode callNode,
569570
@Cached ConstructListNode listNode,
570571
@Cached GetItemNode getKeyNode,

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/cext/PythonCextErrBuiltins.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ static Object create(Object type, Object value,
209209
@SuppressWarnings("unused") @Shared @Cached IsSubClassNode isSubClassNode,
210210
@Cached PrepareExceptionNode prepareExceptionNode) {
211211
Object exception = prepareExceptionNode.execute(null, type, value);
212-
throw PRaiseNode.raiseExceptionObject(inliningTarget, exception);
212+
throw PRaiseNode.raiseExceptionObjectStatic(inliningTarget, exception);
213213
}
214214

215215
protected static boolean isExceptionClass(Node inliningTarget, Object obj, IsTypeNode isTypeNode, IsSubClassNode isSubClassNode) {
@@ -311,7 +311,7 @@ abstract static class _PyErr_GetHandledException extends CApiUnaryBuiltinNode {
311311

312312
@Specialization
313313
static Object get(@SuppressWarnings("unused") Object threadState,
314-
@Bind("this") Node inliningTarget,
314+
@Bind Node inliningTarget,
315315
@Cached GetCaughtExceptionNode getCaughtExceptionNode,
316316
@Cached GetEscapedExceptionNode getEscapedExceptionNode) {
317317
AbstractTruffleException caughtException = getCaughtExceptionNode.executeFromNative();

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/cext/PythonCextPyStateBuiltins.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,15 +182,15 @@ int doIt(long id, Object exceptionObject) {
182182
@Override
183183
protected void perform(Access access) {
184184
if (missedCount == MAX_MISSED_COUNT) {
185-
throw PRaiseNode.raiseExceptionObject(null, exceptionObject);
185+
throw PRaiseNode.raiseExceptionObjectStatic(null, exceptionObject);
186186
}
187187
// If possible, we do not want to raise in some internal code, it could
188188
// corrupt internal data structures.
189189
Node location = access.getLocation();
190190
if (location != null) {
191191
RootNode rootNode = location.getRootNode();
192192
if (rootNode instanceof PRootNode && !rootNode.isInternal()) {
193-
throw PRaiseNode.raiseExceptionObject(null, exceptionObject);
193+
throw PRaiseNode.raiseExceptionObjectStatic(null, exceptionObject);
194194
}
195195
}
196196
// Heuristic fabricated out of thin air:

0 commit comments

Comments
 (0)