8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26 #include "gc/serial/serialArguments.hpp"
27 #include "gc/serial/serialHeap.hpp"
28 #include "gc/shared/fullGCForwarding.hpp"
29 #include "gc/shared/gcArguments.hpp"
30
31 static size_t compute_heap_alignment() {
32 // The card marking array and the offset arrays for old generations are
33 // committed in os pages as well. Make sure they are entirely full (to
34 // avoid partial page problems), e.g. if 512 bytes heap corresponds to 1
35 // byte entry and the os page size is 4096, the maximum heap size should
36 // be 512*4096 = 2MB aligned.
37
38 size_t alignment = CardTable::ct_max_alignment_constraint();
39
40 if (UseLargePages) {
41 // In presence of large pages we have to make sure that our
42 // alignment is large page aware.
43 alignment = lcm(os::large_page_size(), alignment);
44 }
45
46 return alignment;
47 }
48
49 void SerialArguments::initialize_alignments() {
50 // Initialize card size before initializing alignments
51 CardTable::initialize_card_size();
52 SpaceAlignment = (size_t)Generation::GenGrain;
53 HeapAlignment = compute_heap_alignment();
54 }
55
56 void SerialArguments::initialize() {
57 GCArguments::initialize();
58 FullGCForwarding::initialize_flags(MaxHeapSize);
59 }
60
61 size_t SerialArguments::conservative_max_heap_alignment() {
62 return MAX2((size_t)Generation::GenGrain, compute_heap_alignment());
63 }
64
65 CollectedHeap* SerialArguments::create_heap() {
66 return new SerialHeap();
67 }
68
69 size_t SerialArguments::young_gen_size_lower_bound() {
70 // The young generation must be aligned and have room for eden + two survivors
71 return 3 * SpaceAlignment;
72 }
73
74 size_t SerialArguments::old_gen_size_lower_bound() {
75 return SpaceAlignment;
76 }
|
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26 #include "gc/serial/serialArguments.hpp"
27 #include "gc/serial/serialHeap.hpp"
28 #include "gc/shared/gcArguments.hpp"
29
30 static size_t compute_heap_alignment() {
31 // The card marking array and the offset arrays for old generations are
32 // committed in os pages as well. Make sure they are entirely full (to
33 // avoid partial page problems), e.g. if 512 bytes heap corresponds to 1
34 // byte entry and the os page size is 4096, the maximum heap size should
35 // be 512*4096 = 2MB aligned.
36
37 size_t alignment = CardTable::ct_max_alignment_constraint();
38
39 if (UseLargePages) {
40 // In presence of large pages we have to make sure that our
41 // alignment is large page aware.
42 alignment = lcm(os::large_page_size(), alignment);
43 }
44
45 return alignment;
46 }
47
48 void SerialArguments::initialize_alignments() {
49 // Initialize card size before initializing alignments
50 CardTable::initialize_card_size();
51 SpaceAlignment = (size_t)Generation::GenGrain;
52 HeapAlignment = compute_heap_alignment();
53 }
54
55 size_t SerialArguments::conservative_max_heap_alignment() {
56 return MAX2((size_t)Generation::GenGrain, compute_heap_alignment());
57 }
58
59 CollectedHeap* SerialArguments::create_heap() {
60 return new SerialHeap();
61 }
62
63 size_t SerialArguments::young_gen_size_lower_bound() {
64 // The young generation must be aligned and have room for eden + two survivors
65 return 3 * SpaceAlignment;
66 }
67
68 size_t SerialArguments::old_gen_size_lower_bound() {
69 return SpaceAlignment;
70 }
|