# HG changeset patch # User Stefan Anzinger # Date 1401439340 -7200 # Node ID 2fc9d69be77ec41f5efc6fcc9da8c1fe0b1c2060 # Parent 9a40006b53c14af67a13661ba16a101215b0a81d Fixing stub call to unwindExceptionToCaller and jumpToExceptionHandler Fix in generating code for the CString LIR instruction diff -r 9a40006b53c1 -r 2fc9d69be77e graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotJumpToExceptionHandlerInCallerOp.java --- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotJumpToExceptionHandlerInCallerOp.java Thu Apr 24 14:09:40 2014 +0200 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotJumpToExceptionHandlerInCallerOp.java Fri May 30 10:42:20 2014 +0200 @@ -61,6 +61,10 @@ @Override public void emitCode(CompilationResultBuilder crb, SPARCMacroAssembler masm) { + // Move the values up one level to be the input for the next call. + new SPARCMacroAssembler.Mov(asRegister(handlerInCallerPc), i2).emit(masm); + new SPARCMacroAssembler.Mov(asRegister(exception), i0).emit(masm); + new SPARCMacroAssembler.Mov(asRegister(exceptionPc), i1).emit(masm); leaveFrame(crb); // Restore SP from L7 if the exception PC is a method handle call site. diff -r 9a40006b53c1 -r 2fc9d69be77e graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotUnwindOp.java --- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotUnwindOp.java Thu Apr 24 14:09:40 2014 +0200 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotUnwindOp.java Fri May 30 10:42:20 2014 +0200 @@ -49,6 +49,9 @@ @Override public void emitCode(CompilationResultBuilder crb, SPARCMacroAssembler masm) { + // This Frame is left but the called unwind (which is sibling) method needs the exception as + // input in i0 + new Mov(o0, i0).emit(masm); leaveFrame(crb); ForeignCallLinkage linkage = crb.foreignCalls.lookupForeignCall(UNWIND_EXCEPTION_TO_CALLER); @@ -59,7 +62,6 @@ // Get return address (is in o7 after leave). Register returnAddress = asRegister(cc.getArgument(1)); new Mov(o7, returnAddress).emit(masm); - Register scratch = g5; SPARCCall.indirectJmp(crb, masm, scratch, linkage); } diff -r 9a40006b53c1 -r 2fc9d69be77e graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCConstDataOp.java --- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCConstDataOp.java Thu Apr 24 14:09:40 2014 +0200 +++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCConstDataOp.java Fri May 30 10:42:20 2014 +0200 @@ -2,15 +2,14 @@ import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*; +import com.oracle.graal.api.code.CompilationResult.RawData; import com.oracle.graal.api.code.*; -import com.oracle.graal.api.code.CompilationResult.RawData; import com.oracle.graal.api.meta.*; import com.oracle.graal.asm.sparc.*; +import com.oracle.graal.asm.sparc.SPARCMacroAssembler.Nop; import com.oracle.graal.lir.*; import com.oracle.graal.lir.asm.*; -import com.oracle.graal.lir.sparc.SPARCMove.LoadAddressOp; import com.oracle.graal.sparc.*; -import com.sun.javafx.binding.SelectBinding.*; @Opcode("CONST_DATA") public class SPARCConstDataOp extends SPARCLIRInstruction { @@ -25,10 +24,26 @@ @Override public void emitCode(CompilationResultBuilder crb, SPARCMacroAssembler masm) { + RawData rawData = new RawData(val, 16); + // recordDataReferenceInCoe will fix up PC relative. Therefore + // the PC will be added later on to gather an absolute address + crb.recordDataReferenceInCode(rawData); Register dstReg = ValueUtil.asLongReg(dst); - long addr = 0; // Will be fixed up by the loader - new SPARCAssembler.Sethi((int) addr, dstReg).emit(masm); - new SPARCAssembler.Add(SPARC.g0, (int) addr, dstReg).emit(masm); + new SPARCAssembler.Sethi(0, dstReg).emit(masm); + + Nop nop = new SPARCMacroAssembler.Nop(); + nop.emit(masm); + nop.emit(masm); + nop.emit(masm); + nop.emit(masm); + nop.emit(masm); + nop.emit(masm); + new SPARCAssembler.Add(dstReg, 0, dstReg).emit(masm); + // TODO: Fix this issue with the pc relative addressing (This is just my first guess how to + // do this) + new SPARCAssembler.Sub(dstReg, 10 * 4, dstReg).emit(masm); + new SPARCAssembler.Rdpc(SPARC.g5).emit(masm); + new SPARCAssembler.Add(SPARC.g5, dstReg, dstReg).emit(masm); } } diff -r 9a40006b53c1 -r 2fc9d69be77e graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCControlFlow.java --- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCControlFlow.java Thu Apr 24 14:09:40 2014 +0200 +++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCControlFlow.java Fri May 30 10:42:20 2014 +0200 @@ -282,7 +282,7 @@ this.condition = intCond(condition); this.trueValue = trueValue; this.falseValue = falseValue; - this.cCode = CC.Icc; + this.cCode = cCode; } @Override