Skip to content

Commit c7ec539

Browse files
committed
[Graal] Adapt JDK-8361842: Move input validation checks to Java for java.lang.StringCoding intrinsics
1 parent ad4502f commit c7ec539

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/replacements/StandardGraphBuilderPlugins.java

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2621,7 +2621,7 @@ public boolean isApplicable(Architecture arch) {
26212621

26222622
private static void registerStringCodingPlugins(InvocationPlugins plugins) {
26232623
Registration r = new Registration(plugins, "java.lang.StringCoding");
2624-
r.register(new InvocationPlugin("implEncodeISOArray", byte[].class, int.class, byte[].class, int.class, int.class) {
2624+
r.register(new InvocationPlugin("encodeISOArray0", byte[].class, int.class, byte[].class, int.class, int.class) {
26252625
@Override
26262626
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode sa, ValueNode sp,
26272627
ValueNode da, ValueNode dp, ValueNode len) {
@@ -2634,7 +2634,7 @@ public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Rec
26342634
}
26352635
}
26362636
});
2637-
r.register(new InvocationPlugin("implEncodeAsciiArray", char[].class, int.class, byte[].class, int.class, int.class) {
2637+
r.register(new InvocationPlugin("encodeAsciiArray0", char[].class, int.class, byte[].class, int.class, int.class) {
26382638
@Override
26392639
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode sa, ValueNode sp,
26402640
ValueNode da, ValueNode dp, ValueNode len) {
@@ -2646,17 +2646,10 @@ public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Rec
26462646
}
26472647
}
26482648
});
2649-
r.register(new InvocationPlugin("countPositives", byte[].class, int.class, int.class) {
2649+
r.register(new InvocationPlugin("countPositives0", byte[].class, int.class, int.class) {
26502650
@Override
26512651
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode ba, ValueNode off, ValueNode len) {
26522652
try (InvocationPluginHelper helper = new InvocationPluginHelper(b, targetMethod)) {
2653-
helper.intrinsicRangeCheck(off, Condition.LT, ConstantNode.forInt(0));
2654-
helper.intrinsicRangeCheck(len, Condition.LT, ConstantNode.forInt(0));
2655-
2656-
ValueNode arrayLength = b.add(new ArrayLengthNode(ba));
2657-
ValueNode limit = b.add(AddNode.create(off, len, NodeView.DEFAULT));
2658-
helper.intrinsicRangeCheck(arrayLength, Condition.LT, limit);
2659-
26602653
ValueNode array = helper.arrayElementPointer(ba, JavaKind.Byte, off);
26612654
b.addPush(JavaKind.Int, new CountPositivesNode(array, len));
26622655
return true;

0 commit comments

Comments
 (0)