annotate src/share/vm/services/memPtr.cpp @ 17866:270d7cb38f40

8038934: Remove prefix allocated_ from methods and variables in Metaspace Reviewed-by: jmasa, coleenp
author ehelin
date Mon, 31 Mar 2014 17:09:38 +0200
parents baa7927dfbd2
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6197
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
1 /*
12198
baa7927dfbd2 8022798: "assert(seq > 0) failed: counter overflow" in Kitchensink
zgu
parents: 7971
diff changeset
2 * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
6197
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
4 *
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
7 * published by the Free Software Foundation.
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
8 *
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
13 * accompanied this code).
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
14 *
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
18 *
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
21 * questions.
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
22 *
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
23 */
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
24
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
25 #include "precompiled.hpp"
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
26 #include "services/memPtr.hpp"
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
27 #include "services/memTracker.hpp"
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
28
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
29 volatile jint SequenceGenerator::_seq_number = 1;
7971
4102b59539ce 8005012: Add WB APIs to better support NMT testing
ctornqvi
parents: 6882
diff changeset
30 volatile unsigned long SequenceGenerator::_generation = 1;
6607
e5bf1c79ed5b 7191124: Optimized build is broken due to inconsistent use of DEBUG_ONLY and NOT_PRODUCT macros in NMT
zgu
parents: 6197
diff changeset
31 NOT_PRODUCT(jint SequenceGenerator::_max_seq_number = 1;)
6197
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
32
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
33 jint SequenceGenerator::next() {
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
34 jint seq = Atomic::add(1, &_seq_number);
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
35 if (seq < 0) {
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
36 MemTracker::shutdown(MemTracker::NMT_sequence_overflow);
12198
baa7927dfbd2 8022798: "assert(seq > 0) failed: counter overflow" in Kitchensink
zgu
parents: 7971
diff changeset
37 } else {
baa7927dfbd2 8022798: "assert(seq > 0) failed: counter overflow" in Kitchensink
zgu
parents: 7971
diff changeset
38 NOT_PRODUCT(_max_seq_number = (seq > _max_seq_number) ? seq : _max_seq_number;)
6197
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
39 }
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
40 return seq;
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
41 }
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
42