best practices for testing JVM changes that may interact with CDS?

Ioi Lam ioi.lam at oracle.com
Thu Jul 18 17:51:59 PDT 2013


On 07/18/2013 03:48 PM, John Rose wrote:
> On Jul 18, 2013, at 2:15 PM, Ioi Lam <ioi.lam at oracle.com> wrote:
>
>> John, for vtable, do you mean this code?
>>
>> void InstanceKlass::restore_unshareable_info(TRAPS) {
>>    ...
>>    for (int index2 = 0; index2 < num_methods; ++index2) {
>>      methodHandle m(THREAD, methods->at(index2));
>>      m()->link_method(m, CHECK);
>>      // restore method's vtable by calling a virtual function
>>      m->restore_vtable();    /// <<<<<< here??
>>    }
> Perhaps I'm thinking of that bit, which concerns C++ vtables, and doesn't overlap with Klass-to-Method vtables.
>
> Am I just imagining an interaction between CDS and tables containing Method* pointers?

John,

You're right, CDS just messes with C++ vtables, not Java vtables.

The C++ vtables of these types are patched:

void Universe::init_self_patching_vtbl_list(void** list, int count) {
   int n = 0;
   { InstanceKlass o;          add_vtable(list, &n, &o, count); }
   { InstanceClassLoaderKlass o; add_vtable(list, &n, &o, count); }
   { InstanceMirrorKlass o;    add_vtable(list, &n, &o, count); }
   { InstanceRefKlass o;       add_vtable(list, &n, &o, count); }
   { TypeArrayKlass o;         add_vtable(list, &n, &o, count); }
   { ObjArrayKlass o;          add_vtable(list, &n, &o, count); }
   { Method o;                 add_vtable(list, &n, &o, count); }
   { ConstantPool o;           add_vtable(list, &n, &o, count); }
}

I think whole mechanism is gross and should be cleaned up 
(https://jbs.oracle.com/bugs/browse/JDK-8005165), but I never got around 
doing it. In any case, if you add/remove C++ virtual methods in these 
classes, I doubt anything would break. But you never know :-)

Incidentally, I tried removing the m->restore_vtable() call that I 
marked above and nothing seems to break. It seems redundant.

- Ioi








> — John



More information about the hotspot-runtime-dev mailing list