1 /*
2 * Copyright (c) 2001, 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_PARALLELSCAVENGE_OBJECTSTARTARRAY_HPP
26 #define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_OBJECTSTARTARRAY_HPP
27
28 #include "gc_implementation/parallelScavenge/psVirtualspace.hpp"
29 #include "memory/allocation.hpp"
30 #include "memory/memRegion.hpp"
31 #include "oops/oop.hpp"
32
33 //
34 // This class can be used to locate the beginning of an object in the
35 // covered region.
36 //
37
38 class ObjectStartArray : public CHeapObj<mtGC> {
39 friend class VerifyObjectStartArrayClosure;
40
41 private:
42 PSVirtualSpace _virtual_space;
43 MemRegion _reserved_region;
44 MemRegion _covered_region;
45 MemRegion _blocks_region;
46 jbyte* _raw_base;
47 jbyte* _offset_base;
48
156 assert(addr <= next, "wrong order for arg and next");
157 return scroll_forward;
158 }
159
160 bool is_block_allocated(HeapWord* addr) {
161 assert_covered_region_contains(addr);
162 jbyte* block = block_for_addr(addr);
163 if (*block == clean_block)
164 return false;
165
166 return true;
167 }
168 #undef assert_covered_region_contains
169
170 // Return true if an object starts in the range of heap addresses.
171 // If an object starts at an address corresponding to
172 // "start", the method will return true.
173 bool object_starts_in_range(HeapWord* start_addr, HeapWord* end_addr) const;
174 };
175
176 #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_OBJECTSTARTARRAY_HPP
|
1 /*
2 * Copyright (c) 2001, 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_PARALLEL_OBJECTSTARTARRAY_HPP
26 #define SHARE_VM_GC_PARALLEL_OBJECTSTARTARRAY_HPP
27
28 #include "gc/parallel/psVirtualspace.hpp"
29 #include "memory/allocation.hpp"
30 #include "memory/memRegion.hpp"
31 #include "oops/oop.hpp"
32
33 //
34 // This class can be used to locate the beginning of an object in the
35 // covered region.
36 //
37
38 class ObjectStartArray : public CHeapObj<mtGC> {
39 friend class VerifyObjectStartArrayClosure;
40
41 private:
42 PSVirtualSpace _virtual_space;
43 MemRegion _reserved_region;
44 MemRegion _covered_region;
45 MemRegion _blocks_region;
46 jbyte* _raw_base;
47 jbyte* _offset_base;
48
156 assert(addr <= next, "wrong order for arg and next");
157 return scroll_forward;
158 }
159
160 bool is_block_allocated(HeapWord* addr) {
161 assert_covered_region_contains(addr);
162 jbyte* block = block_for_addr(addr);
163 if (*block == clean_block)
164 return false;
165
166 return true;
167 }
168 #undef assert_covered_region_contains
169
170 // Return true if an object starts in the range of heap addresses.
171 // If an object starts at an address corresponding to
172 // "start", the method will return true.
173 bool object_starts_in_range(HeapWord* start_addr, HeapWord* end_addr) const;
174 };
175
176 #endif // SHARE_VM_GC_PARALLEL_OBJECTSTARTARRAY_HPP
|