12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
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 #ifndef SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSPROMOTIONMANAGER_INLINE_HPP
26 #define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSPROMOTIONMANAGER_INLINE_HPP
27
28 #include "gc_implementation/parallelScavenge/psOldGen.hpp"
29 #include "gc_implementation/parallelScavenge/psPromotionManager.hpp"
30 #include "gc_implementation/parallelScavenge/psPromotionLAB.inline.hpp"
31 #include "gc_implementation/parallelScavenge/psScavenge.hpp"
32 #include "oops/oop.psgc.inline.hpp"
33
34 inline PSPromotionManager* PSPromotionManager::manager_array(int index) {
35 assert(_manager_array != NULL, "access of NULL manager_array");
36 assert(index >= 0 && index <= (int)ParallelGCThreads, "out of range manager_array access");
37 return &_manager_array[index];
38 }
39
40 template <class T>
41 inline void PSPromotionManager::claim_or_forward_internal_depth(T* p) {
42 if (p != NULL) { // XXX: error if p != NULL here
43 oop o = oopDesc::load_decode_heap_oop_not_null(p);
44 if (o->is_forwarded()) {
45 o = o->forwardee();
46 // Card mark
47 if (PSScavenge::is_obj_in_young(o)) {
48 PSScavenge::card_table()->inline_write_ref_field_gc(p, o);
49 }
50 oopDesc::encode_store_heap_oop_not_null(p, o);
51 } else {
52 push_depth(p);
75 if (lab != NULL) {
76 // Promotion of object through newly allocated PLAB
77 if (gc_tracer->should_report_promotion_in_new_plab_event()) {
78 size_t obj_bytes = obj_size * HeapWordSize;
79 size_t lab_size = lab->capacity();
80 gc_tracer->report_promotion_in_new_plab_event(old_obj->klass(), obj_bytes,
81 age, tenured, lab_size);
82 }
83 } else {
84 // Promotion of object directly to heap
85 if (gc_tracer->should_report_promotion_outside_plab_event()) {
86 size_t obj_bytes = obj_size * HeapWordSize;
87 gc_tracer->report_promotion_outside_plab_event(old_obj->klass(), obj_bytes,
88 age, tenured);
89 }
90 }
91 }
92 }
93
94 inline void PSPromotionManager::push_contents(oop obj) {
95 obj->push_contents(this);
96 }
97 //
98 // This method is pretty bulky. It would be nice to split it up
99 // into smaller submethods, but we need to be careful not to hurt
100 // performance.
101 //
102 template<bool promote_immediately>
103 oop PSPromotionManager::copy_to_survivor_space(oop o) {
104 assert(should_scavenge(&o), "Sanity");
105
106 oop new_obj = NULL;
107
108 // NOTE! We must be very careful with any methods that access the mark
109 // in o. There may be multiple threads racing on it, and it may be forwarded
110 // at any time. Do not use oop methods for accessing the mark!
111 markOop test_mark = o->mark();
112
113 // The same test as "o->is_forwarded()"
114 if (!test_mark->is_marked()) {
115 bool new_obj_is_tenured = false;
|
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
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 #ifndef SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSPROMOTIONMANAGER_INLINE_HPP
26 #define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSPROMOTIONMANAGER_INLINE_HPP
27
28 #include "gc_implementation/parallelScavenge/psOldGen.hpp"
29 #include "gc_implementation/parallelScavenge/psPromotionManager.hpp"
30 #include "gc_implementation/parallelScavenge/psPromotionLAB.inline.hpp"
31 #include "gc_implementation/parallelScavenge/psScavenge.hpp"
32 #include "oops/oop.inline.hpp"
33
34 inline PSPromotionManager* PSPromotionManager::manager_array(int index) {
35 assert(_manager_array != NULL, "access of NULL manager_array");
36 assert(index >= 0 && index <= (int)ParallelGCThreads, "out of range manager_array access");
37 return &_manager_array[index];
38 }
39
40 template <class T>
41 inline void PSPromotionManager::claim_or_forward_internal_depth(T* p) {
42 if (p != NULL) { // XXX: error if p != NULL here
43 oop o = oopDesc::load_decode_heap_oop_not_null(p);
44 if (o->is_forwarded()) {
45 o = o->forwardee();
46 // Card mark
47 if (PSScavenge::is_obj_in_young(o)) {
48 PSScavenge::card_table()->inline_write_ref_field_gc(p, o);
49 }
50 oopDesc::encode_store_heap_oop_not_null(p, o);
51 } else {
52 push_depth(p);
75 if (lab != NULL) {
76 // Promotion of object through newly allocated PLAB
77 if (gc_tracer->should_report_promotion_in_new_plab_event()) {
78 size_t obj_bytes = obj_size * HeapWordSize;
79 size_t lab_size = lab->capacity();
80 gc_tracer->report_promotion_in_new_plab_event(old_obj->klass(), obj_bytes,
81 age, tenured, lab_size);
82 }
83 } else {
84 // Promotion of object directly to heap
85 if (gc_tracer->should_report_promotion_outside_plab_event()) {
86 size_t obj_bytes = obj_size * HeapWordSize;
87 gc_tracer->report_promotion_outside_plab_event(old_obj->klass(), obj_bytes,
88 age, tenured);
89 }
90 }
91 }
92 }
93
94 inline void PSPromotionManager::push_contents(oop obj) {
95 obj->ps_push_contents(this);
96 }
97 //
98 // This method is pretty bulky. It would be nice to split it up
99 // into smaller submethods, but we need to be careful not to hurt
100 // performance.
101 //
102 template<bool promote_immediately>
103 oop PSPromotionManager::copy_to_survivor_space(oop o) {
104 assert(should_scavenge(&o), "Sanity");
105
106 oop new_obj = NULL;
107
108 // NOTE! We must be very careful with any methods that access the mark
109 // in o. There may be multiple threads racing on it, and it may be forwarded
110 // at any time. Do not use oop methods for accessing the mark!
111 markOop test_mark = o->mark();
112
113 // The same test as "o->is_forwarded()"
114 if (!test_mark->is_marked()) {
115 bool new_obj_is_tenured = false;
|