changeset 35847:990c61a50f24

8143608: Don't 64-bit align start of InstanceKlass vtable, itable, and nonstatic_oopmap on 32-bit systems Summary: Removed alignment of these fields. Reviewed-by: coleenp, dholmes, mgerdin
author cjplummer
date Wed, 20 Jan 2016 11:58:09 -0800
parents 82db90419728
children 72ff6dab9572
files hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java hotspot/src/share/vm/oops/arrayKlass.cpp hotspot/src/share/vm/oops/instanceKlass.cpp hotspot/src/share/vm/oops/instanceKlass.hpp
diffstat 8 files changed, 18 insertions(+), 52 deletions(-) [+]
line wrap: on
line diff
--- a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp	Thu Jan 21 14:17:49 2016 +0300
+++ b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp	Wed Jan 20 11:58:09 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2014, 2015, Red Hat Inc. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -910,11 +910,6 @@
   // lea(scan_temp, Address(recv_klass, scan_temp, times_vte_scale, vtable_base));
   lea(scan_temp, Address(recv_klass, scan_temp, Address::lsl(3)));
   add(scan_temp, scan_temp, vtable_base);
-  if (HeapWordsPerLong > 1) {
-    // Round up to align_object_offset boundary
-    // see code for instanceKlass::start_of_itable!
-    round_to(scan_temp, BytesPerLong);
-  }
 
   // Adjust recv_klass by scaled itable_index, so we can free itable_index.
   assert(itableMethodEntry::size() * wordSize == wordSize, "adjust the scaling in the code below");
--- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp	Thu Jan 21 14:17:49 2016 +0300
+++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp	Wed Jan 20 11:58:09 2016 -0800
@@ -2196,22 +2196,10 @@
   // %%% We should store the aligned, prescaled offset in the klassoop.
   // Then the next several instructions would fold away.
 
-  int round_to_unit = ((HeapWordsPerLong > 1) ? BytesPerLong : 0);
   int itb_offset = vtable_base;
-  if (round_to_unit != 0) {
-    // hoist first instruction of round_to(scan_temp, BytesPerLong):
-    itb_offset += round_to_unit - wordSize;
-  }
   int itb_scale = exact_log2(vtableEntry::size() * wordSize);
   sll(scan_temp, itb_scale,  scan_temp);
   add(scan_temp, itb_offset, scan_temp);
-  if (round_to_unit != 0) {
-    // Round up to align_object_offset boundary
-    // see code for InstanceKlass::start_of_itable!
-    // Was: round_to(scan_temp, BytesPerLong);
-    // Hoisted: add(scan_temp, BytesPerLong-1, scan_temp);
-    and3(scan_temp, -round_to_unit, scan_temp);
-  }
   add(recv_klass, scan_temp, scan_temp);
 
   // Adjust recv_klass by scaled itable_index, so we can free itable_index.
--- a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp	Thu Jan 21 14:17:49 2016 +0300
+++ b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp	Wed Jan 20 11:58:09 2016 -0800
@@ -3158,9 +3158,6 @@
   Register Rtemp = O1_flags;
 
   __ ld(O2_Klass, InstanceKlass::vtable_length_offset() * wordSize, Rtemp);
-  if (align_object_offset(1) > 1) {
-    __ round_to(Rtemp, align_object_offset(1));
-  }
   __ sll(Rtemp, LogBytesPerWord, Rtemp);   // Rscratch *= 4;
   if (Assembler::is_simm13(base)) {
     __ add(Rtemp, base, Rtemp);
--- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp	Thu Jan 21 14:17:49 2016 +0300
+++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp	Wed Jan 20 11:58:09 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -5818,11 +5818,6 @@
 
   // %%% Could store the aligned, prescaled offset in the klassoop.
   lea(scan_temp, Address(recv_klass, scan_temp, times_vte_scale, vtable_base));
-  if (HeapWordsPerLong > 1) {
-    // Round up to align_object_offset boundary
-    // see code for InstanceKlass::start_of_itable!
-    round_to(scan_temp, BytesPerLong);
-  }
 
   // Adjust recv_klass by scaled itable_index, so we can free itable_index.
   assert(itableMethodEntry::size() * wordSize == wordSize, "adjust the scaling in the code below");
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java	Thu Jan 21 14:17:49 2016 +0300
+++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java	Wed Jan 20 11:58:09 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -90,7 +90,7 @@
     genericSignatureIndex = new CIntField(type.getCIntegerField("_generic_signature_index"), 0);
     majorVersion         = new CIntField(type.getCIntegerField("_major_version"), 0);
     minorVersion         = new CIntField(type.getCIntegerField("_minor_version"), 0);
-    headerSize           = Oop.alignObjectOffset(type.getSize());
+    headerSize           = type.getSize();
 
     // read field offset constants
     ACCESS_FLAGS_OFFSET            = db.lookupIntConstant("FieldInfo::access_flags_offset").intValue();
@@ -242,8 +242,8 @@
   }
 
   public long getSize() {
-    return Oop.alignObjectSize(getHeaderSize() + Oop.alignObjectOffset(getVtableLen()) +
-                               Oop.alignObjectOffset(getItableLen()) + Oop.alignObjectOffset(getNonstaticOopMapSize()));
+    return Oop.alignObjectSize(getHeaderSize() + getVtableLen() +
+                               getItableLen() + getNonstaticOopMapSize());
   }
 
   public static long getHeaderSize() { return headerSize; }
