RFR: 8143067: aarch64: guarantee failure in javac (adrp out of range in relocation)

Edward Nevill edward.nevill at gmail.com
Tue Nov 17 09:56:24 UTC 2015


Hi,

Please review the following webrev

http://cr.openjdk.java.net/~enevill/8143067/webrev

JIRA Issuel: https://bugs.openjdk.java.net/browse/JDK-8143067

The issue is described in more detail in the JIRA issue but basically
adrp instructions are becoming out of range during code relocation. This
is happening with -Xmx4G (or greater).

The problem is the existing code for adrp() does

 if (offset out of range) {
   generate other code to form address
 } else {
   generate adrp
 }

Unfortunately this not work if the adrp subsequently becomes out of
range due to code relocation, and this cannot be fixed up in a
relocation because it will require more than 1 instruction.

The solution I have adopted is to add a new method far_adrp() which must
be used if the adrp may be out of range of a single adrp instruction.
The existing adrp() has been modified to guarantee that the offset is in
range.

far_adrp() generates either

  adrp Rn, symbol
  nop

if the symbol is initially within range or

  adrp Rn, <part symbol> ; fill in bits 0..31 in Rn
  mov  Rn, <2nd part> << 32 ; fill in bits 32..47

If the symbol subsequently becomes out of range because of a code
relocation the nop in the first form is rewritten as a movk in the 2nd
form.

Tested with jtreg hotspot and langtools

Hotspot before: Test results: passed: 927; failed: 6; error: 11
Hotspot after: Test results: passed: 928; failed: 5; error: 11

Langtools before and after: Test results: passed: 3,326; error: 2

If have also tested it with jtreg/jdk to ensure there were no fatal
errors and tested jtreg/hotspot with a fastdebug version to check the
fix does not cause any assert failure.

Thanks for your help,
Ed.




More information about the hotspot-compiler-dev mailing list