1 /*
2 * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
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_VM_GC_IMPLEMENTATION_SHARED_SPACEDECORATOR_HPP
26 #define SHARE_VM_GC_IMPLEMENTATION_SHARED_SPACEDECORATOR_HPP
27
28 #include "gc_implementation/shared/mutableSpace.hpp"
29 #include "memory/space.hpp"
30 #include "utilities/globalDefinitions.hpp"
31
32 class SpaceDecorator: public AllStatic {
33 public:
34 // Initialization flags.
35 static const bool Clear = true;
36 static const bool DontClear = false;
37 static const bool Mangle = true;
38 static const bool DontMangle = false;
39 };
40
41 // Functionality for use with class Space and class MutableSpace.
42 // The approach taken with the mangling is to mangle all
43 // the space initially and then to mangle areas that have
44 // been allocated since the last collection. Mangling is
45 // done in the context of a generation and in the context
46 // of a space.
47 // The space in a generation is mangled when it is first
48 // initialized and when the generation grows. The spaces
49 // are not necessarily up-to-date when this mangling occurs
130 HeapWord* top() const { return _sp->top(); }
131 HeapWord* end() const { return _sp->end(); }
132
133 public:
134 GenSpaceMangler(ContiguousSpace* sp) : SpaceMangler(), _sp(sp) {}
135 };
136
137 // For use with ParallelScavengeHeap's.
138 class MutableSpaceMangler: public SpaceMangler {
139 MutableSpace* _sp;
140
141 MutableSpace* sp() { return _sp; }
142
143 HeapWord* top() const { return _sp->top(); }
144 HeapWord* end() const { return _sp->end(); }
145
146 public:
147 MutableSpaceMangler(MutableSpace* sp) : SpaceMangler(), _sp(sp) {}
148 };
149
150 #endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_SPACEDECORATOR_HPP
|
1 /*
2 * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
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_VM_GC_SHARED_SPACEDECORATOR_HPP
26 #define SHARE_VM_GC_SHARED_SPACEDECORATOR_HPP
27
28 #include "gc/parallel/mutableSpace.hpp"
29 #include "gc/shared/space.hpp"
30 #include "utilities/globalDefinitions.hpp"
31
32 class SpaceDecorator: public AllStatic {
33 public:
34 // Initialization flags.
35 static const bool Clear = true;
36 static const bool DontClear = false;
37 static const bool Mangle = true;
38 static const bool DontMangle = false;
39 };
40
41 // Functionality for use with class Space and class MutableSpace.
42 // The approach taken with the mangling is to mangle all
43 // the space initially and then to mangle areas that have
44 // been allocated since the last collection. Mangling is
45 // done in the context of a generation and in the context
46 // of a space.
47 // The space in a generation is mangled when it is first
48 // initialized and when the generation grows. The spaces
49 // are not necessarily up-to-date when this mangling occurs
130 HeapWord* top() const { return _sp->top(); }
131 HeapWord* end() const { return _sp->end(); }
132
133 public:
134 GenSpaceMangler(ContiguousSpace* sp) : SpaceMangler(), _sp(sp) {}
135 };
136
137 // For use with ParallelScavengeHeap's.
138 class MutableSpaceMangler: public SpaceMangler {
139 MutableSpace* _sp;
140
141 MutableSpace* sp() { return _sp; }
142
143 HeapWord* top() const { return _sp->top(); }
144 HeapWord* end() const { return _sp->end(); }
145
146 public:
147 MutableSpaceMangler(MutableSpace* sp) : SpaceMangler(), _sp(sp) {}
148 };
149
150 #endif // SHARE_VM_GC_SHARED_SPACEDECORATOR_HPP
|