comparison src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp @ 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 fc2b798ab316
children 190899198332
comparison
equal deleted inserted replaced
6724:36d1d483d5d6 6725:da91efe96a93
1 /* 1 /*
2 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
35 // weak references are sometimes scanned twice; must check 35 // weak references are sometimes scanned twice; must check
36 // that to-space doesn't already contain this object 36 // that to-space doesn't already contain this object
37 if ((HeapWord*)obj < _boundary && !_g->to()->is_in_reserved(obj)) { 37 if ((HeapWord*)obj < _boundary && !_g->to()->is_in_reserved(obj)) {
38 // we need to ensure that it is copied (see comment in 38 // we need to ensure that it is copied (see comment in
39 // ParScanClosure::do_oop_work). 39 // ParScanClosure::do_oop_work).
40 klassOop objK = obj->klass(); 40 Klass* objK = obj->klass();
41 markOop m = obj->mark(); 41 markOop m = obj->mark();
42 oop new_obj; 42 oop new_obj;
43 if (m->is_marked()) { // Contains forwarding pointer. 43 if (m->is_marked()) { // Contains forwarding pointer.
44 new_obj = ParNewGeneration::real_forwardee(obj); 44 new_obj = ParNewGeneration::real_forwardee(obj);
45 } else { 45 } else {
46 size_t obj_sz = obj->size_given_klass(objK->klass_part()); 46 size_t obj_sz = obj->size_given_klass(objK);
47 new_obj = ((ParNewGeneration*)_g)->copy_to_survivor_space(_par_scan_state, 47 new_obj = ((ParNewGeneration*)_g)->copy_to_survivor_space(_par_scan_state,
48 obj, obj_sz, m); 48 obj, obj_sz, m);
49 } 49 }
50 oopDesc::encode_store_heap_oop_not_null(p, new_obj); 50 oopDesc::encode_store_heap_oop_not_null(p, new_obj);
51 } 51 }
98 // We read the klass and mark in this order, so that we can reliably 98 // We read the klass and mark in this order, so that we can reliably
99 // get the size of the object: if the mark we read is not a 99 // get the size of the object: if the mark we read is not a
100 // forwarding pointer, then the klass is valid: the klass is only 100 // forwarding pointer, then the klass is valid: the klass is only
101 // overwritten with an overflow next pointer after the object is 101 // overwritten with an overflow next pointer after the object is
102 // forwarded. 102 // forwarded.
103 klassOop objK = obj->klass(); 103 Klass* objK = obj->klass();
104 markOop m = obj->mark(); 104 markOop m = obj->mark();
105 oop new_obj; 105 oop new_obj;
106 if (m->is_marked()) { // Contains forwarding pointer. 106 if (m->is_marked()) { // Contains forwarding pointer.
107 new_obj = ParNewGeneration::real_forwardee(obj); 107 new_obj = ParNewGeneration::real_forwardee(obj);
108 oopDesc::encode_store_heap_oop_not_null(p, new_obj); 108 oopDesc::encode_store_heap_oop_not_null(p, new_obj);
109 #ifndef PRODUCT
110 if (TraceScavenge) {
111 gclog_or_tty->print_cr("{%s %s ( " PTR_FORMAT " ) " PTR_FORMAT " -> " PTR_FORMAT " (%d)}",
112 "forwarded ",
113 new_obj->klass()->internal_name(), p, obj, new_obj, new_obj->size());
114 }
115 #endif
116
109 } else { 117 } else {
110 size_t obj_sz = obj->size_given_klass(objK->klass_part()); 118 size_t obj_sz = obj->size_given_klass(objK);
111 new_obj = _g->copy_to_survivor_space(_par_scan_state, obj, obj_sz, m); 119 new_obj = _g->copy_to_survivor_space(_par_scan_state, obj, obj_sz, m);
112 oopDesc::encode_store_heap_oop_not_null(p, new_obj); 120 oopDesc::encode_store_heap_oop_not_null(p, new_obj);
113 if (root_scan) { 121 if (root_scan) {
114 // This may have pushed an object. If we have a root 122 // This may have pushed an object. If we have a root
115 // category with a lot of roots, can't let the queue get too 123 // category with a lot of roots, can't let the queue get too
116 // full: 124 // full:
117 (void)_par_scan_state->trim_queues(10 * ParallelGCThreads); 125 (void)_par_scan_state->trim_queues(10 * ParallelGCThreads);
118 } 126 }
119 } 127 }
120 if (gc_barrier) { 128 if (is_scanning_a_klass()) {
129 do_klass_barrier();
130 } else if (gc_barrier) {
121 // Now call parent closure 131 // Now call parent closure
122 par_do_barrier(p); 132 par_do_barrier(p);
123 } 133 }
124 } 134 }
125 } 135 }