Skip to content

Commit 3ced42d

Browse files
committed
Mark RopeConstants arrays as CompilationFinal
1 parent 8760f32 commit 3ced42d

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/main/java/org/truffleruby/core/rope/RopeConstants.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import java.util.HashMap;
1414
import java.util.Map;
1515

16+
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
1617
import org.jcodings.specific.ASCIIEncoding;
1718
import org.jcodings.specific.USASCIIEncoding;
1819
import org.jcodings.specific.UTF8Encoding;
@@ -30,9 +31,9 @@ public class RopeConstants {
3031
public static final LeafRope EMPTY_UTF8_ROPE = withHashCode(
3132
new AsciiOnlyLeafRope(EMPTY_BYTES, UTF8Encoding.INSTANCE));
3233

33-
public static final LeafRope[] UTF8_SINGLE_BYTE_ROPES = new LeafRope[256];
34-
public static final LeafRope[] US_ASCII_SINGLE_BYTE_ROPES = new LeafRope[256];
35-
public static final LeafRope[] ASCII_8BIT_SINGLE_BYTE_ROPES = new LeafRope[256];
34+
@CompilationFinal(dimensions = 1) public static final LeafRope[] UTF8_SINGLE_BYTE_ROPES = new LeafRope[256];
35+
@CompilationFinal(dimensions = 1) public static final LeafRope[] US_ASCII_SINGLE_BYTE_ROPES = new LeafRope[256];
36+
@CompilationFinal(dimensions = 1) public static final LeafRope[] ASCII_8BIT_SINGLE_BYTE_ROPES = new LeafRope[256];
3637

3738
static {
3839
for (int i = 0; i < 128; i++) {
@@ -128,7 +129,7 @@ public static LeafRope lookupUSASCII(String string) {
128129
}
129130
}
130131

131-
private static final LeafRope[] PADDED_NUMBERS = createPaddedNumbersTable();
132+
@CompilationFinal(dimensions = 1) private static final LeafRope[] PADDED_NUMBERS = createPaddedNumbersTable();
132133

133134
private static LeafRope[] createPaddedNumbersTable() {
134135
final LeafRope[] table = new LeafRope[100];
@@ -147,7 +148,7 @@ public static LeafRope paddedNumber(int n) {
147148
return PADDED_NUMBERS[n];
148149
}
149150

150-
private static final LeafRope[] PADDING_ZEROS = createPaddingZeroTable();
151+
@CompilationFinal(dimensions = 1) private static final LeafRope[] PADDING_ZEROS = createPaddingZeroTable();
151152

152153
private static LeafRope[] createPaddingZeroTable() {
153154
final LeafRope[] table = new LeafRope[6];

0 commit comments

Comments
 (0)