# HG changeset patch # User goetz # Date 1453109141 -3600 # Node ID c9500b124211c9377bc057ecbba4fe961166f6b2 # Parent 5660ec824db3fabb9799326119b6965adb6ab214 8146395: Add inline qualifier in oop.hpp and fix inlining in gc files Summary: Fix remaining issues after 8146401. Also fix windows VS2010 linkage problem (g1OopClosures.hpp). Reviewed-by: stefank, mgerdin diff --git a/src/share/vm/gc/cms/cmsCollectorPolicy.cpp b/src/share/vm/gc/cms/cmsCollectorPolicy.cpp --- a/src/share/vm/gc/cms/cmsCollectorPolicy.cpp +++ b/src/share/vm/gc/cms/cmsCollectorPolicy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,6 +35,7 @@ #include "gc/shared/space.hpp" #include "gc/shared/vmGCOperations.hpp" #include "memory/universe.hpp" +#include "oops/oop.inline.hpp" #include "runtime/arguments.hpp" #include "runtime/globals_extension.hpp" #include "runtime/handles.inline.hpp" diff --git a/src/share/vm/gc/cms/cmsOopClosures.hpp b/src/share/vm/gc/cms/cmsOopClosures.hpp --- a/src/share/vm/gc/cms/cmsOopClosures.hpp +++ b/src/share/vm/gc/cms/cmsOopClosures.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,15 +40,9 @@ class ParMarkFromRootsClosure; // Decode the oop and call do_oop on it. -#define DO_OOP_WORK_DEFN \ - void do_oop(oop obj); \ - template inline void do_oop_work(T* p) { \ - T heap_oop = oopDesc::load_heap_oop(p); \ - if (!oopDesc::is_null(heap_oop)) { \ - oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); \ - do_oop(obj); \ - } \ - } +#define DO_OOP_WORK_DEFN \ + void do_oop(oop obj); \ + template inline void do_oop_work(T* p); // TODO: This duplication of the MetadataAwareOopClosure class is only needed // because some CMS OopClosures derive from OopsInGenClosure. It would be @@ -131,8 +125,8 @@ bool concurrent_precleaning); virtual void do_oop(oop* p); virtual void do_oop(narrowOop* p); - inline void do_oop_nv(oop* p) { PushAndMarkClosure::do_oop_work(p); } - inline void do_oop_nv(narrowOop* p) { PushAndMarkClosure::do_oop_work(p); } + inline void do_oop_nv(oop* p); + inline void do_oop_nv(narrowOop* p); }; // In the parallel case, the bit map and the @@ -157,8 +151,8 @@ OopTaskQueue* work_queue); virtual void do_oop(oop* p); virtual void do_oop(narrowOop* p); - inline void do_oop_nv(oop* p) { ParPushAndMarkClosure::do_oop_work(p); } - inline void do_oop_nv(narrowOop* p) { ParPushAndMarkClosure::do_oop_work(p); } + inline void do_oop_nv(oop* p); + inline void do_oop_nv(narrowOop* p); }; // The non-parallel version (the parallel version appears further below). @@ -186,8 +180,8 @@ bool concurrent_precleaning); virtual void do_oop(oop* p); virtual void do_oop(narrowOop* p); - inline void do_oop_nv(oop* p) { MarkRefsIntoAndScanClosure::do_oop_work(p); } - inline void do_oop_nv(narrowOop* p) { MarkRefsIntoAndScanClosure::do_oop_work(p); } + inline void do_oop_nv(oop* p); + inline void do_oop_nv(narrowOop* p); void set_freelistLock(Mutex* m) { _freelistLock = m; @@ -220,8 +214,8 @@ OopTaskQueue* work_queue); virtual void do_oop(oop* p); virtual void do_oop(narrowOop* p); - inline void do_oop_nv(oop* p) { ParMarkRefsIntoAndScanClosure::do_oop_work(p); } - inline void do_oop_nv(narrowOop* p) { ParMarkRefsIntoAndScanClosure::do_oop_work(p); } + inline void do_oop_nv(oop* p); + inline void do_oop_nv(narrowOop* p); void trim_queue(uint size); }; @@ -249,8 +243,8 @@ MarkFromRootsClosure* parent); virtual void do_oop(oop* p); virtual void do_oop(narrowOop* p); - inline void do_oop_nv(oop* p) { PushOrMarkClosure::do_oop_work(p); } - inline void do_oop_nv(narrowOop* p) { PushOrMarkClosure::do_oop_work(p); } + inline void do_oop_nv(oop* p); + inline void do_oop_nv(narrowOop* p); // Deal with a stack overflow condition void handle_stack_overflow(HeapWord* lost); @@ -287,8 +281,8 @@ ParMarkFromRootsClosure* parent); virtual void do_oop(oop* p); virtual void do_oop(narrowOop* p); - inline void do_oop_nv(oop* p) { ParPushOrMarkClosure::do_oop_work(p); } - inline void do_oop_nv(narrowOop* p) { ParPushOrMarkClosure::do_oop_work(p); } + inline void do_oop_nv(oop* p); + inline void do_oop_nv(narrowOop* p); // Deal with a stack overflow condition void handle_stack_overflow(HeapWord* lost); @@ -318,8 +312,8 @@ bool concurrent_precleaning() const { return _concurrent_precleaning; } virtual void do_oop(oop* p); virtual void do_oop(narrowOop* p); - inline void do_oop_nv(oop* p) { CMSKeepAliveClosure::do_oop_work(p); } - inline void do_oop_nv(narrowOop* p) { CMSKeepAliveClosure::do_oop_work(p); } + inline void do_oop_nv(oop* p); + inline void do_oop_nv(narrowOop* p); }; class CMSInnerParMarkAndPushClosure: public MetadataAwareOopClosure { @@ -336,8 +330,8 @@ OopTaskQueue* work_queue); virtual void do_oop(oop* p); virtual void do_oop(narrowOop* p); - inline void do_oop_nv(oop* p) { CMSInnerParMarkAndPushClosure::do_oop_work(p); } - inline void do_oop_nv(narrowOop* p) { CMSInnerParMarkAndPushClosure::do_oop_work(p); } + inline void do_oop_nv(oop* p); + inline void do_oop_nv(narrowOop* p); }; // A parallel (MT) version of the above, used when diff --git a/src/share/vm/gc/cms/cmsOopClosures.inline.hpp b/src/share/vm/gc/cms/cmsOopClosures.inline.hpp --- a/src/share/vm/gc/cms/cmsOopClosures.inline.hpp +++ b/src/share/vm/gc/cms/cmsOopClosures.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,21 +30,6 @@ #include "gc/shared/taskqueue.inline.hpp" #include "oops/oop.inline.hpp" -// Trim our work_queue so its length is below max at return -inline void ParMarkRefsIntoAndScanClosure::trim_queue(uint max) { - while (_work_queue->size() > max) { - oop newOop; - if (_work_queue->pop_local(newOop)) { - assert(newOop->is_oop(), "Expected an oop"); - assert(_bit_map->isMarked((HeapWord*)newOop), - "only grey objects on this stack"); - // iterate over the oops in this oop, marking and pushing - // the ones in CMS heap (i.e. in _span). - newOop->oop_iterate(&_parPushAndMarkClosure); - } - } -} - // MetadataAwareOopClosure and MetadataAwareOopsInGenClosure are duplicated, // until we get rid of OopsInGenClosure. @@ -61,4 +46,48 @@ cld->oops_do(_klass_closure._oop_closure, &_klass_closure, claim); } +// Decode the oop and call do_oop on it. +#define DO_OOP_WORK_IMPL(cls) \ + template void cls::do_oop_work(T* p) { \ + T heap_oop = oopDesc::load_heap_oop(p); \ + if (!oopDesc::is_null(heap_oop)) { \ + oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); \ + do_oop(obj); \ + } \ + } + +#define DO_OOP_WORK_NV_IMPL(cls) \ + DO_OOP_WORK_IMPL(cls) \ + void cls::do_oop_nv(oop* p) { cls::do_oop_work(p); } \ + void cls::do_oop_nv(narrowOop* p) { cls::do_oop_work(p); } + +DO_OOP_WORK_IMPL(MarkRefsIntoClosure) +DO_OOP_WORK_IMPL(ParMarkRefsIntoClosure) +DO_OOP_WORK_IMPL(MarkRefsIntoVerifyClosure) +DO_OOP_WORK_NV_IMPL(PushAndMarkClosure) +DO_OOP_WORK_NV_IMPL(ParPushAndMarkClosure) +DO_OOP_WORK_NV_IMPL(MarkRefsIntoAndScanClosure) +DO_OOP_WORK_NV_IMPL(ParMarkRefsIntoAndScanClosure) + +// Trim our work_queue so its length is below max at return +inline void ParMarkRefsIntoAndScanClosure::trim_queue(uint max) { + while (_work_queue->size() > max) { + oop newOop; + if (_work_queue->pop_local(newOop)) { + assert(newOop->is_oop(), "Expected an oop"); + assert(_bit_map->isMarked((HeapWord*)newOop), + "only grey objects on this stack"); + // iterate over the oops in this oop, marking and pushing + // the ones in CMS heap (i.e. in _span). + newOop->oop_iterate(&_parPushAndMarkClosure); + } + } +} + +DO_OOP_WORK_NV_IMPL(PushOrMarkClosure) +DO_OOP_WORK_NV_IMPL(ParPushOrMarkClosure) +DO_OOP_WORK_NV_IMPL(CMSKeepAliveClosure) +DO_OOP_WORK_NV_IMPL(CMSInnerParMarkAndPushClosure) +DO_OOP_WORK_IMPL(CMSParKeepAliveClosure) + #endif // SHARE_VM_GC_CMS_CMSOOPCLOSURES_INLINE_HPP diff --git a/src/share/vm/gc/cms/compactibleFreeListSpace.cpp b/src/share/vm/gc/cms/compactibleFreeListSpace.cpp --- a/src/share/vm/gc/cms/compactibleFreeListSpace.cpp +++ b/src/share/vm/gc/cms/compactibleFreeListSpace.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -219,6 +219,10 @@ } } +size_t CompactibleFreeListSpace::obj_size(const HeapWord* addr) const { + return adjustObjectSize(oop(addr)->size()); +} + void CompactibleFreeListSpace::resetIndexedFreeListArray() { for (size_t i = 1; i < IndexSetSize; i++) { assert(_indexedFreeList[i].size() == (size_t) i, diff --git a/src/share/vm/gc/cms/compactibleFreeListSpace.hpp b/src/share/vm/gc/cms/compactibleFreeListSpace.hpp --- a/src/share/vm/gc/cms/compactibleFreeListSpace.hpp +++ b/src/share/vm/gc/cms/compactibleFreeListSpace.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -313,9 +313,7 @@ return adjustObjectSize(size); } - inline size_t obj_size(const HeapWord* addr) const { - return adjustObjectSize(oop(addr)->size()); - } + inline size_t obj_size(const HeapWord* addr) const; protected: // Reset the indexed free list to its initial empty condition. diff --git a/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp b/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp --- a/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp +++ b/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -3324,6 +3324,8 @@ } }; +DO_OOP_WORK_IMPL(ParConcMarkingClosure) + // Grey object scanning during work stealing phase -- // the salient assumption here is that any references // that are in these stolen objects being scanned must diff --git a/src/share/vm/gc/cms/parNewGeneration.cpp b/src/share/vm/gc/cms/parNewGeneration.cpp --- a/src/share/vm/gc/cms/parNewGeneration.cpp +++ b/src/share/vm/gc/cms/parNewGeneration.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,7 +29,7 @@ #include "gc/cms/parOopClosures.inline.hpp" #include "gc/serial/defNewGeneration.inline.hpp" #include "gc/shared/adaptiveSizePolicy.hpp" -#include "gc/shared/ageTable.hpp" +#include "gc/shared/ageTable.inline.hpp" #include "gc/shared/copyFailedInfo.hpp" #include "gc/shared/gcHeapSummary.hpp" #include "gc/shared/gcTimer.hpp" diff --git a/src/share/vm/gc/cms/promotionInfo.cpp b/src/share/vm/gc/cms/promotionInfo.cpp --- a/src/share/vm/gc/cms/promotionInfo.cpp +++ b/src/share/vm/gc/cms/promotionInfo.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,6 +34,31 @@ ///////////////////////////////////////////////////////////////////////// +PromotedObject* PromotedObject::next() const { + assert(!((FreeChunk*)this)->is_free(), "Error"); + PromotedObject* res; + if (UseCompressedOops) { + // The next pointer is a compressed oop stored in the top 32 bits + res = (PromotedObject*)oopDesc::decode_heap_oop(_data._narrow_next); + } else { + res = (PromotedObject*)(_next & next_mask); + } + assert(oop(res)->is_oop_or_null(true /* ignore mark word */), "Expected an oop or NULL at " PTR_FORMAT, p2i(oop(res))); + return res; +} + +inline void PromotedObject::setNext(PromotedObject* x) { + assert(((intptr_t)x & ~next_mask) == 0, "Conflict in bit usage, " + "or insufficient alignment of objects"); + if (UseCompressedOops) { + assert(_data._narrow_next == 0, "Overwrite?"); + _data._narrow_next = oopDesc::encode_heap_oop(oop(x)); + } else { + _next |= (intptr_t)x; + } + assert(!((FreeChunk*)this)->is_free(), "Error"); +} + ////////////////////////////////////////////////////////////////////////////// // We go over the list of promoted objects, removing each from the list, // and applying the closure (this may, in turn, add more elements to diff --git a/src/share/vm/gc/cms/promotionInfo.hpp b/src/share/vm/gc/cms/promotionInfo.hpp --- a/src/share/vm/gc/cms/promotionInfo.hpp +++ b/src/share/vm/gc/cms/promotionInfo.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -64,29 +64,8 @@ Data _data; }; public: - inline PromotedObject* next() const { - assert(!((FreeChunk*)this)->is_free(), "Error"); - PromotedObject* res; - if (UseCompressedOops) { - // The next pointer is a compressed oop stored in the top 32 bits - res = (PromotedObject*)oopDesc::decode_heap_oop(_data._narrow_next); - } else { - res = (PromotedObject*)(_next & next_mask); - } - assert(oop(res)->is_oop_or_null(true /* ignore mark word */), "Expected an oop or NULL at " PTR_FORMAT, p2i(oop(res))); - return res; - } - inline void setNext(PromotedObject* x) { - assert(((intptr_t)x & ~next_mask) == 0, "Conflict in bit usage, " - "or insufficient alignment of objects"); - if (UseCompressedOops) { - assert(_data._narrow_next == 0, "Overwrite?"); - _data._narrow_next = oopDesc::encode_heap_oop(oop(x)); - } else { - _next |= (intptr_t)x; - } - assert(!((FreeChunk*)this)->is_free(), "Error"); - } + PromotedObject* next() const; + void setNext(PromotedObject* x); inline void setPromotedMark() { _next |= promoted_mask; assert(!((FreeChunk*)this)->is_free(), "Error"); diff --git a/src/share/vm/gc/g1/concurrentMark.hpp b/src/share/vm/gc/g1/concurrentMark.hpp --- a/src/share/vm/gc/g1/concurrentMark.hpp +++ b/src/share/vm/gc/g1/concurrentMark.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -96,12 +96,7 @@ } // The argument addr should be the start address of a valid object - HeapWord* nextObject(HeapWord* addr) { - oop obj = (oop) addr; - HeapWord* res = addr + obj->size(); - assert(offsetToHeapWord(heapWordToOffset(res)) == res, "sanity"); - return res; - } + inline HeapWord* nextObject(HeapWord* addr); void print_on_error(outputStream* st, const char* prefix) const; @@ -627,14 +622,7 @@ // If marking is not in progress, it's a no-op. void verify_no_cset_oops() PRODUCT_RETURN; - bool isPrevMarked(oop p) const { - assert(p != NULL && p->is_oop(), "expected an oop"); - HeapWord* addr = (HeapWord*)p; - assert(addr >= _prevMarkBitMap->startWord() || - addr < _prevMarkBitMap->endWord(), "in a region"); - - return _prevMarkBitMap->isMarked(addr); - } + inline bool isPrevMarked(oop p) const; inline bool do_yield_check(uint worker_i = 0); diff --git a/src/share/vm/gc/g1/concurrentMark.inline.hpp b/src/share/vm/gc/g1/concurrentMark.inline.hpp --- a/src/share/vm/gc/g1/concurrentMark.inline.hpp +++ b/src/share/vm/gc/g1/concurrentMark.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -185,6 +185,14 @@ return true; } +// The argument addr should be the start address of a valid object +HeapWord* CMBitMapRO::nextObject(HeapWord* addr) { + oop obj = (oop) addr; + HeapWord* res = addr + obj->size(); + assert(offsetToHeapWord(heapWordToOffset(res)) == res, "sanity"); + return res; +} + #define check_mark(addr) \ assert(_bmStartWord <= (addr) && (addr) < (_bmStartWord + _bmWordSize), \ "outside underlying space?"); \ @@ -353,6 +361,15 @@ ((CMBitMap*)_prevMarkBitMap)->mark((HeapWord*) p); } +bool ConcurrentMark::isPrevMarked(oop p) const { + assert(p != NULL && p->is_oop(), "expected an oop"); + HeapWord* addr = (HeapWord*)p; + assert(addr >= _prevMarkBitMap->startWord() || + addr < _prevMarkBitMap->endWord(), "in a region"); + + return _prevMarkBitMap->isMarked(addr); +} + inline void ConcurrentMark::grayRoot(oop obj, size_t word_size, uint worker_id, HeapRegion* hr) { assert(obj != NULL, "pre-condition"); diff --git a/src/share/vm/gc/g1/g1CollectedHeap.cpp b/src/share/vm/gc/g1/g1CollectedHeap.cpp --- a/src/share/vm/gc/g1/g1CollectedHeap.cpp +++ b/src/share/vm/gc/g1/g1CollectedHeap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -60,7 +60,7 @@ #include "gc/shared/gcTraceTime.inline.hpp" #include "gc/shared/generationSpec.hpp" #include "gc/shared/isGCActiveMark.hpp" -#include "gc/shared/referenceProcessor.hpp" +#include "gc/shared/referenceProcessor.inline.hpp" #include "gc/shared/taskqueue.inline.hpp" #include "logging/log.hpp" #include "memory/allocation.hpp" diff --git a/src/share/vm/gc/g1/g1OopClosures.hpp b/src/share/vm/gc/g1/g1OopClosures.hpp --- a/src/share/vm/gc/g1/g1OopClosures.hpp +++ b/src/share/vm/gc/g1/g1OopClosures.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -206,9 +206,9 @@ OopClosure* _c2; public: G1Mux2Closure(OopClosure *c1, OopClosure *c2); - template void do_oop_work(T* p); - virtual void do_oop(oop* p) { do_oop_work(p); } - virtual void do_oop(narrowOop* p) { do_oop_work(p); } + template inline void do_oop_work(T* p); + virtual inline void do_oop(oop* p); + virtual inline void do_oop(narrowOop* p); }; // A closure that returns true if it is actually applied @@ -219,9 +219,9 @@ public: G1TriggerClosure(); bool triggered() const { return _triggered; } - template void do_oop_work(T* p); - virtual void do_oop(oop* p) { do_oop_work(p); } - virtual void do_oop(narrowOop* p) { do_oop_work(p); } + template inline void do_oop_work(T* p); + virtual inline void do_oop(oop* p); + virtual inline void do_oop(narrowOop* p); }; // A closure which uses a triggering closure to determine @@ -232,9 +232,9 @@ OopClosure* _oop_cl; public: G1InvokeIfNotTriggeredClosure(G1TriggerClosure* t, OopClosure* oc); - template void do_oop_work(T* p); - virtual void do_oop(oop* p) { do_oop_work(p); } - virtual void do_oop(narrowOop* p) { do_oop_work(p); } + template inline void do_oop_work(T* p); + virtual inline void do_oop(oop* p); + virtual inline void do_oop(narrowOop* p); }; class G1UpdateRSOrPushRefOopClosure: public OopClosure { @@ -263,9 +263,9 @@ return result; } - template void do_oop_work(T* p); - virtual void do_oop(narrowOop* p) { do_oop_work(p); } - virtual void do_oop(oop* p) { do_oop_work(p); } + template inline void do_oop_work(T* p); + virtual inline void do_oop(narrowOop* p); + virtual inline void do_oop(oop* p); }; #endif // SHARE_VM_GC_G1_G1OOPCLOSURES_HPP diff --git a/src/share/vm/gc/g1/g1OopClosures.inline.hpp b/src/share/vm/gc/g1/g1OopClosures.inline.hpp --- a/src/share/vm/gc/g1/g1OopClosures.inline.hpp +++ b/src/share/vm/gc/g1/g1OopClosures.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -141,12 +141,16 @@ _c1->do_oop(p); _c2->do_oop(p); } +void G1Mux2Closure::do_oop(oop* p) { do_oop_work(p); } +void G1Mux2Closure::do_oop(narrowOop* p) { do_oop_work(p); } template inline void G1TriggerClosure::do_oop_work(T* p) { // Record that this closure was actually applied (triggered). _triggered = true; } +void G1TriggerClosure::do_oop(oop* p) { do_oop_work(p); } +void G1TriggerClosure::do_oop(narrowOop* p) { do_oop_work(p); } template inline void G1InvokeIfNotTriggeredClosure::do_oop_work(T* p) { @@ -154,6 +158,8 @@ _oop_cl->do_oop(p); } } +void G1InvokeIfNotTriggeredClosure::do_oop(oop* p) { do_oop_work(p); } +void G1InvokeIfNotTriggeredClosure::do_oop(narrowOop* p) { do_oop_work(p); } template inline void G1UpdateRSOrPushRefOopClosure::do_oop_work(T* p) { @@ -224,6 +230,8 @@ to->rem_set()->add_reference(p, _worker_i); } } +void G1UpdateRSOrPushRefOopClosure::do_oop(oop* p) { do_oop_work(p); } +void G1UpdateRSOrPushRefOopClosure::do_oop(narrowOop* p) { do_oop_work(p); } template void G1ParCopyHelper::do_klass_barrier(T* p, oop new_obj) { diff --git a/src/share/vm/gc/g1/g1RemSet.cpp b/src/share/vm/gc/g1/g1RemSet.cpp --- a/src/share/vm/gc/g1/g1RemSet.cpp +++ b/src/share/vm/gc/g1/g1RemSet.cpp @@ -34,6 +34,7 @@ #include "gc/g1/g1HotCardCache.hpp" #include "gc/g1/g1OopClosures.inline.hpp" #include "gc/g1/g1RemSet.inline.hpp" +#include "gc/g1/g1SATBCardTableModRefBS.inline.hpp" #include "gc/g1/heapRegion.inline.hpp" #include "gc/g1/heapRegionManager.inline.hpp" #include "gc/g1/heapRegionRemSet.hpp" diff --git a/src/share/vm/gc/g1/g1SATBCardTableModRefBS.cpp b/src/share/vm/gc/g1/g1SATBCardTableModRefBS.cpp --- a/src/share/vm/gc/g1/g1SATBCardTableModRefBS.cpp +++ b/src/share/vm/gc/g1/g1SATBCardTableModRefBS.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include "precompiled.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" -#include "gc/g1/g1SATBCardTableModRefBS.hpp" +#include "gc/g1/g1SATBCardTableModRefBS.inline.hpp" #include "gc/g1/heapRegion.hpp" #include "gc/g1/satbMarkQueue.hpp" #include "gc/shared/memset_with_concurrent_readers.hpp" diff --git a/src/share/vm/gc/g1/g1SATBCardTableModRefBS.hpp b/src/share/vm/gc/g1/g1SATBCardTableModRefBS.hpp --- a/src/share/vm/gc/g1/g1SATBCardTableModRefBS.hpp +++ b/src/share/vm/gc/g1/g1SATBCardTableModRefBS.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -58,20 +58,11 @@ // We export this to make it available in cases where the static // type of the barrier set is known. Note that it is non-virtual. - template inline void inline_write_ref_field_pre(T* field, oop newVal) { - T heap_oop = oopDesc::load_heap_oop(field); - if (!oopDesc::is_null(heap_oop)) { - enqueue(oopDesc::decode_heap_oop(heap_oop)); - } - } + template inline void inline_write_ref_field_pre(T* field, oop newVal); // These are the more general virtual versions. - virtual void write_ref_field_pre_work(oop* field, oop new_val) { - inline_write_ref_field_pre(field, new_val); - } - virtual void write_ref_field_pre_work(narrowOop* field, oop new_val) { - inline_write_ref_field_pre(field, new_val); - } + inline virtual void write_ref_field_pre_work(oop* field, oop new_val); + inline virtual void write_ref_field_pre_work(narrowOop* field, oop new_val); virtual void write_ref_field_pre_work(void* field, oop new_val) { guarantee(false, "Not needed"); } @@ -98,15 +89,7 @@ return (val & (clean_card_mask_val() | claimed_card_val())) == claimed_card_val(); } - void set_card_claimed(size_t card_index) { - jbyte val = _byte_map[card_index]; - if (val == clean_card_val()) { - val = (jbyte)claimed_card_val(); - } else { - val |= (jbyte)claimed_card_val(); - } - _byte_map[card_index] = val; - } + inline void set_card_claimed(size_t card_index); void verify_g1_young_region(MemRegion mr) PRODUCT_RETURN; void g1_mark_as_young(const MemRegion& mr); diff --git a/src/share/vm/gc/g1/g1SATBCardTableModRefBS.inline.hpp b/src/share/vm/gc/g1/g1SATBCardTableModRefBS.inline.hpp new file mode 100644 --- /dev/null +++ b/src/share/vm/gc/g1/g1SATBCardTableModRefBS.inline.hpp @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#ifndef SHARE_VM_GC_G1_G1SATBCARDTABLEMODREFBS_INLINE_HPP +#define SHARE_VM_GC_G1_G1SATBCARDTABLEMODREFBS_INLINE_HPP + +#include "gc/g1/g1SATBCardTableModRefBS.hpp" +#include "oops/oop.inline.hpp" + +// We export this to make it available in cases where the static +// type of the barrier set is known. Note that it is non-virtual. +template void G1SATBCardTableModRefBS::inline_write_ref_field_pre(T* field, oop newVal) { + T heap_oop = oopDesc::load_heap_oop(field); + if (!oopDesc::is_null(heap_oop)) { + enqueue(oopDesc::decode_heap_oop(heap_oop)); + } +} + +// These are the more general virtual versions. +void G1SATBCardTableModRefBS::write_ref_field_pre_work(oop* field, oop new_val) { + inline_write_ref_field_pre(field, new_val); +} +void G1SATBCardTableModRefBS::write_ref_field_pre_work(narrowOop* field, oop new_val) { + inline_write_ref_field_pre(field, new_val); +} + +void G1SATBCardTableModRefBS::set_card_claimed(size_t card_index) { + jbyte val = _byte_map[card_index]; + if (val == clean_card_val()) { + val = (jbyte)claimed_card_val(); + } else { + val |= (jbyte)claimed_card_val(); + } + _byte_map[card_index] = val; +} + +#endif // SHARE_VM_GC_G1_G1SATBCARDTABLEMODREFBS_INLINE_HPP diff --git a/src/share/vm/gc/parallel/asPSYoungGen.cpp b/src/share/vm/gc/parallel/asPSYoungGen.cpp --- a/src/share/vm/gc/parallel/asPSYoungGen.cpp +++ b/src/share/vm/gc/parallel/asPSYoungGen.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ #include "gc/parallel/asPSYoungGen.hpp" #include "gc/parallel/parallelScavengeHeap.hpp" #include "gc/parallel/psMarkSweepDecorator.hpp" -#include "gc/parallel/psScavenge.hpp" +#include "gc/parallel/psScavenge.inline.hpp" #include "gc/parallel/psYoungGen.hpp" #include "gc/shared/gcUtil.hpp" #include "gc/shared/spaceDecorator.hpp" diff --git a/src/share/vm/gc/parallel/cardTableExtension.cpp b/src/share/vm/gc/parallel/cardTableExtension.cpp --- a/src/share/vm/gc/parallel/cardTableExtension.cpp +++ b/src/share/vm/gc/parallel/cardTableExtension.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "gc/parallel/cardTableExtension.hpp" #include "gc/parallel/gcTaskManager.hpp" +#include "gc/parallel/objectStartArray.inline.hpp" #include "gc/parallel/parallelScavengeHeap.hpp" #include "gc/parallel/psPromotionManager.inline.hpp" #include "gc/parallel/psScavenge.hpp" diff --git a/src/share/vm/gc/parallel/objectStartArray.cpp b/src/share/vm/gc/parallel/objectStartArray.cpp --- a/src/share/vm/gc/parallel/objectStartArray.cpp +++ b/src/share/vm/gc/parallel/objectStartArray.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ */ #include "precompiled.hpp" -#include "gc/parallel/objectStartArray.hpp" +#include "gc/parallel/objectStartArray.inline.hpp" #include "gc/shared/cardTableModRefBS.hpp" #include "memory/allocation.inline.hpp" #include "oops/oop.inline.hpp" @@ -123,7 +123,6 @@ memset(_blocks_region.start(), clean_block, _blocks_region.byte_size()); } - bool ObjectStartArray::object_starts_in_range(HeapWord* start_addr, HeapWord* end_addr) const { assert(start_addr <= end_addr, diff --git a/src/share/vm/gc/parallel/objectStartArray.hpp b/src/share/vm/gc/parallel/objectStartArray.hpp --- a/src/share/vm/gc/parallel/objectStartArray.hpp +++ b/src/share/vm/gc/parallel/objectStartArray.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -139,23 +139,7 @@ // a given block. The blocks contain the offset of the last // object in that block. Scroll backwards by one, and the first // object hit should be at the beginning of the block - HeapWord* object_start(HeapWord* addr) const { - assert_covered_region_contains(addr); - jbyte* block = block_for_addr(addr); - HeapWord* scroll_forward = offset_addr_for_block(block--); - while (scroll_forward > addr) { - scroll_forward = offset_addr_for_block(block--); - } - - HeapWord* next = scroll_forward; - while (next <= addr) { - scroll_forward = next; - next += oop(next)->size(); - } - assert(scroll_forward <= addr, "wrong order for current and arg"); - assert(addr <= next, "wrong order for arg and next"); - return scroll_forward; - } + inline HeapWord* object_start(HeapWord* addr) const; bool is_block_allocated(HeapWord* addr) { assert_covered_region_contains(addr); @@ -165,7 +149,6 @@ return true; } -#undef assert_covered_region_contains // Return true if an object starts in the range of heap addresses. // If an object starts at an address corresponding to diff --git a/src/share/vm/gc/parallel/objectStartArray.inline.hpp b/src/share/vm/gc/parallel/objectStartArray.inline.hpp new file mode 100644 --- /dev/null +++ b/src/share/vm/gc/parallel/objectStartArray.inline.hpp @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#ifndef SHARE_VM_GC_PARALLEL_OBJECTSTARTARRAY_INLINE_HPP +#define SHARE_VM_GC_PARALLEL_OBJECTSTARTARRAY_INLINE_HPP + +#include "gc/parallel/objectStartArray.hpp" + +// Optimized for finding the first object that crosses into +// a given block. The blocks contain the offset of the last +// object in that block. Scroll backwards by one, and the first +// object hit should be at the beginning of the block +HeapWord* ObjectStartArray::object_start(HeapWord* addr) const { + assert_covered_region_contains(addr); + jbyte* block = block_for_addr(addr); + HeapWord* scroll_forward = offset_addr_for_block(block--); + while (scroll_forward > addr) { + scroll_forward = offset_addr_for_block(block--); + } + + HeapWord* next = scroll_forward; + while (next <= addr) { + scroll_forward = next; + next += oop(next)->size(); + } + assert(scroll_forward <= addr, "wrong order for current and arg"); + assert(addr <= next, "wrong order for arg and next"); + return scroll_forward; +} + + +#endif // SHARE_VM_GC_PARALLEL_OBJECTSTARTARRAY_INLINE_HPP diff --git a/src/share/vm/gc/parallel/parMarkBitMap.cpp b/src/share/vm/gc/parallel/parMarkBitMap.cpp --- a/src/share/vm/gc/parallel/parMarkBitMap.cpp +++ b/src/share/vm/gc/parallel/parMarkBitMap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include "precompiled.hpp" #include "gc/parallel/parMarkBitMap.hpp" -#include "gc/parallel/psParallelCompact.hpp" +#include "gc/parallel/psParallelCompact.inline.hpp" #include "oops/oop.inline.hpp" #include "runtime/atomic.inline.hpp" #include "runtime/os.hpp" diff --git a/src/share/vm/gc/parallel/parallelScavengeHeap.cpp b/src/share/vm/gc/parallel/parallelScavengeHeap.cpp --- a/src/share/vm/gc/parallel/parallelScavengeHeap.cpp +++ b/src/share/vm/gc/parallel/parallelScavengeHeap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,10 +28,11 @@ #include "gc/parallel/cardTableExtension.hpp" #include "gc/parallel/gcTaskManager.hpp" #include "gc/parallel/generationSizer.hpp" +#include "gc/parallel/objectStartArray.inline.hpp" #include "gc/parallel/parallelScavengeHeap.inline.hpp" #include "gc/parallel/psAdaptiveSizePolicy.hpp" #include "gc/parallel/psMarkSweep.hpp" -#include "gc/parallel/psParallelCompact.hpp" +#include "gc/parallel/psParallelCompact.inline.hpp" #include "gc/parallel/psPromotionManager.hpp" #include "gc/parallel/psScavenge.hpp" #include "gc/parallel/vmPSOperations.hpp" diff --git a/src/share/vm/gc/parallel/psOldGen.cpp b/src/share/vm/gc/parallel/psOldGen.cpp --- a/src/share/vm/gc/parallel/psOldGen.cpp +++ b/src/share/vm/gc/parallel/psOldGen.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,6 +23,7 @@ */ #include "precompiled.hpp" +#include "gc/parallel/objectStartArray.inline.hpp" #include "gc/parallel/parallelScavengeHeap.hpp" #include "gc/parallel/psAdaptiveSizePolicy.hpp" #include "gc/parallel/psMarkSweepDecorator.hpp" diff --git a/src/share/vm/gc/parallel/psParallelCompact.cpp b/src/share/vm/gc/parallel/psParallelCompact.cpp --- a/src/share/vm/gc/parallel/psParallelCompact.cpp +++ b/src/share/vm/gc/parallel/psParallelCompact.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -3169,3 +3169,14 @@ do_addr(addr); return ParMarkBitMap::incomplete; } + +ParMarkBitMapClosure::IterationStatus +FillClosure::do_addr(HeapWord* addr, size_t size) { + CollectedHeap::fill_with_objects(addr, size); + HeapWord* const end = addr + size; + do { + _start_array->allocate_block(addr); + addr += oop(addr)->size(); + } while (addr < end); + return ParMarkBitMap::incomplete; +} diff --git a/src/share/vm/gc/parallel/psParallelCompact.hpp b/src/share/vm/gc/parallel/psParallelCompact.hpp --- a/src/share/vm/gc/parallel/psParallelCompact.hpp +++ b/src/share/vm/gc/parallel/psParallelCompact.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1242,16 +1242,6 @@ #endif // #ifdef ASSERT }; -inline bool PSParallelCompact::mark_obj(oop obj) { - const int obj_size = obj->size(); - if (mark_bitmap()->mark_obj(obj, obj_size)) { - _summary_data.add_obj(obj, obj_size); - return true; - } else { - return false; - } -} - inline bool PSParallelCompact::is_marked(oop obj) { return mark_bitmap()->is_marked(obj); } @@ -1386,9 +1376,8 @@ inline void do_addr(HeapWord* addr); }; -class FillClosure: public ParMarkBitMapClosure -{ -public: +class FillClosure: public ParMarkBitMapClosure { + public: FillClosure(ParCompactionManager* cm, PSParallelCompact::SpaceId space_id) : ParMarkBitMapClosure(PSParallelCompact::mark_bitmap(), cm), _start_array(PSParallelCompact::start_array(space_id)) @@ -1397,17 +1386,9 @@ "cannot use FillClosure in the young gen"); } - virtual IterationStatus do_addr(HeapWord* addr, size_t size) { - CollectedHeap::fill_with_objects(addr, size); - HeapWord* const end = addr + size; - do { - _start_array->allocate_block(addr); - addr += oop(addr)->size(); - } while (addr < end); - return ParMarkBitMap::incomplete; - } + virtual IterationStatus do_addr(HeapWord* addr, size_t size); -private: + private: ObjectStartArray* const _start_array; }; diff --git a/src/share/vm/gc/parallel/psParallelCompact.inline.hpp b/src/share/vm/gc/parallel/psParallelCompact.inline.hpp --- a/src/share/vm/gc/parallel/psParallelCompact.inline.hpp +++ b/src/share/vm/gc/parallel/psParallelCompact.inline.hpp @@ -31,6 +31,16 @@ #include "oops/klass.hpp" #include "oops/oop.inline.hpp" +inline bool PSParallelCompact::mark_obj(oop obj) { + const int obj_size = obj->size(); + if (mark_bitmap()->mark_obj(obj, obj_size)) { + _summary_data.add_obj(obj, obj_size); + return true; + } else { + return false; + } +} + template inline void PSParallelCompact::adjust_pointer(T* p) { T heap_oop = oopDesc::load_heap_oop(p); diff --git a/src/share/vm/gc/parallel/psScavenge.cpp b/src/share/vm/gc/parallel/psScavenge.cpp --- a/src/share/vm/gc/parallel/psScavenge.cpp +++ b/src/share/vm/gc/parallel/psScavenge.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ #include "gc/parallel/parallelScavengeHeap.hpp" #include "gc/parallel/psAdaptiveSizePolicy.hpp" #include "gc/parallel/psMarkSweep.hpp" -#include "gc/parallel/psParallelCompact.hpp" +#include "gc/parallel/psParallelCompact.inline.hpp" #include "gc/parallel/psScavenge.inline.hpp" #include "gc/parallel/psTasks.hpp" #include "gc/shared/collectorPolicy.hpp" @@ -763,6 +763,15 @@ return ParallelScavengeHeap::gc_task_manager(); } +// Adaptive size policy support. When the young generation/old generation +// boundary moves, _young_generation_boundary must be reset +void PSScavenge::set_young_generation_boundary(HeapWord* v) { + _young_generation_boundary = v; + if (UseCompressedOops) { + _young_generation_boundary_compressed = (uintptr_t)oopDesc::encode_heap_oop((oop)v); + } +} + void PSScavenge::initialize() { // Arguments must have been parsed diff --git a/src/share/vm/gc/parallel/psScavenge.hpp b/src/share/vm/gc/parallel/psScavenge.hpp --- a/src/share/vm/gc/parallel/psScavenge.hpp +++ b/src/share/vm/gc/parallel/psScavenge.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -117,12 +117,7 @@ } // Adaptive size policy support. When the young generation/old generation // boundary moves, _young_generation_boundary must be reset - static void set_young_generation_boundary(HeapWord* v) { - _young_generation_boundary = v; - if (UseCompressedOops) { - _young_generation_boundary_compressed = (uintptr_t)oopDesc::encode_heap_oop((oop)v); - } - } + static void set_young_generation_boundary(HeapWord* v); // Called by parallelScavengeHeap to init the tenuring threshold static void initialize(); diff --git a/src/share/vm/gc/serial/defNewGeneration.cpp b/src/share/vm/gc/serial/defNewGeneration.cpp --- a/src/share/vm/gc/serial/defNewGeneration.cpp +++ b/src/share/vm/gc/serial/defNewGeneration.cpp @@ -24,6 +24,7 @@ #include "precompiled.hpp" #include "gc/serial/defNewGeneration.inline.hpp" +#include "gc/shared/ageTable.inline.hpp" #include "gc/shared/cardTableRS.hpp" #include "gc/shared/collectorCounters.hpp" #include "gc/shared/gcHeapSummary.hpp" diff --git a/src/share/vm/gc/shared/ageTable.cpp b/src/share/vm/gc/shared/ageTable.cpp --- a/src/share/vm/gc/shared/ageTable.cpp +++ b/src/share/vm/gc/shared/ageTable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,15 +23,16 @@ */ #include "precompiled.hpp" -#include "gc/shared/ageTable.hpp" +#include "gc/shared/ageTable.inline.hpp" #include "gc/shared/collectedHeap.hpp" #include "gc/shared/collectorPolicy.hpp" #include "gc/shared/gcPolicyCounters.hpp" #include "memory/resourceArea.hpp" #include "logging/log.hpp" +#include "oops/oop.inline.hpp" #include "utilities/copy.hpp" -/* Copyright (c) 1992, 2015, Oracle and/or its affiliates, and Stanford University. +/* Copyright (c) 1992, 2016, Oracle and/or its affiliates, and Stanford University. See the LICENSE file for license information. */ AgeTable::AgeTable(bool global) { diff --git a/src/share/vm/gc/shared/ageTable.hpp b/src/share/vm/gc/shared/ageTable.hpp --- a/src/share/vm/gc/shared/ageTable.hpp +++ b/src/share/vm/gc/shared/ageTable.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,7 +31,7 @@ class GCPolicyCounters; -/* Copyright (c) 1992, 2015, Oracle and/or its affiliates, and Stanford University. +/* Copyright (c) 1992, 2016, Oracle and/or its affiliates, and Stanford University. See the LICENSE file for license information. */ // Age table for adaptive feedback-mediated tenuring (scavenging) @@ -56,9 +56,7 @@ void clear(); // add entry - void add(oop p, size_t oop_size) { - add(p->age(), oop_size); - } + inline void add(oop p, size_t oop_size); void add(uint age, size_t oop_size) { assert(age > 0 && age < table_size, "invalid age of object"); diff --git a/src/share/vm/gc/shared/ageTable.inline.hpp b/src/share/vm/gc/shared/ageTable.inline.hpp new file mode 100644 --- /dev/null +++ b/src/share/vm/gc/shared/ageTable.inline.hpp @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#ifndef SHARE_VM_GC_SHARED_AGETABLE_INLINE_HPP +#define SHARE_VM_GC_SHARED_AGETABLE_INLINE_HPP + +#include "gc/shared/ageTable.hpp" +#include "oops/oop.inline.hpp" + +// add entry +void AgeTable::add(oop p, size_t oop_size) { + add(p->age(), oop_size); +} + +#endif // SHARE_VM_GC_SHARED_AGETABLE_INLINE_HPP diff --git a/src/share/vm/gc/shared/collectedHeap.inline.hpp b/src/share/vm/gc/shared/collectedHeap.inline.hpp --- a/src/share/vm/gc/shared/collectedHeap.inline.hpp +++ b/src/share/vm/gc/shared/collectedHeap.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,7 @@ #include "gc/shared/threadLocalAllocBuffer.inline.hpp" #include "memory/universe.hpp" #include "oops/arrayOop.hpp" +#include "oops/oop.inline.hpp" #include "prims/jvmtiExport.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/thread.inline.hpp" diff --git a/src/share/vm/gc/shared/genOopClosures.hpp b/src/share/vm/gc/shared/genOopClosures.hpp --- a/src/share/vm/gc/shared/genOopClosures.hpp +++ b/src/share/vm/gc/shared/genOopClosures.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -146,23 +146,15 @@ HeapWord* _boundary; ExtendedOopClosure* _cl; protected: - template inline void do_oop_work(T* p) { - T heap_oop = oopDesc::load_heap_oop(p); - if (!oopDesc::is_null(heap_oop)) { - oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); - if ((HeapWord*)obj < _boundary) { - _cl->do_oop(p); - } - } - } + template inline void do_oop_work(T* p); public: FilteringClosure(HeapWord* boundary, ExtendedOopClosure* cl) : ExtendedOopClosure(cl->ref_processor()), _boundary(boundary), _cl(cl) {} virtual void do_oop(oop* p); virtual void do_oop(narrowOop* p); - inline void do_oop_nv(oop* p) { FilteringClosure::do_oop_work(p); } - inline void do_oop_nv(narrowOop* p) { FilteringClosure::do_oop_work(p); } + inline void do_oop_nv(oop* p); + inline void do_oop_nv(narrowOop* p); virtual bool do_metadata() { return do_metadata_nv(); } inline bool do_metadata_nv() { assert(!_cl->do_metadata(), "assumption broken, must change to 'return _cl->do_metadata()'"); return false; } }; diff --git a/src/share/vm/gc/shared/genOopClosures.inline.hpp b/src/share/vm/gc/shared/genOopClosures.inline.hpp --- a/src/share/vm/gc/shared/genOopClosures.inline.hpp +++ b/src/share/vm/gc/shared/genOopClosures.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -124,6 +124,19 @@ inline void FastScanClosure::do_oop_nv(oop* p) { FastScanClosure::do_oop_work(p); } inline void FastScanClosure::do_oop_nv(narrowOop* p) { FastScanClosure::do_oop_work(p); } +template void FilteringClosure::do_oop_work(T* p) { + T heap_oop = oopDesc::load_heap_oop(p); + if (!oopDesc::is_null(heap_oop)) { + oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); + if ((HeapWord*)obj < _boundary) { + _cl->do_oop(p); + } + } +} + +void FilteringClosure::do_oop_nv(oop* p) { FilteringClosure::do_oop_work(p); } +void FilteringClosure::do_oop_nv(narrowOop* p) { FilteringClosure::do_oop_work(p); } + // Note similarity to ScanClosure; the difference is that // the barrier set is taken care of outside this closure. template inline void ScanWeakRefClosure::do_oop_work(T* p) { diff --git a/src/share/vm/gc/shared/referenceProcessor.cpp b/src/share/vm/gc/shared/referenceProcessor.cpp --- a/src/share/vm/gc/shared/referenceProcessor.cpp +++ b/src/share/vm/gc/shared/referenceProcessor.cpp @@ -30,7 +30,7 @@ #include "gc/shared/gcTimer.hpp" #include "gc/shared/gcTraceTime.inline.hpp" #include "gc/shared/referencePolicy.hpp" -#include "gc/shared/referenceProcessor.hpp" +#include "gc/shared/referenceProcessor.inline.hpp" #include "logging/log.hpp" #include "memory/allocation.hpp" #include "oops/oop.inline.hpp" diff --git a/src/share/vm/gc/shared/referenceProcessor.hpp b/src/share/vm/gc/shared/referenceProcessor.hpp --- a/src/share/vm/gc/shared/referenceProcessor.hpp +++ b/src/share/vm/gc/shared/referenceProcessor.hpp @@ -58,23 +58,13 @@ class DiscoveredList { public: DiscoveredList() : _len(0), _compressed_head(0), _oop_head(NULL) { } - oop head() const { - return UseCompressedOops ? oopDesc::decode_heap_oop(_compressed_head) : - _oop_head; - } + inline oop head() const; HeapWord* adr_head() { return UseCompressedOops ? (HeapWord*)&_compressed_head : (HeapWord*)&_oop_head; } - void set_head(oop o) { - if (UseCompressedOops) { - // Must compress the head ptr. - _compressed_head = oopDesc::encode_heap_oop(o); - } else { - _oop_head = o; - } - } - bool is_empty() const { return head() == NULL; } + inline void set_head(oop o); + inline bool is_empty() const; size_t length() { return _len; } void set_length(size_t len) { _len = len; } void inc_length(size_t inc) { _len += inc; assert(_len > 0, "Error"); } @@ -113,22 +103,7 @@ public: inline DiscoveredListIterator(DiscoveredList& refs_list, OopClosure* keep_alive, - BoolObjectClosure* is_alive): - _refs_list(refs_list), - _prev_next(refs_list.adr_head()), - _prev(NULL), - _ref(refs_list.head()), -#ifdef ASSERT - _first_seen(refs_list.head()), -#endif -#ifndef PRODUCT - _processed(0), - _removed(0), -#endif - _next(NULL), - _keep_alive(keep_alive), - _is_alive(is_alive) -{ } + BoolObjectClosure* is_alive); // End Of List. inline bool has_next() const { return _ref != NULL; } diff --git a/src/share/vm/gc/shared/referenceProcessor.inline.hpp b/src/share/vm/gc/shared/referenceProcessor.inline.hpp new file mode 100644 --- /dev/null +++ b/src/share/vm/gc/shared/referenceProcessor.inline.hpp @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#ifndef SHARE_VM_GC_SHARED_REFERENCEPROCESSOR_INLINE_HPP +#define SHARE_VM_GC_SHARED_REFERENCEPROCESSOR_INLINE_HPP + +#include "gc/shared/referenceProcessor.hpp" +#include "oops/oop.inline.hpp" + +oop DiscoveredList::head() const { + return UseCompressedOops ? oopDesc::decode_heap_oop(_compressed_head) : + _oop_head; +} + +void DiscoveredList::set_head(oop o) { + if (UseCompressedOops) { + // Must compress the head ptr. + _compressed_head = oopDesc::encode_heap_oop(o); + } else { + _oop_head = o; + } +} + +bool DiscoveredList::is_empty() const { + return head() == NULL; +} + +DiscoveredListIterator::DiscoveredListIterator(DiscoveredList& refs_list, + OopClosure* keep_alive, + BoolObjectClosure* is_alive): + _refs_list(refs_list), + _prev_next(refs_list.adr_head()), + _prev(NULL), + _ref(refs_list.head()), +#ifdef ASSERT + _first_seen(refs_list.head()), +#endif +#ifndef PRODUCT + _processed(0), + _removed(0), +#endif + _next(NULL), + _keep_alive(keep_alive), + _is_alive(is_alive) { +} + +#endif // SHARE_VM_GC_SHARED_REFERENCEPROCESSOR_INLINE_HPP diff --git a/src/share/vm/gc/shared/space.hpp b/src/share/vm/gc/shared/space.hpp --- a/src/share/vm/gc/shared/space.hpp +++ b/src/share/vm/gc/shared/space.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -360,9 +360,7 @@ return size; } - inline size_t obj_size(const HeapWord* addr) const { - return oop(addr)->size(); - } + inline size_t obj_size(const HeapWord* addr) const; public: CompactibleSpace() : @@ -508,9 +506,7 @@ return true; // Always true, since scan_limit is top } - inline size_t scanned_block_size(const HeapWord* addr) const { - return oop(addr)->size(); - } + inline size_t scanned_block_size(const HeapWord* addr) const; protected: HeapWord* _top; diff --git a/src/share/vm/gc/shared/space.inline.hpp b/src/share/vm/gc/shared/space.inline.hpp --- a/src/share/vm/gc/shared/space.inline.hpp +++ b/src/share/vm/gc/shared/space.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -72,6 +72,10 @@ return _offsets.block_start(p); } +size_t CompactibleSpace::obj_size(const HeapWord* addr) const { + return oop(addr)->size(); +} + template inline void CompactibleSpace::scan_and_forward(SpaceType* space, CompactPoint* cp) { // Compute the new addresses for the live objects and store it in the mark @@ -331,4 +335,9 @@ if (ZapUnusedHeapArea) space->mangle_unused_area(); } } + +size_t ContiguousSpace::scanned_block_size(const HeapWord* addr) const { + return oop(addr)->size(); +} + #endif // SHARE_VM_GC_SHARED_SPACE_INLINE_HPP diff --git a/src/share/vm/memory/heapInspection.cpp b/src/share/vm/memory/heapInspection.cpp --- a/src/share/vm/memory/heapInspection.cpp +++ b/src/share/vm/memory/heapInspection.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,6 +40,14 @@ // HeapInspection +int KlassSizeStats::count(oop x) { + return (HeapWordSize * (((x) != NULL) ? (x)->size() : 0)); +} + +int KlassSizeStats::count_array(objArrayOop x) { + return (HeapWordSize * (((x) != NULL) ? (x)->size() : 0)); +} + inline KlassInfoEntry::~KlassInfoEntry() { if (_subclasses != NULL) { delete _subclasses; diff --git a/src/share/vm/memory/heapInspection.hpp b/src/share/vm/memory/heapInspection.hpp --- a/src/share/vm/memory/heapInspection.hpp +++ b/src/share/vm/memory/heapInspection.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -154,13 +154,9 @@ HEAP_INSPECTION_COLUMNS_DO(DECLARE_KLASS_SIZE_STATS_FIELD) - static int count(oop x) { - return (HeapWordSize * (((x) != NULL) ? (x)->size() : 0)); - } + static int count(oop x); - static int count_array(objArrayOop x) { - return (HeapWordSize * (((x) != NULL) ? (x)->size() : 0)); - } + static int count_array(objArrayOop x); template static int count(T* x) { return (HeapWordSize * ((x) ? (x)->size() : 0)); diff --git a/src/share/vm/oops/markOop.inline.hpp b/src/share/vm/oops/markOop.inline.hpp --- a/src/share/vm/oops/markOop.inline.hpp +++ b/src/share/vm/oops/markOop.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,7 @@ #include "oops/klass.hpp" #include "oops/markOop.hpp" +#include "oops/oop.inline.hpp" #include "runtime/globals.hpp" // Should this header be preserved during GC (when biased locking is enabled)? diff --git a/src/share/vm/oops/objArrayOop.hpp b/src/share/vm/oops/objArrayOop.hpp --- a/src/share/vm/oops/objArrayOop.hpp +++ b/src/share/vm/oops/objArrayOop.hpp @@ -81,7 +81,7 @@ // Accessing oop obj_at(int index) const; - void /*inline*/ obj_at_put(int index, oop value); + void inline obj_at_put(int index, oop value); oop atomic_compare_exchange_oop(int index, oop exchange_value, oop compare_value); diff --git a/src/share/vm/oops/objArrayOop.inline.hpp b/src/share/vm/oops/objArrayOop.inline.hpp --- a/src/share/vm/oops/objArrayOop.inline.hpp +++ b/src/share/vm/oops/objArrayOop.inline.hpp @@ -39,7 +39,7 @@ } } -inline void objArrayOopDesc::obj_at_put(int index, oop value) { +void objArrayOopDesc::obj_at_put(int index, oop value) { if (UseCompressedOops) { oop_store(obj_at_addr(index), value); } else { diff --git a/src/share/vm/oops/oop.hpp b/src/share/vm/oops/oop.hpp --- a/src/share/vm/oops/oop.hpp +++ b/src/share/vm/oops/oop.hpp @@ -82,16 +82,16 @@ // objects during a GC) -- requires a valid klass pointer inline void init_mark(); - /*inline*/ Klass* klass() const; + inline Klass* klass() const; inline Klass* klass_or_null() const volatile; inline Klass** klass_addr(); inline narrowKlass* compressed_klass_addr(); - /*inline*/ void set_klass(Klass* k); + inline void set_klass(Klass* k); // For klass field compression inline int klass_gap() const; - /*inline*/ void set_klass_gap(int z); + inline void set_klass_gap(int z); // For when the klass pointer is being used as a linked list "next" field. inline void set_klass_to_list_ptr(oop k); inline oop list_ptr_from_klass(); @@ -103,7 +103,7 @@ inline bool is_a(Klass* k) const; // Returns the actual oop size of the object - /*inline*/ int size(); + inline int size(); // Sometimes (for complicated concurrency-related reasons), it is useful // to be able to figure out the size of an object knowing its klass. @@ -111,7 +111,7 @@ // type test operations (inlined in oop.inline.hpp) inline bool is_instance() const; - /*inline*/ bool is_array() const; + inline bool is_array() const; inline bool is_objArray() const; inline bool is_typeArray() const; @@ -149,15 +149,15 @@ // These are overloaded for oop and narrowOop as are the other functions // below so that they can be called in template functions. static inline oop decode_heap_oop_not_null(oop v) { return v; } - static /*inline*/ oop decode_heap_oop_not_null(narrowOop v); + static inline oop decode_heap_oop_not_null(narrowOop v); static inline oop decode_heap_oop(oop v) { return v; } - static /*inline*/ oop decode_heap_oop(narrowOop v); + static inline oop decode_heap_oop(narrowOop v); // Encode an oop pointer to a narrow oop. The or_null versions accept // null oop pointer, others do not in order to eliminate the // null checking branches. static inline narrowOop encode_heap_oop_not_null(oop v); - static /*inline*/ narrowOop encode_heap_oop(oop v); + static inline narrowOop encode_heap_oop(oop v); // Load an oop out of the Java heap as is without decoding. // Called by GC to check for null before decoding. @@ -284,8 +284,8 @@ inline bool has_bias_pattern() const; // asserts - /*inline*/ bool is_oop(bool ignore_mark_word = false) const; - /*inline*/ bool is_oop_or_null(bool ignore_mark_word = false) const; + inline bool is_oop(bool ignore_mark_word = false) const; + inline bool is_oop_or_null(bool ignore_mark_word = false) const; #ifndef PRODUCT inline bool is_unlocked_oop() const; #endif @@ -312,7 +312,7 @@ inline oop forwardee() const; // Age of object during scavenge - /*inline*/ uint age() const; + inline uint age() const; inline void incr_age(); // mark-sweep support diff --git a/src/share/vm/oops/oop.inline.hpp b/src/share/vm/oops/oop.inline.hpp --- a/src/share/vm/oops/oop.inline.hpp +++ b/src/share/vm/oops/oop.inline.hpp @@ -100,7 +100,7 @@ set_mark(markOopDesc::prototype_for_object(this)); } -inline Klass* oopDesc::klass() const { +Klass* oopDesc::klass() const { if (UseCompressedClassPointers) { return Klass::decode_klass_not_null(_metadata._compressed_klass); } else { @@ -129,7 +129,7 @@ return &_metadata._compressed_klass; } -inline void oopDesc::set_klass(Klass* k) { +void oopDesc::set_klass(Klass* k) { // since klasses are promoted no store check is needed assert(Universe::is_bootstrapping() || k != NULL, "must be a real Klass*"); assert(Universe::is_bootstrapping() || k->is_klass(), "not a Klass*"); @@ -144,7 +144,7 @@ return *(int*)(((intptr_t)this) + klass_gap_offset_in_bytes()); } -inline void oopDesc::set_klass_gap(int v) { +void oopDesc::set_klass_gap(int v) { if (UseCompressedClassPointers) { *(int*)(((intptr_t)this) + klass_gap_offset_in_bytes()) = v; } @@ -174,7 +174,7 @@ return klass()->is_subtype_of(k); } -inline int oopDesc::size() { +int oopDesc::size() { return size_given_klass(klass()); } @@ -264,7 +264,7 @@ } bool oopDesc::is_instance() const { return klass()->is_instance_klass(); } -inline bool oopDesc::is_array() const { return klass()->is_array_klass(); } +bool oopDesc::is_array() const { return klass()->is_array_klass(); } bool oopDesc::is_objArray() const { return klass()->is_objArray_klass(); } bool oopDesc::is_typeArray() const { return klass()->is_typeArray_klass(); } @@ -298,7 +298,7 @@ return cast_from_oop(obj) % MinObjAlignmentInBytes == 0; } -inline oop oopDesc::decode_heap_oop_not_null(narrowOop v) { +oop oopDesc::decode_heap_oop_not_null(narrowOop v) { assert(!is_null(v), "narrow oop value can never be zero"); address base = Universe::narrow_oop_base(); int shift = Universe::narrow_oop_shift(); @@ -307,7 +307,7 @@ return result; } -inline oop oopDesc::decode_heap_oop(narrowOop v) { +oop oopDesc::decode_heap_oop(narrowOop v) { return is_null(v) ? (oop)NULL : decode_heap_oop_not_null(v); } @@ -325,7 +325,7 @@ return (narrowOop)result; } -inline narrowOop oopDesc::encode_heap_oop(oop v) { +narrowOop oopDesc::encode_heap_oop(oop v) { return (is_null(v)) ? (narrowOop)0 : encode_heap_oop_not_null(v); } @@ -516,7 +516,7 @@ } // used only for asserts -inline bool oopDesc::is_oop(bool ignore_mark_word) const { +bool oopDesc::is_oop(bool ignore_mark_word) const { oop obj = (oop) this; if (!check_obj_alignment(obj)) return false; if (!Universe::heap()->is_in_reserved(obj)) return false; @@ -538,7 +538,7 @@ // used only for asserts -inline bool oopDesc::is_oop_or_null(bool ignore_mark_word) const { +bool oopDesc::is_oop_or_null(bool ignore_mark_word) const { return this == NULL ? true : is_oop(ignore_mark_word); } @@ -620,7 +620,7 @@ } // The following method needs to be MT safe. -inline uint oopDesc::age() const { +uint oopDesc::age() const { assert(!is_forwarded(), "Attempt to read age from forwarded mark"); if (has_displaced_mark()) { return displaced_mark()->age();