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 #ifndef SHARE_VM_MEMORY_METACHUNK_HPP
25 #define SHARE_VM_MEMORY_METACHUNK_HPP
26
27 #include "memory/allocation.hpp"
28 #include "utilities/debug.hpp"
29 #include "utilities/globalDefinitions.hpp"
30
31 class VirtualSpaceNode;
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 VALUE_OBJ_CLASS_SPEC {
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
52 size_t size() const volatile { return _word_size; }
53 void set_size(size_t v) { _word_size = v; }
54
55 void link_next(T* ptr) { set_next(ptr); }
56 void link_prev(T* ptr) { set_prev(ptr); }
|
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 #ifndef SHARE_VM_MEMORY_METACHUNK_HPP
25 #define SHARE_VM_MEMORY_METACHUNK_HPP
26
27 #include "memory/allocation.hpp"
28 #include "utilities/debug.hpp"
29 #include "utilities/globalDefinitions.hpp"
30
31 class VirtualSpaceNode;
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
52 size_t size() const volatile { return _word_size; }
53 void set_size(size_t v) { _word_size = v; }
54
55 void link_next(T* ptr) { set_next(ptr); }
56 void link_prev(T* ptr) { set_prev(ptr); }
|