use of org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler in project graal by oracle.
the class AArch64HotSpotPatchReturnAddressOp method emitCode.
@Override
public void emitCode(CompilationResultBuilder crb, AArch64MacroAssembler masm) {
final int frameSize = crb.frameMap.frameSize();
// LR is saved in the {fp, lr} pair above the frame
AArch64Address lrAddress = AArch64Address.createUnscaledImmediateAddress(sp, frameSize + crb.target.wordSize);
masm.str(64, asRegister(address), lrAddress);
}
use of org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler in project graal by oracle.
the class AArch64HotSpotBackend method emitCodeSuffix.
private void emitCodeSuffix(CompilationResultBuilder crb, AArch64MacroAssembler masm, FrameMap frameMap) {
HotSpotProviders providers = getProviders();
HotSpotFrameContext frameContext = (HotSpotFrameContext) crb.frameContext;
if (!frameContext.isStub) {
HotSpotForeignCallsProvider foreignCalls = providers.getForeignCalls();
try (ScratchRegister sc = masm.getScratchRegister()) {
Register scratch = sc.getRegister();
crb.recordMark(config.MARKID_EXCEPTION_HANDLER_ENTRY);
ForeignCallLinkage linkage = foreignCalls.lookupForeignCall(EXCEPTION_HANDLER);
Register helper = AArch64Call.isNearCall(linkage) ? null : scratch;
AArch64Call.directCall(crb, masm, linkage, helper, null);
}
crb.recordMark(config.MARKID_DEOPT_HANDLER_ENTRY);
ForeignCallLinkage linkage = foreignCalls.lookupForeignCall(DEOPTIMIZATION_HANDLER);
// Warning: the argument is an offset from the instruction!
masm.adr(lr, 0);
AArch64Call.directJmp(crb, masm, linkage);
} else {
// it has no calls that can cause such "return" entries
assert !frameMap.accessesCallerFrame();
}
}
use of org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler in project graal by oracle.
the class AArch64HotSpotBackend method bangStackWithOffset.
@Override
protected void bangStackWithOffset(CompilationResultBuilder crb, int bangOffset) {
AArch64MacroAssembler masm = (AArch64MacroAssembler) crb.asm;
try (ScratchRegister sc = masm.getScratchRegister()) {
Register scratch = sc.getRegister();
AArch64Address address = masm.makeAddress(sp, -bangOffset, scratch, 8, /* allowOverwrite */
false);
masm.str(64, zr, address);
}
}
use of org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler in project graal by oracle.
the class AArch64TruffleCallBoundaryInstumentationFactory method createBuilder.
@Override
public CompilationResultBuilder createBuilder(CodeCacheProvider codeCache, ForeignCallsProvider foreignCalls, FrameMap frameMap, Assembler asm, DataBuilder dataBuilder, FrameContext frameContext, OptionValues options, DebugContext debug, CompilationResult compilationResult) {
return new TruffleCallBoundaryInstrumentation(metaAccess, codeCache, foreignCalls, frameMap, asm, dataBuilder, frameContext, options, debug, compilationResult, config, registers) {
@Override
protected void injectTailCallCode(int installedCodeOffset, int entryPointOffset) {
AArch64MacroAssembler masm = (AArch64MacroAssembler) this.asm;
AArch64HotSpotBackend.emitInvalidatePlaceholder(this, masm);
try (ScratchRegister scratch = masm.getScratchRegister()) {
Register thisRegister = codeCache.getRegisterConfig().getCallingConventionRegisters(JavaCall, Object).get(0);
Register spillRegister = scratch.getRegister();
Label doProlog = new Label();
if (config.useCompressedOops) {
CompressEncoding encoding = config.getOopEncoding();
masm.ldr(32, spillRegister, AArch64Address.createPairUnscaledImmediateAddress(thisRegister, installedCodeOffset));
Register base = encoding.hasBase() ? registers.getHeapBaseRegister() : null;
AArch64HotSpotMove.UncompressPointer.emitUncompressCode(masm, spillRegister, spillRegister, base, encoding.getShift(), true);
} else {
masm.ldr(64, spillRegister, AArch64Address.createPairUnscaledImmediateAddress(thisRegister, installedCodeOffset));
}
masm.ldr(64, spillRegister, AArch64Address.createPairUnscaledImmediateAddress(spillRegister, entryPointOffset));
masm.cbz(64, spillRegister, doProlog);
masm.jmp(spillRegister);
masm.nop();
masm.bind(doProlog);
}
}
};
}
use of org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler in project graal by oracle.
the class AArch64MacroAssemblerTest method setupEnvironment.
@Before
public void setupEnvironment() {
TargetDescription target = createTarget();
masm = new AArch64MacroAssembler(target);
asm = new TestProtectedAssembler(target);
base = AArch64.r10;
index = AArch64.r13;
scratch = AArch64.r15;
}
Aggregations