1 /* |
1 /* |
2 * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
35 import java.nio.channels.FileChannel.MapMode; |
35 import java.nio.channels.FileChannel.MapMode; |
36 import java.nio.file.Files; |
36 import java.nio.file.Files; |
37 import java.nio.file.Path; |
37 import java.nio.file.Path; |
38 |
38 |
39 import org.graalvm.compiler.nodes.StructuredGraph; |
39 import org.graalvm.compiler.nodes.StructuredGraph; |
40 import org.graalvm.compiler.phases.common.CanonicalizerPhase; |
|
41 import org.graalvm.compiler.phases.common.inlining.InliningPhase; |
40 import org.graalvm.compiler.phases.common.inlining.InliningPhase; |
42 import org.graalvm.compiler.phases.common.inlining.policy.InlineEverythingPolicy; |
41 import org.graalvm.compiler.phases.common.inlining.policy.InlineEverythingPolicy; |
43 import org.graalvm.compiler.phases.tiers.HighTierContext; |
42 import org.graalvm.compiler.phases.tiers.HighTierContext; |
44 import org.junit.Assert; |
43 import org.junit.Assert; |
45 import org.junit.Assume; |
44 import org.junit.Assume; |
123 ResolvedJavaType mbbClass = getMetaAccess().lookupJavaType(MappedByteBuffer.class); |
122 ResolvedJavaType mbbClass = getMetaAccess().lookupJavaType(MappedByteBuffer.class); |
124 ResolvedJavaMethod getMethodImpl = mbbClass.findUniqueConcreteMethod(getMethod).getResult(); |
123 ResolvedJavaMethod getMethodImpl = mbbClass.findUniqueConcreteMethod(getMethod).getResult(); |
125 Assert.assertNotNull(getMethodImpl); |
124 Assert.assertNotNull(getMethodImpl); |
126 StructuredGraph graph = parseForCompile(getMethodImpl); |
125 StructuredGraph graph = parseForCompile(getMethodImpl); |
127 HighTierContext highContext = getDefaultHighTierContext(); |
126 HighTierContext highContext = getDefaultHighTierContext(); |
128 new CanonicalizerPhase().apply(graph, highContext); |
127 createCanonicalizerPhase().apply(graph, highContext); |
129 new InliningPhase(new InlineEverythingPolicy(), new CanonicalizerPhase()).apply(graph, highContext); |
128 new InliningPhase(new InlineEverythingPolicy(), createCanonicalizerPhase()).apply(graph, highContext); |
130 InstalledCode compiledCode = getCode(getMethodImpl, graph); |
129 InstalledCode compiledCode = getCode(getMethodImpl, graph); |
131 testMappedByteBuffer(mbb -> { |
130 testMappedByteBuffer(mbb -> { |
132 try { |
131 try { |
133 return (byte) compiledCode.executeVarargs(mbb); |
132 return (byte) compiledCode.executeVarargs(mbb); |
134 } catch (InvalidInstalledCodeException e) { |
133 } catch (InvalidInstalledCodeException e) { |