diff src/share/vm/oops/instanceKlass.hpp @ 974:26b774d693aa

Merge
author acorn
date Wed, 16 Sep 2009 09:10:57 -0400
parents ad6585fd4087 9eebd3ac74cf
children 83c29a26f67c
line wrap: on
line diff
--- a/src/share/vm/oops/instanceKlass.hpp	Fri Sep 04 12:53:02 2009 -0400
+++ b/src/share/vm/oops/instanceKlass.hpp	Wed Sep 16 09:10:57 2009 -0400
@@ -71,7 +71,6 @@
 
 // forward declaration for class -- see below for definition
 class SuperTypeClosure;
-class OopMapBlock;
 class JNIid;
 class jniIdMapBase;
 class BreakpointInfo;
@@ -99,6 +98,29 @@
 };
 #endif  // !PRODUCT
 
+// ValueObjs embedded in klass. Describes where oops are located in instances of
+// this klass.
+class OopMapBlock VALUE_OBJ_CLASS_SPEC {
+ public:
+  // Byte offset of the first oop mapped by this block.
+  int offset() const          { return _offset; }
+  void set_offset(int offset) { _offset = offset; }
+
+  // Number of oops in this block.
+  uint count() const         { return _count; }
+  void set_count(uint count) { _count = count; }
+
+  // sizeof(OopMapBlock) in HeapWords.
+  static const int size_in_words() {
+    return align_size_up(int(sizeof(OopMapBlock)), HeapWordSize) >>
+      LogHeapWordSize;
+  }
+
+ private:
+  int  _offset;
+  uint _count;
+};
+
 class instanceKlass: public Klass {
   friend class VMStructs;
  public:
@@ -200,7 +222,7 @@
   int             _nonstatic_field_size;
   int             _static_field_size;    // number words used by static fields (oop and non-oop) in this klass
   int             _static_oop_field_size;// number of static oop fields in this klass
-  int             _nonstatic_oop_map_size;// number of nonstatic oop-map blocks allocated at end of this klass
+  int             _nonstatic_oop_map_size;// size in words of nonstatic oop map blocks
   int             _class_flags;          // internal class state flags
   u2              _minor_version;        // minor version number of class file
   u2              _major_version;        // major version number of class file
@@ -436,8 +458,16 @@
   void set_source_debug_extension(symbolOop n){ oop_store_without_check((oop*) &_source_debug_extension, (oop) n); }
 
   // nonstatic oop-map blocks
-  int nonstatic_oop_map_size() const        { return _nonstatic_oop_map_size; }
-  void set_nonstatic_oop_map_size(int size) { _nonstatic_oop_map_size = size; }
+  static int nonstatic_oop_map_size(unsigned int oop_map_count) {
+    return oop_map_count * OopMapBlock::size_in_words();
+  }
+  unsigned int nonstatic_oop_map_count() const {
+    return _nonstatic_oop_map_size / OopMapBlock::size_in_words();
+  }
+  int nonstatic_oop_map_size() const { return _nonstatic_oop_map_size; }
+  void set_nonstatic_oop_map_size(int words) {
+    _nonstatic_oop_map_size = words;
+  }
 
   // RedefineClasses() support for previous versions:
   void add_previous_version(instanceKlassHandle ikh, BitMap *emcp_methods,
@@ -852,21 +882,6 @@
 }
 
 
-// ValueObjs embedded in klass. Describes where oops are located in instances of this klass.
-
-class OopMapBlock VALUE_OBJ_CLASS_SPEC {
- private:
-  jushort _offset;    // Offset of first oop in oop-map block
-  jushort _length;    // Length of oop-map block
- public:
-  // Accessors
-  jushort offset() const          { return _offset; }
-  void set_offset(jushort offset) { _offset = offset; }
-
-  jushort length() const          { return _length; }
-  void set_length(jushort length) { _length = length; }
-};
-
 /* JNIid class for jfieldIDs only */
 class JNIid: public CHeapObj {
   friend class VMStructs;