changeset 16996:6ea6d4c260c8

[SPARC/AMD64] Fixing handling of floatingpoint register handling
author Stefan Anzinger <stefan.anzinger@oracle.com>
date Thu, 28 Aug 2014 16:47:43 -0700
parents 4feac7e51f42
children c9c416d90a4e
files src/share/vm/classfile/systemDictionary.hpp src/share/vm/classfile/vmSymbols.hpp src/share/vm/graal/graalCodeInstaller.cpp src/share/vm/graal/graalJavaAccess.hpp
diffstat 4 files changed, 17 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/classfile/systemDictionary.hpp	Thu Aug 28 15:43:44 2014 -0700
+++ b/src/share/vm/classfile/systemDictionary.hpp	Thu Aug 28 16:47:43 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 15:43:44 2014 -0700
+++ b/src/share/vm/classfile/vmSymbols.hpp	Thu Aug 28 16:47:43 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 15:43:44 2014 -0700
+++ b/src/share/vm/graal/graalCodeInstaller.cpp	Thu Aug 28 16:47:43 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 15:43:44 2014 -0700
+++ b/src/share/vm/graal/graalJavaAccess.hpp	Thu Aug 28 16:47:43 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)                                                                                                                               \