JDK-6914349 : Load constants from nmethod constant pool using base+offset rather than direct addressing
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris
  • CPU: sparc
  • Submitted: 2010-01-05
  • Updated: 2011-04-18
  • Resolved: 2011-04-18
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7Resolved
Related Reports
Duplicate :  
Description
Currently, floating point constants are loaded from the nmethod constant pool
using the address of the constant directly. For sparc64, this means materializing
a 64-bit address in a register using up to 6 instructions and then dereferencing it.
Each constant has a unique address, so each load must use a different instruction
sequence.  It would be nice to avoid this somehow.

One way to do this, which amounts to using pc-relative addressing, is to change the compiler IR to reference items in the nmethod constant pool via base + offset rather
than directly.  That way, the base address can be CSE'ed by the compiler and stored
in a register, thus avoiding more than one 64-bit address materialization.  The base address can be obtained by making it a relocatable constant or by materializing the nmethod address (or a proxy such as the method entry point) into the method entry IR.

In addition to floating point constants, 64-bit address constants (e.g., oops)
could be stored in the nmethod constant pool.  On some platforms, such as CMT,
a load might be the same speed or faster than issuing 6 instructions.  Depends on
the tradeoff between I$ and D$ occupancy and how much fragmentation might result
in the D$.  We'd expect not much, because D$ line size is 16 bytes and it's unlikely
the program would not use the second half of the line to store something else useful
(like another constant).

Another benefit of storing 64-bit address constants in the nmethod constant pool is
that patching them (oops must be patched when gc moves the referenced object) is much
easier, especially in cases where they must be patched atomically.

Comments
EVALUATION Since 6961690 floating point constants are loaded from the constant table with a constant table base register + offset. On newer hardware (like T4) the RDPC instruction is used to get the constant table base address avoiding the materialization of the address.
18-04-2011