< prev index next >

src/hotspot/share/memory/metaspaceClosure.cpp

Print this page




  28 // Update the reference to point to new_loc.
  29 void MetaspaceClosure::Ref::update(address new_loc) const {
  30   log_trace(cds)("Ref: [" PTR_FORMAT "] -> " PTR_FORMAT " => " PTR_FORMAT,
  31                  p2i(mpp()), p2i(obj()), p2i(new_loc));
  32   uintx p = (uintx)new_loc;
  33   p |= flag_bits(); // Make sure the flag bits are copied to the new pointer.
  34   *(address*)mpp() = (address)p;
  35 }
  36 
  37 void MetaspaceClosure::push_impl(MetaspaceClosure::Ref* ref) {
  38   if (_nest_level < MAX_NEST_LEVEL) {
  39     do_push(ref);
  40     delete ref;
  41   } else {
  42     ref->set_next(_pending_refs);
  43     _pending_refs = ref;
  44   }
  45 }
  46 
  47 void MetaspaceClosure::do_push(MetaspaceClosure::Ref* ref) {
  48   if (ref->not_null()) {
  49     bool read_only;
  50     Writability w = ref->writability();
  51     switch (w) {
  52     case _writable:
  53       read_only = false;
  54       break;
  55     case _not_writable:
  56       read_only = true;
  57       break;
  58     default:
  59       assert(w == _default, "must be");
  60       read_only = ref->is_read_only_by_default();
  61     }
  62     _nest_level ++;
  63     if (do_ref(ref, read_only)) { // true means we want to iterate the embedded pointer in <ref>
  64       ref->metaspace_pointers_do(this);
  65     }
  66     _nest_level --;
  67   }
  68 }




  28 // Update the reference to point to new_loc.
  29 void MetaspaceClosure::Ref::update(address new_loc) const {
  30   log_trace(cds)("Ref: [" PTR_FORMAT "] -> " PTR_FORMAT " => " PTR_FORMAT,
  31                  p2i(mpp()), p2i(obj()), p2i(new_loc));
  32   uintx p = (uintx)new_loc;
  33   p |= flag_bits(); // Make sure the flag bits are copied to the new pointer.
  34   *(address*)mpp() = (address)p;
  35 }
  36 
  37 void MetaspaceClosure::push_impl(MetaspaceClosure::Ref* ref) {
  38   if (_nest_level < MAX_NEST_LEVEL) {
  39     do_push(ref);
  40     delete ref;
  41   } else {
  42     ref->set_next(_pending_refs);
  43     _pending_refs = ref;
  44   }
  45 }
  46 
  47 void MetaspaceClosure::do_push(MetaspaceClosure::Ref* ref) {
  48   if (ref->not_null()) { // FIXME: make this configurable, so DynamicArchiveBuilder mark all pointers
  49     bool read_only;
  50     Writability w = ref->writability();
  51     switch (w) {
  52     case _writable:
  53       read_only = false;
  54       break;
  55     case _not_writable:
  56       read_only = true;
  57       break;
  58     default:
  59       assert(w == _default, "must be");
  60       read_only = ref->is_read_only_by_default();
  61     }
  62     _nest_level ++;
  63     if (do_ref(ref, read_only)) { // true means we want to iterate the embedded pointer in <ref>
  64       ref->metaspace_pointers_do(this);
  65     }
  66     _nest_level --;
  67   }
  68 }


< prev index next >