1 /*
2 * Copyright (c) 2000, 2008, 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 // This class provides the interface between a barrier implementation and
26 // the rest of the system.
27
28 class BarrierSet: public CHeapObj {
29 friend class VMStructs;
30 public:
31 enum Name {
32 ModRef,
33 CardTableModRef,
34 CardTableExtension,
35 G1SATBCT,
36 G1SATBCTLogging,
37 Other,
38 Uninit
39 };
40
41 protected:
42 int _max_covered_regions;
43 Name _kind;
44
153 // the heap; the CardTableModRefBS is an example. Such barrier sets will
154 // normally reserve space for such tables, and commit parts of the table
155 // "covering" parts of the heap that are committed. The constructor is
156 // passed the maximum number of independently committable subregions to
157 // be covered, and the "resize_covoered_region" function allows the
158 // sub-parts of the heap to inform the barrier set of changes of their
159 // sizes.
160 BarrierSet(int max_covered_regions) :
161 _max_covered_regions(max_covered_regions) {}
162
163 // Inform the BarrierSet that the the covered heap region that starts
164 // with "base" has been changed to have the given size (possibly from 0,
165 // for initialization.)
166 virtual void resize_covered_region(MemRegion new_region) = 0;
167
168 // If the barrier set imposes any alignment restrictions on boundaries
169 // within the heap, this function tells whether they are met.
170 virtual bool is_aligned(HeapWord* addr) = 0;
171
172 };
|
1 /*
2 * Copyright (c) 2000, 2010, 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_MEMORY_BARRIERSET_HPP
26 #define SHARE_VM_MEMORY_BARRIERSET_HPP
27
28 #include "memory/memRegion.hpp"
29 #include "oops/oopsHierarchy.hpp"
30
31 // This class provides the interface between a barrier implementation and
32 // the rest of the system.
33
34 class BarrierSet: public CHeapObj {
35 friend class VMStructs;
36 public:
37 enum Name {
38 ModRef,
39 CardTableModRef,
40 CardTableExtension,
41 G1SATBCT,
42 G1SATBCTLogging,
43 Other,
44 Uninit
45 };
46
47 protected:
48 int _max_covered_regions;
49 Name _kind;
50
159 // the heap; the CardTableModRefBS is an example. Such barrier sets will
160 // normally reserve space for such tables, and commit parts of the table
161 // "covering" parts of the heap that are committed. The constructor is
162 // passed the maximum number of independently committable subregions to
163 // be covered, and the "resize_covoered_region" function allows the
164 // sub-parts of the heap to inform the barrier set of changes of their
165 // sizes.
166 BarrierSet(int max_covered_regions) :
167 _max_covered_regions(max_covered_regions) {}
168
169 // Inform the BarrierSet that the the covered heap region that starts
170 // with "base" has been changed to have the given size (possibly from 0,
171 // for initialization.)
172 virtual void resize_covered_region(MemRegion new_region) = 0;
173
174 // If the barrier set imposes any alignment restrictions on boundaries
175 // within the heap, this function tells whether they are met.
176 virtual bool is_aligned(HeapWord* addr) = 0;
177
178 };
179
180 #endif // SHARE_VM_MEMORY_BARRIERSET_HPP
|