use of org.graalvm.compiler.hotspot.meta.HotSpotProviders in project graal by oracle.
the class StubAVXTest method test.
@Test
public void test() {
HotSpotProviders providers = (HotSpotProviders) getProviders();
HotSpotForeignCallsProviderImpl foreignCalls = (HotSpotForeignCallsProviderImpl) providers.getForeignCalls();
HotSpotForeignCallLinkage linkage = foreignCalls.registerStubCall(TEST_STUB, true, HotSpotForeignCallLinkage.Transition.LEAF_NOFP);
linkage.setCompiledStub(new TestStub(getInitialOptions(), providers, linkage));
runTest("testStub");
}
use of org.graalvm.compiler.hotspot.meta.HotSpotProviders in project graal by oracle.
the class HotSpotGraalCompiler method compileHelper.
public CompilationResult compileHelper(CompilationResultBuilderFactory crbf, CompilationResult result, StructuredGraph graph, ResolvedJavaMethod method, int entryBCI, boolean useProfilingInfo, OptionValues options) {
HotSpotBackend backend = graalRuntime.getHostBackend();
HotSpotProviders providers = backend.getProviders();
final boolean isOSR = entryBCI != JVMCICompiler.INVOCATION_ENTRY_BCI;
Suites suites = getSuites(providers, options);
LIRSuites lirSuites = getLIRSuites(providers, options);
ProfilingInfo profilingInfo = useProfilingInfo ? method.getProfilingInfo(!isOSR, isOSR) : DefaultProfilingInfo.get(TriState.FALSE);
OptimisticOptimizations optimisticOpts = getOptimisticOpts(profilingInfo, options);
/*
* Cut off never executed code profiles if there is code, e.g. after the osr loop, that is
* never executed.
*/
if (isOSR && !OnStackReplacementPhase.Options.DeoptAfterOSR.getValue(options)) {
optimisticOpts.remove(Optimization.RemoveNeverExecutedCode);
}
result.setEntryBCI(entryBCI);
boolean shouldDebugNonSafepoints = providers.getCodeCache().shouldDebugNonSafepoints();
PhaseSuite<HighTierContext> graphBuilderSuite = configGraphBuilderSuite(providers.getSuites().getDefaultGraphBuilderSuite(), shouldDebugNonSafepoints, isOSR);
GraalCompiler.compileGraph(graph, method, providers, backend, graphBuilderSuite, optimisticOpts, profilingInfo, suites, lirSuites, result, crbf);
if (!isOSR && useProfilingInfo) {
ProfilingInfo profile = profilingInfo;
profile.setCompilerIRSize(StructuredGraph.class, graph.getNodeCount());
}
return result;
}
use of org.graalvm.compiler.hotspot.meta.HotSpotProviders in project graal by oracle.
the class HotSpotGraalCompiler method createGraph.
public StructuredGraph createGraph(ResolvedJavaMethod method, int entryBCI, boolean useProfilingInfo, CompilationIdentifier compilationId, OptionValues options, DebugContext debug) {
HotSpotBackend backend = graalRuntime.getHostBackend();
HotSpotProviders providers = backend.getProviders();
final boolean isOSR = entryBCI != JVMCICompiler.INVOCATION_ENTRY_BCI;
StructuredGraph graph = method.isNative() || isOSR ? null : getIntrinsicGraph(method, providers, compilationId, options, debug);
if (graph == null) {
SpeculationLog speculationLog = method.getSpeculationLog();
if (speculationLog != null) {
speculationLog.collectFailedSpeculations();
}
graph = new StructuredGraph.Builder(options, debug, AllowAssumptions.ifTrue(OptAssumptions.getValue(options))).method(method).entryBCI(entryBCI).speculationLog(speculationLog).useProfilingInfo(useProfilingInfo).compilationId(compilationId).build();
}
return graph;
}
use of org.graalvm.compiler.hotspot.meta.HotSpotProviders in project graal by oracle.
the class HotSpotHostBackend method completeInitialization.
@Override
@SuppressWarnings("try")
public void completeInitialization(HotSpotJVMCIRuntime jvmciRuntime, OptionValues options) {
final HotSpotProviders providers = getProviders();
HotSpotHostForeignCallsProvider foreignCalls = (HotSpotHostForeignCallsProvider) providers.getForeignCalls();
final HotSpotLoweringProvider lowerer = (HotSpotLoweringProvider) providers.getLowerer();
try (InitTimer st = timer("foreignCalls.initialize")) {
foreignCalls.initialize(providers, options);
}
try (InitTimer st = timer("lowerer.initialize")) {
Iterable<DebugHandlersFactory> factories = Collections.singletonList(new GraalDebugHandlersFactory(providers.getSnippetReflection()));
lowerer.initialize(options, factories, providers, config);
}
}
use of org.graalvm.compiler.hotspot.meta.HotSpotProviders in project graal by oracle.
the class CheckGraalIntrinsics method test.
@Test
@SuppressWarnings("try")
public void test() throws ClassNotFoundException {
HotSpotGraalRuntimeProvider rt = (HotSpotGraalRuntimeProvider) Graal.getRequiredCapability(RuntimeProvider.class);
HotSpotProviders providers = rt.getHostBackend().getProviders();
Plugins graphBuilderPlugins = providers.getGraphBuilderPlugins();
InvocationPlugins invocationPlugins = graphBuilderPlugins.getInvocationPlugins();
HotSpotVMConfigStore store = rt.getVMConfig().getStore();
List<VMIntrinsicMethod> intrinsics = store.getIntrinsics();
List<String> missing = new ArrayList<>();
EconomicMap<String, List<Binding>> bindings = invocationPlugins.getBindings(true);
for (VMIntrinsicMethod intrinsic : intrinsics) {
InvocationPlugin plugin = findPlugin(bindings, intrinsic);
if (plugin == null) {
ResolvedJavaMethod method = resolveIntrinsic(providers.getMetaAccess(), intrinsic);
if (method != null) {
IntrinsicMethod intrinsicMethod = providers.getConstantReflection().getMethodHandleAccess().lookupMethodHandleIntrinsic(method);
if (intrinsicMethod != null) {
continue;
}
}
String m = String.format("%s.%s%s", intrinsic.declaringClass, intrinsic.name, intrinsic.descriptor);
if (!TO_BE_INVESTIGATED.contains(m) && !IGNORE.contains(m)) {
missing.add(m);
}
}
}
if (!missing.isEmpty()) {
Collections.sort(missing);
String missingString = missing.stream().collect(Collectors.joining(String.format("%n ")));
fail("missing Graal intrinsics for:%n %s", missingString);
}
}
Aggregations