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 namespace internals {
32
33 // Super class of Metablock and Metachunk to allow them to
34 // be put on the FreeList and in the BinaryTreeDictionary.
35 template <class T>
36 class Metabase {
37 size_t _word_size;
38 T* _next;
39 T* _prev;
40
41 protected:
42 Metabase(size_t word_size) : _word_size(word_size), _next(NULL), _prev(NULL) {}
43
44 public:
45 T* next() const { return _next; }
46 T* prev() const { return _prev; }
47 void set_next(T* v) { _next = v; assert(v != this, "Boom");}
48 void set_prev(T* v) { _prev = v; assert(v != this, "Boom");}
49 void clear_next() { set_next(NULL); }
50 void clear_prev() { set_prev(NULL); }
51
61
62 uintptr_t* end() const { return ((uintptr_t*) this) + size(); }
63
64 bool cantCoalesce() const { return false; }
65
66 // Debug support
67 #ifdef ASSERT
68 void* prev_addr() const { return (void*)&_prev; }
69 void* next_addr() const { return (void*)&_next; }
70 void* size_addr() const { return (void*)&_word_size; }
71 #endif
72 bool verify_chunk_in_free_list(T* tc) const { return true; }
73 bool verify_par_locked() { return true; }
74
75 void assert_is_mangled() const {/* Don't check "\*/}
76
77 bool is_free() { return true; }
78 };
79
80 } // namespace metaspace
81 } // namespace internals
82
83
84 #endif /* SHARE_MEMORY_METASPACE_METABASE_HPP_ */
|
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
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
81 #endif /* SHARE_MEMORY_METASPACE_METABASE_HPP_ */
82
|