Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2621,7 +2621,7 @@ public boolean isApplicable(Architecture arch) {

private static void registerStringCodingPlugins(InvocationPlugins plugins) {
Registration r = new Registration(plugins, "java.lang.StringCoding");
r.register(new InvocationPlugin("implEncodeISOArray", byte[].class, int.class, byte[].class, int.class, int.class) {
r.register(new InvocationPlugin("encodeISOArray0", byte[].class, int.class, byte[].class, int.class, int.class) {
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode sa, ValueNode sp,
ValueNode da, ValueNode dp, ValueNode len) {
Expand All @@ -2634,7 +2634,7 @@ public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Rec
}
}
});
r.register(new InvocationPlugin("implEncodeAsciiArray", char[].class, int.class, byte[].class, int.class, int.class) {
r.register(new InvocationPlugin("encodeAsciiArray0", char[].class, int.class, byte[].class, int.class, int.class) {
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode sa, ValueNode sp,
ValueNode da, ValueNode dp, ValueNode len) {
Expand All @@ -2646,17 +2646,10 @@ public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Rec
}
}
});
r.register(new InvocationPlugin("countPositives", byte[].class, int.class, int.class) {
r.register(new InvocationPlugin("countPositives0", byte[].class, int.class, int.class) {
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode ba, ValueNode off, ValueNode len) {
try (InvocationPluginHelper helper = new InvocationPluginHelper(b, targetMethod)) {
helper.intrinsicRangeCheck(off, Condition.LT, ConstantNode.forInt(0));
helper.intrinsicRangeCheck(len, Condition.LT, ConstantNode.forInt(0));

ValueNode arrayLength = b.add(new ArrayLengthNode(ba));
ValueNode limit = b.add(AddNode.create(off, len, NodeView.DEFAULT));
helper.intrinsicRangeCheck(arrayLength, Condition.LT, limit);

ValueNode array = helper.arrayElementPointer(ba, JavaKind.Byte, off);
b.addPush(JavaKind.Int, new CountPositivesNode(array, len));
return true;
Expand Down
Loading