RFR[S] 8005165 Platform-independent C++ vtables for CDS (original) (raw)

Ioi Lam ioi.lam at oracle.com
Wed Mar 8 05:39:43 UTC 2017


On 3/7/17 8:12 PM, Jiangli Zhou wrote:

Hi Ioi,

On Mar 7, 2017, at 5:50 PM, Ioi Lam <ioi.lam at oracle.com_ _<mailto:ioi.lam at oracle.com>> wrote:

On 3/7/17 4:04 PM, Jiangli Zhou wrote: Hi Ioi, Some minor comments/suggestions for the latest changes: You added MetaspaceShared::isvalidmethod(). There is an existing Method::isvalidmethod() function. It might cause confusion for anyone who’s not familiar with the CDS code when trying to determine which isvalidmethod() to use in the future. How about renaming MetaspaceShared::isvalidmethod() to isvalidarchivedmethod() and move it to method.*? I renamed it to MetaspaceShared::isvalidsharedmethod(), to be consistent with existing names such as MetaspaceShared::isinsharedspace(). I don't want to move it to method.cpp because the logic of determining whether the Method's vptr points to the cloned vtable is inside metaspaceShared.cpp Ok. Also, MetaspaceShared::isvalidsharedobject() might be more meaningful if it is rename as MetaspaceShared::isvalidsharedmetadata or MetaspaceShared::isvalidarchivemetadata. There's no MetaspaceShared::isvalidsharedobject(). I think you mean CppVtableCloner::isvalidsharedobject. The meaning of the name is pretty clear: is it a valid shared object of type Using ‘sharedobject’ might be a bit too broad here. We have both shared metadata and shared String objects. This API is used to determine if it is a valid data of the Metadata types that have C++ vtable. Also, I just noticed the implementation doesn’t do any specific ‘isshared’ check. How about changing it to CppVtableCloner::isvalid()?

How about this:

template class CppVtableCloner : public T { ... static bool is_valid_shared_object(const T* obj) { intptr_t* vptr = (intptr_t*)obj; return vptr == _info->cloned_vtable(); } };

bool MetaspaceShared::is_valid_shared_method(const Method* m) { assert(is_in_shared_space(m), "must be"); return CppVtableCloner::is_valid_shared_object(m); }

You can pass in only a Method* to CppVtableCloner::is_valid_shared_object(const Method* obj), so it's pretty clear what "obj" is in this case.

I also added the "is_shared" check as an assert. The caller should call this only after checking that the method is in shared space.

What do you think?

Thanks



More information about the hotspot-dev mailing list