RFR (S) 8075030: JvmtiEnv::GetObjectSize reports incorrect java.lang.Class instance size

Coleen Phillimore coleen.phillimore at oracle.com
Wed Jun 1 12:39:30 UTC 2016


This seems like a pretty straightforward fix.  I think the special case 
for Class_klass was so that the size of the statics were counted, but 
I'm not sure.  These were the permgen changes to get the same effect but 
it seems like what you have might be closer to what's wanted, since 
statics are in the mirror instance.

http://cr.openjdk.java.net/~coleenp/metadata9/src/share/vm/prims/jvmtiEnv.cpp.udiff.html

Thanks for fixing this and the tests.  The object sizes won't agree 
though if A or B has any statics in it.

Coleen


On 5/31/16 3:40 AM, Aleksey Shipilev wrote:
> Hi,
>
> Please review a tiny fix in GetObjectSize:
>    https://bugs.openjdk.java.net/browse/JDK-8075030
>    http://cr.openjdk.java.net/~shade/8075030/webrev.01/
>
> I think this is a leftover from Metaspace work.
>
> For some reason, JvmtiEnv::GetObjectSize has a special case for
> java.lang.Class: it returns the Klass* size, not the java.lang.Class
> instance size. This is incorrect: Klass* is indeed referenced from
> java.lang.Class.metadata field, but the instance size itself does not
> depend on metadata size. This confuses Instrumentation.getObjectSize users.
>
> Testing: new test; RBT, :hotspot_compiler, :hotspot_gc,
> :hotspot_runtime, :hotspot_serviceability, :hotspot_misc,
> :jdk_management, :jdk_instrument, :jdk_jmx, :jdk_jdi, :svc_tools.
>
> Thanks,
> -Aleksey
>



More information about the hotspot-runtime-dev mailing list