< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahBarrierSetNMethod.cpp

Print this page
*** 21,10 ***
--- 21,11 ---
   * questions.
   *
   */
  
  
+ #include "gc/shenandoah/shenandoahBarrierSetAssembler.hpp"
  #include "gc/shenandoah/shenandoahBarrierSetNMethod.hpp"
  #include "gc/shenandoah/shenandoahClosures.inline.hpp"
  #include "gc/shenandoah/shenandoahCodeRoots.hpp"
  #include "gc/shenandoah/shenandoahHeap.inline.hpp"
  #include "gc/shenandoah/shenandoahLock.hpp"

*** 63,15 ***
--- 64,39 ---
      // since we clear compiled ICs lazily. Returning false
      // will re-resovle the call and update the compiled IC.
      return false;
    }
  
+   bool code_changed = false;
+ 
    // Heal oops
    ShenandoahNMethod::heal_nmethod(nm);
  
+   // Update barriers
+   code_changed |= ShenandoahNMethod::update_barriers(nm);
+ 
    // CodeCache unloading support
    nm->mark_as_maybe_on_stack();
  
+   // Invalidate the entire nmethod once.
+   if (code_changed) {
+     ICache::invalidate_range(nm->code_begin(), nm->code_size());
+   }
+ 
    // Disarm
    ShenandoahNMethod::disarm_nmethod(nm);
    return true;
  }
+ 
+ void ShenandoahBarrierSetNMethod::patch_barrier_relocation(patchable_barrier_Relocation* reloc) {
+ #ifdef COMPILER2
+   if (reloc->target_offset() != 0) {
+     // Already set. This is likely nmethod relocation path, so just trust the existing relocation.
+     return;
+   }
+ 
+   address pc = reloc->addr();
+   address target = ShenandoahBarrierSetAssembler::parse_stub_address(pc);
+   reloc->set_target_offset(target - pc);
+ #endif
+ }
+ 
< prev index next >