RFR: 8347431: Update ObjectMonitor comments [v3]

Coleen Phillimore coleenp at openjdk.org
Wed Jan 15 13:42:43 UTC 2025


On Tue, 14 Jan 2025 06:31:38 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> I guess it depends on platform whether the instruction is more efficient without an offset.
>
> Well the point is that with a known zero offset you just have a load of the base address, you don't have to do `base + offset` either explicitly, or as part of an indexed load.

Don't know.  For example, is this instruction more efficient with a zero offset (aarch64)?
  ldr(r0, Address(c_rarg1, BasicObjectLock::obj_offset()));

The ObjectMonitor::metadata_offset() isn't called by our assembly code in c2_MacroAssembler, it's only used in a gtest.  So if the underlying C++ compiler generates better code for the static offset at zero, then having metadata at zero offset makes sense.  I still wonder if we access the metadata more than owner field though.

In any case, I'm not going to change anything unless I find evidence it would be worth changing.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/23042#discussion_r1916669290


More information about the hotspot-runtime-dev mailing list