< prev index next >

src/share/vm/gc/g1/g1CodeBlobClosure.cpp

Print this page




  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "code/nmethod.hpp"
  27 #include "gc/g1/g1CodeBlobClosure.hpp"
  28 #include "gc/g1/g1CollectedHeap.inline.hpp"
  29 #include "gc/g1/heapRegion.hpp"
  30 #include "gc/g1/heapRegionRemSet.hpp"
  31 #include "oops/oop.inline.hpp"
  32 
  33 template <typename T>
  34 void G1CodeBlobClosure::HeapRegionGatheringOopClosure::do_oop_work(T* p) {
  35   _work->do_oop(p);
  36   T oop_or_narrowoop = oopDesc::load_heap_oop(p);
  37   if (!oopDesc::is_null(oop_or_narrowoop)) {
  38     oop o = oopDesc::decode_heap_oop_not_null(oop_or_narrowoop);
  39     HeapRegion* hr = _g1h->heap_region_containing_raw(o);
  40     assert(!_g1h->obj_in_cs(o) || hr->rem_set()->strong_code_roots_list_contains(_nm), "if o still in collection set then evacuation failed and nm must already be in the remset");
  41     hr->add_strong_code_root(_nm);
  42   }
  43 }
  44 
  45 void G1CodeBlobClosure::HeapRegionGatheringOopClosure::do_oop(oop* o) {
  46   do_oop_work(o);
  47 }
  48 
  49 void G1CodeBlobClosure::HeapRegionGatheringOopClosure::do_oop(narrowOop* o) {
  50   do_oop_work(o);
  51 }
  52 
  53 void G1CodeBlobClosure::do_code_blob(CodeBlob* cb) {
  54   nmethod* nm = cb->as_nmethod_or_null();
  55   if (nm != NULL) {
  56     if (!nm->test_set_oops_do_mark()) {
  57       _oc.set_nm(nm);
  58       nm->oops_do(&_oc);
  59       nm->fix_oop_relocations();


  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "code/nmethod.hpp"
  27 #include "gc/g1/g1CodeBlobClosure.hpp"
  28 #include "gc/g1/g1CollectedHeap.inline.hpp"
  29 #include "gc/g1/heapRegion.hpp"
  30 #include "gc/g1/heapRegionRemSet.hpp"
  31 #include "oops/oop.inline.hpp"
  32 
  33 template <typename T>
  34 void G1CodeBlobClosure::HeapRegionGatheringOopClosure::do_oop_work(T* p) {
  35   _work->do_oop(p);
  36   T oop_or_narrowoop = oopDesc::load_heap_oop(p);
  37   if (!oopDesc::is_null(oop_or_narrowoop)) {
  38     oop o = oopDesc::decode_heap_oop_not_null(oop_or_narrowoop);
  39     HeapRegion* hr = _g1h->heap_region_containing(o);
  40     assert(!_g1h->obj_in_cs(o) || hr->rem_set()->strong_code_roots_list_contains(_nm), "if o still in collection set then evacuation failed and nm must already be in the remset");
  41     hr->add_strong_code_root(_nm);
  42   }
  43 }
  44 
  45 void G1CodeBlobClosure::HeapRegionGatheringOopClosure::do_oop(oop* o) {
  46   do_oop_work(o);
  47 }
  48 
  49 void G1CodeBlobClosure::HeapRegionGatheringOopClosure::do_oop(narrowOop* o) {
  50   do_oop_work(o);
  51 }
  52 
  53 void G1CodeBlobClosure::do_code_blob(CodeBlob* cb) {
  54   nmethod* nm = cb->as_nmethod_or_null();
  55   if (nm != NULL) {
  56     if (!nm->test_set_oops_do_mark()) {
  57       _oc.set_nm(nm);
  58       nm->oops_do(&_oc);
  59       nm->fix_oop_relocations();
< prev index next >