6761092: jvm crashes when CDS is enabled.
authoracorn
Wed, 22 Oct 2008 14:48:08 -0400
changeset 1440 32e1f7935659
parent 1430 16aa7ef1ffa1
child 1441 2d62dcf3c29f
6761092: jvm crashes when CDS is enabled. Summary: CDS hardcoded max c++ virtual method table increased Reviewed-by: coleenp, xlu, jmasa
hotspot/src/share/vm/memory/compactingPermGenGen.hpp
hotspot/src/share/vm/memory/dump.cpp
--- a/hotspot/src/share/vm/memory/compactingPermGenGen.hpp	Tue Oct 14 10:15:33 2008 -0400
+++ b/hotspot/src/share/vm/memory/compactingPermGenGen.hpp	Wed Oct 22 14:48:08 2008 -0400
@@ -100,7 +100,7 @@
 
   enum {
     vtbl_list_size = 16, // number of entries in the shared space vtable list.
-    num_virtuals = 100   // number of virtual methods in Klass (or
+    num_virtuals = 200   // number of virtual methods in Klass (or
                          // subclass) objects, or greater.
   };
 
--- a/hotspot/src/share/vm/memory/dump.cpp	Tue Oct 14 10:15:33 2008 -0400
+++ b/hotspot/src/share/vm/memory/dump.cpp	Wed Oct 22 14:48:08 2008 -0400
@@ -818,6 +818,40 @@
 // across the space while doing this, as that causes the vtables to be
 // patched, undoing our useful work.  Instead, iterate to make a list,
 // then use the list to do the fixing.
+//
+// Our constructed vtables:
+// Dump time:
+//  1. init_self_patching_vtbl_list: table of pointers to current virtual method addrs
+//  2. generate_vtable_methods: create jump table, appended to above vtbl_list
+//  3. PatchKlassVtables: for Klass list, patch the vtable entry to point to jump table
+//     rather than to current vtbl
+// Table layout: NOTE FIXED SIZE
+//   1. vtbl pointers
+//   2. #Klass X #virtual methods per Klass
+//   1 entry for each, in the order:
+//   Klass1:method1 entry, Klass1:method2 entry, ... Klass1:method<num_virtuals> entry
+//   Klass2:method1 entry, Klass2:method2 entry, ... Klass2:method<num_virtuals> entry
+//   ...
+//   Klass<vtbl_list_size>:method1 entry, Klass<vtbl_list_size>:method2 entry,
+//       ... Klass<vtbl_list_size>:method<num_virtuals> entry
+//  Sample entry: (Sparc):
+//   save(sp, -256, sp)
+//   ba,pt common_code
+//   mov XXX, %L0       %L0 gets: Klass index <<8 + method index (note: max method index 255)
+//
+// Restore time:
+//   1. initialize_oops: reserve space for table
+//   2. init_self_patching_vtbl_list: update pointers to NEW virtual method addrs in text
+//
+// Execution time:
+//   First virtual method call for any object of these Klass types:
+//   1. object->klass->klass_part
+//   2. vtable entry for that klass_part points to the jump table entries
+//   3. branches to common_code with %O0/klass_part, %L0: Klass index <<8 + method index
+//   4. common_code:
+//      Get address of new vtbl pointer for this Klass from updated table
+//      Update new vtbl pointer in the Klass: future virtual calls go direct
+//      Jump to method, using new vtbl pointer and method index
 
 class PatchKlassVtables: public ObjectClosure {
 private: