use of org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler in project graal by oracle.
the class AArch64HotSpotBackend method emitCode.
@Override
public void emitCode(CompilationResultBuilder crb, LIR lir, ResolvedJavaMethod installedCodeOwner) {
AArch64MacroAssembler masm = (AArch64MacroAssembler) crb.asm;
FrameMap frameMap = crb.frameMap;
RegisterConfig regConfig = frameMap.getRegisterConfig();
Label verifiedStub = new Label();
emitCodePrefix(crb, installedCodeOwner, masm, regConfig, verifiedStub);
emitCodeBody(crb, lir, masm);
emitCodeSuffix(crb, masm, frameMap);
}
use of org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler 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.asm.aarch64.AArch64MacroAssembler in project graal by oracle.
the class AArch64HotSpotEpilogueOp method leaveFrame.
protected void leaveFrame(CompilationResultBuilder crb, AArch64MacroAssembler masm, boolean emitSafepoint) {
assert crb.frameContext != null : "We never elide frames in aarch64";
crb.frameContext.leave(crb);
if (emitSafepoint) {
try (ScratchRegister sc = masm.getScratchRegister()) {
Register scratch = sc.getRegister();
AArch64HotSpotSafepointOp.emitCode(crb, masm, config, true, thread, scratch, null);
}
}
}
use of org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler in project graal by oracle.
the class AArch64Move method reg2reg.
private static void reg2reg(@SuppressWarnings("unused") CompilationResultBuilder crb, AArch64MacroAssembler masm, AllocatableValue result, AllocatableValue input) {
Register dst = asRegister(result);
Register src = asRegister(input);
if (src.equals(dst)) {
return;
}
AArch64Kind kind = (AArch64Kind) input.getPlatformKind();
int size = kind.getSizeInBytes() * Byte.SIZE;
if (kind.isInteger()) {
masm.mov(size, dst, src);
} else {
masm.fmov(size, dst, src);
}
}
use of org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler in project graal by oracle.
the class AArch64Move method emitStackMove.
private static void emitStackMove(CompilationResultBuilder crb, AArch64MacroAssembler masm, AllocatableValue result, Value input) {
try (ScratchRegister r1 = masm.getScratchRegister()) {
try (ScratchRegister r2 = masm.getScratchRegister()) {
Register rscratch1 = r1.getRegister();
Register rscratch2 = r2.getRegister();
// use the slot kind to define the operand size
PlatformKind kind = input.getPlatformKind();
final int size = kind.getSizeInBytes() * Byte.SIZE;
// Always perform stack -> stack copies through integer registers
crb.blockComment("[stack -> stack copy]");
AArch64Address src = loadStackSlotAddress(crb, masm, asStackSlot(input), rscratch2);
masm.ldr(size, rscratch1, src);
AArch64Address dst = loadStackSlotAddress(crb, masm, asStackSlot(result), rscratch2);
masm.str(size, rscratch1, dst);
}
}
}
Aggregations