src/share/vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp

Thu, 16 Jun 2011 15:51:57 -0400

author
tonyp
date
Thu, 16 Jun 2011 15:51:57 -0400
changeset 2971
c9ca3f51cf41
parent 2708
1d1603768966
child 3536
95f6641e38e0
permissions
-rw-r--r--

6994322: Remove the is_tlab and is_noref / is_large_noref parameters from the CollectedHeap
Summary: Remove two unused parameters from the mem_allocate() method and update its uses accordingly.
Reviewed-by: stefank, johnc

duke@435 1 /*
trims@2708 2 * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #ifndef SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSSCAVENGE_INLINE_HPP
stefank@2314 26 #define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSSCAVENGE_INLINE_HPP
stefank@2314 27
stefank@2314 28 #include "gc_implementation/parallelScavenge/cardTableExtension.hpp"
stefank@2314 29 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
stefank@2314 30 #include "gc_implementation/parallelScavenge/psPromotionManager.hpp"
stefank@2314 31 #include "gc_implementation/parallelScavenge/psScavenge.hpp"
stefank@2314 32
duke@435 33 inline void PSScavenge::save_to_space_top_before_gc() {
duke@435 34 ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap();
duke@435 35 _to_space_top_before_gc = heap->young_gen()->to_space()->top();
duke@435 36 }
duke@435 37
coleenp@548 38 template <class T> inline bool PSScavenge::should_scavenge(T* p) {
coleenp@548 39 T heap_oop = oopDesc::load_heap_oop(p);
coleenp@548 40 if (oopDesc::is_null(heap_oop)) return false;
coleenp@548 41 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
coleenp@548 42 return PSScavenge::is_obj_in_young((HeapWord*)obj);
duke@435 43 }
duke@435 44
coleenp@548 45 template <class T>
coleenp@548 46 inline bool PSScavenge::should_scavenge(T* p, MutableSpace* to_space) {
duke@435 47 if (should_scavenge(p)) {
coleenp@548 48 oop obj = oopDesc::load_decode_heap_oop_not_null(p);
duke@435 49 // Skip objects copied to to_space since the scavenge started.
coleenp@548 50 HeapWord* const addr = (HeapWord*)obj;
duke@435 51 return addr < to_space_top_before_gc() || addr >= to_space->end();
duke@435 52 }
duke@435 53 return false;
duke@435 54 }
duke@435 55
coleenp@548 56 template <class T>
coleenp@548 57 inline bool PSScavenge::should_scavenge(T* p, bool check_to_space) {
duke@435 58 if (check_to_space) {
coleenp@548 59 ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap();
duke@435 60 return should_scavenge(p, heap->young_gen()->to_space());
duke@435 61 }
duke@435 62 return should_scavenge(p);
duke@435 63 }
duke@435 64
duke@435 65 // Attempt to "claim" oop at p via CAS, push the new obj if successful
duke@435 66 // This version tests the oop* to make sure it is within the heap before
duke@435 67 // attempting marking.
coleenp@548 68 template <class T>
duke@435 69 inline void PSScavenge::copy_and_push_safe_barrier(PSPromotionManager* pm,
coleenp@548 70 T* p) {
coleenp@548 71 assert(should_scavenge(p, true), "revisiting object?");
duke@435 72
coleenp@548 73 oop o = oopDesc::load_decode_heap_oop_not_null(p);
coleenp@548 74 oop new_obj = o->is_forwarded()
coleenp@548 75 ? o->forwardee()
tonyp@2061 76 : pm->copy_to_survivor_space(o);
coleenp@548 77 oopDesc::encode_store_heap_oop_not_null(p, new_obj);
duke@435 78
duke@435 79 // We cannot mark without test, as some code passes us pointers
duke@435 80 // that are outside the heap.
coleenp@548 81 if ((!PSScavenge::is_obj_in_young((HeapWord*)p)) &&
duke@435 82 Universe::heap()->is_in_reserved(p)) {
coleenp@548 83 if (PSScavenge::is_obj_in_young((HeapWord*)new_obj)) {
coleenp@548 84 card_table()->inline_write_ref_field_gc(p, new_obj);
duke@435 85 }
duke@435 86 }
duke@435 87 }
stefank@2314 88
jcoomes@2661 89 class PSScavengeRootsClosure: public OopClosure {
jcoomes@2661 90 private:
jcoomes@2661 91 PSPromotionManager* _promotion_manager;
jcoomes@2661 92
jcoomes@2661 93 protected:
jcoomes@2661 94 template <class T> void do_oop_work(T *p) {
jcoomes@2661 95 if (PSScavenge::should_scavenge(p)) {
jcoomes@2661 96 // We never card mark roots, maybe call a func without test?
jcoomes@2661 97 PSScavenge::copy_and_push_safe_barrier(_promotion_manager, p);
jcoomes@2661 98 }
jcoomes@2661 99 }
jcoomes@2661 100 public:
jcoomes@2661 101 PSScavengeRootsClosure(PSPromotionManager* pm) : _promotion_manager(pm) { }
jcoomes@2661 102 void do_oop(oop* p) { PSScavengeRootsClosure::do_oop_work(p); }
jcoomes@2661 103 void do_oop(narrowOop* p) { PSScavengeRootsClosure::do_oop_work(p); }
jcoomes@2661 104 };
jcoomes@2661 105
stefank@2314 106 #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSSCAVENGE_INLINE_HPP

mercurial