RFR(M): 8166562: C2: Suppress relocations in scratch emit.

Lindenmaier, Goetz goetz.lindenmaier at sap.com
Fri Sep 23 10:58:37 UTC 2016


Please review this nice and small improvement to scratch emit. It simplifies
The s390 port considerably, but is completely independent. I introduced
usage of the feature on ppc.   I please need a sponsor.


The C2 compiler needs to know how much space the assembly emitted for a MachNode requires. For many nodes, this is statically specified. Some nodes don't have fixed sizes, as the code emitted depends on flags or even runtime values. To determine the sizes of these, C2 does a scratch emit, i.e., it emits the assembly for the MachNode to a dedicated code buffer and remembers the space needed. In the debug build, this is done on each emit also for nodes with fixed size to verify the fixed size.

The scratch emit buffer does not support relocations. Therefore any code needing relocations must check for scratch emit and skip the relocations if so.

The s390x architecture offers a lot of instructions with pc-relative addressing. We use these to access constants in the constant section of the code buffer. As this section can be resized, these offsets must be able to be relocated. Instead of coding the check whether a scratch emit is happening into all the MachNodes, we mark the scratch emit buffers as such and just skip the relocation in these buffers. This simplifies usage of relocations in a lot of nodes and macroAssembler routines.

Best regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20160923/d434283b/attachment.html>

More information about the hotspot-compiler-dev mailing list