# HG changeset patch # User acorn # Date 1224701288 14400 # Node ID 52e32c8b317e0dc9e758e91b53d022c99eaac0c2 # Parent 443791f333a2656f490b73d9c017f8be895fc574 6761092: jvm crashes when CDS is enabled. Summary: CDS hardcoded max c++ virtual method table increased Reviewed-by: coleenp, xlu, jmasa diff -r 443791f333a2 -r 52e32c8b317e src/share/vm/memory/compactingPermGenGen.hpp --- a/src/share/vm/memory/compactingPermGenGen.hpp Tue Oct 14 10:15:33 2008 -0400 +++ b/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. }; diff -r 443791f333a2 -r 52e32c8b317e src/share/vm/memory/dump.cpp --- a/src/share/vm/memory/dump.cpp Tue Oct 14 10:15:33 2008 -0400 +++ b/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 entry +// Klass2:method1 entry, Klass2:method2 entry, ... Klass2:method entry +// ... +// Klass:method1 entry, Klass:method2 entry, +// ... Klass:method 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: