Skip to content

Commit b8f3f43

Browse files
committed
[GR-67249] Fix Truffle DSL warnings
PullRequest: graalpython/3891
2 parents 2575297 + d099390 commit b8f3f43

File tree

509 files changed

+3671
-3673
lines changed

Some content is hidden

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

509 files changed

+3671
-3673
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/PythonLanguage.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ public boolean isSingleContext() {
405405
*/
406406
private final ConcurrentHashMap<Object, Source> sourceCache = new ConcurrentHashMap<>();
407407

408+
@Idempotent
408409
public static PythonLanguage get(Node node) {
409410
return REFERENCE.get(node);
410411
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ abstract static class AbcInitCollectionFlagsNode extends PythonUnaryBuiltinNode
9393
@TruffleBoundary
9494
@Specialization
9595
static Object init(Object object,
96-
@Bind("this") Node inliningTarget) {
96+
@Bind Node inliningTarget) {
9797
if (TypeNodes.IsTypeNode.executeUncached(object)) {
9898
Object flags = PyObjectLookupAttr.executeUncached(object, ABC_TPFLAGS);
9999
long val;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public void postInitialize(Python3Core core) {
9191
abstract static class ArrayReconstructorNode extends PythonClinicBuiltinNode {
9292
@Specialization(guards = "mformatCode == cachedCode", limit = "3")
9393
static Object reconstructCached(VirtualFrame frame, Object arrayType, TruffleString typeCode, @SuppressWarnings("unused") int mformatCode, PBytes bytes,
94-
@Bind("this") Node inliningTarget,
94+
@Bind Node inliningTarget,
9595
@Cached("mformatCode") int cachedCode,
9696
// Truffle lacks generic inline value profile, but it still warns that this
9797
// can be inlined:
@@ -117,7 +117,7 @@ static Object reconstructCached(VirtualFrame frame, Object arrayType, TruffleStr
117117

118118
@Specialization(replaces = "reconstructCached")
119119
static Object reconstruct(VirtualFrame frame, Object arrayType, TruffleString typeCode, int mformatCode, PBytes bytes,
120-
@Bind("this") Node inliningTarget,
120+
@Bind Node inliningTarget,
121121
@Exclusive @Cached PyObjectCallMethodObjArgs callDecode,
122122
@Exclusive @Cached ArrayBuiltins.FromBytesNode fromBytesNode,
123123
@Exclusive @Cached ArrayBuiltins.FromUnicodeNode fromUnicodeNode,
@@ -175,7 +175,7 @@ private static Object doReconstruct(VirtualFrame frame, Node inliningTarget, Obj
175175
@Specialization(guards = "!isPBytes(value)")
176176
@SuppressWarnings("unused")
177177
static Object error(Object arrayType, TruffleString typeCode, int mformatCode, Object value,
178-
@Bind("this") Node inliningTarget) {
178+
@Bind Node inliningTarget) {
179179
throw PRaiseNode.raiseStatic(inliningTarget, TypeError, ErrorMessages.FOURTH_ARG_SHOULD_BE_BYTES, value);
180180
}
181181

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public void postInitialize(Python3Core core) {
125125
public abstract static class GetRunningLoop extends PythonBuiltinNode {
126126
@Specialization
127127
static Object getCurrentLoop(
128-
@Bind("this") Node inliningTarget,
128+
@Bind Node inliningTarget,
129129
@Bind PythonContext context,
130130
@Cached PRaiseNode raise) {
131131
Object eventLoop = context.getThreadState(context.getLanguage(inliningTarget)).getRunningEventLoop();
@@ -142,7 +142,7 @@ static Object getCurrentLoop(
142142
public abstract static class InternalGetRunningLoop extends PythonBuiltinNode {
143143
@Specialization
144144
static Object getCurrentLoop(
145-
@Bind("this") Node inliningTarget,
145+
@Bind Node inliningTarget,
146146
@Bind PythonContext context) {
147147
Object eventLoop = context.getThreadState(context.getLanguage(inliningTarget)).getRunningEventLoop();
148148

@@ -155,7 +155,7 @@ static Object getCurrentLoop(
155155
public abstract static class InternalSetRunningLoop extends PythonUnaryBuiltinNode {
156156
@Specialization
157157
static Object setCurrentLoop(Object loop,
158-
@Bind("this") Node inliningTarget,
158+
@Bind Node inliningTarget,
159159
@Bind PythonContext context) {
160160
context.getThreadState(context.getLanguage(inliningTarget)).setRunningEventLoop(loop == PNone.NONE ? null : loop);
161161
return PNone.NONE;
@@ -173,7 +173,7 @@ public abstract static class GetEventLoop extends PythonUnaryBuiltinNode {
173173

174174
@Specialization
175175
static Object getCurrentLoop(VirtualFrame frame, Object ignored,
176-
@Bind("this") Node inliningTarget,
176+
@Bind Node inliningTarget,
177177
@Bind PythonContext context,
178178
@Cached CallNode callGetPolicy,
179179
@Cached CallNode callGetLoop,
@@ -209,7 +209,7 @@ public Object getCurrentLoop(VirtualFrame frame, Object stacklevel,
209209
public abstract static class EnterTask extends PythonTernaryBuiltinNode {
210210
@Specialization
211211
public Object enterTask(VirtualFrame frame, PythonModule self, Object loop, Object task,
212-
@Bind("this") Node inliningTarget,
212+
@Bind Node inliningTarget,
213213
@Cached ObjectBuiltins.GetAttributeNode getattr,
214214
@Cached PyDictSetItem set,
215215
@Cached PyDictGetItem get,
@@ -230,7 +230,7 @@ public Object enterTask(VirtualFrame frame, PythonModule self, Object loop, Obje
230230
public abstract static class LeaveTask extends PythonTernaryBuiltinNode {
231231
@Specialization
232232
public Object leaveTask(VirtualFrame frame, PythonModule self, Object loop, Object task,
233-
@Bind("this") Node inliningTarget,
233+
@Bind Node inliningTarget,
234234
@Cached ObjectBuiltins.GetAttributeNode getattr,
235235
@Cached PyDictDelItem del,
236236
@Cached PyDictGetItem get,
@@ -254,7 +254,7 @@ public abstract static class RegisterTask extends PythonBinaryBuiltinNode {
254254

255255
@Specialization
256256
public Object registerTask(VirtualFrame frame, PythonModule self, Object task,
257-
@Bind("this") Node inliningTarget,
257+
@Bind Node inliningTarget,
258258
@Cached ObjectBuiltins.GetAttributeNode getattr,
259259
@Cached PyObjectCallMethodObjArgs callmethod) {
260260
Object weakset = getattr.execute(frame, self, SCHEDULED_TASKS_ATTR);
@@ -269,7 +269,7 @@ public abstract static class UnregisterTask extends PythonBinaryBuiltinNode {
269269

270270
@Specialization
271271
public Object unregisterTask(VirtualFrame frame, PythonModule self, Object task,
272-
@Bind("this") Node inliningTarget,
272+
@Bind Node inliningTarget,
273273
@Cached ObjectBuiltins.GetAttributeNode getattr,
274274
@Cached PyObjectCallMethodObjArgs callMethod) {
275275
Object weakset = getattr.execute(frame, self, SCHEDULED_TASKS_ATTR);
@@ -318,7 +318,7 @@ protected ArgumentClinicProvider getArgumentClinic() {
318318

319319
@Specialization
320320
public Object currentTask(VirtualFrame frame, PythonModule self, Object argloop,
321-
@Bind("this") Node inliningTarget,
321+
@Bind Node inliningTarget,
322322
@Bind PythonContext context,
323323
@Cached ObjectBuiltins.GetAttributeNode getattr,
324324
@Cached PyDictGetItem get,
@@ -342,7 +342,7 @@ public Object currentTask(VirtualFrame frame, PythonModule self, Object argloop,
342342
public abstract static class SwapCurrentTaskNode extends PythonTernaryBuiltinNode {
343343
@Specialization
344344
public Object enterTask(VirtualFrame frame, PythonModule self, Object loop, Object task,
345-
@Bind("this") Node inliningTarget,
345+
@Bind Node inliningTarget,
346346
@Cached ObjectBuiltins.GetAttributeNode getattr,
347347
@Cached PyObjectHashNode hashNode,
348348
@Cached HashingStorageNodes.HashingStorageGetItemWithHash getItem,

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ protected List<? extends NodeFactory<? extends PythonBuiltinBaseNode>> getNodeFa
109109
abstract static class AsciiBufferConverter extends ArgumentCastNode {
110110
@Specialization(guards = "acquireLib.hasBuffer(value)", limit = "getCallSiteInlineCacheMaxDepth()")
111111
static Object doObject(VirtualFrame frame, Object value,
112-
@Bind("this") Node inliningTarget,
112+
@Bind Node inliningTarget,
113113
@Bind PythonContext context,
114-
@Cached("createFor(this)") IndirectCallData indirectCallData,
114+
@Cached("createFor($node)") IndirectCallData indirectCallData,
115115
@CachedLibrary("value") PythonBufferAcquireLibrary acquireLib) {
116116
return acquireLib.acquireReadonly(value, frame, context, context.getLanguage(inliningTarget), indirectCallData);
117117
}
@@ -154,14 +154,14 @@ static Object asciiString(TruffleString value,
154154

155155
@Specialization(guards = "!isAscii(value, getCodeRangeNode)")
156156
static Object nonAsciiString(@SuppressWarnings("unused") TruffleString value,
157-
@Bind("this") Node inliningTarget,
157+
@Bind Node inliningTarget,
158158
@Shared("getCodeRange") @Cached @SuppressWarnings("unused") TruffleString.GetCodeRangeNode getCodeRangeNode) {
159159
throw PRaiseNode.raiseStatic(inliningTarget, ValueError, ErrorMessages.STRING_ARG_SHOULD_CONTAIN_ONLY_ASCII);
160160
}
161161

162162
@Specialization
163163
static Object string(PString value,
164-
@Bind("this") Node inliningTarget,
164+
@Bind Node inliningTarget,
165165
@Cached CastToTruffleStringNode cast,
166166
@Shared("getCodeRange") @Cached @SuppressWarnings("unused") TruffleString.GetCodeRangeNode getCodeRangeNode,
167167
@Cached InlinedConditionProfile asciiProfile) {
@@ -175,7 +175,7 @@ static Object string(PString value,
175175

176176
@Fallback
177177
static Object error(@SuppressWarnings("unused") Object value,
178-
@Bind("this") Node inliningTarget) {
178+
@Bind Node inliningTarget) {
179179
throw PRaiseNode.raiseStatic(inliningTarget, TypeError, ErrorMessages.ARG_SHOULD_BE_BYTES_BUFFER_OR_ASCII_NOT_P, value);
180180
}
181181

@@ -193,7 +193,7 @@ public static AsciiBufferConverter create() {
193193
abstract static class A2bBase64Node extends PythonBinaryClinicBuiltinNode {
194194
@Specialization(limit = "3")
195195
PBytes doConvert(VirtualFrame frame, Object buffer, boolean strictMode,
196-
@Cached("createFor(this)") IndirectCallData indirectCallData,
196+
@Cached("createFor($node)") IndirectCallData indirectCallData,
197197
@CachedLibrary("buffer") PythonBufferAccessLibrary bufferLib,
198198
@Bind PythonLanguage language) {
199199
try {
@@ -278,7 +278,7 @@ protected ArgumentClinicProvider getArgumentClinic() {
278278
abstract static class A2bHexNode extends PythonUnaryClinicBuiltinNode {
279279
@Specialization(limit = "3")
280280
PBytes a2b(VirtualFrame frame, Object buffer,
281-
@Cached("createFor(this)") IndirectCallData indirectCallData,
281+
@Cached("createFor($node)") IndirectCallData indirectCallData,
282282
@CachedLibrary("buffer") PythonBufferAccessLibrary bufferLib,
283283
@Bind PythonLanguage language) {
284284
try {
@@ -342,7 +342,7 @@ private PBytes b2a(byte[] data, int lenght, boolean newline, PythonLanguage lang
342342

343343
@Specialization(limit = "3")
344344
PBytes b2aBuffer(VirtualFrame frame, Object buffer, boolean newline,
345-
@Cached("createFor(this)") IndirectCallData indirectCallData,
345+
@Cached("createFor($node)") IndirectCallData indirectCallData,
346346
@CachedLibrary("buffer") PythonBufferAccessLibrary bufferLib,
347347
@Bind PythonLanguage language) {
348348
try {
@@ -368,8 +368,8 @@ abstract static class B2aHexNode extends PythonTernaryClinicBuiltinNode {
368368

369369
@Specialization(limit = "3")
370370
static PBytes b2a(VirtualFrame frame, Object buffer, Object sep, int bytesPerSep,
371-
@Bind("this") Node inliningTarget,
372-
@Cached("createFor(this)") IndirectCallData indirectCallData,
371+
@Bind Node inliningTarget,
372+
@Cached("createFor($node)") IndirectCallData indirectCallData,
373373
@CachedLibrary("buffer") PythonBufferAccessLibrary bufferLib,
374374
@Bind PythonLanguage language,
375375
@Cached PRaiseNode raiseNode) {
@@ -409,7 +409,7 @@ abstract static class Crc32Node extends PythonBinaryClinicBuiltinNode {
409409

410410
@Specialization(limit = "3")
411411
static long b2a(VirtualFrame frame, Object buffer, long crc,
412-
@Cached("createFor(this)") IndirectCallData indirectCallData,
412+
@Cached("createFor($node)") IndirectCallData indirectCallData,
413413
@CachedLibrary("buffer") PythonBufferAccessLibrary bufferLib) {
414414
try {
415415
return crc32((int) crc, bufferLib.getInternalOrCopiedByteArray(buffer), 0, bufferLib.getBufferLength(buffer));
@@ -432,7 +432,7 @@ abstract static class CrcHqxNode extends PythonBinaryClinicBuiltinNode {
432432

433433
@Specialization(limit = "3")
434434
static long b2a(VirtualFrame frame, Object buffer, long crc,
435-
@Cached("createFor(this)") IndirectCallData indirectCallData,
435+
@Cached("createFor($node)") IndirectCallData indirectCallData,
436436
@CachedLibrary("buffer") PythonBufferAccessLibrary bufferLib) {
437437
try {
438438
return crcHqx((int) crc, bufferLib.getInternalOrCopiedByteArray(buffer), 0, bufferLib.getBufferLength(buffer));

0 commit comments

Comments
 (0)