|
1 | 1 | /*
|
2 |
| - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
4 | 4 | *
|
5 | 5 | * This code is free software; you can redistribute it and/or modify it
|
|
26 | 26 |
|
27 | 27 | import java.nio.charset.StandardCharsets;
|
28 | 28 |
|
| 29 | +import org.junit.Assert; |
| 30 | +import org.junit.Test; |
| 31 | + |
29 | 32 | import jdk.graal.compiler.graph.Node;
|
30 | 33 | import jdk.graal.compiler.nodes.StructuredGraph;
|
| 34 | +import jdk.graal.compiler.nodes.ValueNode; |
| 35 | +import jdk.graal.compiler.nodes.graphbuilderconf.GraphBuilderContext; |
| 36 | +import jdk.graal.compiler.nodes.graphbuilderconf.InlineInvokePlugin; |
31 | 37 | import jdk.graal.compiler.replacements.nodes.EncodeArrayNode;
|
32 |
| -import org.junit.Assert; |
33 |
| -import org.junit.Test; |
| 38 | +import jdk.vm.ci.meta.ResolvedJavaMethod; |
34 | 39 |
|
35 | 40 | public class StringGetBytesTest extends MethodSubstitutionTest {
|
36 | 41 |
|
@@ -66,4 +71,13 @@ protected void checkLowTierGraph(StructuredGraph graph) {
|
66 | 71 | }
|
67 | 72 | Assert.fail("intrinsic not found in graph!");
|
68 | 73 | }
|
| 74 | + |
| 75 | + @Override |
| 76 | + protected InlineInvokePlugin.InlineInfo bytecodeParserShouldInlineInvoke(GraphBuilderContext b, ResolvedJavaMethod method, ValueNode[] args) { |
| 77 | + String className = method.getDeclaringClass().getUnqualifiedName(); |
| 78 | + if ((className.equals("String") && !method.getName().equals("implEncodeISOArray")) || className.equals("StringCoding")) { |
| 79 | + return InlineInvokePlugin.InlineInfo.createStandardInlineInfo(method); |
| 80 | + } |
| 81 | + return super.bytecodeParserShouldInlineInvoke(b, method, args); |
| 82 | + } |
69 | 83 | }
|
0 commit comments