use of org.graalvm.compiler.replacements.classfile.ClassfileBytecodeProvider in project graal by oracle.
the class AMD64HotSpotBackendFactory method createBackend.
@Override
@SuppressWarnings("try")
public HotSpotBackend createBackend(HotSpotGraalRuntimeProvider graalRuntime, CompilerConfiguration compilerConfiguration, HotSpotJVMCIRuntimeProvider jvmciRuntime, HotSpotBackend host) {
assert host == null;
OptionValues options = graalRuntime.getOptions();
JVMCIBackend jvmci = jvmciRuntime.getHostJVMCIBackend();
GraalHotSpotVMConfig config = graalRuntime.getVMConfig();
HotSpotProviders providers;
HotSpotRegistersProvider registers;
HotSpotCodeCacheProvider codeCache = (HotSpotCodeCacheProvider) jvmci.getCodeCache();
TargetDescription target = codeCache.getTarget();
HotSpotHostForeignCallsProvider foreignCalls;
Value[] nativeABICallerSaveRegisters;
HotSpotMetaAccessProvider metaAccess = (HotSpotMetaAccessProvider) jvmci.getMetaAccess();
HotSpotConstantReflectionProvider constantReflection = (HotSpotConstantReflectionProvider) jvmci.getConstantReflection();
ConstantFieldProvider constantFieldProvider = new HotSpotGraalConstantFieldProvider(config, metaAccess);
HotSpotLoweringProvider lowerer;
HotSpotSnippetReflectionProvider snippetReflection;
HotSpotReplacementsImpl replacements;
HotSpotSuitesProvider suites;
HotSpotWordTypes wordTypes;
Plugins plugins;
BytecodeProvider bytecodeProvider;
try (InitTimer t = timer("create providers")) {
try (InitTimer rt = timer("create HotSpotRegisters provider")) {
registers = createRegisters();
}
try (InitTimer rt = timer("create NativeABICallerSaveRegisters")) {
nativeABICallerSaveRegisters = createNativeABICallerSaveRegisters(config, codeCache.getRegisterConfig());
}
try (InitTimer rt = timer("create WordTypes")) {
wordTypes = new HotSpotWordTypes(metaAccess, target.wordJavaKind);
}
try (InitTimer rt = timer("create ForeignCalls provider")) {
foreignCalls = createForeignCalls(jvmciRuntime, graalRuntime, metaAccess, codeCache, wordTypes, nativeABICallerSaveRegisters);
}
try (InitTimer rt = timer("create Lowerer provider")) {
lowerer = createLowerer(graalRuntime, metaAccess, foreignCalls, registers, constantReflection, target);
}
HotSpotStampProvider stampProvider = new HotSpotStampProvider();
Providers p = new Providers(metaAccess, codeCache, constantReflection, constantFieldProvider, foreignCalls, lowerer, null, stampProvider);
try (InitTimer rt = timer("create SnippetReflection provider")) {
snippetReflection = createSnippetReflection(graalRuntime, constantReflection, wordTypes);
}
try (InitTimer rt = timer("create Bytecode provider")) {
bytecodeProvider = new ClassfileBytecodeProvider(metaAccess, snippetReflection);
}
try (InitTimer rt = timer("create Replacements provider")) {
replacements = createReplacements(options, p, snippetReflection, bytecodeProvider);
}
try (InitTimer rt = timer("create GraphBuilderPhase plugins")) {
plugins = createGraphBuilderPlugins(compilerConfiguration, config, options, target, constantReflection, foreignCalls, lowerer, metaAccess, snippetReflection, replacements, wordTypes, stampProvider);
replacements.setGraphBuilderPlugins(plugins);
}
try (InitTimer rt = timer("create Suites provider")) {
suites = createSuites(config, graalRuntime, compilerConfiguration, plugins, registers, replacements, options);
}
providers = new HotSpotProviders(metaAccess, codeCache, constantReflection, constantFieldProvider, foreignCalls, lowerer, replacements, suites, registers, snippetReflection, wordTypes, plugins);
}
try (InitTimer rt = timer("instantiate backend")) {
return createBackend(config, graalRuntime, providers);
}
}
use of org.graalvm.compiler.replacements.classfile.ClassfileBytecodeProvider in project graal by oracle.
the class AArch64HotSpotBackendFactory method createBackend.
@Override
@SuppressWarnings("try")
public HotSpotBackend createBackend(HotSpotGraalRuntimeProvider graalRuntime, CompilerConfiguration compilerConfiguration, HotSpotJVMCIRuntimeProvider jvmciRuntime, HotSpotBackend host) {
assert host == null;
JVMCIBackend jvmci = jvmciRuntime.getHostJVMCIBackend();
GraalHotSpotVMConfig config = graalRuntime.getVMConfig();
HotSpotProviders providers;
HotSpotRegistersProvider registers;
HotSpotCodeCacheProvider codeCache = (HotSpotCodeCacheProvider) jvmci.getCodeCache();
TargetDescription target = codeCache.getTarget();
HotSpotHostForeignCallsProvider foreignCalls;
Value[] nativeABICallerSaveRegisters;
HotSpotMetaAccessProvider metaAccess = (HotSpotMetaAccessProvider) jvmci.getMetaAccess();
HotSpotConstantReflectionProvider constantReflection = (HotSpotConstantReflectionProvider) jvmci.getConstantReflection();
HotSpotConstantFieldProvider constantFieldProvider = new HotSpotGraalConstantFieldProvider(config, metaAccess);
HotSpotLoweringProvider lowerer;
HotSpotSnippetReflectionProvider snippetReflection;
HotSpotReplacementsImpl replacements;
HotSpotSuitesProvider suites;
HotSpotWordTypes wordTypes;
Plugins plugins;
BytecodeProvider bytecodeProvider;
try (InitTimer t = timer("create providers")) {
try (InitTimer rt = timer("create HotSpotRegisters provider")) {
registers = createRegisters();
}
try (InitTimer rt = timer("create NativeABICallerSaveRegisters")) {
nativeABICallerSaveRegisters = createNativeABICallerSaveRegisters(config, codeCache.getRegisterConfig());
}
try (InitTimer rt = timer("create WordTypes")) {
wordTypes = new HotSpotWordTypes(metaAccess, target.wordJavaKind);
}
try (InitTimer rt = timer("create ForeignCalls provider")) {
foreignCalls = createForeignCalls(jvmciRuntime, graalRuntime, metaAccess, codeCache, wordTypes, nativeABICallerSaveRegisters);
}
try (InitTimer rt = timer("create Lowerer provider")) {
lowerer = createLowerer(graalRuntime, metaAccess, foreignCalls, registers, constantReflection, target);
}
HotSpotStampProvider stampProvider = new HotSpotStampProvider();
Providers p = new Providers(metaAccess, codeCache, constantReflection, constantFieldProvider, foreignCalls, lowerer, null, stampProvider);
try (InitTimer rt = timer("create SnippetReflection provider")) {
snippetReflection = createSnippetReflection(graalRuntime, constantReflection, wordTypes);
}
try (InitTimer rt = timer("create Bytecode provider")) {
bytecodeProvider = new ClassfileBytecodeProvider(metaAccess, snippetReflection);
}
try (InitTimer rt = timer("create Replacements provider")) {
replacements = createReplacements(graalRuntime.getOptions(), p, snippetReflection, bytecodeProvider);
}
try (InitTimer rt = timer("create GraphBuilderPhase plugins")) {
plugins = createGraphBuilderPlugins(compilerConfiguration, config, constantReflection, foreignCalls, lowerer, metaAccess, snippetReflection, replacements, wordTypes, stampProvider);
replacements.setGraphBuilderPlugins(plugins);
}
try (InitTimer rt = timer("create Suites provider")) {
suites = createSuites(config, graalRuntime, compilerConfiguration, plugins);
}
providers = new HotSpotProviders(metaAccess, codeCache, constantReflection, constantFieldProvider, foreignCalls, lowerer, replacements, suites, registers, snippetReflection, wordTypes, plugins);
}
try (InitTimer rt = timer("instantiate backend")) {
return createBackend(config, graalRuntime, providers);
}
}
use of org.graalvm.compiler.replacements.classfile.ClassfileBytecodeProvider in project graal by oracle.
the class SubstitutionsTest method registerInvocationPlugins.
@Override
protected void registerInvocationPlugins(InvocationPlugins invocationPlugins) {
new PluginFactory_SubstitutionsTest().registerPlugins(invocationPlugins, null);
ClassfileBytecodeProvider bytecodeProvider = getSystemClassLoaderBytecodeProvider();
Registration r = new Registration(invocationPlugins, TestMethod.class, bytecodeProvider);
r.registerMethodSubstitution(TestMethodSubstitution.class, "test");
super.registerInvocationPlugins(invocationPlugins);
}
use of org.graalvm.compiler.replacements.classfile.ClassfileBytecodeProvider in project graal by oracle.
the class SPARCHotSpotBackendFactory method createBackend.
@Override
public HotSpotBackend createBackend(HotSpotGraalRuntimeProvider runtime, CompilerConfiguration compilerConfiguration, HotSpotJVMCIRuntimeProvider jvmciRuntime, HotSpotBackend host) {
assert host == null;
GraalHotSpotVMConfig config = runtime.getVMConfig();
JVMCIBackend jvmci = jvmciRuntime.getHostJVMCIBackend();
HotSpotRegistersProvider registers = createRegisters();
HotSpotMetaAccessProvider metaAccess = (HotSpotMetaAccessProvider) jvmci.getMetaAccess();
HotSpotCodeCacheProvider codeCache = (HotSpotCodeCacheProvider) jvmci.getCodeCache();
TargetDescription target = codeCache.getTarget();
HotSpotConstantReflectionProvider constantReflection = (HotSpotConstantReflectionProvider) jvmci.getConstantReflection();
HotSpotConstantFieldProvider constantFieldProvider = new HotSpotGraalConstantFieldProvider(config, metaAccess);
Value[] nativeABICallerSaveRegisters = createNativeABICallerSaveRegisters(config, codeCache.getRegisterConfig());
HotSpotWordTypes wordTypes = new HotSpotWordTypes(metaAccess, target.wordJavaKind);
HotSpotForeignCallsProvider foreignCalls = new SPARCHotSpotForeignCallsProvider(jvmciRuntime, runtime, metaAccess, codeCache, wordTypes, nativeABICallerSaveRegisters);
LoweringProvider lowerer = createLowerer(runtime, metaAccess, foreignCalls, registers, constantReflection, target);
HotSpotStampProvider stampProvider = new HotSpotStampProvider();
Providers p = new Providers(metaAccess, codeCache, constantReflection, constantFieldProvider, foreignCalls, lowerer, null, stampProvider);
HotSpotSnippetReflectionProvider snippetReflection = new HotSpotSnippetReflectionProvider(runtime, constantReflection, wordTypes);
BytecodeProvider bytecodeProvider = new ClassfileBytecodeProvider(metaAccess, snippetReflection);
HotSpotReplacementsImpl replacements = new HotSpotReplacementsImpl(runtime.getOptions(), p, snippetReflection, bytecodeProvider, target);
Plugins plugins = createGraphBuilderPlugins(compilerConfiguration, config, metaAccess, constantReflection, foreignCalls, lowerer, stampProvider, snippetReflection, replacements, wordTypes);
replacements.setGraphBuilderPlugins(plugins);
HotSpotSuitesProvider suites = createSuites(config, runtime, compilerConfiguration, plugins, replacements);
HotSpotProviders providers = new HotSpotProviders(metaAccess, codeCache, constantReflection, constantFieldProvider, foreignCalls, lowerer, replacements, suites, registers, snippetReflection, wordTypes, plugins);
return createBackend(config, runtime, providers);
}
use of org.graalvm.compiler.replacements.classfile.ClassfileBytecodeProvider in project graal by oracle.
the class DerivedOopTest method registerInvocationPlugins.
@Override
protected void registerInvocationPlugins(InvocationPlugins invocationPlugins) {
Registration r = new Registration(invocationPlugins, DerivedOopTest.class);
ClassfileBytecodeProvider bytecodeProvider = getSystemClassLoaderBytecodeProvider();
ResolvedJavaMethod intrinsic = getResolvedJavaMethod("getRawPointerIntrinsic");
r.register1("getRawPointer", Object.class, new InvocationPlugin() {
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode arg) {
return b.intrinsify(bytecodeProvider, targetMethod, intrinsic, receiver, new ValueNode[] { arg });
}
});
super.registerInvocationPlugins(invocationPlugins);
}
Aggregations