Skip to content

Commit 60d1387

Browse files
committed
Trivial fixes
1 parent 1279450 commit 60d1387

17 files changed

+40
-149
lines changed

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,29 +1153,28 @@ protected static boolean isPrimitiveFloat(Node inliningTarget, Object cls, IsBui
11531153
public abstract static class FrozenSetNode extends PythonBinaryBuiltinNode {
11541154

11551155
@Specialization(guards = "isNoValue(arg)")
1156-
public PFrozenSet frozensetEmpty(Object cls, @SuppressWarnings("unused") PNone arg,
1156+
static PFrozenSet frozensetEmpty(Object cls, @SuppressWarnings("unused") PNone arg,
11571157
@Shared @Cached PythonObjectFactory factory) {
11581158
return factory.createFrozenSet(cls);
11591159
}
11601160

11611161
@Specialization(guards = "isBuiltinClass.profileIsAnyBuiltinClass(inliningTarget, cls)")
1162-
public static PFrozenSet frozensetIdentity(@SuppressWarnings("unused") Object cls, PFrozenSet arg,
1162+
static PFrozenSet frozensetIdentity(@SuppressWarnings("unused") Object cls, PFrozenSet arg,
11631163
@SuppressWarnings("unused") @Bind("this") Node inliningTarget,
11641164
@Shared("isBuiltinProfile") @SuppressWarnings("unused") @Cached IsAnyBuiltinClassProfile isBuiltinClass) {
11651165
return arg;
11661166
}
11671167

11681168
@Specialization(guards = "!isBuiltinClass.profileIsAnyBuiltinClass(inliningTarget, cls)")
1169-
public PFrozenSet subFrozensetIdentity(Object cls, PFrozenSet arg,
1169+
static PFrozenSet subFrozensetIdentity(Object cls, PFrozenSet arg,
11701170
@SuppressWarnings("unused") @Bind("this") Node inliningTarget,
11711171
@Shared("isBuiltinProfile") @SuppressWarnings("unused") @Cached IsAnyBuiltinClassProfile isBuiltinClass,
11721172
@Shared @Cached PythonObjectFactory factory) {
11731173
return factory.createFrozenSet(cls, arg.getDictStorage());
11741174
}
11751175

11761176
@Specialization(guards = {"!isNoValue(iterable)", "!isPFrozenSet(iterable)"})
1177-
@SuppressWarnings("truffle-static-method")
1178-
public PFrozenSet frozensetIterable(VirtualFrame frame, Object cls, Object iterable,
1177+
static PFrozenSet frozensetIterable(VirtualFrame frame, Object cls, Object iterable,
11791178
@Bind("this") Node inliningTarget,
11801179
@Cached HashingCollectionNodes.GetClonedHashingStorageNode getHashingStorageNode,
11811180
@Shared @Cached PythonObjectFactory factory) {

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -487,8 +487,7 @@ static boolean doHashColl(VirtualFrame frame, PHashingCollection object,
487487
}
488488

489489
@Specialization
490-
@SuppressWarnings("truffle-static-method")
491-
boolean doObject(VirtualFrame frame, Object object,
490+
static boolean doObject(VirtualFrame frame, Object object,
492491
@Bind("this") Node inliningTarget,
493492
@Cached PyObjectGetIter getIter,
494493
@Cached GetNextNode nextNode,
@@ -508,7 +507,7 @@ boolean doObject(VirtualFrame frame, Object object,
508507
e.expectStopIteration(inliningTarget, errorProfile);
509508
break;
510509
} finally {
511-
LoopNode.reportLoopCount(this, nbrIter);
510+
LoopNode.reportLoopCount(inliningTarget, nbrIter);
512511
}
513512
}
514513

@@ -545,8 +544,7 @@ static boolean doHashColl(VirtualFrame frame, PHashingCollection object,
545544
}
546545

547546
@Specialization
548-
@SuppressWarnings("truffle-static-method")
549-
boolean doObject(VirtualFrame frame, Object object,
547+
static boolean doObject(VirtualFrame frame, Object object,
550548
@Bind("this") Node inliningTarget,
551549
@Cached PyObjectGetIter getIter,
552550
@Cached GetNextNode nextNode,
@@ -566,7 +564,7 @@ boolean doObject(VirtualFrame frame, Object object,
566564
e.expectStopIteration(inliningTarget, errorProfile);
567565
break;
568566
} finally {
569-
LoopNode.reportLoopCount(this, nbrIter);
567+
LoopNode.reportLoopCount(inliningTarget, nbrIter);
570568
}
571569
}
572570

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

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -273,23 +273,22 @@ boolean compute(double real, double imag) {
273273
abstract static class PhaseNode extends PythonUnaryBuiltinNode {
274274

275275
@Specialization
276-
double doL(long value) {
276+
static double doL(long value) {
277277
return value < 0 ? Math.PI : 0;
278278
}
279279

280280
@Specialization
281-
double doD(double value) {
281+
static double doD(double value) {
282282
return value < 0 ? Math.PI : 0;
283283
}
284284

285285
@Specialization
286-
double doC(PComplex value) {
286+
static double doC(PComplex value) {
287287
return Math.atan2(value.getImag(), value.getReal());
288288
}
289289

290290
@Specialization
291-
@SuppressWarnings("truffle-static-method")
292-
double doGeneral(VirtualFrame frame, Object value,
291+
static double doGeneral(VirtualFrame frame, Object value,
293292
@Bind("this") Node inliningTarget,
294293
@Cached CoerceToComplexNode coerceToComplex) {
295294
return doC(coerceToComplex.execute(frame, inliningTarget, value));
@@ -315,15 +314,14 @@ static PTuple doD(double value,
315314
}
316315

317316
@Specialization
318-
PTuple doC(PComplex value,
317+
static PTuple doC(PComplex value,
319318
@Shared @Cached ComplexBuiltins.AbsNode absNode,
320319
@Shared @Cached PythonObjectFactory factory) {
321320
return toPolar(value, absNode, factory);
322321
}
323322

324323
@Specialization
325-
@SuppressWarnings("truffle-static-method")
326-
PTuple doGeneral(VirtualFrame frame, Object value,
324+
static PTuple doGeneral(VirtualFrame frame, Object value,
327325
@Bind("this") Node inliningTarget,
328326
@Cached CoerceToComplexNode coerceToComplex,
329327
@Shared @Cached ComplexBuiltins.AbsNode absNode,
@@ -358,41 +356,40 @@ abstract static class RectNode extends PythonBinaryBuiltinNode {
358356

359357
@Specialization
360358
PComplex doLL(long r, long phi) {
361-
return rect(r, phi);
359+
return rect(this, r, phi);
362360
}
363361

364362
@Specialization
365363
PComplex doLD(long r, double phi) {
366-
return rect(r, phi);
364+
return rect(this, r, phi);
367365
}
368366

369367
@Specialization
370368
PComplex doDL(double r, long phi) {
371-
return rect(r, phi);
369+
return rect(this, r, phi);
372370
}
373371

374372
@Specialization
375373
PComplex doDD(double r, double phi) {
376-
return rect(r, phi);
374+
return rect(this, r, phi);
377375
}
378376

379377
@Specialization
380-
@SuppressWarnings("truffle-static-method")
381-
PComplex doGeneral(VirtualFrame frame, Object r, Object phi,
378+
static PComplex doGeneral(VirtualFrame frame, Object r, Object phi,
382379
@Bind("this") Node inliningTarget,
383380
@Cached PyFloatAsDoubleNode rAsDoubleNode,
384381
@Cached PyFloatAsDoubleNode phiAsDoubleNode) {
385-
return rect(rAsDoubleNode.execute(frame, inliningTarget, r), phiAsDoubleNode.execute(frame, inliningTarget, phi));
382+
return rect(inliningTarget, rAsDoubleNode.execute(frame, inliningTarget, r), phiAsDoubleNode.execute(frame, inliningTarget, phi));
386383
}
387384

388385
@TruffleBoundary
389-
private PComplex rect(double r, double phi) {
386+
private static PComplex rect(Node raisingNode, double r, double phi) {
390387
PythonObjectFactory factory = PythonObjectFactory.getUncached();
391388
// deal with special values
392389
if (!Double.isFinite(r) || !Double.isFinite(phi)) {
393390
// need to raise an exception if r is a nonzero number and phi is infinite
394391
if (r != 0.0 && !Double.isNaN(r) && Double.isInfinite(phi)) {
395-
throw PRaiseNode.raiseUncached(this, ValueError, ErrorMessages.MATH_DOMAIN_ERROR);
392+
throw PRaiseNode.raiseUncached(raisingNode, ValueError, ErrorMessages.MATH_DOMAIN_ERROR);
396393
}
397394

398395
// if r is +/-infinity and phi is finite but nonzero then

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,6 @@ private static Object checkNull(Node inliningTarget, Object value, PRaiseNode.La
490490
@Builtin(name = "execv", minNumOfPositionalArgs = 2, parameterNames = {"pathname", "argv"})
491491
@ArgumentClinic(name = "pathname", conversionClass = PathConversionNode.class, args = {"false", "false"})
492492
@GenerateNodeFactory
493-
@SuppressWarnings("truffle-static-method")
494493
public abstract static class ExecvNode extends PythonBinaryClinicBuiltinNode {
495494

496495
@Override

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,6 @@ static long doDouble(Node inliningTarget, double t,
272272
}
273273

274274
@Specialization(guards = "!isPNone(obj)")
275-
@SuppressWarnings("truffle-static-method")
276275
static long doObject(VirtualFrame frame, Node inliningTarget, Object obj,
277276
@Exclusive @Cached PRaiseNode.Lazy raiseNode,
278277
@Cached CastToJavaDoubleNode castToDouble,

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/codecs/ErrorHandlers.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,6 @@ static Object doFallback(@SuppressWarnings("unused") Object o,
277277
}
278278

279279
@Builtin(name = "ignore_errors", minNumOfPositionalArgs = 1, parameterNames = "e")
280-
@SuppressWarnings("truffle-static-method")
281280
abstract static class IgnoreErrorHandlerNode extends ErrorHandlerBaseNode {
282281
@Specialization(guards = "isDecode(inliningTarget, exception, pyObjectTypeCheck)", limit = "1")
283282
static Object doDecodeException(PBaseException exception,
@@ -307,7 +306,6 @@ static Object doFallback(Object o,
307306
}
308307

309308
@Builtin(name = "replace_errors", minNumOfPositionalArgs = 1, parameterNames = "e")
310-
@SuppressWarnings("truffle-static-method")
311309
abstract static class ReplaceErrorHandlerNode extends ErrorHandlerBaseNode {
312310

313311
private static final TruffleString T_REPLACEMENT = tsLiteral("\uFFFD");
@@ -348,7 +346,6 @@ static Object doFallback(Object o,
348346
}
349347

350348
@Builtin(name = "xmlcharrefreplace_errors", minNumOfPositionalArgs = 1, parameterNames = "e")
351-
@SuppressWarnings("truffle-static-method")
352349
abstract static class XmlCharRefReplaceErrorHandlerNode extends ErrorHandlerBaseNode {
353350

354351
@Specialization(guards = "isEncode(inliningTarget, exception, pyObjectTypeCheck)", limit = "1")
@@ -388,7 +385,6 @@ static Object doFallback(Object o,
388385
}
389386

390387
@Builtin(name = "backslashreplace_errors", minNumOfPositionalArgs = 1, parameterNames = "e")
391-
@SuppressWarnings("truffle-static-method")
392388
abstract static class BackslashReplaceErrorHandlerNode extends ErrorHandlerBaseNode {
393389

394390
@Specialization(guards = "isDecode(inliningTarget, exception, pyObjectTypeCheck)", limit = "1")
@@ -473,7 +469,6 @@ static Object doFallback(Object o,
473469
}
474470

475471
@Builtin(name = "namereplace_errors", minNumOfPositionalArgs = 1, parameterNames = "e")
476-
@SuppressWarnings("truffle-static-method")
477472
abstract static class NameReplaceErrorHandlerNode extends ErrorHandlerBaseNode {
478473

479474
@Specialization(guards = "isEncode(inliningTarget, exception, pyObjectTypeCheck)", limit = "1")
@@ -526,7 +521,6 @@ static Object doFallback(Object o,
526521
}
527522

528523
@Builtin(name = "surrogatepass", minNumOfPositionalArgs = 1, parameterNames = "e")
529-
@SuppressWarnings("truffle-static-method")
530524
abstract static class SurrogatePassErrorHandlerNode extends ErrorHandlerBaseNode {
531525

532526
@Specialization(guards = "isEncode(inliningTarget, exception, pyObjectTypeCheck)", limit = "1")
@@ -663,7 +657,6 @@ private static boolean isSurrogate(int cp) {
663657
}
664658

665659
@Builtin(name = "surrogateescape", minNumOfPositionalArgs = 1, parameterNames = "e")
666-
@SuppressWarnings("truffle-static-method")
667660
abstract static class SurrogateEscapeErrorHandlerNode extends ErrorHandlerBaseNode {
668661

669662
@Specialization(guards = "isEncode(inliningTarget, exception, pyObjectTypeCheck)", limit = "1")

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/functools/PartialBuiltins.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,6 @@ static Object reduce(PPartial self,
341341
public abstract static class PartialSetStateNode extends PythonBinaryBuiltinNode {
342342

343343
@Specialization
344-
@SuppressWarnings("truffle-static-method")
345344
static Object setState(VirtualFrame frame, PPartial self, PTuple state,
346345
@Bind("this") Node inliningTarget,
347346
@Cached SetDictNode setDictNode,

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/io/FileIOBuiltins.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -891,12 +891,11 @@ static Object closedError(PFileIO self, Object posobj,
891891
@GenerateNodeFactory
892892
abstract static class CloseNode extends PythonUnaryBuiltinNode {
893893
@Specialization(guards = "!self.isCloseFD()")
894-
@SuppressWarnings("truffle-static-method")
895-
Object simple(VirtualFrame frame, PFileIO self,
894+
static Object simple(VirtualFrame frame, PFileIO self,
896895
@Bind("this") Node inliningTarget,
897896
@Exclusive @Cached PyObjectCallMethodObjArgs callClose) {
898897
try {
899-
callClose.execute(frame, inliningTarget, getContext().lookupType(PRawIOBase), T_CLOSE, self);
898+
callClose.execute(frame, inliningTarget, PythonContext.get(inliningTarget).lookupType(PRawIOBase), T_CLOSE, self);
900899
} catch (PException e) {
901900
self.setClosed();
902901
throw e;

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/deque/DequeBuiltins.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,6 @@ void appendOperation(PDeque self, Object item) {
403403

404404
@Builtin(name = "index", minNumOfPositionalArgs = 2, parameterNames = {"$self", "v", "start", "stop"})
405405
@GenerateNodeFactory
406-
@SuppressWarnings("truffle-static-method")
407406
public abstract static class DequeIndexNode extends PythonQuaternaryBuiltinNode {
408407

409408
@Specialization(guards = {"isNoValue(start)", "isNoValue(stop)"})

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/dict/DictBuiltins.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,6 @@ private static void updateKwargs(VirtualFrame frame, Node inliningTarget, PDict
504504
@Builtin(name = "fromkeys", minNumOfPositionalArgs = 2, parameterNames = {"$cls", "iterable", "value"}, isClassmethod = true)
505505
@ImportStatic(SpecialMethodSlot.class)
506506
@GenerateNodeFactory
507-
@SuppressWarnings("truffle-static-method")
508507
public abstract static class FromKeysNode extends PythonTernaryBuiltinNode {
509508

510509
@Specialization(guards = "isBuiltinDict(inliningTarget, cls, isSameTypeNode)", limit = "1")

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/dict/DictViewBuiltins.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ static Object getItemsViewIter(PDictItemsView self,
172172

173173
@Builtin(name = J___REVERSED__, minNumOfPositionalArgs = 1)
174174
@GenerateNodeFactory
175-
@SuppressWarnings("truffle-static-method")
176175
public abstract static class ReversedNode extends PythonUnaryBuiltinNode {
177176
@Specialization
178177
static Object getReversedKeysViewIter(PDictKeysView self,

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/range/RangeBuiltins.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,7 @@ static boolean eqIntInt(PIntRange left, PIntRange right) {
330330
}
331331

332332
@Specialization
333-
@SuppressWarnings("truffle-static-method")
334-
boolean eqIntBig(VirtualFrame frame, PIntRange left, PBigRange right,
333+
static boolean eqIntBig(VirtualFrame frame, PIntRange left, PBigRange right,
335334
@Bind("this") Node inliningTarget,
336335
@Shared @Cached RangeNodes.CoerceToBigRange intToBigRange,
337336
@Shared @Cached PyNumberAsSizeNode asSizeNode) {
@@ -346,8 +345,7 @@ boolean eqIntBig(VirtualFrame frame, PIntRange left, PBigRange right,
346345
}
347346

348347
@Specialization
349-
@SuppressWarnings("truffle-static-method")
350-
boolean eqIntBig(VirtualFrame frame, PBigRange left, PIntRange right,
348+
static boolean eqIntBig(VirtualFrame frame, PBigRange left, PIntRange right,
351349
@Bind("this") Node inliningTarget,
352350
@Shared @Cached RangeNodes.CoerceToBigRange intToBigRange,
353351
@Shared @Cached PyNumberAsSizeNode asSizeNode) {

0 commit comments

Comments
 (0)