use of org.graalvm.compiler.asm.sparc.SPARCAddress in project graal by oracle.
the class SPARCTruffleCallBoundaryInstumentationFactory 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) {
SPARCMacroAssembler masm = (SPARCMacroAssembler) this.asm;
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.ld(new SPARCAddress(thisRegister, installedCodeOffset), spillRegister, 4, false);
Register baseReg = encoding.hasBase() ? registers.getHeapBaseRegister() : null;
SPARCHotSpotMove.UncompressPointer.emitUncompressCode(masm, spillRegister, spillRegister, baseReg, encoding.getShift(), true);
} else {
masm.ldx(new SPARCAddress(thisRegister, installedCodeOffset), spillRegister);
}
masm.ldx(new SPARCAddress(spillRegister, entryPointOffset), spillRegister);
masm.compareBranch(spillRegister, 0, Equal, Xcc, doProlog, PREDICT_NOT_TAKEN, null);
masm.jmp(spillRegister);
masm.nop();
masm.bind(doProlog);
}
}
};
}
use of org.graalvm.compiler.asm.sparc.SPARCAddress in project graal by oracle.
the class SPARCCall method indirectJmp.
public static void indirectJmp(CompilationResultBuilder crb, SPARCMacroAssembler masm, Register dst, InvokeTarget target) {
int before = masm.position();
masm.sethix(0L, dst, true);
masm.jmp(new SPARCAddress(dst, 0));
// delay slot
masm.nop();
int after = masm.position();
crb.recordIndirectCall(before, after, target, null);
masm.ensureUniquePC();
}
use of org.graalvm.compiler.asm.sparc.SPARCAddress in project graal by oracle.
the class SPARCMove method stack2stack.
public static void stack2stack(CompilationResultBuilder crb, SPARCMacroAssembler masm, PlatformKind resultKind, PlatformKind inputKind, Value result, Value input, SPARCDelayedControlTransfer delaySlotLir) {
try (ScratchRegister sc = masm.getScratchRegister()) {
SPARCAddress inputAddress = (SPARCAddress) crb.asAddress(input);
Value scratchRegisterValue = sc.getRegister().asValue(LIRKind.combine(input));
emitLoad(crb, masm, inputAddress, scratchRegisterValue, false, inputKind, SPARCDelayedControlTransfer.DUMMY, null);
SPARCAddress resultAddress = (SPARCAddress) crb.asAddress(result);
emitStore(scratchRegisterValue, resultAddress, resultKind, delaySlotLir, null, crb, masm);
}
}
use of org.graalvm.compiler.asm.sparc.SPARCAddress in project graal by oracle.
the class SPARCMove method reg2stack.
public static void reg2stack(CompilationResultBuilder crb, SPARCMacroAssembler masm, Value result, Value input, SPARCDelayedControlTransfer delaySlotLir) {
SPARCAddress resultAddress = (SPARCAddress) crb.asAddress(result);
emitStore(input, resultAddress, result.getPlatformKind(), delaySlotLir, null, crb, masm);
}
use of org.graalvm.compiler.asm.sparc.SPARCAddress in project graal by oracle.
the class SPARCSaveRegistersOp method emitCode.
@Override
public void emitCode(CompilationResultBuilder crb, SPARCMacroAssembler masm) {
// Can be used with VIS3
// new Movxtod(SPARC.i0, RETURN_REGISTER_STORAGE).emit(masm);
// We abuse the first stackslot for transferring i0 to return_register_storage
// assert slots.length >= 1;
SPARCAddress slot0Address = (SPARCAddress) crb.asAddress(slots[0]);
masm.stx(SPARC.i0, slot0Address);
masm.lddf(slot0Address, RETURN_REGISTER_STORAGE);
// Now save the registers
for (int i = 0; i < savedRegisters.length; i++) {
if (savedRegisters[i] != null) {
assert isStackSlot(slots[i]) : "not a StackSlot: " + slots[i];
Register savedRegister = savedRegisters[i];
StackSlot slot = asStackSlot(slots[i]);
SPARCAddress slotAddress = (SPARCAddress) crb.asAddress(slot);
RegisterValue input = savedRegister.asValue(slot.getValueKind());
SPARCMove.emitStore(input, slotAddress, slot.getPlatformKind(), DUMMY, null, crb, masm);
}
}
}
Aggregations