use of org.graalvm.compiler.hotspot.meta.HotSpotProviders in project graal by oracle.
the class AMD64HotSpotBackend method emitCodeSuffix.
/**
* @param installedCodeOwner see {@link Backend#emitCode}
*/
public void emitCodeSuffix(ResolvedJavaMethod installedCodeOwner, CompilationResultBuilder crb, AMD64MacroAssembler asm, FrameMap frameMap) {
HotSpotProviders providers = getProviders();
HotSpotFrameContext frameContext = (HotSpotFrameContext) crb.frameContext;
if (!frameContext.isStub) {
HotSpotForeignCallsProvider foreignCalls = providers.getForeignCalls();
crb.recordMark(config.MARKID_EXCEPTION_HANDLER_ENTRY);
AMD64Call.directCall(crb, asm, foreignCalls.lookupForeignCall(EXCEPTION_HANDLER), null, false, null);
crb.recordMark(config.MARKID_DEOPT_HANDLER_ENTRY);
AMD64Call.directCall(crb, asm, foreignCalls.lookupForeignCall(DEOPTIMIZATION_HANDLER), null, false, null);
} else {
if (frameContext.omitFrame) {
// Cannot access slots in caller's frame if my frame is omitted
assert !frameMap.accessesCallerFrame();
}
}
}
use of org.graalvm.compiler.hotspot.meta.HotSpotProviders in project graal by oracle.
the class AMD64HotSpotBackend method emitCodePrefix.
/**
* Emits the code prior to the verified entry point.
*
* @param installedCodeOwner see {@link Backend#emitCode}
*/
public void emitCodePrefix(ResolvedJavaMethod installedCodeOwner, CompilationResultBuilder crb, AMD64MacroAssembler asm, RegisterConfig regConfig, Label verifiedEntry) {
HotSpotProviders providers = getProviders();
if (installedCodeOwner != null && !installedCodeOwner.isStatic()) {
crb.recordMark(config.MARKID_UNVERIFIED_ENTRY);
CallingConvention cc = regConfig.getCallingConvention(HotSpotCallingConventionType.JavaCallee, null, new JavaType[] { providers.getMetaAccess().lookupJavaType(Object.class) }, this);
// see definition of IC_Klass in
Register inlineCacheKlass = rax;
// c1_LIRAssembler_x86.cpp
Register receiver = asRegister(cc.getArgument(0));
AMD64Address src = new AMD64Address(receiver, config.hubOffset);
if (config.useCompressedClassPointers) {
Register register = r10;
AMD64HotSpotMove.decodeKlassPointer(crb, asm, register, providers.getRegisters().getHeapBaseRegister(), src, config);
if (GeneratePIC.getValue(crb.getOptions())) {
asm.movq(providers.getRegisters().getHeapBaseRegister(), asm.getPlaceholder(-1));
crb.recordMark(config.MARKID_NARROW_OOP_BASE_ADDRESS);
} else {
if (config.narrowKlassBase != 0) {
// The heap base register was destroyed above, so restore it
asm.movq(providers.getRegisters().getHeapBaseRegister(), config.narrowOopBase);
}
}
asm.cmpq(inlineCacheKlass, register);
} else {
asm.cmpq(inlineCacheKlass, src);
}
AMD64Call.directConditionalJmp(crb, asm, getForeignCalls().lookupForeignCall(IC_MISS_HANDLER), ConditionFlag.NotEqual);
}
asm.align(config.codeEntryAlignment);
crb.recordMark(config.MARKID_OSR_ENTRY);
asm.bind(verifiedEntry);
crb.recordMark(config.MARKID_VERIFIED_ENTRY);
if (GeneratePIC.getValue(crb.getOptions())) {
// Check for method state
HotSpotFrameContext frameContext = (HotSpotFrameContext) crb.frameContext;
if (!frameContext.isStub) {
crb.recordInlineDataInCodeWithNote(new HotSpotSentinelConstant(LIRKind.value(AMD64Kind.QWORD), JavaKind.Long), HotSpotConstantLoadAction.MAKE_NOT_ENTRANT);
asm.movq(AMD64.rax, asm.getPlaceholder(-1));
asm.testq(AMD64.rax, AMD64.rax);
AMD64Call.directConditionalJmp(crb, asm, getForeignCalls().lookupForeignCall(WRONG_METHOD_HANDLER), ConditionFlag.NotZero);
}
}
}
use of org.graalvm.compiler.hotspot.meta.HotSpotProviders 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.hotspot.meta.HotSpotProviders in project graal by oracle.
the class AArch64HotSpotBackend method emitCodePrefix.
private void emitCodePrefix(CompilationResultBuilder crb, ResolvedJavaMethod installedCodeOwner, AArch64MacroAssembler masm, RegisterConfig regConfig, Label verifiedStub) {
HotSpotProviders providers = getProviders();
if (installedCodeOwner != null && !isStatic(installedCodeOwner.getModifiers())) {
crb.recordMark(config.MARKID_UNVERIFIED_ENTRY);
CallingConvention cc = regConfig.getCallingConvention(HotSpotCallingConventionType.JavaCallee, null, new JavaType[] { providers.getMetaAccess().lookupJavaType(Object.class) }, this);
// See definition of IC_Klass in c1_LIRAssembler_aarch64.cpp
// equal to scratch(1) careful!
Register inlineCacheKlass = AArch64HotSpotRegisterConfig.inlineCacheRegister;
Register receiver = asRegister(cc.getArgument(0));
int transferSize = config.useCompressedClassPointers ? 4 : 8;
AArch64Address klassAddress = masm.makeAddress(receiver, config.hubOffset, transferSize);
// Are r10 and r11 available scratch registers here? One would hope so.
Register klass = r10;
if (config.useCompressedClassPointers) {
masm.ldr(32, klass, klassAddress);
AArch64HotSpotMove.decodeKlassPointer(masm, klass, klass, providers.getRegisters().getHeapBaseRegister(), config.getKlassEncoding());
} else {
masm.ldr(64, klass, klassAddress);
}
masm.cmp(64, inlineCacheKlass, klass);
/*
* Conditional jumps have a much lower range than unconditional ones, which can be a
* problem because the miss handler could be out of range.
*/
masm.branchConditionally(AArch64Assembler.ConditionFlag.EQ, verifiedStub);
AArch64Call.directJmp(crb, masm, getForeignCalls().lookupForeignCall(IC_MISS_HANDLER));
}
masm.align(config.codeEntryAlignment);
crb.recordMark(config.MARKID_OSR_ENTRY);
masm.bind(verifiedStub);
crb.recordMark(config.MARKID_VERIFIED_ENTRY);
}
use of org.graalvm.compiler.hotspot.meta.HotSpotProviders 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);
}
}
Aggregations