Skip to content

Commit ea05b46

Browse files
committed
Address TruffleString deprecations and serial warnings
1 parent d46946e commit ea05b46

File tree

20 files changed

+39
-35
lines changed

20 files changed

+39
-35
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/csv/CSVReaderBuiltins.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ static Object nextPos(VirtualFrame frame, CSVReader self,
168168
self.lineNum++;
169169
TruffleStringIterator tsi = createCodePointIteratorNode.execute(line, TS_ENCODING);
170170
while (tsi.hasNext()) {
171-
final int codepoint = stringNextNode.execute(tsi);
171+
final int codepoint = stringNextNode.execute(tsi, TS_ENCODING);
172172
parseProcessCodePoint(inliningTarget, self, fields, codepoint, appendCodePointNode, toStringNode, pyNumberFloatNode, appendNode, raiseNode);
173173
}
174174
parseProcessCodePoint(inliningTarget, self, fields, EOL, appendCodePointNode, toStringNode, pyNumberFloatNode, appendNode, raiseNode);

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/csv/CSVWriterBuiltins.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ static boolean joinAppendData(Node inliningTarget, TruffleStringBuilder sb, CSVD
239239

240240
boolean wantEscape = false;
241241

242-
final int c = nextNode.execute(tsi);
242+
final int c = nextNode.execute(tsi, TS_ENCODING);
243243

244244
if (needsEscape(dialect, c, byteIndexOfCodePointNode)) {
245245
if (dialect.quoting == QUOTE_NONE) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ private IOMode(TruffleString mode, boolean reading, boolean writing, boolean bin
252252
int flags = 0;
253253
TruffleStringIterator it = createCodePointIteratorNode.execute(mode, TS_ENCODING);
254254
while (it.hasNext()) {
255-
int c = nextNode.execute(it);
255+
int c = nextNode.execute(it, TS_ENCODING);
256256
int current;
257257
switch (c) {
258258
case 'x':

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/json/JSONUtils.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* The Universal Permissive License (UPL), Version 1.0
@@ -68,7 +68,7 @@ static void appendStringUncached(TruffleString ts, TruffleStringBuilderUTF32 bui
6868
builder.appendCodePointUncached('"');
6969
TruffleStringIterator it = ts.createCodePointIteratorUncached(TS_ENCODING);
7070
while (it.hasNext()) {
71-
int c = it.nextUncached();
71+
int c = it.nextUncached(TS_ENCODING);
7272
switch (c) {
7373
case '\\':
7474
builder.appendStringUncached(T_ESC_BACKSLASH);
@@ -122,7 +122,7 @@ static void appendString(TruffleString s, TruffleStringIterator it, TruffleStrin
122122
int chunkStart = 0;
123123
int currentIndex = 0;
124124
while (it.hasNext()) {
125-
int c = nextNode.execute(it);
125+
int c = nextNode.execute(it, TS_ENCODING);
126126
switch (c) {
127127
case '\\':
128128
appendSubstring(builder, s, chunkStart, currentIndex, appendStringNode, substringNode);

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/array/ArrayBuiltins.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1342,7 +1342,7 @@ static Object fromunicode(VirtualFrame frame, PArray self, TruffleString str,
13421342
TruffleStringIterator it = createCodePointIteratorNode.execute(str, TS_ENCODING);
13431343
int codePointIndex = 0;
13441344
while (it.hasNext()) {
1345-
TruffleString value = fromCodePointNode.execute(nextNode.execute(it), TS_ENCODING, true);
1345+
TruffleString value = fromCodePointNode.execute(nextNode.execute(it, TS_ENCODING), TS_ENCODING, true);
13461346
putValueNode.execute(frame, inliningTarget, self, self.getLength() + codePointIndex++, value);
13471347
}
13481348
setLengthNode.execute(inliningTarget, self, newLength);

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/bytes/BytesNodes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -932,7 +932,7 @@ static byte[] nonAscii(TruffleString str,
932932
TruffleStringIterator it = createCodePointIteratorNode.execute(str, TS_ENCODING);
933933
int i = 0;
934934
while (it.hasNext()) {
935-
if (nextNode.execute(it) > 127) {
935+
if (nextNode.execute(it, TS_ENCODING) > 127) {
936936
throw raiseNode.raise(inliningTarget, PythonBuiltinClassType.ValueError, NON_HEX_NUMBER_IN_FROMHEX, i);
937937
}
938938
++i;

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/common/HashingCollectionNodes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ static HashingStorage doString(Node inliningTarget, Object strObj, Object value,
238238
TruffleStringIterator it = createCodePointIteratorNode.execute(str, TS_ENCODING);
239239
while (it.hasNext()) {
240240
// TODO: GR-37219: use SubstringNode with lazy=true?
241-
int codePoint = nextNode.execute(it);
241+
int codePoint = nextNode.execute(it, TS_ENCODING);
242242
TruffleString key = fromCodePointNode.execute(codePoint, TS_ENCODING, true);
243243
storage = setStorageItem.execute(inliningTarget, storage, key, val);
244244
}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/iterator/IteratorNodes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ public static Object[] doIt(Object iterableObj,
348348
int i = 0;
349349
while (loopProfile.inject(inliningTarget, it.hasNext())) {
350350
// TODO: GR-37219: use SubstringNode with lazy=true?
351-
result[i++] = fromCodePointNode.execute(nextNode.execute(it), TS_ENCODING, true);
351+
result[i++] = fromCodePointNode.execute(nextNode.execute(it, TS_ENCODING), TS_ENCODING, true);
352352
}
353353
return result;
354354
}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/list/ListBuiltins.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ static PNone initTruffleString(PList list, TruffleString value,
254254
TruffleStringIterator iterator = createCodePointIteratorNode.execute(value, TS_ENCODING);
255255
while (iterator.hasNext()) {
256256
// TODO: GR-37219: use SubstringNode with lazy=true?
257-
int cp = nextNode.execute(iterator);
257+
int cp = nextNode.execute(iterator, TS_ENCODING);
258258
appendNode.execute(list, fromCodePointNode.execute(cp, TS_ENCODING, true));
259259
}
260260
return PNone.NONE;

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/str/StringBuiltins.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,15 +1016,15 @@ static PDict doString(VirtualFrame frame, Object cls, Object from, Object to, Ob
10161016
TruffleStringIterator toIt = createCodePointIteratorNode.execute(toStr, TS_ENCODING);
10171017
while (fromIt.hasNext()) {
10181018
assert toIt.hasNext();
1019-
int key = nextNode.execute(fromIt);
1020-
int value = nextNode.execute(toIt);
1019+
int key = nextNode.execute(fromIt, TS_ENCODING);
1020+
int value = nextNode.execute(toIt, TS_ENCODING);
10211021
storage = setHashingStorageItem.execute(frame, inliningTarget, storage, key, value);
10221022
}
10231023
assert !toIt.hasNext();
10241024
if (hasZ) {
10251025
TruffleStringIterator zIt = createCodePointIteratorNode.execute(zString, TS_ENCODING);
10261026
while (zIt.hasNext()) {
1027-
int key = nextNode.execute(zIt);
1027+
int key = nextNode.execute(zIt, TS_ENCODING);
10281028
storage = setHashingStorageItem.execute(frame, inliningTarget, storage, key, PNone.NONE);
10291029
}
10301030
}
@@ -1089,7 +1089,7 @@ static TruffleString doStringString(TruffleString self, TruffleString table,
10891089
TruffleStringIterator it = createCodePointIteratorNode.execute(self, TS_ENCODING);
10901090
TruffleStringBuilder sb = TruffleStringBuilder.create(TS_ENCODING, self.byteLength(TS_ENCODING));
10911091
while (it.hasNext()) {
1092-
int cp = nextNode.execute(it);
1092+
int cp = nextNode.execute(it, TS_ENCODING);
10931093
if (cp >= 0 && cp < tableLen) {
10941094
cp = codePointAtIndexNode.execute(table, cp, TS_ENCODING);
10951095
}
@@ -1114,7 +1114,7 @@ static TruffleString doGeneric(VirtualFrame frame, Object self, Object table,
11141114
TruffleStringBuilder sb = TruffleStringBuilder.create(TS_ENCODING, selfStr.byteLength(TS_ENCODING));
11151115
TruffleStringIterator it = createCodePointIteratorNode.execute(selfStr, TS_ENCODING);
11161116
while (it.hasNext()) {
1117-
int original = nextNode.execute(it);
1117+
int original = nextNode.execute(it, TS_ENCODING);
11181118
Object translated = null;
11191119
try {
11201120
translated = getItemNode.execute(frame, inliningTarget, table, original);
@@ -1920,7 +1920,7 @@ boolean doGeneric(Object selfObj,
19201920
}
19211921
TruffleStringIterator it = createCodePointIteratorNode.execute(self, TS_ENCODING);
19221922
while (it.hasNext()) {
1923-
int codePoint = nextNode.execute(it);
1923+
int codePoint = nextNode.execute(it, TS_ENCODING);
19241924
if (!isCategory(codePoint)) {
19251925
return false;
19261926
}
@@ -2056,7 +2056,7 @@ static boolean doIt(Object selfObj,
20562056
boolean hasLower = false;
20572057
TruffleStringIterator it = createCodePointIteratorNode.execute(self, TS_ENCODING);
20582058
while (it.hasNext()) {
2059-
int codePoint = nextNode.execute(it);
2059+
int codePoint = nextNode.execute(it, TS_ENCODING);
20602060
if (isUpper(codePoint)) {
20612061
return false;
20622062
}
@@ -2113,7 +2113,7 @@ static boolean doString(TruffleString self,
21132113
boolean previousIsCased = false;
21142114
TruffleStringIterator it = createCodePointIteratorNode.execute(self, TS_ENCODING);
21152115
while (it.hasNext()) {
2116-
int codePoint = nextNode.execute(it);
2116+
int codePoint = nextNode.execute(it, TS_ENCODING);
21172117
if (isUpper(codePoint)) {
21182118
if (previousIsCased) {
21192119
return false;
@@ -2163,7 +2163,7 @@ static boolean doString(TruffleString self,
21632163
boolean hasUpper = false;
21642164
TruffleStringIterator it = createCodePointIteratorNode.execute(self, TS_ENCODING);
21652165
while (it.hasNext()) {
2166-
int codePoint = nextNode.execute(it);
2166+
int codePoint = nextNode.execute(it, TS_ENCODING);
21672167
if (isLower(codePoint)) {
21682168
return false;
21692169
}
@@ -2262,7 +2262,7 @@ static TruffleString doString(TruffleString self,
22622262
int start = 0;
22632263
int end = 0;
22642264
while (it.hasNext()) {
2265-
final int cp = nextNode.execute(it);
2265+
final int cp = nextNode.execute(it, TS_ENCODING);
22662266
if (!UCharacter.isLowerCase(cp) && !UCharacter.isUpperCase(cp)) {
22672267
if (start == end) {
22682268
appendCodePointNode.execute(sb, cp, 1, true);
@@ -2621,7 +2621,7 @@ static TruffleString doString(TruffleString self, int tabsize,
26212621
TruffleStringIterator it = createCodePointIteratorNode.execute(self, TS_ENCODING);
26222622
// It's ok to iterate with charAt, we just pass surrogates through
26232623
while (it.hasNext()) {
2624-
int cp = nextNode.execute(it);
2624+
int cp = nextNode.execute(it, TS_ENCODING);
26252625
if (cp == '\t') {
26262626
int incr = tabsize - (linePos % tabsize);
26272627
if (incr > 0) {

0 commit comments

Comments
 (0)