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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
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_PSSCAVENGE_INLINE_HPP
26 #define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSSCAVENGE_INLINE_HPP
27
28 #include "gc_implementation/parallelScavenge/cardTableExtension.hpp"
29 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
30 #include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
31 #include "gc_implementation/parallelScavenge/psScavenge.hpp"
32 #include "memory/iterator.hpp"
33 #include "utilities/globalDefinitions.hpp"
34
35 inline void PSScavenge::save_to_space_top_before_gc() {
36 ParallelScavengeHeap* heap = ParallelScavengeHeap::heap();
37 _to_space_top_before_gc = heap->young_gen()->to_space()->top();
38 }
39
40 template <class T> inline bool PSScavenge::should_scavenge(T* p) {
41 T heap_oop = oopDesc::load_heap_oop(p);
42 return PSScavenge::is_obj_in_young(heap_oop);
43 }
44
45 template <class T>
46 inline bool PSScavenge::should_scavenge(T* p, MutableSpace* to_space) {
47 if (should_scavenge(p)) {
48 oop obj = oopDesc::load_decode_heap_oop_not_null(p);
49 // Skip objects copied to to_space since the scavenge started.
50 HeapWord* const addr = (HeapWord*)obj;
51 return addr < to_space_top_before_gc() || addr >= to_space->end();
146 klass->external_name(),
147 klass->has_modified_oops() ? "true" : "false");
148 }
149 #endif
150
151 if (klass->has_modified_oops()) {
152 // Clean the klass since we're going to scavenge all the metadata.
153 klass->clear_modified_oops();
154
155 // Setup the promotion manager to redirty this klass
156 // if references are left in the young gen.
157 _oop_closure.set_scanned_klass(klass);
158
159 klass->oops_do(&_oop_closure);
160
161 _oop_closure.set_scanned_klass(NULL);
162 }
163 }
164 };
165
166 #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSSCAVENGE_INLINE_HPP
|
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
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_PARALLEL_PSSCAVENGE_INLINE_HPP
26 #define SHARE_VM_GC_PARALLEL_PSSCAVENGE_INLINE_HPP
27
28 #include "gc/parallel/cardTableExtension.hpp"
29 #include "gc/parallel/parallelScavengeHeap.hpp"
30 #include "gc/parallel/psPromotionManager.inline.hpp"
31 #include "gc/parallel/psScavenge.hpp"
32 #include "memory/iterator.hpp"
33 #include "utilities/globalDefinitions.hpp"
34
35 inline void PSScavenge::save_to_space_top_before_gc() {
36 ParallelScavengeHeap* heap = ParallelScavengeHeap::heap();
37 _to_space_top_before_gc = heap->young_gen()->to_space()->top();
38 }
39
40 template <class T> inline bool PSScavenge::should_scavenge(T* p) {
41 T heap_oop = oopDesc::load_heap_oop(p);
42 return PSScavenge::is_obj_in_young(heap_oop);
43 }
44
45 template <class T>
46 inline bool PSScavenge::should_scavenge(T* p, MutableSpace* to_space) {
47 if (should_scavenge(p)) {
48 oop obj = oopDesc::load_decode_heap_oop_not_null(p);
49 // Skip objects copied to to_space since the scavenge started.
50 HeapWord* const addr = (HeapWord*)obj;
51 return addr < to_space_top_before_gc() || addr >= to_space->end();
146 klass->external_name(),
147 klass->has_modified_oops() ? "true" : "false");
148 }
149 #endif
150
151 if (klass->has_modified_oops()) {
152 // Clean the klass since we're going to scavenge all the metadata.
153 klass->clear_modified_oops();
154
155 // Setup the promotion manager to redirty this klass
156 // if references are left in the young gen.
157 _oop_closure.set_scanned_klass(klass);
158
159 klass->oops_do(&_oop_closure);
160
161 _oop_closure.set_scanned_klass(NULL);
162 }
163 }
164 };
165
166 #endif // SHARE_VM_GC_PARALLEL_PSSCAVENGE_INLINE_HPP
|