rev 9846 : [mq]: par-scav-patch rev 9847 : 8146987: Improve Parallel GC Full GC by caching results of live_words_in_range() Summary: A large part of time in the parallel scavenge collector is spent finding out the amount of live words within memory ranges to find out where to move an object to. Try to incrementally calculate this value. Reviewed-by: tschatzl, mgerdin Contributed-by: ray alex <sky1young@gmail.com>
1 /* 2 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 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_PSPARALLELCOMPACT_INLINE_HPP 26 #define SHARE_VM_GC_PARALLEL_PSPARALLELCOMPACT_INLINE_HPP 27 28 #include "gc/parallel/parallelScavengeHeap.hpp" 29 #include "gc/parallel/psParallelCompact.hpp" 30 #include "gc/shared/collectedHeap.hpp" 31 #include "oops/klass.hpp" 32 #include "oops/oop.inline.hpp" 33 34 template <class T> 35 inline void PSParallelCompact::adjust_pointer(T* p, ParCompactionManager* cm) { 36 T heap_oop = oopDesc::load_heap_oop(p); 37 if (!oopDesc::is_null(heap_oop)) { 38 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); 39 assert(ParallelScavengeHeap::heap()->is_in(obj), "should be in heap"); 40 41 oop new_obj = (oop)summary_data().calc_new_pointer(obj, cm); 42 assert(new_obj != NULL, // is forwarding ptr? 43 "should be forwarded"); 44 // Just always do the update unconditionally? 45 if (new_obj != NULL) { 46 assert(ParallelScavengeHeap::heap()->is_in_reserved(new_obj), 47 "should be in object space"); 48 oopDesc::encode_store_heap_oop_not_null(p, new_obj); 49 } 50 } 51 } 52 53 template <typename T> 54 void PSParallelCompact::AdjustPointerClosure::do_oop_nv(T* p) { 55 adjust_pointer(p, _cm); 56 } 57 58 inline void PSParallelCompact::AdjustPointerClosure::do_oop(oop* p) { do_oop_nv(p); } 59 inline void PSParallelCompact::AdjustPointerClosure::do_oop(narrowOop* p) { do_oop_nv(p); } 60 61 #endif // SHARE_VM_GC_PARALLEL_PSPARALLELCOMPACT_INLINE_HPP --- EOF ---