use of org.graalvm.compiler.asm.sparc.SPARCMacroAssembler 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.SPARCMacroAssembler in project graal by oracle.
the class SPARCJumpOp method emitCode.
@Override
public void emitCode(CompilationResultBuilder crb) {
if (!crb.isSuccessorEdge(destination())) {
if (!emitDone) {
SPARCMacroAssembler masm = (SPARCMacroAssembler) crb.asm;
masm.jmp(destination().label());
} else {
int disp = crb.asm.position() - delaySlotPosition;
assert disp == 4 : disp;
}
}
}
use of org.graalvm.compiler.asm.sparc.SPARCMacroAssembler in project graal by oracle.
the class SPARCAssemblerTest method setup.
@Before
public void setup() {
TargetDescription target = createTarget();
masm = new SPARCMacroAssembler(target);
}
use of org.graalvm.compiler.asm.sparc.SPARCMacroAssembler in project graal by oracle.
the class SPARCHotSpotBackend method bangStackWithOffset.
@Override
protected void bangStackWithOffset(CompilationResultBuilder crb, int bangOffset) {
// Use SPARCAddress to get the final displacement including the stack bias.
SPARCMacroAssembler masm = (SPARCMacroAssembler) crb.asm;
SPARCAddress address = new SPARCAddress(sp, -bangOffset);
if (SPARCAssembler.isSimm13(address.getDisplacement())) {
masm.stx(g0, address);
} else {
try (ScratchRegister sc = masm.getScratchRegister()) {
Register scratch = sc.getRegister();
assert isGlobalRegister(scratch) : "Only global (g1-g7) registers are allowed if the frame was not initialized here. Got register " + scratch;
masm.setx(address.getDisplacement(), scratch, false);
masm.stx(g0, new SPARCAddress(sp, scratch));
}
}
}
use of org.graalvm.compiler.asm.sparc.SPARCMacroAssembler in project graal by oracle.
the class SPARCHotSpotCounterOp method emitCode.
@Override
public void emitCode(CompilationResultBuilder crb) {
SPARCMacroAssembler masm = (SPARCMacroAssembler) crb.asm;
TargetDescription target = crb.target;
// address for counters array
SPARCAddress countersArrayAddr = new SPARCAddress(thread, config.jvmciCountersThreadOffset);
try (ScratchRegister scratch = masm.getScratchRegister()) {
Register countersArrayReg = scratch.getRegister();
// load counters array
masm.ldx(countersArrayAddr, countersArrayReg);
IncrementEmitter emitter = new IncrementEmitter(countersArrayReg, masm);
forEachCounter(emitter, target);
}
}
Aggregations