8146286: aarch64: guarantee failures with large code cache sizes on jtreg test java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java
authorenevill
Tue, 29 Dec 2015 16:47:34 +0000
changeset 35159 3ee05e289424
parent 35158 23c52c9c06f5
child 35160 acae4975b367
8146286: aarch64: guarantee failures with large code cache sizes on jtreg test java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java Summary: patch trampoline calls with special case bl to itself which does not cause guarantee failure Reviewed-by: aph
hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp
hotspot/src/cpu/aarch64/vm/relocInfo_aarch64.cpp
--- a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp	Tue Dec 29 18:30:51 2015 +0100
+++ b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp	Tue Dec 29 16:47:34 2015 +0000
@@ -678,7 +678,7 @@
 
   if (cbuf) cbuf->set_insts_mark();
   relocate(entry.rspec());
-  if (Assembler::reachable_from_branch_at(pc(), entry.target())) {
+  if (!far_branches()) {
     bl(entry.target());
   } else {
     bl(pc());
--- a/hotspot/src/cpu/aarch64/vm/relocInfo_aarch64.cpp	Tue Dec 29 18:30:51 2015 +0100
+++ b/hotspot/src/cpu/aarch64/vm/relocInfo_aarch64.cpp	Tue Dec 29 16:47:34 2015 +0000
@@ -66,7 +66,13 @@
     }
   }
   if (orig_addr != NULL) {
-    return MacroAssembler::pd_call_destination(orig_addr);
+    address new_addr = MacroAssembler::pd_call_destination(orig_addr);
+    // If call is branch to self, don't try to relocate it, just leave it
+    // as branch to self. This happens during code generation if the code
+    // buffer expands. It will be relocated to the trampoline above once
+    // code generation is complete.
+    new_addr = (new_addr == orig_addr) ? addr() : new_addr;
+    return new_addr;
   }
   return MacroAssembler::pd_call_destination(addr());
 }