author | gziemski |
Wed, 08 May 2019 11:11:50 -0500 | |
changeset 54764 | 865ec913f916 |
parent 53244 | 9807daeb47c4 |
permissions | -rw-r--r-- |
50193 | 1 |
/* |
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
50193
diff
changeset
|
2 |
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. |
50193 | 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_MEMORY_METASPACE_METABASE_HPP |
|
26 |
#define SHARE_MEMORY_METASPACE_METABASE_HPP |
|
27 |
||
28 |
#include "utilities/globalDefinitions.hpp" |
|
29 |
||
30 |
namespace metaspace { |
|
31 |
||
32 |
// Super class of Metablock and Metachunk to allow them to |
|
33 |
// be put on the FreeList and in the BinaryTreeDictionary. |
|
34 |
template <class T> |
|
35 |
class Metabase { |
|
36 |
size_t _word_size; |
|
37 |
T* _next; |
|
38 |
T* _prev; |
|
39 |
||
40 |
protected: |
|
41 |
Metabase(size_t word_size) : _word_size(word_size), _next(NULL), _prev(NULL) {} |
|
42 |
||
43 |
public: |
|
44 |
T* next() const { return _next; } |
|
45 |
T* prev() const { return _prev; } |
|
46 |
void set_next(T* v) { _next = v; assert(v != this, "Boom");} |
|
47 |
void set_prev(T* v) { _prev = v; assert(v != this, "Boom");} |
|
48 |
void clear_next() { set_next(NULL); } |
|
49 |
void clear_prev() { set_prev(NULL); } |
|
50 |
||
51 |
size_t size() const volatile { return _word_size; } |
|
52 |
void set_size(size_t v) { _word_size = v; } |
|
53 |
||
54 |
void link_next(T* ptr) { set_next(ptr); } |
|
55 |
void link_prev(T* ptr) { set_prev(ptr); } |
|
56 |
void link_after(T* ptr) { |
|
57 |
link_next(ptr); |
|
58 |
if (ptr != NULL) ptr->link_prev((T*)this); |
|
59 |
} |
|
60 |
||
61 |
uintptr_t* end() const { return ((uintptr_t*) this) + size(); } |
|
62 |
||
63 |
bool cantCoalesce() const { return false; } |
|
64 |
||
65 |
// Debug support |
|
66 |
#ifdef ASSERT |
|
67 |
void* prev_addr() const { return (void*)&_prev; } |
|
68 |
void* next_addr() const { return (void*)&_next; } |
|
69 |
void* size_addr() const { return (void*)&_word_size; } |
|
70 |
#endif |
|
71 |
bool verify_chunk_in_free_list(T* tc) const { return true; } |
|
72 |
bool verify_par_locked() { return true; } |
|
73 |
||
74 |
void assert_is_mangled() const {/* Don't check "\*/} |
|
75 |
||
76 |
bool is_free() { return true; } |
|
77 |
}; |
|
78 |
||
79 |
} // namespace metaspace |
|
80 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
50193
diff
changeset
|
81 |
#endif // SHARE_MEMORY_METASPACE_METABASE_HPP |