annotate src/hotspot/share/gc/shared/plab.inline.hpp @ 52321:31b159f30fb2

8180193: Make marking bitmap code available to other GCs Reviewed-by: shade, stefank
author rkennke
date Wed, 29 Aug 2018 20:15:09 +0200
parents 71c04702a3d5
children 9807daeb47c4
rev   line source
jprovino@30275 1 /*
coleenp@47789 2 * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
jprovino@30275 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
jprovino@30275 4 *
jprovino@30275 5 * This code is free software; you can redistribute it and/or modify it
jprovino@30275 6 * under the terms of the GNU General Public License version 2 only, as
jprovino@30275 7 * published by the Free Software Foundation.
jprovino@30275 8 *
jprovino@30275 9 * This code is distributed in the hope that it will be useful, but WITHOUT
jprovino@30275 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
jprovino@30275 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
jprovino@30275 12 * version 2 for more details (a copy is included in the LICENSE file that
jprovino@30275 13 * accompanied this code).
jprovino@30275 14 *
jprovino@30275 15 * You should have received a copy of the GNU General Public License version
jprovino@30275 16 * 2 along with this work; if not, write to the Free Software Foundation,
jprovino@30275 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
jprovino@30275 18 *
jprovino@30275 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
jprovino@30275 20 * or visit www.oracle.com if you need additional information or have any
jprovino@30275 21 * questions.
jprovino@30275 22 *
jprovino@30275 23 */
jprovino@30275 24
pliden@30764 25 #ifndef SHARE_VM_GC_SHARED_PLAB_INLINE_HPP
pliden@30764 26 #define SHARE_VM_GC_SHARED_PLAB_INLINE_HPP
jprovino@30275 27
pliden@30764 28 #include "gc/shared/collectedHeap.inline.hpp"
pliden@30764 29 #include "gc/shared/plab.hpp"
tschatzl@32379 30 #include "memory/allocation.inline.hpp"
dholmes@40655 31 #include "runtime/atomic.hpp"
jprovino@30275 32
tschatzl@32378 33 inline HeapWord* PLAB::allocate_aligned(size_t word_sz, unsigned short alignment_in_bytes) {
jprovino@30275 34 HeapWord* res = CollectedHeap::align_allocation_or_fail(_top, _end, alignment_in_bytes);
jprovino@30275 35 if (res == NULL) {
jprovino@30275 36 return NULL;
jprovino@30275 37 }
jprovino@30275 38
jprovino@30275 39 // Set _top so that allocate(), which expects _top to be correctly set,
jprovino@30275 40 // can be used below.
jprovino@30275 41 _top = res;
jprovino@30275 42 return allocate(word_sz);
jprovino@30275 43 }
jprovino@30275 44
tschatzl@32378 45 void PLABStats::add_allocated(size_t v) {
coleenp@47789 46 Atomic::add(v, &_allocated);
tschatzl@32378 47 }
tschatzl@32378 48
tschatzl@32378 49 void PLABStats::add_unused(size_t v) {
coleenp@47789 50 Atomic::add(v, &_unused);
tschatzl@32378 51 }
tschatzl@32378 52
tschatzl@32378 53 void PLABStats::add_wasted(size_t v) {
coleenp@47789 54 Atomic::add(v, &_wasted);
tschatzl@32378 55 }
tschatzl@32378 56
tschatzl@32378 57 void PLABStats::add_undo_wasted(size_t v) {
coleenp@47789 58 Atomic::add(v, &_undo_wasted);
tschatzl@32378 59 }
tschatzl@32378 60
pliden@30764 61 #endif // SHARE_VM_GC_SHARED_PLAB_INLINE_HPP