1 #ifdef USE_PRAGMA_IDENT_SRC
2 #pragma ident "@(#)psPromotionLAB.cpp 1.17 07/05/05 17:05:30 JVM"
3 #endif
4 /*
5 * Copyright 2002-2006 Sun Microsystems, Inc. All Rights Reserved.
6 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7 *
8 * This code is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 2 only, as
10 * published by the Free Software Foundation.
11 *
12 * This code is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * version 2 for more details (a copy is included in the LICENSE file that
16 * accompanied this code).
17 *
18 * You should have received a copy of the GNU General Public License version
19 * 2 along with this work; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21 *
22 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23 * CA 95054 USA or visit www.sun.com if you need additional information or
24 * have any questions.
25 *
26 */
27
28 #include "incls/_precompiled.incl"
29 #include "incls/_psPromotionLAB.cpp.incl"
30
31 const size_t PSPromotionLAB::filler_header_size = align_object_size(typeArrayOopDesc::header_size(T_INT));
32
33 // This is the shared initialization code. It sets up the basic pointers,
34 // and allows enough extra space for a filler object. We call a virtual
35 // method, "lab_is_valid()" to handle the different asserts the old/young
36 // labs require.
37 void PSPromotionLAB::initialize(MemRegion lab) {
38 assert(lab_is_valid(lab), "Sanity");
39
40 HeapWord* bottom = lab.start();
41 HeapWord* end = lab.end();
42
43 set_bottom(bottom);
44 set_end(end);
45 set_top(bottom);
46
47 // We can be initialized to a zero size!
48 if (free() > 0) {
49 if (ZapUnusedHeapArea) {
50 debug_only(Copy::fill_to_words(top(), free()/HeapWordSize, badHeapWord));
51 }
52
53 // NOTE! We need to allow space for a filler object.
54 assert(lab.word_size() >= filler_header_size, "lab is too small");
55 end = end - filler_header_size;
56 set_end(end);
57
58 _state = needs_flush;
59 } else {
60 _state = zero_size;
61 }
62
63 assert(this->top() <= this->end(), "pointers out of order");
64 }
65
66 // Fill all remaining lab space with an unreachable object.
|
1 #ifdef USE_PRAGMA_IDENT_SRC
2 #pragma ident "@(#)psPromotionLAB.cpp 1.17 07/05/05 17:05:30 JVM"
3 #endif
4 /*
5 * Copyright 2002-2008 Sun Microsystems, Inc. All Rights Reserved.
6 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7 *
8 * This code is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 2 only, as
10 * published by the Free Software Foundation.
11 *
12 * This code is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * version 2 for more details (a copy is included in the LICENSE file that
16 * accompanied this code).
17 *
18 * You should have received a copy of the GNU General Public License version
19 * 2 along with this work; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21 *
22 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23 * CA 95054 USA or visit www.sun.com if you need additional information or
24 * have any questions.
25 *
26 */
27
28 #include "incls/_precompiled.incl"
29 #include "incls/_psPromotionLAB.cpp.incl"
30
31 size_t PSPromotionLAB::filler_header_size;
32
33 // This is the shared initialization code. It sets up the basic pointers,
34 // and allows enough extra space for a filler object. We call a virtual
35 // method, "lab_is_valid()" to handle the different asserts the old/young
36 // labs require.
37 void PSPromotionLAB::initialize(MemRegion lab) {
38 assert(lab_is_valid(lab), "Sanity");
39
40 HeapWord* bottom = lab.start();
41 HeapWord* end = lab.end();
42
43 set_bottom(bottom);
44 set_end(end);
45 set_top(bottom);
46
47 // Initialize after VM starts up because header_size depends on compressed
48 // oops.
49 filler_header_size = align_object_size(typeArrayOopDesc::header_size(T_INT));
50
51 // We can be initialized to a zero size!
52 if (free() > 0) {
53 if (ZapUnusedHeapArea) {
54 debug_only(Copy::fill_to_words(top(), free()/HeapWordSize, badHeapWord));
55 }
56
57 // NOTE! We need to allow space for a filler object.
58 assert(lab.word_size() >= filler_header_size, "lab is too small");
59 end = end - filler_header_size;
60 set_end(end);
61
62 _state = needs_flush;
63 } else {
64 _state = zero_size;
65 }
66
67 assert(this->top() <= this->end(), "pointers out of order");
68 }
69
70 // Fill all remaining lab space with an unreachable object.
|