Skip to content

Commit d89796a

Browse files
committed
[GR-69122] Force inlining in StringGetBytesTest.
PullRequest: graal/21982
2 parents 7927a51 + 7878f0f commit d89796a

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/replacements/test/StringGetBytesTest.java

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
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.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -26,11 +26,16 @@
2626

2727
import java.nio.charset.StandardCharsets;
2828

29+
import org.junit.Assert;
30+
import org.junit.Test;
31+
2932
import jdk.graal.compiler.graph.Node;
3033
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;
3137
import jdk.graal.compiler.replacements.nodes.EncodeArrayNode;
32-
import org.junit.Assert;
33-
import org.junit.Test;
38+
import jdk.vm.ci.meta.ResolvedJavaMethod;
3439

3540
public class StringGetBytesTest extends MethodSubstitutionTest {
3641

@@ -66,4 +71,13 @@ protected void checkLowTierGraph(StructuredGraph graph) {
6671
}
6772
Assert.fail("intrinsic not found in graph!");
6873
}
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+
}
6983
}

0 commit comments

Comments
 (0)