Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8166562

C2: Suppress relocations in scratch emit.


    • Subcomponent:
    • Resolved In Build:


      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.


          Issue Links



              • Assignee:
                goetz Goetz Lindenmaier
                goetz Goetz Lindenmaier
              • Votes:
                0 Vote for this issue
                4 Start watching this issue


                • Created: