RFC (round 1), JEP draft: Low-level Object layout introspection methods
peter.levart at gmail.com
Sun Aug 16 10:41:51 UTC 2020
Just a thought...
On 8/11/20 12:22 PM, Aleksey Shipilev wrote:
> ...but dislike:
> public static long addressOf(Object obj);
> public static long fieldOffsetOf(Field field);
What exactly is the purpose of "addressOf" method in terms of
information API? Is it used to estimate relative placement of several
objects in the heap to see how they are scattered around which affects
the CPU cache performance when accessing them?
If this is the case, then maybe the method could return a "mangled"
address: the address + some secret random value calculated once for the
whole VM. You could still picture the relative placement of objects with
such value, but could not use it to actually access the data in the
object (although as Roman Kennke already put it, the object address is a
"moving target" today already and so can not be reliably used to access
object data via the returned "long" address anyway).
More information about the jdk-dev