use of jdk.vm.ci.meta.ResolvedJavaMethod in project graal by oracle.
the class HistogramInlineInvokePlugin method accept.
private void accept(MethodStatistic current) {
ResolvedJavaMethod method = current.getMethod();
HistogramInlineInvokePlugin.MethodStatistics statistics = histogram.get(method);
if (statistics == null) {
statistics = new MethodStatistics(method);
histogram.put(method, statistics);
}
statistics.accept(current);
}
use of jdk.vm.ci.meta.ResolvedJavaMethod in project graal by oracle.
the class UnsafeDeopt method testByteBuffer.
@Test
public void testByteBuffer() {
int m = 42;
try {
ResolvedJavaMethod method = getResolvedJavaMethod("readWriteReadByteBuffer");
Object receiver = method.isStatic() ? null : this;
Result expect = executeExpected(method, receiver, ByteBuffer.allocateDirect(32), m);
if (getCodeCache() == null) {
return;
}
ByteBuffer warmupBuffer = ByteBuffer.allocateDirect(32);
for (int i = 0; i < 10000; ++i) {
readWriteReadByteBuffer(warmupBuffer, (i % 50) + 1);
warmupBuffer.putInt(0, 0);
}
testAgainstExpected(method, expect, receiver, ByteBuffer.allocateDirect(32), m);
} catch (AssumptionViolatedException e) {
// Suppress so that subsequent calls to this method within the
// same Junit @Test annotated method can proceed.
}
}
use of jdk.vm.ci.meta.ResolvedJavaMethod in project graal by oracle.
the class ControlFlowAnchorDirectiveTest method getNodeCountAnnotations.
private static List<NodeCount> getNodeCountAnnotations(StructuredGraph graph) {
ResolvedJavaMethod method = graph.method();
AnchorSnippet snippet = method.getAnnotation(AnchorSnippet.class);
if (snippet != null) {
return Arrays.asList(snippet.value());
}
NodeCount single = method.getAnnotation(NodeCount.class);
if (single != null) {
return Collections.singletonList(single);
}
return Collections.emptyList();
}
use of jdk.vm.ci.meta.ResolvedJavaMethod in project graal by oracle.
the class PartialEscapeAnalysisTreesTest method testGraph.
/**
* Prepare a graph that includes some blackholes and then remove the blackholes and compile
* normally to create an unusual situation for PEA.
*/
@SuppressWarnings("try")
public void testGraph(String name) {
ResolvedJavaMethod method = getResolvedJavaMethod(name);
prepareGraph(name, true);
try (DebugContext.Scope s = graph.getDebug().scope(getClass(), method, getCodeCache(), graph)) {
for (BlackholeNode node : graph.getNodes().filter(BlackholeNode.class)) {
graph.removeFixed(node);
}
new DeadCodeEliminationPhase().apply(graph);
new CanonicalizerPhase().apply(graph, context);
InstalledCode code = getCode(method, graph, true);
GraalCompilerTest.Result r = executeExpected(method, null, true);
int expectedInstances = ((TreeNode) r.returnValue).countInstances();
TreeNode r2 = (TreeNode) code.executeVarargs(true);
Assert.assertEquals("Wrong number of nodes in tree", expectedInstances, r2.countInstances());
r = executeExpected(method, null, false);
expectedInstances = ((TreeNode) r.returnValue).countInstances();
r2 = (TreeNode) code.executeVarargs(false);
Assert.assertEquals("Wrong number of nodes in tree", expectedInstances, r2.countInstances());
} catch (Throwable e) {
throw graph.getDebug().handle(e);
}
}
use of jdk.vm.ci.meta.ResolvedJavaMethod in project graal by oracle.
the class UnsafeEATest method testEscapeAnalysis.
@Override
protected void testEscapeAnalysis(String snippet, JavaConstant expectedConstantResult, boolean iterativeEscapeAnalysis) {
// Exercise both a graph containing UnsafeAccessNodes and one which has been possibly been
// canonicalized into AccessFieldNodes.
testingUnsafe = true;
super.testEscapeAnalysis(snippet, expectedConstantResult, iterativeEscapeAnalysis);
testingUnsafe = false;
super.testEscapeAnalysis(snippet, expectedConstantResult, iterativeEscapeAnalysis);
if (expectedConstantResult != null) {
// Check that a compiled version of this method returns the same value if we expect a
// constant result.
ResolvedJavaMethod method = getResolvedJavaMethod(snippet);
JavaKind[] javaKinds = method.getSignature().toParameterKinds(false);
Object[] args = new Object[javaKinds.length];
int i = 0;
for (JavaKind k : javaKinds) {
args[i++] = JavaConstant.defaultForKind(k).asBoxedPrimitive();
}
Result result = executeExpected(method, null, args);
assertTrue(result.returnValue.equals(expectedConstantResult.asBoxedPrimitive()));
}
}
Aggregations