Mercurial > hg > graal-jvmci-8
diff src/share/vm/gc_implementation/parNew/parNewGeneration.cpp @ 6725:da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author | coleenp |
---|---|
date | Sat, 01 Sep 2012 13:25:18 -0400 |
parents | aaf61e68b255 |
children | 2e6857353b2c |
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp Fri Aug 31 16:39:35 2012 -0700 +++ b/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp Sat Sep 01 13:25:18 2012 -0400 @@ -478,7 +478,7 @@ ParScanClosure::ParScanClosure(ParNewGeneration* g, ParScanThreadState* par_scan_state) : - OopsInGenClosure(g), _par_scan_state(par_scan_state), _g(g) + OopsInKlassOrGenClosure(g), _par_scan_state(par_scan_state), _g(g) { assert(_g->level() == 0, "Optimized for youngest generation"); _boundary = _g->reserved().end(); @@ -607,16 +607,22 @@ par_scan_state.set_young_old_boundary(_young_old_boundary); + KlassScanClosure klass_scan_closure(&par_scan_state.to_space_root_closure(), + gch->rem_set()->klass_rem_set()); + + int so = SharedHeap::SO_AllClasses | SharedHeap::SO_Strings | SharedHeap::SO_CodeCache; + par_scan_state.start_strong_roots(); gch->gen_process_strong_roots(_gen->level(), true, // Process younger gens, if any, // as strong roots. false, // no scope; this is parallel code - false, // not collecting perm generation. - SharedHeap::SO_AllClasses, + true, // is scavenging + SharedHeap::ScanningOption(so), &par_scan_state.to_space_root_closure(), true, // walk *all* scavengable nmethods - &par_scan_state.older_gen_closure()); + &par_scan_state.older_gen_closure(), + &klass_scan_closure); par_scan_state.end_strong_roots(); // "evacuate followers". @@ -1191,6 +1197,16 @@ } assert(new_obj != NULL, "just checking"); +#ifndef PRODUCT + // This code must come after the CAS test, or it will print incorrect + // information. + if (TraceScavenge) { + gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}", + is_in_reserved(new_obj) ? "copying" : "tenuring", + new_obj->klass()->internal_name(), old, new_obj, new_obj->size()); + } +#endif + if (forward_ptr == NULL) { oop obj_to_push = new_obj; if (par_scan_state->should_be_partially_scanned(obj_to_push, old)) { @@ -1303,6 +1319,16 @@ } assert(new_obj != NULL, "just checking"); +#ifndef PRODUCT + // This code must come after the CAS test, or it will print incorrect + // information. + if (TraceScavenge) { + gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}", + is_in_reserved(new_obj) ? "copying" : "tenuring", + new_obj->klass()->internal_name(), old, new_obj, new_obj->size()); + } +#endif + // Now attempt to install the forwarding pointer (atomically). // We have to copy the mark word before overwriting with forwarding // ptr, so we can restore it below in the copy. @@ -1494,7 +1520,7 @@ size_t i = 1; oop cur = prefix; while (i < objsFromOverflow && cur->klass_or_null() != NULL) { - i++; cur = oop(cur->klass()); + i++; cur = cur->list_ptr_from_klass(); } // Reattach remaining (suffix) to overflow list @@ -1505,8 +1531,8 @@ (void) Atomic::cmpxchg_ptr(NULL, &_overflow_list, BUSY); } } else { - assert(cur->klass_or_null() != BUSY, "Error"); - oop suffix = oop(cur->klass()); // suffix will be put back on global list + assert(cur->klass_or_null() != (Klass*)(address)BUSY, "Error"); + oop suffix = cur->list_ptr_from_klass(); // suffix will be put back on global list cur->set_klass_to_list_ptr(NULL); // break off suffix // It's possible that the list is still in the empty(busy) state // we left it in a short while ago; in that case we may be @@ -1527,7 +1553,7 @@ // Find the last item of suffix list oop last = suffix; while (last->klass_or_null() != NULL) { - last = oop(last->klass()); + last = last->list_ptr_from_klass(); } // Atomically prepend suffix to current overflow list observed_overflow_list = _overflow_list; @@ -1551,7 +1577,7 @@ ssize_t n = 0; while (cur != NULL) { oop obj_to_push = cur->forwardee(); - oop next = oop(cur->klass_or_null()); + oop next = cur->list_ptr_from_klass(); cur->set_klass(obj_to_push->klass()); // This may be an array object that is self-forwarded. In that case, the list pointer // space, cur, is not in the Java heap, but rather in the C-heap and should be freed.