RFR(M): 8166562: C2: Suppress relocations in scratch emit.
vladimir.kozlov at oracle.com
Fri Sep 23 21:25:52 UTC 2016
Looks good. I thought about using new type of CodeBlobType but it may need more changes then in your.
On 9/23/16 3:58 AM, Lindenmaier, Goetz wrote:
> 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,
More information about the hotspot-compiler-dev