1 /* |
1 /* |
2 * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2001, 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. |
37 |
37 |
38 // This must a ifdef'ed because the counting it controls is in a |
38 // This must a ifdef'ed because the counting it controls is in a |
39 // perf-critical inner loop. |
39 // perf-critical inner loop. |
40 #define FILTERINTOCSCLOSURE_DOHISTOGRAMCOUNT 0 |
40 #define FILTERINTOCSCLOSURE_DOHISTOGRAMCOUNT 0 |
41 |
41 |
42 template <class T> inline void FilterIntoCSClosure::do_oop_nv(T* p) { |
42 template <class T> |
|
43 inline void FilterIntoCSClosure::do_oop_nv(T* p) { |
43 T heap_oop = oopDesc::load_heap_oop(p); |
44 T heap_oop = oopDesc::load_heap_oop(p); |
44 if (!oopDesc::is_null(heap_oop) && |
45 if (!oopDesc::is_null(heap_oop) && |
45 _g1->obj_in_cs(oopDesc::decode_heap_oop_not_null(heap_oop))) { |
46 _g1->obj_in_cs(oopDesc::decode_heap_oop_not_null(heap_oop))) { |
46 _oc->do_oop(p); |
47 _oc->do_oop(p); |
47 #if FILTERINTOCSCLOSURE_DOHISTOGRAMCOUNT |
48 #if FILTERINTOCSCLOSURE_DOHISTOGRAMCOUNT |
51 } |
52 } |
52 } |
53 } |
53 |
54 |
54 #define FILTEROUTOFREGIONCLOSURE_DOHISTOGRAMCOUNT 0 |
55 #define FILTEROUTOFREGIONCLOSURE_DOHISTOGRAMCOUNT 0 |
55 |
56 |
56 template <class T> inline void FilterOutOfRegionClosure::do_oop_nv(T* p) { |
57 template <class T> |
|
58 inline void FilterOutOfRegionClosure::do_oop_nv(T* p) { |
57 T heap_oop = oopDesc::load_heap_oop(p); |
59 T heap_oop = oopDesc::load_heap_oop(p); |
58 if (!oopDesc::is_null(heap_oop)) { |
60 if (!oopDesc::is_null(heap_oop)) { |
59 HeapWord* obj_hw = (HeapWord*)oopDesc::decode_heap_oop_not_null(heap_oop); |
61 HeapWord* obj_hw = (HeapWord*)oopDesc::decode_heap_oop_not_null(heap_oop); |
60 if (obj_hw < _r_bottom || obj_hw >= _r_end) { |
62 if (obj_hw < _r_bottom || obj_hw >= _r_end) { |
61 _oc->do_oop(p); |
63 _oc->do_oop(p); |
65 } |
67 } |
66 } |
68 } |
67 } |
69 } |
68 |
70 |
69 // This closure is applied to the fields of the objects that have just been copied. |
71 // This closure is applied to the fields of the objects that have just been copied. |
70 template <class T> inline void G1ParScanClosure::do_oop_nv(T* p) { |
72 template <class T> |
|
73 inline void G1ParScanClosure::do_oop_nv(T* p) { |
71 T heap_oop = oopDesc::load_heap_oop(p); |
74 T heap_oop = oopDesc::load_heap_oop(p); |
72 |
75 |
73 if (!oopDesc::is_null(heap_oop)) { |
76 if (!oopDesc::is_null(heap_oop)) { |
74 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); |
77 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); |
75 if (_g1->in_cset_fast_test(obj)) { |
78 if (_g1->in_cset_fast_test(obj)) { |
94 _par_scan_state->update_rs(_from, p, _par_scan_state->queue_num()); |
97 _par_scan_state->update_rs(_from, p, _par_scan_state->queue_num()); |
95 } |
98 } |
96 } |
99 } |
97 } |
100 } |
98 |
101 |
99 template <class T> inline void G1ParPushHeapRSClosure::do_oop_nv(T* p) { |
102 template <class T> |
|
103 inline void G1ParPushHeapRSClosure::do_oop_nv(T* p) { |
100 T heap_oop = oopDesc::load_heap_oop(p); |
104 T heap_oop = oopDesc::load_heap_oop(p); |
101 |
105 |
102 if (!oopDesc::is_null(heap_oop)) { |
106 if (!oopDesc::is_null(heap_oop)) { |
103 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); |
107 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); |
104 if (_g1->in_cset_fast_test(obj)) { |
108 if (_g1->in_cset_fast_test(obj)) { |
109 _par_scan_state->push_on_queue(p); |
113 _par_scan_state->push_on_queue(p); |
110 } |
114 } |
111 } |
115 } |
112 } |
116 } |
113 |
117 |
114 template <class T> inline void G1CMOopClosure::do_oop_nv(T* p) { |
118 template <class T> |
|
119 inline void G1CMOopClosure::do_oop_nv(T* p) { |
115 assert(_g1h->is_in_g1_reserved((HeapWord*) p), "invariant"); |
120 assert(_g1h->is_in_g1_reserved((HeapWord*) p), "invariant"); |
116 assert(!_g1h->is_on_master_free_list( |
121 assert(!_g1h->is_on_master_free_list( |
117 _g1h->heap_region_containing((HeapWord*) p)), "invariant"); |
122 _g1h->heap_region_containing((HeapWord*) p)), "invariant"); |
118 |
123 |
119 oop obj = oopDesc::load_decode_heap_oop(p); |
124 oop obj = oopDesc::load_decode_heap_oop(p); |
123 _task->task_id(), p, (void*) obj); |
128 _task->task_id(), p, (void*) obj); |
124 } |
129 } |
125 _task->deal_with_reference(obj); |
130 _task->deal_with_reference(obj); |
126 } |
131 } |
127 |
132 |
|
133 template <class T> |
|
134 inline void G1RootRegionScanClosure::do_oop_nv(T* p) { |
|
135 T heap_oop = oopDesc::load_heap_oop(p); |
|
136 if (!oopDesc::is_null(heap_oop)) { |
|
137 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); |
|
138 HeapRegion* hr = _g1h->heap_region_containing((HeapWord*) obj); |
|
139 if (hr != NULL) { |
|
140 _cm->grayRoot(obj, obj->size(), _worker_id, hr); |
|
141 } |
|
142 } |
|
143 } |
|
144 |
128 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1OOPCLOSURES_INLINE_HPP |
145 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1OOPCLOSURES_INLINE_HPP |