src/share/vm/services/memPtr.cpp

Wed, 10 Oct 2012 14:35:58 -0400

author
jprovino
date
Wed, 10 Oct 2012 14:35:58 -0400
changeset 4165
fb19af007ffc
parent 4053
33143ee07800
child 4193
716c64bda5ba
permissions
-rw-r--r--

7189254: Change makefiles for more flexibility to override defaults
Summary: Change makefiles so that targets and parameters can be overridden by alternate makefiles.
Reviewed-by: dholmes, coleenp

zgu@3900 1 /*
zgu@3900 2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
zgu@3900 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
zgu@3900 4 *
zgu@3900 5 * This code is free software; you can redistribute it and/or modify it
zgu@3900 6 * under the terms of the GNU General Public License version 2 only, as
zgu@3900 7 * published by the Free Software Foundation.
zgu@3900 8 *
zgu@3900 9 * This code is distributed in the hope that it will be useful, but WITHOUT
zgu@3900 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
zgu@3900 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
zgu@3900 12 * version 2 for more details (a copy is included in the LICENSE file that
zgu@3900 13 * accompanied this code).
zgu@3900 14 *
zgu@3900 15 * You should have received a copy of the GNU General Public License version
zgu@3900 16 * 2 along with this work; if not, write to the Free Software Foundation,
zgu@3900 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
zgu@3900 18 *
zgu@3900 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
zgu@3900 20 * or visit www.oracle.com if you need additional information or have any
zgu@3900 21 * questions.
zgu@3900 22 *
zgu@3900 23 */
zgu@3900 24
zgu@3900 25 #include "precompiled.hpp"
zgu@3900 26 #include "services/memPtr.hpp"
zgu@3900 27 #include "services/memTracker.hpp"
zgu@3900 28
zgu@3900 29 volatile jint SequenceGenerator::_seq_number = 1;
zgu@3994 30 NOT_PRODUCT(jint SequenceGenerator::_max_seq_number = 1;)
zgu@3900 31 DEBUG_ONLY(volatile unsigned long SequenceGenerator::_generation = 0;)
zgu@3900 32
zgu@3900 33 jint SequenceGenerator::next() {
zgu@3900 34 jint seq = Atomic::add(1, &_seq_number);
zgu@3900 35 if (seq < 0) {
zgu@3900 36 MemTracker::shutdown(MemTracker::NMT_sequence_overflow);
zgu@3900 37 }
zgu@3900 38 assert(seq > 0, "counter overflow");
zgu@3994 39 NOT_PRODUCT(_max_seq_number = (seq > _max_seq_number) ? seq : _max_seq_number;)
zgu@3900 40 return seq;
zgu@3900 41 }
zgu@3900 42
zgu@3900 43
zgu@3900 44
zgu@3900 45 bool VMMemRegion::contains(const VMMemRegion* mr) const {
zgu@4053 46 assert(base() != 0, "Sanity check");
zgu@3900 47 assert(size() != 0 || committed_size() != 0,
zgu@4053 48 "Sanity check");
zgu@3900 49 address base_addr = base();
zgu@3900 50 address end_addr = base_addr +
zgu@3900 51 (is_reserve_record()? reserved_size(): committed_size());
zgu@3900 52 if (mr->is_reserve_record()) {
zgu@3900 53 if (mr->base() == base_addr && mr->size() == size()) {
zgu@3900 54 // the same range
zgu@3900 55 return true;
zgu@3900 56 }
zgu@3900 57 return false;
zgu@3900 58 } else if (mr->is_commit_record() || mr->is_uncommit_record()) {
zgu@3900 59 assert(mr->base() != 0 && mr->committed_size() > 0,
zgu@3900 60 "bad record");
zgu@3900 61 return (mr->base() >= base_addr &&
zgu@3900 62 (mr->base() + mr->committed_size()) <= end_addr);
zgu@3900 63 } else if (mr->is_type_tagging_record()) {
zgu@4053 64 assert(mr->base() != NULL, "Sanity check");
zgu@4053 65 return (mr->base() >= base_addr && mr->base() < end_addr);
zgu@3900 66 } else if (mr->is_release_record()) {
zgu@3900 67 assert(mr->base() != 0 && mr->size() > 0,
zgu@3900 68 "bad record");
zgu@3900 69 return (mr->base() == base_addr && mr->size() == size());
zgu@3900 70 } else {
zgu@4053 71 ShouldNotReachHere();
zgu@3900 72 return false;
zgu@3900 73 }
zgu@3900 74 }

mercurial