changeset 19538:fac54d234f30

Merge.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Sun, 22 Feb 2015 17:17:45 +0100
parents 9d5003af91f5 (current diff) 9299e71df12a (diff)
children 34462e7f0278
files
diffstat 5 files changed, 14 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.sparc.test/src/com/oracle/graal/compiler/sparc/test/SPARCAllocatorTest.java	Sun Feb 22 17:15:55 2015 +0100
+++ b/graal/com.oracle.graal.compiler.sparc.test/src/com/oracle/graal/compiler/sparc/test/SPARCAllocatorTest.java	Sun Feb 22 17:17:45 2015 +0100
@@ -47,7 +47,7 @@
 
     @Test
     public void test2() {
-        testAllocation("test2snippet", 2, 1, 0);
+        testAllocation("test2snippet", 1, 0, 0);
     }
 
     public static long test2snippet(long x) {
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackendFactory.java	Sun Feb 22 17:15:55 2015 +0100
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackendFactory.java	Sun Feb 22 17:17:45 2015 +0100
@@ -93,10 +93,14 @@
 
     @SuppressWarnings("unused")
     private static Value[] createNativeABICallerSaveRegisters(HotSpotVMConfig config, RegisterConfig regConfig) {
-        CalleeSaveLayout csl = regConfig.getCalleeSaveLayout();
-        Value[] nativeABICallerSaveRegisters = new Value[csl.registers.length];
-        for (int i = 0; i < csl.registers.length; i++) {
-            nativeABICallerSaveRegisters[i] = csl.registers[i].asValue();
+        List<Register> callerSaveRegisters = new ArrayList<>();
+        Collections.addAll(callerSaveRegisters, regConfig.getCallerSaveRegisters());
+        // TODO: Saving callee saved registers as well seems unneccessary, however as of now it does
+        // not work without; needs further investigation
+        Collections.addAll(callerSaveRegisters, regConfig.getCalleeSaveLayout().registers);
+        Value[] nativeABICallerSaveRegisters = new Value[callerSaveRegisters.size()];
+        for (int i = 0; i < callerSaveRegisters.size(); i++) {
+            nativeABICallerSaveRegisters[i] = callerSaveRegisters.get(i).asValue();
         }
         return nativeABICallerSaveRegisters;
     }
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotJumpToExceptionHandlerInCallerOp.java	Sun Feb 22 17:15:55 2015 +0100
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotJumpToExceptionHandlerInCallerOp.java	Sun Feb 22 17:17:45 2015 +0100
@@ -47,7 +47,7 @@
 @Opcode("JUMP_TO_EXCEPTION_HANDLER_IN_CALLER")
 final class SPARCHotSpotJumpToExceptionHandlerInCallerOp extends SPARCHotSpotEpilogueOp {
 
-    public static final LIRInstructionClass<SPARCHotSpotDeoptimizeCallerOp> TYPE = LIRInstructionClass.create(SPARCHotSpotDeoptimizeCallerOp.class);
+    public static final LIRInstructionClass<SPARCHotSpotJumpToExceptionHandlerInCallerOp> TYPE = LIRInstructionClass.create(SPARCHotSpotJumpToExceptionHandlerInCallerOp.class);
 
     @Use(REG) AllocatableValue handlerInCallerPc;
     @Use(REG) AllocatableValue exception;
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotRegisterConfig.java	Sun Feb 22 17:15:55 2015 +0100
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotRegisterConfig.java	Sun Feb 22 17:17:45 2015 +0100
@@ -92,7 +92,8 @@
     private final Register[] fpuParameterRegisters = {f0, f1, f2, f3, f4, f5, f6, f7};
     // @formatter:off
     private final Register[] callerSaveRegisters =
-                   {g1, g3, g4, g5, o0, o1, o2, o3, o4, o5, o7,
+                   {g1, g2, g3, g4, g5, g6, g7,
+                    o0, o1, o2, o3, o4, o5, o7,
                     f0,  f1,  f2,  f3,  f4,  f5,  f6,  f7,
                     f8,  f9,  f10, f11, f12, f13, f14, f15,
                     f16, f17, f18, f19, f20, f21, f22, f23,
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/MulNode.java	Sun Feb 22 17:15:55 2015 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/MulNode.java	Sun Feb 22 17:17:45 2015 +0100
@@ -77,33 +77,8 @@
 
             if (c instanceof PrimitiveConstant && ((PrimitiveConstant) c).getKind().isNumericInteger()) {
                 long i = ((PrimitiveConstant) c).asLong();
-                boolean signFlip = false;
-                if (i < 0) {
-                    i = -i;
-                    signFlip = true;
-                }
-                if (i > 0) {
-                    ValueNode mulResult = null;
-                    long bit1 = i & -i;
-                    long bit2 = i - bit1;
-                    bit2 = bit2 & -bit2;    // Extract 2nd bit
-                    if (CodeUtil.isPowerOf2(i)) { //
-                        mulResult = new LeftShiftNode(forX, ConstantNode.forInt(CodeUtil.log2(i)));
-                    } else if (bit2 + bit1 == i) { // We can work with two shifts and add
-                        ValueNode shift1 = new LeftShiftNode(forX, ConstantNode.forInt(CodeUtil.log2(bit1)));
-                        ValueNode shift2 = new LeftShiftNode(forX, ConstantNode.forInt(CodeUtil.log2(bit2)));
-                        mulResult = new AddNode(shift1, shift2);
-                    } else if (CodeUtil.isPowerOf2(i + 1)) { // shift and subtract
-                        ValueNode shift1 = new LeftShiftNode(forX, ConstantNode.forInt(CodeUtil.log2(i + 1)));
-                        mulResult = new SubNode(shift1, forX);
-                    }
-                    if (mulResult != null) {
-                        if (signFlip) {
-                            return new NegateNode(mulResult);
-                        } else {
-                            return mulResult;
-                        }
-                    }
+                if (i > 0 && CodeUtil.isPowerOf2(i)) {
+                    return new LeftShiftNode(forX, ConstantNode.forInt(CodeUtil.log2(i)));
                 }
             }