< 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 ***
      // since we clear compiled ICs lazily. Returning false
      // will re-resovle the call and update the compiled IC.
      return false;
    }
  
!   // Heal oops
!   ShenandoahNMethod::heal_nmethod(nm);
  
    // CodeCache unloading support
    nm->mark_as_maybe_on_stack();
  
    // Disarm
    ShenandoahNMethod::disarm_nmethod(nm);
    return true;
  }
--- 64,40 ---
      // since we clear compiled ICs lazily. Returning false
      // will re-resovle the call and update the compiled IC.
      return false;
    }
  
!   bool changed = false;
! 
+   // Handle oops and barriers.
+   changed |= ShenandoahNMethod::handle_oops(nm);
+   changed |= ShenandoahNMethod::handle_barriers(nm);
+ 
+   // If any code changed, bulk invalidate the entire nmethod.
+   if (changed) {
+     ICache::invalidate_range(nm->code_begin(), nm->code_size());
+   }
  
    // CodeCache unloading support
    nm->mark_as_maybe_on_stack();
  
    // Disarm
    ShenandoahNMethod::disarm_nmethod(nm);
    return true;
  }
+ 
+ void ShenandoahBarrierSetNMethod::finalize_relocations(nmethod* nm) {
+   RelocIterator iter(nm);
+   while (iter.next()) {
+     if (iter.type() == relocInfo::patchable_barrier_type) {
+       patchable_barrier_Relocation* r = iter.patchable_barrier_reloc();
+       if (!r->is_target_offset_resolved()) {
+         address pc = r->addr();
+         address target = ShenandoahBarrierSetAssembler::parse_jump_address(pc);
+         r->set_target_offset(target - nm->code_begin());
+       } else {
+         // Already set. This is likely nmethod relocation, so just trust
+         // the existing relocation data.
+       }
+     }
+   }
+ }
< prev index next >