changeset 16310:2fc9d69be77e

Fixing stub call to unwindExceptionToCaller and jumpToExceptionHandler Fix in generating code for the CString LIR instruction
author Stefan Anzinger <stefan.anzinger@gmail.com>
date Fri, 30 May 2014 10:42:20 +0200
parents 9a40006b53c1
children 08b2bfcb9075
files graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotJumpToExceptionHandlerInCallerOp.java graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotUnwindOp.java graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCConstDataOp.java graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCControlFlow.java
diffstat 4 files changed, 29 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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.
--- 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);
     }
--- 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);
     }
 
 }
--- 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