use of org.graalvm.compiler.debug.DebugHandlersFactory 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.debug.DebugHandlersFactory in project graal by oracle.
the class NativeImageGenerator method registerReplacements.
@SuppressWarnings("try")
public static void registerReplacements(DebugContext debug, FeatureHandler featureHandler, RuntimeConfiguration runtimeConfig, Providers providers, SnippetReflectionProvider snippetReflection, boolean hosted) {
OptionValues options = hosted ? HostedOptionValues.singleton() : RuntimeOptionValues.singleton();
Providers runtimeCallProviders = runtimeConfig != null ? runtimeConfig.getBackendForNormalMethod().getProviders() : providers;
SubstrateForeignCallsProvider foreignCallsProvider = (SubstrateForeignCallsProvider) providers.getForeignCalls();
for (SubstrateForeignCallDescriptor descriptor : SnippetRuntime.getRuntimeCalls()) {
foreignCallsProvider.getForeignCalls().put(descriptor, new SubstrateForeignCallLinkage(runtimeCallProviders, descriptor));
}
featureHandler.forEachGraalFeature(feature -> feature.registerForeignCalls(runtimeConfig, runtimeCallProviders, snippetReflection, foreignCallsProvider.getForeignCalls(), hosted));
try (DebugContext.Scope s = debug.scope("RegisterLowerings", new DebugDumpScope("RegisterLowerings"))) {
SubstrateLoweringProvider lowerer = (SubstrateLoweringProvider) providers.getLowerer();
Map<Class<? extends Node>, NodeLoweringProvider<?>> lowerings = lowerer.getLowerings();
Iterable<DebugHandlersFactory> factories = runtimeConfig != null ? runtimeConfig.getDebugHandlersFactories() : Collections.singletonList(new GraalDebugHandlersFactory(snippetReflection));
lowerer.setConfiguration(runtimeConfig, options, factories, providers, snippetReflection);
NonSnippetLowerings.registerLowerings(runtimeConfig, options, factories, providers, snippetReflection, lowerings);
ArithmeticSnippets.registerLowerings(options, factories, providers, snippetReflection, lowerings);
MonitorSnippets.registerLowerings(options, factories, providers, snippetReflection, lowerings);
TypeSnippets.registerLowerings(runtimeConfig, options, factories, providers, snippetReflection, lowerings);
ExceptionSnippets.registerLowerings(options, factories, providers, snippetReflection, lowerings);
if (hosted) {
AssertSnippets.registerLowerings(options, factories, providers, snippetReflection, lowerings);
DeoptHostedSnippets.registerLowerings(options, factories, providers, snippetReflection, lowerings);
} else {
DeoptRuntimeSnippets.registerLowerings(options, factories, providers, snippetReflection, lowerings);
}
if (NativeImageOptions.DeoptimizeAll.getValue()) {
DeoptTestSnippets.registerLowerings(options, factories, providers, snippetReflection, lowerings);
}
featureHandler.forEachGraalFeature(feature -> feature.registerLowerings(runtimeConfig, options, factories, providers, snippetReflection, lowerings, hosted));
} catch (Throwable e) {
throw debug.handle(e);
}
SubstrateReplacements replacements = (SubstrateReplacements) providers.getReplacements();
assert checkInvocationPluginMethods(replacements);
replacements.encodeSnippets();
}
use of org.graalvm.compiler.debug.DebugHandlersFactory in project graal by oracle.
the class PartialEvaluationTest method getDebugHandlersFactories.
@Override
protected Collection<DebugHandlersFactory> getDebugHandlersFactories() {
List<DebugHandlersFactory> c = new ArrayList<>(super.getDebugHandlersFactories());
c.add(new TruffleTreeDebugHandlersFactory());
return c;
}
use of org.graalvm.compiler.debug.DebugHandlersFactory in project graal by oracle.
the class ReplacementsImpl method openDebugContext.
protected DebugContext openDebugContext(String idPrefix, ResolvedJavaMethod method) {
DebugContext outer = DebugContext.forCurrentThread();
Description description = new Description(method, idPrefix + nextDebugContextId.incrementAndGet());
List<DebugHandlersFactory> factories = debugHandlersFactory == null ? Collections.emptyList() : Collections.singletonList(debugHandlersFactory);
return DebugContext.create(options, description, outer.getGlobalMetrics(), DEFAULT_LOG_STREAM, factories);
}
use of org.graalvm.compiler.debug.DebugHandlersFactory in project graal by oracle.
the class HotSpotTruffleCompilerImpl method getDebugHandlerFactories.
private List<DebugHandlersFactory> getDebugHandlerFactories() {
if (factories == null) {
// Multiple initialization by racing threads is harmless
List<DebugHandlersFactory> list = new ArrayList<>();
list.add(new GraalDebugHandlersFactory(snippetReflection));
for (DebugHandlersFactory factory : DebugHandlersFactory.LOADER) {
// Ignore other instances of GraalDebugHandlersFactory
if (!(factory instanceof GraalDebugHandlersFactory)) {
list.add(factory);
}
}
factories = list;
}
return factories;
}
Aggregations