6860920: serialize.cpp shouldn't use objArrayOopDesc::base_offset_in_bytes(T_BYTE)
authortwisti
Mon, 20 Jul 2009 08:20:00 -0700
changeset 3595 d67c151b72a5
parent 3271 4c3a294df59b
child 3596 baa6856ba14e
6860920: serialize.cpp shouldn't use objArrayOopDesc::base_offset_in_bytes(T_BYTE) Summary: serialize.cpp currently uses objArrayOopDesc::base_offset_in_bytes(T_BYTE), which seems to be wrong. Reviewed-by: coleenp, kvn
hotspot/src/share/vm/memory/serialize.cpp
hotspot/src/share/vm/oops/objArrayOop.hpp
hotspot/src/share/vm/opto/library_call.cpp
--- a/hotspot/src/share/vm/memory/serialize.cpp	Fri Jul 17 00:50:55 2009 -0700
+++ b/hotspot/src/share/vm/memory/serialize.cpp	Mon Jul 20 08:20:00 2009 -0700
@@ -51,7 +51,7 @@
   soc->do_tag(arrayOopDesc::base_offset_in_bytes(T_BYTE));
   soc->do_tag(sizeof(constantPoolOopDesc));
   soc->do_tag(sizeof(constantPoolCacheOopDesc));
-  soc->do_tag(objArrayOopDesc::base_offset_in_bytes(T_BYTE));
+  soc->do_tag(objArrayOopDesc::base_offset_in_bytes());
   soc->do_tag(typeArrayOopDesc::base_offset_in_bytes(T_BYTE));
   soc->do_tag(sizeof(symbolOopDesc));
   soc->do_tag(sizeof(klassOopDesc));
--- a/hotspot/src/share/vm/oops/objArrayOop.hpp	Fri Jul 17 00:50:55 2009 -0700
+++ b/hotspot/src/share/vm/oops/objArrayOop.hpp	Mon Jul 20 08:20:00 2009 -0700
@@ -38,6 +38,11 @@
   }
 
  public:
+  // Returns the offset of the first element.
+  static int base_offset_in_bytes() {
+    return arrayOopDesc::base_offset_in_bytes(T_OBJECT);
+  }
+
   // base is the address following the header.
   HeapWord* base() const      { return (HeapWord*) arrayOopDesc::base(T_OBJECT); }
 
--- a/hotspot/src/share/vm/opto/library_call.cpp	Fri Jul 17 00:50:55 2009 -0700
+++ b/hotspot/src/share/vm/opto/library_call.cpp	Mon Jul 20 08:20:00 2009 -0700
@@ -2074,7 +2074,7 @@
 
     // See if it is a narrow oop array.
     if (adr_type->isa_aryptr()) {
-      if (adr_type->offset() >= objArrayOopDesc::base_offset_in_bytes(type)) {
+      if (adr_type->offset() >= objArrayOopDesc::base_offset_in_bytes()) {
         const TypeOopPtr *elem_type = adr_type->is_aryptr()->elem()->isa_oopptr();
         if (elem_type != NULL) {
           sharpened_klass = elem_type->klass();