Mercurial > hg > graal-jvmci-8
changeset 16633:57c3b36b894b
[SPARC] Improving Exception Handling and Const2Stack
author | Stefan Anzinger <stefan.anzinger@gmail.com> |
---|---|
date | Mon, 21 Jul 2014 10:08:37 -0700 |
parents | d89cafcc398b |
children | b0cf5908ae96 |
files | graal/com.oracle.graal.asm.sparc/src/com/oracle/graal/asm/sparc/SPARCAssembler.java graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackend.java graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLIRGenerator.java graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotPatchReturnAddressOp.java graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCMove.java |
diffstat | 5 files changed, 30 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.asm.sparc/src/com/oracle/graal/asm/sparc/SPARCAssembler.java Thu Jul 17 17:29:35 2014 -0700 +++ b/graal/com.oracle.graal.asm.sparc/src/com/oracle/graal/asm/sparc/SPARCAssembler.java Mon Jul 21 10:08:37 2014 -0700 @@ -3687,6 +3687,8 @@ public Return(Register src1, Register src2) { super(Op3s.Rett, src1, src2, r0); } + + public static int PC_RETURN_OFFSET = 8; } public static class Save extends Fmt10 {
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackend.java Thu Jul 17 17:29:35 2014 -0700 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackend.java Mon Jul 21 10:08:37 2014 -0700 @@ -172,7 +172,7 @@ public CompilationResultBuilder newCompilationResultBuilder(LIRGenerationResult lirGenRes, CompilationResult compilationResult, CompilationResultBuilderFactory factory) { SPARCHotSpotLIRGenerationResult gen = (SPARCHotSpotLIRGenerationResult) lirGenRes; FrameMap frameMap = gen.getFrameMap(); - assert gen.getDeoptimizationRescueSlot() == null || frameMap.frameNeedsAllocating() : "method that can deoptimize must have a frame"; + assert gen.getDeoptimizationRescueSlot() != null || frameMap.frameNeedsAllocating() : "method that can deoptimize must have a frame"; Stub stub = gen.getStub(); Assembler masm = createAssembler(frameMap);
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLIRGenerator.java Thu Jul 17 17:29:35 2014 -0700 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLIRGenerator.java Mon Jul 21 10:08:37 2014 -0700 @@ -90,6 +90,15 @@ } @Override + public void beforeRegisterAllocation() { + super.beforeRegisterAllocation(); + boolean hasDebugInfo = getResult().getLIR().hasDebugInfo(); + if (hasDebugInfo) { + ((SPARCHotSpotLIRGenerationResult) getResult()).setDeoptimizationRescueSlot(getResult().getFrameMap().allocateSpillSlot(LIRKind.value(Kind.Long))); + } + } + + @Override public Variable emitForeignCall(ForeignCallLinkage linkage, LIRFrameState state, Value... args) { HotSpotForeignCallLinkage hotspotLinkage = (HotSpotForeignCallLinkage) linkage; Variable result;
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotPatchReturnAddressOp.java Thu Jul 17 17:29:35 2014 -0700 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotPatchReturnAddressOp.java Mon Jul 21 10:08:37 2014 -0700 @@ -26,6 +26,7 @@ import static com.oracle.graal.sparc.SPARC.*; import static com.oracle.graal.api.code.ValueUtil.*; +import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.asm.sparc.*; import com.oracle.graal.asm.sparc.SPARCMacroAssembler.*; @@ -50,17 +51,18 @@ public void emitCode(CompilationResultBuilder crb, SPARCMacroAssembler masm) { // FIXME This is non-trivial. On SPARC we need to flush all register windows first before we // can patch the return address (see: frame::patch_pc). - new Flushw().emit(masm); + // new Flushw().emit(masm); // int frameSize = crb.frameMap.frameSize(); // new SPARCAssembler.Ldx(new SPARCAddress(o7, 1), g3).emit(masm); // new Setx(8 * 15 - 1, g4, false).emit(masm); - new Mov(asLongReg(address), g4).emit(masm); - new Save(sp, -2000, sp).emit(masm); - - new Sub(g4, 0, i7).emit(masm); - new Stx(i7, new SPARCAddress(fp, 8 * 15)).emit(masm); - new Restore(g0, g0, g0).emit(masm); - new Flushw().emit(masm); + Register addrRegister = asLongReg(address); + // new SPARCAssembler.Ldx(new SPARCAddress(o7, 1), g3).emit(masm); + new Sub(addrRegister, Return.PC_RETURN_OFFSET, i7).emit(masm); + // new Save(sp, -2047, sp).emit(masm); + // new Flushw().emit(masm); + // new Stx(g4, new SPARCAddress(fp, o7.number * crb.target.wordSize)).emit(masm); + // new Restore(g0, g0, g0).emit(masm); +// new Flushw().emit(masm); // new Ldx(new SPARCAddress(g0, 0x123), g0).emit(masm); } }
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCMove.java Thu Jul 17 17:29:35 2014 -0700 +++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCMove.java Mon Jul 21 10:08:37 2014 -0700 @@ -387,8 +387,13 @@ } else if (isConstant(input)) { if (isRegister(result)) { const2reg(crb, masm, result, (Constant) input); + } else if (isStackSlot(result)) { + // Move a Constant to a stack slot (Probably a 7th output parameter) + Value scratch = input.getKind() == Kind.Float || input.getKind() == Kind.Double ? f30.asValue() : g5.asValue(); + const2reg(crb, masm, scratch, (Constant) input); + reg2stack(crb, masm, result, scratch); } else { - throw GraalInternalError.shouldNotReachHere(); + throw GraalInternalError.shouldNotReachHere("Result is a : " + result); } } else { throw GraalInternalError.shouldNotReachHere(); @@ -510,6 +515,7 @@ } break; case Float: + // TODO: Handle it the same way, as in the double case with Movwtos crb.asFloatConstRef(input); // First load the address into the scratch register new Setx(0, scratch, true).emit(masm); @@ -517,9 +523,8 @@ new Ldf(scratch, asFloatReg(result)).emit(masm); break; case Double: - // before we load this from memory and do the complicated lookup, + // instead loading this from memory and do the complicated lookup, // just load it directly into a scratch register - scratch = g5; // First load the address into the scratch register new Setx(Double.doubleToLongBits(input.asDouble()), scratch, true).emit(masm); // Now load the float value