changeset 1468:e4cd5d2de7e1

Changes to sync with CRI changes.
author Doug Simon <doug.simon@oracle.com>
date Fri, 19 Nov 2010 00:26:51 +0100
parents c0de7306803c
children 52bb06250d35
files c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotRegisterConfig.java c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/VMExitsNative.java c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/server/CompilationServer.java src/share/vm/c1x/c1x_CodeInstaller.cpp src/share/vm/c1x/c1x_TargetMethod.hpp src/share/vm/classfile/systemDictionary.hpp src/share/vm/classfile/vmSymbols.hpp
diffstat 7 files changed, 35 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotRegisterConfig.java	Fri Nov 19 00:26:31 2010 +0100
+++ b/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotRegisterConfig.java	Fri Nov 19 00:26:51 2010 +0100
@@ -67,21 +67,15 @@
     private final CiRegister[] xmmParameterRegisters = {xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7};
     private final CiRegister[] allParameterRegisters;
 
-    public static final CiRegisterSaveArea RSA;
+    public static final CiCalleeSaveArea RSA;
     static {
-        int offset = 0;
         CiRegister[] rsaRegs = {
             rax,  rcx,  rdx,   rbx,   rsp,   rbp,   rsi,   rdi,
             r8,   r9,   r10,   r11,   r12,   r13,   r14,   r15,
             xmm0, xmm1, xmm2,  xmm3,  xmm4,  xmm5,  xmm6,  xmm7,
             xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15
         };
-        Map<CiRegister, Integer> registerOffsets = new HashMap<CiRegister, Integer>(rsaRegs.length);
-        for (CiRegister reg : rsaRegs) {
-            registerOffsets.put(reg, offset);
-            offset += reg.isFpu() ? 16 : 8;
-        }
-        RSA = new CiRegisterSaveArea(offset, registerOffsets, 8);
+        RSA = new CiCalleeSaveArea(-1, rsaRegs, 8);
     }
 
     public HotSpotRegisterConfig(HotSpotVMConfig config) {
@@ -100,13 +94,6 @@
         return getAllocatableRegisters();
     }
 
-    private final CiRegister[] none = {};
-
-    @Override
-    public CiRegister[] getCalleeSaveRegisters() {
-        return none;
-    }
-
     @Override
     public CiRegister getRegister(int index) {
         throw new UnsupportedOperationException();
@@ -202,7 +189,7 @@
         return rsp;
     }
 
-    public CiRegisterSaveArea getRSA() {
+    public CiCalleeSaveArea getCalleeSaveArea() {
         return RSA;
     }
 
@@ -211,7 +198,7 @@
         String res = String.format(
              "Allocatable: " + Arrays.toString(getAllocatableRegisters()) + "%n" +
              "CallerSave:  " + Arrays.toString(getCallerSaveRegisters()) + "%n" +
-             "CalleeSave:  " + Arrays.toString(getCalleeSaveRegisters()) + "%n" +
+             "CalleeSave:  " + getCalleeSaveArea() + "%n" +
              "Scratch:     " + getScratchRegister() + "%n");
         return res;
     }
--- a/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/VMExitsNative.java	Fri Nov 19 00:26:31 2010 +0100
+++ b/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/VMExitsNative.java	Fri Nov 19 00:26:51 2010 +0100
@@ -236,7 +236,7 @@
 
     @Override
     public CiConstant createCiConstantLong(long value) {
-        return new CiConstant(CiKind.Long, value);
+        return CiConstant.forLong(value);
     }
 
     @Override
--- a/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/server/CompilationServer.java	Fri Nov 19 00:26:31 2010 +0100
+++ b/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/server/CompilationServer.java	Fri Nov 19 00:26:51 2010 +0100
@@ -105,7 +105,7 @@
                 if (c.clazz == CiConstant.class) {
                     return CiConstant.forBoxed((CiKind) c.values[0], c.values[1]);
                 } else if (c.clazz == CiDebugInfo.class) {
-                    return new CiDebugInfo((CiCodePos) c.values[0], (byte[]) c.values[2], (byte[]) c.values[3]);
+                    return new CiDebugInfo((CiCodePos) c.values[0], (Long) c.values[2], (CiBitMap) c.values[3]);
                 } else if (c.clazz == CiCodePos.class) {
                     return new CiCodePos((CiCodePos) c.values[0], (RiMethod) c.values[1], (Integer) c.values[2]);
                 }
