changeset 16998:e4cfc9ea2bd3

Merge
author Stefan Anzinger <stefan.anzinger@oracle.com>
date Thu, 28 Aug 2014 17:49:37 -0700
parents c9c416d90a4e (diff) 9cf849d5b3f9 (current diff)
children f8565347bb3b e91533b86166
files graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/instrument/SLNodeProber.java
diffstat 9 files changed, 109 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCLIRGenerator.java	Thu Aug 28 20:55:39 2014 +0200
+++ b/graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCLIRGenerator.java	Thu Aug 28 17:49:37 2014 -0700
@@ -224,6 +224,8 @@
                     double trueDestinationProbability) {
         boolean mirrored = emitCompare(cmpKind, left, right);
         Condition finalCondition = mirrored ? cond.mirror() : cond;
+        boolean finalUnorderedIsTrue = mirrored ? !unorderedIsTrue : unorderedIsTrue;
+
         Kind kind = left.getKind().getStackKind();
         switch (kind) {
             case Int:
@@ -233,7 +235,7 @@
                 break;
             case Float:
             case Double:
-                append(new BranchOp(finalCondition, trueDestination, falseDestination, kind));
+                append(new BranchOp(finalCondition, trueDestination, falseDestination, kind, finalUnorderedIsTrue));
                 break;
             default:
                 throw GraalInternalError.shouldNotReachHere("" + left.getKind());
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLIRGenerator.java	Thu Aug 28 20:55:39 2014 +0200
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLIRGenerator.java	Thu Aug 28 17:49:37 2014 -0700
@@ -250,11 +250,15 @@
         Register[] savedRegisters = {
                         // CPU
                         g1, g3, g4, g5,
-                        // FPU
-                        f0,  f1,  f2,  f3,  f4,  f5,  f6,  f7,
-                        f8,  f9,  f10, f11, f12, f13, f14, f15,
-                        f16, f17, f18, f19, f20, f21, f22, f23,
-                        f24, f25, f26, f27, f28, f29, f30, f31
+                        // FPU, use only every second register as doubles are stored anyways
+                        f0,  /*f1, */ f2,  /*f3, */ f4,  /*f5, */ f6,  /*f7, */
+                        f8,  /*f9, */ f10, /*f11,*/ f12, /*f13,*/ f14, /*f15,*/
+                        f16, /*f17,*/ f18, /*f19,*/ f20, /*f21,*/ f22, /*f23,*/
+                        f24, /*f25,*/ f26, /*f27,*/ f28, /*f29,*/ f30, /*f31 */
+                        d32,          d34,          d36,          d38,
+                        d40,          d42,          d44,          d46,
+                        d48,          d50,          d52,          d54,
+                        d56,          d58,          d60,          d62
         };
         // @formatter:on
         StackSlot[] savedRegisterLocations = new StackSlot[savedRegisters.length];
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotRegisterConfig.java	Thu Aug 28 20:55:39 2014 +0200
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotRegisterConfig.java	Thu Aug 28 17:49:37 2014 -0700
@@ -61,9 +61,12 @@
             if (architecture.canStoreValue(reg.getRegisterCategory(), kind)) {
                 // Special treatment for double precision
                 // TODO: This is wasteful it uses only half of the registers as float.
-                if (kind == Kind.Double || kind == Kind.Float) {
-                    // Only even register numbers are valid double precision regs
-                    if (reg.number % 2 == 0) {
+                if (kind == Kind.Double) {
+                    if (reg.name.startsWith("d")) {
+                        list.add(reg);
+                    }
+                } else if (kind == Kind.Float) {
+                    if (reg.name.startsWith("f")) {
                         list.add(reg);
                     }
                 } else {
@@ -92,7 +95,9 @@
                     f0,  f1,  f2,  f3,  f4,  f5,  f6,  f7,
                     f8,  f9,  f10, f11, f12, f13, f14, f15,
                     f16, f17, f18, f19, f20, f21, f22, f23,
-                    f24, f25, f26, f27, f28, f29, f30, f31};
+                    f24, f25, f26, f27, f28, f29, f30, f31,
+                    d32, d34, d36, d38, d40, d42, d44, d46,
+                    d48, d50, d52, d54, d56, d58, d60, d62};
     // @formatter:on
 
     /**
@@ -125,7 +130,12 @@
                         o0, o1, o2, o3, o4, o5, /*o6, o7,*/
                         l0, l1, l2, l3, l4, l5, l6, l7,
                         i0, i1, i2, i3, i4, i5, /*i6,*/ /*i7,*/
-                        f0, f1, f2, f3, f4, f5, f6, f7
+                        //f0, f1, f2, f3, f4, f5, f6, f7,
+                        f8,  f9,  f10, f11, f12, f13, f14, f15,
+                        f16, f17, f18, f19, f20, f21, f22, f23,
+                        f24, f25, f26, f27, f28, f29, f30, f31,
+                        d32, d34, d36, d38, d40, d42, d44, d46,
+                        d48, d50, d52, d54, d56, d58, d60, d62
             };
             // @formatter:on
         } else {
@@ -135,7 +145,12 @@
                         o0, o1, o2, o3, o4, o5, /*o6, o7,*/
                         l0, l1, l2, l3, l4, l5, l6, l7,
                         i0, i1, i2, i3, i4, i5, /*i6,*/ /*i7,*/
-                        f0, f1, f2, f3, f4, f5, f6, f7
+//                        f0, f1, f2, f3, f4, f5, f6, f7
+                        f8,  f9,  f10, f11, f12, f13, f14, f15,
+                        f16, f17, f18, f19, f20, f21, f22, f23,
+                        f24, f25, f26, f27, f28, f29, f30, f31,
+                        d32, d34, d36, d38, d40, d42, d44, d46,
+                        d48, d50, d52, d54, d56, d58, d60, d62
             };
             // @formatter:on
         }
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCControlFlow.java	Thu Aug 28 20:55:39 2014 +0200
+++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCControlFlow.java	Thu Aug 28 17:49:37 2014 -0700
@@ -68,6 +68,7 @@
         protected final LabelRef trueDestination;
         protected final LabelRef falseDestination;
         protected final Kind kind;
+        protected final boolean unorderedIsTrue;
 
         public BranchOp(ConditionFlag condition, LabelRef trueDestination, LabelRef falseDestination, Kind kind) {
             this.conditionFlag = condition;
@@ -75,6 +76,7 @@
             this.falseDestination = falseDestination;
             this.kind = kind;
             this.condition = null;
+            this.unorderedIsTrue = true;
         }
 
         public BranchOp(Condition condition, LabelRef trueDestination, LabelRef falseDestination, Kind kind) {
@@ -83,6 +85,16 @@
             this.falseDestination = falseDestination;
             this.kind = kind;
             this.conditionFlag = null;
+            this.unorderedIsTrue = true;
+        }
+
+        public BranchOp(Condition finalCondition, LabelRef trueDestination, LabelRef falseDestination, Kind kind, boolean unorderedIsTrue) {
+            this.trueDestination = trueDestination;
+            this.falseDestination = falseDestination;
+            this.kind = kind;
+            this.conditionFlag = null;
+            this.unorderedIsTrue = unorderedIsTrue;
+            this.condition = finalCondition;
         }
 
         @Override
@@ -91,21 +103,24 @@
             Label actualTarget;
             Condition actualCondition;
             ConditionFlag actualConditionFlag;
+            boolean branchOnUnordered;
             boolean needJump;
             if (crb.isSuccessorEdge(trueDestination)) {
                 actualCondition = condition != null ? condition.negate() : null;
                 actualConditionFlag = conditionFlag != null ? conditionFlag.negate() : null;
                 actualTarget = falseDestination.label();
                 needJump = false;
+                branchOnUnordered = !unorderedIsTrue;
             } else {
                 actualCondition = condition;
                 actualConditionFlag = conditionFlag;
                 actualTarget = trueDestination.label();
                 needJump = !crb.isSuccessorEdge(falseDestination);
+                branchOnUnordered = unorderedIsTrue;
             }
             assert kind == Kind.Int || kind == Kind.Long || kind == Kind.Object || kind == Kind.Double || kind == Kind.Float : kind;
             if (kind == Kind.Double || kind == Kind.Float) {
-                emitFloatCompare(masm, actualTarget, actualCondition);
+                emitFloatCompare(masm, actualTarget, actualCondition, branchOnUnordered);
             } else {
                 CC cc = kind == Kind.Int ? CC.Icc : CC.Xcc;
                 if (actualCondition != null) {
@@ -123,7 +138,11 @@
         }
     }
 
-    private static void emitFloatCompare(SPARCMacroAssembler masm, Label target, Condition actualCondition) {
+    private static void emitFloatCompare(SPARCMacroAssembler masm, Label target, Condition actualCondition, boolean branchOnUnordered) {
+        if (branchOnUnordered) {
+            // new Fbu(false, target).emit(masm);
+            // new Nop().emit(masm);
+        }
         switch (actualCondition) {
             case EQ:
                 new Fbe(false, target).emit(masm);
--- a/graal/com.oracle.graal.sparc/src/com/oracle/graal/sparc/SPARC.java	Thu Aug 28 20:55:39 2014 +0200
+++ b/graal/com.oracle.graal.sparc/src/com/oracle/graal/sparc/SPARC.java	Thu Aug 28 17:49:37 2014 -0700
@@ -161,12 +161,32 @@
     public static final Register f30 = new Register(62, 30, "f30", FPU);
     public static final Register f31 = new Register(63, 31, "f31", FPU);
 
+    public static final Register d32 = new Register(64, getDoubleEncoding(32), "d32", FPU);
+    public static final Register d34 = new Register(65, getDoubleEncoding(34), "d34", FPU);
+    public static final Register d36 = new Register(66, getDoubleEncoding(36), "d36", FPU);
+    public static final Register d38 = new Register(67, getDoubleEncoding(38), "d38", FPU);
+    public static final Register d40 = new Register(68, getDoubleEncoding(40), "d40", FPU);
+    public static final Register d42 = new Register(69, getDoubleEncoding(42), "d42", FPU);
+    public static final Register d44 = new Register(70, getDoubleEncoding(44), "d44", FPU);
+    public static final Register d46 = new Register(71, getDoubleEncoding(46), "d46", FPU);
+
+    public static final Register d48 = new Register(72, getDoubleEncoding(48), "d48", FPU);
+    public static final Register d50 = new Register(73, getDoubleEncoding(50), "d50", FPU);
+    public static final Register d52 = new Register(74, getDoubleEncoding(52), "d52", FPU);
+    public static final Register d54 = new Register(75, getDoubleEncoding(54), "d54", FPU);
+    public static final Register d56 = new Register(76, getDoubleEncoding(56), "d56", FPU);
+    public static final Register d58 = new Register(77, getDoubleEncoding(58), "d58", FPU);
+    public static final Register d60 = new Register(78, getDoubleEncoding(60), "d60", FPU);
+    public static final Register d62 = new Register(79, getDoubleEncoding(62), "d62", FPU);
+
     // @formatter:off
     public static final Register[] fpuRegisters = {
         f0,  f1,  f2,  f3,  f4,  f5,  f6,  f7,
         f8,  f9,  f10, f11, f12, f13, f14, f15,
         f16, f17, f18, f19, f20, f21, f22, f23,
-        f24, f25, f26, f27, f28, f29, f30, f31
+        f24, f25, f26, f27, f28, f29, f30, f31,
+        d32, d34, d36, d38, d40, d42, d44, d46,
+        d48, d50, d52, d54, d56, d58, d60, d62
     };
     // @formatter:on
 
@@ -181,7 +201,9 @@
         f0,  f1,  f2,  f3,  f4,  f5,  f6,  f7,
         f8,  f9,  f10, f11, f12, f13, f14, f15,
         f16, f17, f18, f19, f20, f21, f22, f23,
-        f24, f25, f26, f27, f28, f29, f30, f31
+        f24, f25, f26, f27, f28, f29, f30, f31,
+        d32, d34, d36, d38, d40, d42, d44, d46,
+        d48, d50, d52, d54, d56, d58, d60, d62
     };
     // @formatter:on
 
@@ -246,4 +268,18 @@
     public static int spillSlotSize(TargetDescription td, PlatformKind kind) {
         return Math.max(td.getSizeInBytes(kind), MEMORY_ACCESS_ALIGN);
     }
+
+    public static int getDoubleEncoding(int reg) {
+        assert reg < 64 && ((reg & 1) == 0);
+        // ignore v8 assertion for now
+        return (reg & 0x1e) | ((reg & 0x20) >> 5);
+    }
+
+    public static boolean isSingleFloatRegister(Register r) {
+        return r.name.startsWith("f");
+    }
+
+    public static boolean isDoubleFloatRegister(Register r) {
+        return r.name.startsWith("d");
+    }
 }
--- a/src/share/vm/classfile/systemDictionary.hpp	Thu Aug 28 20:55:39 2014 +0200
+++ b/src/share/vm/classfile/systemDictionary.hpp	Thu Aug 28 17:49:37 2014 -0700
@@ -231,6 +231,7 @@
   GRAAL_ONLY(do_klass(InstalledCode_klass,                   com_oracle_graal_api_code_InstalledCode,                      Graal)) \
   GRAAL_ONLY(do_klass(code_Register_klass,                   com_oracle_graal_api_code_Register,                           Graal)) \
   GRAAL_ONLY(do_klass(RegisterValue_klass,                   com_oracle_graal_api_code_RegisterValue,                      Graal)) \
+  GRAAL_ONLY(do_klass(RegisterCategory_klass,                com_oracle_graal_api_code_Register_RegisterCategory,          Graal)) \
   GRAAL_ONLY(do_klass(StackSlot_klass,                       com_oracle_graal_api_code_StackSlot,                          Graal)) \
   GRAAL_ONLY(do_klass(VirtualObject_klass,                   com_oracle_graal_api_code_VirtualObject,                      Graal)) \
   GRAAL_ONLY(do_klass(SpeculationLog_klass,                  com_oracle_graal_api_code_SpeculationLog,                     Graal)) \
--- a/src/share/vm/classfile/vmSymbols.hpp	Thu Aug 28 20:55:39 2014 +0200
+++ b/src/share/vm/classfile/vmSymbols.hpp	Thu Aug 28 17:49:37 2014 -0700
@@ -345,6 +345,7 @@
   GRAAL_ONLY(template(com_oracle_graal_api_code_DebugInfo,                      "com/oracle/graal/api/code/DebugInfo"))                           \
   GRAAL_ONLY(template(com_oracle_graal_api_code_Register,                       "com/oracle/graal/api/code/Register"))                            \
   GRAAL_ONLY(template(com_oracle_graal_api_code_RegisterValue,                  "com/oracle/graal/api/code/RegisterValue"))                       \
+  GRAAL_ONLY(template(com_oracle_graal_api_code_Register_RegisterCategory,      "com/oracle/graal/api/code/Register$RegisterCategory"))           \
   GRAAL_ONLY(template(com_oracle_graal_api_code_StackSlot,                      "com/oracle/graal/api/code/StackSlot"))                           \
   GRAAL_ONLY(template(com_oracle_graal_api_code_VirtualObject,                  "com/oracle/graal/api/code/VirtualObject"))                       \
   GRAAL_ONLY(template(com_oracle_graal_api_code_RegisterSaveLayout,             "com/oracle/graal/api/code/RegisterSaveLayout"))                  \
--- a/src/share/vm/graal/graalCodeInstaller.cpp	Thu Aug 28 20:55:39 2014 +0200
+++ b/src/share/vm/graal/graalCodeInstaller.cpp	Thu Aug 28 17:49:37 2014 -0700
@@ -225,8 +225,11 @@
   BasicType type = GraalRuntime::kindToBasicType(Kind::typeChar(platformKind));
 
   if (value->is_a(RegisterValue::klass())) {
-    jint number = code_Register::number(RegisterValue::reg(value));
-    jint encoding = code_Register::encoding(RegisterValue::reg(value));
+    oop reg = RegisterValue::reg(value);
+    jint number = code_Register::number(reg);
+    jint encoding = code_Register::encoding(reg);
+    oop registerCategory = code_Register::registerCategory(reg);
+    jint referenceMapOffset = RegisterCategory::referenceMapOffset(registerCategory);
     if (number < RegisterImpl::number_of_registers) {
       Location::Type locationType;
       if (type == T_INT) {
@@ -256,15 +259,17 @@
         locationType = Location::dbl;
       }
       assert(!reference, "unexpected type in floating point register");
+      jint floatRegisterNumber = number - referenceMapOffset;
 #ifdef TARGET_ARCH_x86
-      ScopeValue* value = new LocationValue(Location::new_reg_loc(locationType, as_XMMRegister(number - 16)->as_VMReg()));
+      ScopeValue* value = new LocationValue(Location::new_reg_loc(locationType, as_XMMRegister(floatRegisterNumber)->as_VMReg()));
       if (type == T_DOUBLE) {
         second = value;
       }
       return value;
 #else
 #ifdef TARGET_ARCH_sparc
-      ScopeValue* value = new LocationValue(Location::new_reg_loc(locationType, as_FloatRegister(encoding)->as_VMReg()));
+      floatRegisterNumber += MAX2(0, floatRegisterNumber-32); // Beginning with f32, only every second register is going to be addressed
+      ScopeValue* value = new LocationValue(Location::new_reg_loc(locationType, as_FloatRegister(floatRegisterNumber)->as_VMReg()));
       if (type == T_DOUBLE) {
         second = value;
       }
--- a/src/share/vm/graal/graalJavaAccess.hpp	Thu Aug 28 20:55:39 2014 +0200
+++ b/src/share/vm/graal/graalJavaAccess.hpp	Thu Aug 28 17:49:37 2014 -0700
@@ -237,9 +237,15 @@
   start_class(RegisterValue)                                                                                                                                   \
     oop_field(RegisterValue, reg, "Lcom/oracle/graal/api/code/Register;")                                                                                      \
   end_class                                                                                                                                                    \
+  start_class(RegisterCategory)                                                                                                                                \
+    oop_field(RegisterCategory, name, "Ljava/lang/String;")                                                                                                    \
+    int_field(RegisterCategory, referenceMapOffset)                                                                                                            \
+    int_field(RegisterCategory, referenceMapShift)                                                                                                             \
+  end_class                                                                                                                                                    \
   start_class(code_Register)                                                                                                                                   \
     int_field(code_Register, number)                                                                                                                           \
     int_field(code_Register, encoding)                                                                                                                         \
+    oop_field(code_Register, registerCategory, "Lcom/oracle/graal/api/code/Register$RegisterCategory;")                                                        \
   end_class                                                                                                                                                    \
   start_class(StackSlot)                                                                                                                                       \
     int_field(StackSlot, offset)                                                                                                                               \