Skip to content

Commit 3388bf4

Browse files
committed
Rename CastToIntegerFromIntNode to CoerceToIntegerNode
1 parent dc359f7 commit 3388bf4

File tree

8 files changed

+35
-35
lines changed

8 files changed

+35
-35
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
import com.oracle.graal.python.nodes.function.builtins.PythonBinaryBuiltinNode;
7070
import com.oracle.graal.python.nodes.function.builtins.PythonUnaryBuiltinNode;
7171
import com.oracle.graal.python.nodes.truffle.PythonArithmeticTypes;
72-
import com.oracle.graal.python.nodes.util.CastToIntegerFromIntNode;
72+
import com.oracle.graal.python.nodes.util.CoerceToIntegerNode;
7373
import com.oracle.graal.python.runtime.PythonCore;
7474
import com.oracle.graal.python.runtime.exception.PException;
7575
import com.oracle.truffle.api.CompilerDirectives;
@@ -183,7 +183,7 @@ private ReadAttributeFromObjectNode getAttrNode() {
183183
abstract static class B2aBase64Node extends PythonBinaryBuiltinNode {
184184

185185
@Child private SequenceStorageNodes.ToByteArrayNode toByteArray;
186-
@Child private CastToIntegerFromIntNode castToIntNode;
186+
@Child private CoerceToIntegerNode castToIntNode;
187187
@Child private B2aBase64Node recursiveNode;
188188

189189
private SequenceStorageNodes.ToByteArrayNode getToByteArrayNode() {
@@ -194,10 +194,10 @@ private SequenceStorageNodes.ToByteArrayNode getToByteArrayNode() {
194194
return toByteArray;
195195
}
196196

197-
private CastToIntegerFromIntNode getCastToIntNode() {
197+
private CoerceToIntegerNode getCastToIntNode() {
198198
if (castToIntNode == null) {
199199
CompilerDirectives.transferToInterpreterAndInvalidate();
200-
castToIntNode = insert(CastToIntegerFromIntNode.create(val -> {
200+
castToIntNode = insert(CoerceToIntegerNode.create(val -> {
201201
throw raise(PythonBuiltinClassType.TypeError, "an integer is required (got type %p)", val);
202202
}));
203203
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
import com.oracle.graal.python.nodes.object.IsBuiltinClassProfile;
6262
import com.oracle.graal.python.nodes.truffle.PythonArithmeticTypes;
6363
import com.oracle.graal.python.nodes.util.CoerceToDoubleNode;
64-
import com.oracle.graal.python.nodes.util.CastToIntegerFromIntNode;
64+
import com.oracle.graal.python.nodes.util.CoerceToIntegerNode;
6565
import com.oracle.graal.python.runtime.exception.PException;
6666
import com.oracle.graal.python.runtime.exception.PythonErrorType;
6767
import com.oracle.truffle.api.CompilerDirectives;
@@ -489,7 +489,7 @@ public Object factorialPFL(PFloat value) {
489489

490490
@Specialization(guards = "!isNumber(value)")
491491
public Object factorialObject(VirtualFrame frame, Object value,
492-
@Cached("create()") CastToIntegerFromIntNode castNode,
492+
@Cached("create()") CoerceToIntegerNode castNode,
493493
@Cached("create()") FactorialNode recursiveNode) {
494494
return recursiveNode.execute(frame, castNode.execute(value));
495495
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
import com.oracle.graal.python.nodes.function.builtins.PythonTernaryBuiltinNode;
122122
import com.oracle.graal.python.nodes.function.builtins.PythonUnaryBuiltinNode;
123123
import com.oracle.graal.python.nodes.truffle.PythonArithmeticTypes;
124-
import com.oracle.graal.python.nodes.util.CastToIntegerFromIntNode;
124+
import com.oracle.graal.python.nodes.util.CoerceToIntegerNode;
125125
import com.oracle.graal.python.nodes.util.CastToJavaIntNode;
126126
import com.oracle.graal.python.nodes.util.CastToPathNode;
127127
import com.oracle.graal.python.nodes.util.ChannelNodes.ReadFromChannelNode;
@@ -1763,16 +1763,16 @@ int getAndSetUmask(int umask) {
17631763
@GenerateNodeFactory
17641764
abstract static class GetTerminalSizeNode extends PythonUnaryBuiltinNode {
17651765

1766-
@Child private CastToIntegerFromIntNode castIntNode;
1766+
@Child private CoerceToIntegerNode castIntNode;
17671767
@Child private GetTerminalSizeNode recursiveNode;
17681768

17691769
@CompilationFinal private ConditionProfile errorProfile;
17701770
@CompilationFinal private ConditionProfile overflowProfile;
17711771

1772-
private CastToIntegerFromIntNode getCastIntNode() {
1772+
private CoerceToIntegerNode getCastIntNode() {
17731773
if (castIntNode == null) {
17741774
CompilerDirectives.transferToInterpreterAndInvalidate();
1775-
castIntNode = insert(CastToIntegerFromIntNode.create(val -> {
1775+
castIntNode = insert(CoerceToIntegerNode.create(val -> {
17761776
throw raise(PythonBuiltinClassType.TypeError, "an integer is required (got type %p)", val);
17771777
}));
17781778
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
import com.oracle.graal.python.nodes.function.builtins.PythonUnaryBuiltinNode;
7676
import com.oracle.graal.python.nodes.object.GetClassNode;
7777
import com.oracle.graal.python.nodes.truffle.PythonArithmeticTypes;
78-
import com.oracle.graal.python.nodes.util.CastToIntegerFromIntNode;
78+
import com.oracle.graal.python.nodes.util.CoerceToIntegerNode;
7979
import com.oracle.graal.python.nodes.util.ExceptionStateNodes.GetCaughtExceptionNode;
8080
import com.oracle.graal.python.runtime.PythonContext;
8181
import com.oracle.graal.python.runtime.PythonCore;
@@ -469,7 +469,7 @@ protected String getFileSystemEncoding() {
469469
@Builtin(name = "getsizeof", minNumOfPositionalArgs = 1, maxNumOfPositionalArgs = 2)
470470
@GenerateNodeFactory
471471
public abstract static class GetsizeofNode extends PythonBinaryBuiltinNode {
472-
@Child private CastToIntegerFromIntNode castToIntNode = CastToIntegerFromIntNode.create();
472+
@Child private CoerceToIntegerNode castToIntNode = CoerceToIntegerNode.create();
473473

474474
@Specialization(guards = "isNoValue(dflt)")
475475
protected Object doGeneric(VirtualFrame frame, Object object, @SuppressWarnings("unused") PNone dflt,

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
import com.oracle.graal.python.nodes.function.PythonBuiltinNode;
5454
import com.oracle.graal.python.nodes.function.builtins.PythonUnaryBuiltinNode;
5555
import com.oracle.graal.python.nodes.truffle.PythonArithmeticTypes;
56-
import com.oracle.graal.python.nodes.util.CastToIntegerFromIntNode;
56+
import com.oracle.graal.python.nodes.util.CoerceToIntegerNode;
5757
import com.oracle.graal.python.runtime.PythonCore;
5858
import com.oracle.truffle.api.CompilerAsserts;
5959
import com.oracle.truffle.api.CompilerDirectives;
@@ -346,14 +346,14 @@ Object sleep(double seconds) {
346346
@TypeSystemReference(PythonArithmeticTypes.class)
347347
public abstract static class StrfTimeNode extends PythonBuiltinNode {
348348
private static final int IMPOSSIBLE = -2;
349-
@Child private CastToIntegerFromIntNode castIntNode;
349+
@Child private CoerceToIntegerNode castIntNode;
350350

351351
@CompilationFinal private ConditionProfile outOfRangeProfile;
352352

353-
private CastToIntegerFromIntNode getCastIntNode() {
353+
private CoerceToIntegerNode getCastIntNode() {
354354
if (castIntNode == null) {
355355
CompilerDirectives.transferToInterpreterAndInvalidate();
356-
castIntNode = insert(CastToIntegerFromIntNode.create(val -> {
356+
castIntNode = insert(CoerceToIntegerNode.create(val -> {
357357
throw raise(PythonBuiltinClassType.TypeError, "an integer is required (got type %p)", val);
358358
}));
359359
}

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
import com.oracle.graal.python.nodes.function.builtins.PythonBinaryBuiltinNode;
6868
import com.oracle.graal.python.nodes.function.builtins.PythonTernaryBuiltinNode;
6969
import com.oracle.graal.python.nodes.truffle.PythonArithmeticTypes;
70-
import com.oracle.graal.python.nodes.util.CastToIntegerFromIntNode;
70+
import com.oracle.graal.python.nodes.util.CoerceToIntegerNode;
7171
import com.oracle.graal.python.nodes.util.CastToJavaIntNode;
7272
import com.oracle.graal.python.runtime.PythonCore;
7373
import com.oracle.truffle.api.CompilerDirectives;
@@ -153,7 +153,7 @@ public void initialize(PythonCore core) {
153153
@GenerateNodeFactory
154154
public abstract static class Crc32Node extends PythonBinaryBuiltinNode {
155155

156-
@Child private CastToIntegerFromIntNode castToIntNode;
156+
@Child private CoerceToIntegerNode castToIntNode;
157157

158158
// we can't use jdk Crc32 class, if there is done init value of crc
159159
private static final int[] CRC32_TABLE = {
@@ -221,10 +221,10 @@ private static int computeCRC32(byte[] bytes, int value) {
221221
return result;
222222
}
223223

224-
private CastToIntegerFromIntNode getCastToIntNode() {
224+
private CoerceToIntegerNode getCastToIntNode() {
225225
if (castToIntNode == null) {
226226
CompilerDirectives.transferToInterpreterAndInvalidate();
227-
castToIntNode = insert(CastToIntegerFromIntNode.create(val -> {
227+
castToIntNode = insert(CoerceToIntegerNode.create(val -> {
228228
throw raise(PythonBuiltinClassType.TypeError, "an integer is required (got type %p)", val);
229229
}));
230230
}
@@ -279,7 +279,7 @@ protected static Crc32Node create() {
279279
@GenerateNodeFactory
280280
public abstract static class Adler32Node extends PythonBinaryBuiltinNode {
281281

282-
@Child private CastToIntegerFromIntNode castToIntNode;
282+
@Child private CoerceToIntegerNode castToIntNode;
283283

284284
private static final int DEFER = 3850;
285285
private static final int BASE = 65521;
@@ -303,10 +303,10 @@ private static int computeAdler32(byte[] bytes, int value) {
303303
return result;
304304
}
305305

306-
private CastToIntegerFromIntNode getCastToIntNode() {
306+
private CoerceToIntegerNode getCastToIntNode() {
307307
if (castToIntNode == null) {
308308
CompilerDirectives.transferToInterpreterAndInvalidate();
309-
castToIntNode = insert(CastToIntegerFromIntNode.create(val -> {
309+
castToIntNode = insert(CoerceToIntegerNode.create(val -> {
310310
throw raise(PythonBuiltinClassType.TypeError, "an integer is required (got type %p)", val);
311311
}));
312312
}
@@ -583,7 +583,7 @@ public PBytes doitLong(PIBytesLike data, long level,
583583
@GenerateNodeFactory
584584
public abstract static class DecompressNode extends PythonTernaryBuiltinNode {
585585

586-
@Child private CastToIntegerFromIntNode castToIntNode;
586+
@Child private CoerceToIntegerNode castToIntNode;
587587
@Child private SequenceStorageNodes.ToByteArrayNode toArrayNode;
588588

589589
private final ConditionProfile bufSizeProfile = ConditionProfile.createBinaryProfile();
@@ -596,10 +596,10 @@ private SequenceStorageNodes.ToByteArrayNode getToArrayNode() {
596596
return toArrayNode;
597597
}
598598

599-
private CastToIntegerFromIntNode getCastToIntNode() {
599+
private CoerceToIntegerNode getCastToIntNode() {
600600
if (castToIntNode == null) {
601601
CompilerDirectives.transferToInterpreterAndInvalidate();
602-
castToIntNode = insert(CastToIntegerFromIntNode.create(val -> {
602+
castToIntNode = insert(CoerceToIntegerNode.create(val -> {
603603
throw raise(PythonBuiltinClassType.TypeError, "an integer is required (got type %p)", val);
604604
}));
605605
}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/DynamicObjectNativeWrapper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130
import com.oracle.graal.python.nodes.object.IsBuiltinClassProfile;
131131
import com.oracle.graal.python.nodes.truffle.PythonArithmeticTypes;
132132
import com.oracle.graal.python.nodes.truffle.PythonTypes;
133-
import com.oracle.graal.python.nodes.util.CastToIntegerFromIntNode;
133+
import com.oracle.graal.python.nodes.util.CoerceToIntegerNode;
134134
import com.oracle.graal.python.runtime.PythonContext;
135135
import com.oracle.graal.python.runtime.PythonOptions;
136136
import com.oracle.graal.python.runtime.exception.PException;
@@ -1000,7 +1000,7 @@ Object doTpDict(PythonManagedClass object, @SuppressWarnings("unused") String ke
10001000

10011001
@Specialization(guards = "eq(TP_DICTOFFSET, key)")
10021002
Object doTpDictoffset(PythonManagedClass object, @SuppressWarnings("unused") String key, Object value,
1003-
@Cached CastToIntegerFromIntNode.Dynamic castToIntNode,
1003+
@Cached CoerceToIntegerNode.Dynamic castToIntNode,
10041004
@Cached PythonAbstractObject.PInteropSetAttributeNode setAttrNode) throws UnsupportedMessageException, UnknownIdentifierException {
10051005
// TODO properly implement 'tp_dictoffset' for builtin classes
10061006
if (object instanceof PythonBuiltinClass) {
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
import com.oracle.graal.python.nodes.SpecialMethodNames;
5454
import com.oracle.graal.python.nodes.call.special.LookupAndCallUnaryNode.LookupAndCallUnaryDynamicNode;
5555
import com.oracle.graal.python.nodes.truffle.PythonArithmeticTypes;
56-
import com.oracle.graal.python.nodes.util.CastToIntegerFromIntNodeFactory.DynamicNodeGen;
56+
import com.oracle.graal.python.nodes.util.CoerceToIntegerNodeFactory.DynamicNodeGen;
5757
import com.oracle.truffle.api.CompilerDirectives;
5858
import com.oracle.truffle.api.dsl.Cached;
5959
import com.oracle.truffle.api.dsl.Cached.Shared;
@@ -64,13 +64,13 @@
6464
import com.oracle.truffle.api.nodes.Node;
6565

6666
@TypeSystemReference(PythonArithmeticTypes.class)
67-
public class CastToIntegerFromIntNode extends Node {
67+
public class CoerceToIntegerNode extends Node {
6868

6969
@Child private Dynamic dynamicNode;
7070

7171
private final Function<Object, Byte> typeErrorHandler;
7272

73-
public CastToIntegerFromIntNode(Function<Object, Byte> typeErrorHandler) {
73+
public CoerceToIntegerNode(Function<Object, Byte> typeErrorHandler) {
7474
super();
7575
this.typeErrorHandler = typeErrorHandler;
7676
}
@@ -83,12 +83,12 @@ public Object execute(Object x) {
8383
return dynamicNode.execute(x, typeErrorHandler);
8484
}
8585

86-
public static CastToIntegerFromIntNode create() {
87-
return new CastToIntegerFromIntNode(null);
86+
public static CoerceToIntegerNode create() {
87+
return new CoerceToIntegerNode(null);
8888
}
8989

90-
public static CastToIntegerFromIntNode create(Function<Object, Byte> typeErrorHandler) {
91-
return new CastToIntegerFromIntNode(typeErrorHandler);
90+
public static CoerceToIntegerNode create(Function<Object, Byte> typeErrorHandler) {
91+
return new CoerceToIntegerNode(typeErrorHandler);
9292
}
9393

9494
@GenerateUncached

0 commit comments

Comments
 (0)