changeset 8579:0e3fa1efe9b1

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
author enevill
date Tue, 29 Dec 2015 16:47:34 +0000
parents 86ebc388af0b
children af416790f406
files src/cpu/aarch64/vm/macroAssembler_aarch64.cpp src/cpu/aarch64/vm/relocInfo_aarch64.cpp
diffstat 2 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp	Tue Jan 05 17:40:17 2016 +0000
+++ b/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp	Tue Dec 29 16:47:34 2015 +0000
@@ -684,7 +684,7 @@
   if (cbuf) cbuf->set_insts_mark();
   relocate(entry.rspec());
 #ifdef COMPILER2
-  if (Assembler::reachable_from_branch_at(pc(), entry.target())) {
+  if (!far_branches()) {
     bl(entry.target());
   } else {
     bl(pc());
--- a/src/cpu/aarch64/vm/relocInfo_aarch64.cpp	Tue Jan 05 17:40:17 2016 +0000
+++ b/src/cpu/aarch64/vm/relocInfo_aarch64.cpp	Tue Dec 29 16:47:34 2015 +0000
@@ -67,7 +67,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());
 }