1 /*
2 * Copyright (c) 2001, 2009, 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 // Forward decl.
26
27 class PLABStats;
28
29 // A per-thread allocation buffer used during GC.
30 class ParGCAllocBuffer: public CHeapObj {
31 protected:
32 char head[32];
33 size_t _word_sz; // in HeapWord units
34 HeapWord* _bottom;
35 HeapWord* _top;
36 HeapWord* _end; // last allocatable address + 1
37 HeapWord* _hard_end; // _end + AlignmentReserve
38 bool _retained; // whether we hold a _retained_filler
39 MemRegion _retained_filler;
40 // In support of ergonomic sizing of PLAB's
41 size_t _allocated; // in HeapWord units
42 size_t _wasted; // in HeapWord units
43 char tail[32];
44 static size_t FillerHeaderSize;
220 res = allocate_slow(word_sz);
221 }
222 return res;
223 }
224
225 void undo_allocation(HeapWord* obj, size_t word_sz);
226
227 void set_buf(HeapWord* buf_start) {
228 ParGCAllocBuffer::set_buf(buf_start);
229 _true_end = _hard_end;
230 _bt.set_region(MemRegion(buf_start, word_sz()));
231 _bt.initialize_threshold();
232 }
233
234 void retire(bool end_of_gc, bool retain);
235
236 MemRegion range() {
237 return MemRegion(_top, _true_end);
238 }
239 };
|
1 /*
2 * Copyright (c) 2001, 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_GC_IMPLEMENTATION_PARNEW_PARGCALLOCBUFFER_HPP
26 #define SHARE_VM_GC_IMPLEMENTATION_PARNEW_PARGCALLOCBUFFER_HPP
27
28 #include "memory/allocation.hpp"
29 #include "memory/threadLocalAllocBuffer.hpp"
30 #include "utilities/globalDefinitions.hpp"
31
32 // Forward decl.
33
34 class PLABStats;
35
36 // A per-thread allocation buffer used during GC.
37 class ParGCAllocBuffer: public CHeapObj {
38 protected:
39 char head[32];
40 size_t _word_sz; // in HeapWord units
41 HeapWord* _bottom;
42 HeapWord* _top;
43 HeapWord* _end; // last allocatable address + 1
44 HeapWord* _hard_end; // _end + AlignmentReserve
45 bool _retained; // whether we hold a _retained_filler
46 MemRegion _retained_filler;
47 // In support of ergonomic sizing of PLAB's
48 size_t _allocated; // in HeapWord units
49 size_t _wasted; // in HeapWord units
50 char tail[32];
51 static size_t FillerHeaderSize;
227 res = allocate_slow(word_sz);
228 }
229 return res;
230 }
231
232 void undo_allocation(HeapWord* obj, size_t word_sz);
233
234 void set_buf(HeapWord* buf_start) {
235 ParGCAllocBuffer::set_buf(buf_start);
236 _true_end = _hard_end;
237 _bt.set_region(MemRegion(buf_start, word_sz()));
238 _bt.initialize_threshold();
239 }
240
241 void retire(bool end_of_gc, bool retain);
242
243 MemRegion range() {
244 return MemRegion(_top, _true_end);
245 }
246 };
247
248 #endif // SHARE_VM_GC_IMPLEMENTATION_PARNEW_PARGCALLOCBUFFER_HPP
|