--- a/src/share/vm/c1x/c1x_CodeInstaller.cpp	Fri Nov 19 00:26:31 2010 +0100
+++ b/src/share/vm/c1x/c1x_CodeInstaller.cpp	Fri Nov 19 00:26:51 2010 +0100
@@ -33,6 +33,7 @@
 XMMRegister XMM_REGS[] = { xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15 };
 const static int NUM_XMM_REGS = sizeof(XMM_REGS) / sizeof(XMMRegister);
 const static int NUM_REGS = NUM_CPU_REGS + NUM_XMM_REGS;
+const static jlong NO_REF_MAP = 0x8000000000000000L;
 
 // convert c1x register indices (as used in oop maps) to hotspot registers
 VMReg get_hotspot_reg(jint c1x_reg) {
@@ -48,15 +49,13 @@
 // creates a hotspot oop map out of the byte arrays provided by CiDebugInfo
 static OopMap* create_oop_map(jint frame_size, jint parameter_count, oop debug_info) {
   OopMap* map = new OopMap(frame_size, parameter_count);
-  arrayOop register_map = (arrayOop) CiDebugInfo::registerRefMap(debug_info);
-  arrayOop frame_map = (arrayOop) CiDebugInfo::frameRefMap(debug_info);
+  jlong register_map = CiDebugInfo::registerRefMap(debug_info);
+  oop frame_map = (oop) CiDebugInfo::frameRefMap(debug_info);
 
-  if (register_map != NULL) {
-    assert(register_map->length() == (NUM_CPU_REGS + 7) / 8, "unexpected register_map length");
-
+  assert(sizeof(register_map) * 8 >= (unsigned) NUM_CPU_REGS, "unexpected register_map length");
+  if (register_map != NO_REF_MAP) {
     for (jint i = 0; i < NUM_CPU_REGS; i++) {
-      unsigned char byte = ((unsigned char*) register_map->base(T_BYTE))[i / 8];
-      bool is_oop = (byte & (1 << (i % 8))) != 0;
+      bool is_oop = (register_map & (1L << i)) != 0;
       VMReg reg = get_hotspot_reg(i);
       if (is_oop) {
         assert(OOP_ALLOWED[i], "this register may never be an oop, register map misaligned?");
@@ -68,11 +67,21 @@
   }
 
   if (frame_size > 0) {
-    assert(frame_map->length() == ((frame_size / HeapWordSize) + 7) / 8, "unexpected frame_map length");
+    assert(CiBitMap::size(frame_map) == frame_size / HeapWordSize, "unexpected frame_map length");
 
     for (jint i = 0; i < frame_size / HeapWordSize; i++) {
-      unsigned char byte = ((unsigned char*) frame_map->base(T_BYTE))[i / 8];
-      bool is_oop = (byte & (1 << (i % 8))) != 0;
+      bool is_oop;
+      if (i < 64) {
+        jlong low = CiBitMap::low(frame_map);
+        is_oop = (low & (1 << i)) != 0;
+      } else {
+        const unsigned int MapWordBits = 64;
+        jint extra_idx = (i - MapWordBits) / MapWordBits;
+        arrayOop extra = (arrayOop) CiBitMap::extra(frame_map);
+        assert(extra_idx >= 0 && extra_idx < extra->length(), "unexpected index");
+        jlong word = ((jlong*) extra->base(T_LONG))[extra_idx];
+        is_oop = (word & (1 << (i % MapWordBits))) != 0;
+      }
       // hotspot stack slots are 4 bytes
       VMReg reg = VMRegImpl::stack2reg(i * 2);
       if (is_oop) {
@@ -82,7 +91,7 @@
       }
     }
   } else {
-    assert(frame_map == NULL || frame_map->length() == 0, "cannot have frame_map for frames with size 0");
+    assert(frame_map == NULL || CiBitMap::size(frame_map) == 0, "cannot have frame_map for frames with size 0");
   }
 
   return map;
--- a/src/share/vm/c1x/c1x_TargetMethod.hpp	Fri Nov 19 00:26:31 2010 +0100
+++ b/src/share/vm/c1x/c1x_TargetMethod.hpp	Fri Nov 19 00:26:51 2010 +0100
@@ -112,8 +112,13 @@
   end_class                                                                             \
   start_class(CiDebugInfo)                                                              \
     oop_field(CiDebugInfo, codePos, "Lcom/sun/cri/ci/CiCodePos;")                       \
-    oop_field(CiDebugInfo, registerRefMap, "[B")                                        \
-    oop_field(CiDebugInfo, frameRefMap, "[B")                                           \
+    long_field(CiDebugInfo, registerRefMap)                                             \
+    oop_field(CiDebugInfo, frameRefMap, "Lcom/sun/cri/ci/CiBitMap;")                    \
+  end_class                                                                             \
+  start_class(CiBitMap)                                                                 \
+    int_field(CiBitMap, size)                                                           \
+    long_field(CiBitMap, low)                                                           \
+    oop_field(CiBitMap, extra, "[J")                                                    \
   end_class                                                                             \
   start_class(CiDebugInfo_Frame)                                                        \
     oop_field(CiDebugInfo_Frame, values, "[Lcom/sun/cri/ci/CiValue;")                   \
--- a/src/share/vm/classfile/systemDictionary.hpp	Fri Nov 19 00:26:31 2010 +0100
+++ b/src/share/vm/classfile/systemDictionary.hpp	Fri Nov 19 00:26:51 2010 +0100
@@ -183,6 +183,7 @@
   template(CiTargetMethod_Safepoint_klass, com_sun_cri_ci_CiTargetMethod_Safepoint,                 Opt) \
   template(CiTargetMethod_ExceptionHandler_klass, com_sun_cri_ci_CiTargetMethod_ExceptionHandler,   Opt) \
   template(CiTargetMethod_Mark_klass,    com_sun_cri_ci_CiTargetMethod_Mark,                        Opt) \
+  template(CiBitMap_klass,               com_sun_cri_ci_CiBitMap,                                   Opt) \
   template(CiDebugInfo_klass,            com_sun_cri_ci_CiDebugInfo,                                Opt) \
   template(CiDebugInfo_Frame_klass,      com_sun_cri_ci_CiDebugInfo_Frame,                          Opt) \
   template(CiValue_klass,                com_sun_cri_ci_CiValue,                                    Opt) \
--- a/src/share/vm/classfile/vmSymbols.hpp	Fri Nov 19 00:26:31 2010 +0100
+++ b/src/share/vm/classfile/vmSymbols.hpp	Fri Nov 19 00:26:51 2010 +0100
@@ -264,6 +264,7 @@
   template(com_sun_cri_ci_CiTargetMethod_Safepoint,   "com/sun/cri/ci/CiTargetMethod$Safepoint")                        \
   template(com_sun_cri_ci_CiTargetMethod_ExceptionHandler, "com/sun/cri/ci/CiTargetMethod$ExceptionHandler")            \
   template(com_sun_cri_ci_CiTargetMethod_Mark,        "com/sun/cri/ci/CiTargetMethod$Mark")                             \
+  template(com_sun_cri_ci_CiBitMap,                   "com/sun/cri/ci/CiBitMap")                                        \
   template(com_sun_cri_ci_CiDebugInfo,                "com/sun/cri/ci/CiDebugInfo")                                     \
   template(com_sun_cri_ci_CiDebugInfo_Frame,          "com/sun/cri/ci/CiDebugInfo$Frame")                               \
   template(com_sun_cri_ci_CiValue,                    "com/sun/cri/ci/CiValue")                                         \