--- a/hotspot/src/share/vm/oops/arrayKlass.cpp	Thu Jan 21 14:17:49 2016 +0300
+++ b/hotspot/src/share/vm/oops/arrayKlass.cpp	Wed Jan 20 11:58:09 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,11 +42,7 @@
   // If this assert fails, see comments in base_create_array_klass.
   header_size = InstanceKlass::header_size();
   int vtable_len = Universe::base_vtable_size();
-#ifdef _LP64
-  int size = header_size + align_object_offset(vtable_len);
-#else
   int size = header_size + vtable_len;
-#endif
   return align_object_size(size);
 }
 
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp	Thu Jan 21 14:17:49 2016 +0300
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp	Wed Jan 20 11:58:09 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2910,12 +2910,9 @@
   Klass::collect_statistics(sz);
 
   sz->_inst_size  = HeapWordSize * size_helper();
-  sz->_vtab_bytes = HeapWordSize * align_object_offset(vtable_length());
-  sz->_itab_bytes = HeapWordSize * align_object_offset(itable_length());
-  sz->_nonstatic_oopmap_bytes = HeapWordSize *
-        ((is_interface() || is_anonymous()) ?
-         align_object_offset(nonstatic_oop_map_size()) :
-         nonstatic_oop_map_size());
+  sz->_vtab_bytes = HeapWordSize * vtable_length();
+  sz->_itab_bytes = HeapWordSize * itable_length();
+  sz->_nonstatic_oopmap_bytes = HeapWordSize * nonstatic_oop_map_size();
 
   int n = 0;
   n += (sz->_methods_array_bytes         = sz->count_array(methods()));
--- a/hotspot/src/share/vm/oops/instanceKlass.hpp	Thu Jan 21 14:17:49 2016 +0300
+++ b/hotspot/src/share/vm/oops/instanceKlass.hpp	Wed Jan 20 11:58:09 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -927,17 +927,15 @@
   }
 
   // Sizing (in words)
-  static int header_size()            { return align_object_offset(sizeof(InstanceKlass)/HeapWordSize); }
+  static int header_size()            { return sizeof(InstanceKlass)/HeapWordSize; }
 
   static int size(int vtable_length, int itable_length,
                   int nonstatic_oop_map_size,
                   bool is_interface, bool is_anonymous) {
     return align_object_size(header_size() +
-           align_object_offset(vtable_length) +
-           align_object_offset(itable_length) +
-           ((is_interface || is_anonymous) ?
-             align_object_offset(nonstatic_oop_map_size) :
-             nonstatic_oop_map_size) +
+           vtable_length +
+           itable_length +
+           nonstatic_oop_map_size +
            (is_interface ? (int)sizeof(Klass*)/HeapWordSize : 0) +
            (is_anonymous ? (int)sizeof(Klass*)/HeapWordSize : 0));
   }
@@ -955,7 +953,7 @@
   static int vtable_length_offset()   { return offset_of(InstanceKlass, _vtable_len) / HeapWordSize; }
 
   intptr_t* start_of_vtable() const        { return ((intptr_t*)this) + vtable_start_offset(); }
-  intptr_t* start_of_itable() const        { return start_of_vtable() + align_object_offset(vtable_length()); }
+  intptr_t* start_of_itable() const        { return start_of_vtable() + vtable_length(); }
   int  itable_offset_in_words() const { return start_of_itable() - (intptr_t*)this; }
 
   intptr_t* end_of_itable() const          { return start_of_itable() + itable_length(); }
@@ -963,7 +961,7 @@
   address static_field_addr(int offset);
 
   OopMapBlock* start_of_nonstatic_oop_maps() const {
-    return (OopMapBlock*)(start_of_itable() + align_object_offset(itable_length()));
+    return (OopMapBlock*)(start_of_itable() + itable_length());
   }
 
   Klass** end_of_nonstatic_oop_maps() const {