JDK-8166562 : C2: Suppress relocations in scratch emit.
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-09-22
  • Updated: 2016-11-04
  • Resolved: 2016-10-05
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 9
9 b143Fixed
Related Reports
Relates :  
Description
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.
Comments
FC Extension Request Justification: These are basic adaptions needed for the s390x C2 port. Risk: Low. Shared code changes are small. They should not affect any other platform. Proposed Integration Date: As soon as reviewed and approved. Remaining work: only review and integration activity is left This is a small extension to the scratch emit mechanism in C2. The feature can be used on other platforms as well. webrev: http://cr.openjdk.java.net/~goetz/wr16/8166562-scratch_emit/webrev.01/
23-09-2016