29 |
29 |
30 void CollectorPolicy::initialize_flags() { |
30 void CollectorPolicy::initialize_flags() { |
31 if (PermSize > MaxPermSize) { |
31 if (PermSize > MaxPermSize) { |
32 MaxPermSize = PermSize; |
32 MaxPermSize = PermSize; |
33 } |
33 } |
34 PermSize = align_size_down(PermSize, min_alignment()); |
34 PermSize = MAX2(min_alignment(), align_size_down_(PermSize, min_alignment())); |
35 MaxPermSize = align_size_up(MaxPermSize, max_alignment()); |
35 MaxPermSize = align_size_up(MaxPermSize, max_alignment()); |
36 |
36 |
37 MinPermHeapExpansion = align_size_down(MinPermHeapExpansion, min_alignment()); |
37 MinPermHeapExpansion = MAX2(min_alignment(), align_size_down_(MinPermHeapExpansion, min_alignment())); |
38 MaxPermHeapExpansion = align_size_down(MaxPermHeapExpansion, min_alignment()); |
38 MaxPermHeapExpansion = MAX2(min_alignment(), align_size_down_(MaxPermHeapExpansion, min_alignment())); |
39 |
39 |
40 MinHeapDeltaBytes = align_size_up(MinHeapDeltaBytes, min_alignment()); |
40 MinHeapDeltaBytes = align_size_up(MinHeapDeltaBytes, min_alignment()); |
41 |
41 |
42 SharedReadOnlySize = align_size_up(SharedReadOnlySize, max_alignment()); |
42 SharedReadOnlySize = align_size_up(SharedReadOnlySize, max_alignment()); |
43 SharedReadWriteSize = align_size_up(SharedReadWriteSize, max_alignment()); |
43 SharedReadWriteSize = align_size_up(SharedReadWriteSize, max_alignment()); |
53 } |
53 } |
54 } |
54 } |
55 |
55 |
56 void CollectorPolicy::initialize_size_info() { |
56 void CollectorPolicy::initialize_size_info() { |
57 // User inputs from -mx and ms are aligned |
57 // User inputs from -mx and ms are aligned |
58 _initial_heap_byte_size = align_size_up(Arguments::initial_heap_size(), |
58 set_initial_heap_byte_size(Arguments::initial_heap_size()); |
59 min_alignment()); |
|
60 set_min_heap_byte_size(align_size_up(Arguments::min_heap_size(), |
|
61 min_alignment())); |
|
62 set_max_heap_byte_size(align_size_up(MaxHeapSize, max_alignment())); |
|
63 |
|
64 // Check validity of heap parameters from launcher |
|
65 if (initial_heap_byte_size() == 0) { |
59 if (initial_heap_byte_size() == 0) { |
66 set_initial_heap_byte_size(NewSize + OldSize); |
60 set_initial_heap_byte_size(NewSize + OldSize); |
67 } else { |
61 } |
68 Universe::check_alignment(initial_heap_byte_size(), min_alignment(), |
62 set_initial_heap_byte_size(align_size_up(_initial_heap_byte_size, |
69 "initial heap"); |
63 min_alignment())); |
70 } |
64 |
|
65 set_min_heap_byte_size(Arguments::min_heap_size()); |
71 if (min_heap_byte_size() == 0) { |
66 if (min_heap_byte_size() == 0) { |
72 set_min_heap_byte_size(NewSize + OldSize); |
67 set_min_heap_byte_size(NewSize + OldSize); |
73 } else { |
68 } |
74 Universe::check_alignment(min_heap_byte_size(), min_alignment(), |
69 set_min_heap_byte_size(align_size_up(_min_heap_byte_size, |
75 "initial heap"); |
70 min_alignment())); |
76 } |
71 |
|
72 set_max_heap_byte_size(align_size_up(MaxHeapSize, max_alignment())); |
77 |
73 |
78 // Check heap parameter properties |
74 // Check heap parameter properties |
79 if (initial_heap_byte_size() < M) { |
75 if (initial_heap_byte_size() < M) { |
80 vm_exit_during_initialization("Too small initial heap"); |
76 vm_exit_during_initialization("Too small initial heap"); |
81 } |
77 } |
119 |
115 |
120 GenRemSet* CollectorPolicy::create_rem_set(MemRegion whole_heap, |
116 GenRemSet* CollectorPolicy::create_rem_set(MemRegion whole_heap, |
121 int max_covered_regions) { |
117 int max_covered_regions) { |
122 switch (rem_set_name()) { |
118 switch (rem_set_name()) { |
123 case GenRemSet::CardTable: { |
119 case GenRemSet::CardTable: { |
124 if (barrier_set_name() != BarrierSet::CardTableModRef) |
|
125 vm_exit_during_initialization("Mismatch between RS and BS."); |
|
126 CardTableRS* res = new CardTableRS(whole_heap, max_covered_regions); |
120 CardTableRS* res = new CardTableRS(whole_heap, max_covered_regions); |
127 return res; |
121 return res; |
128 } |
122 } |
129 default: |
123 default: |
130 guarantee(false, "unrecognized GenRemSet::Name"); |
124 guarantee(false, "unrecognized GenRemSet::Name"); |
343 set_max_gen0_size( |
337 set_max_gen0_size( |
344 bound_minus_alignment(_max_gen0_size, max_heap_byte_size())); |
338 bound_minus_alignment(_max_gen0_size, max_heap_byte_size())); |
345 |
339 |
346 // At this point all three sizes have been checked against the |
340 // At this point all three sizes have been checked against the |
347 // maximum sizes but have not been checked for consistency |
341 // maximum sizes but have not been checked for consistency |
348 // amoung the three. |
342 // among the three. |
349 |
343 |
350 // Final check min <= initial <= max |
344 // Final check min <= initial <= max |
351 set_min_gen0_size(MIN2(_min_gen0_size, _max_gen0_size)); |
345 set_min_gen0_size(MIN2(_min_gen0_size, _max_gen0_size)); |
352 set_initial_gen0_size( |
346 set_initial_gen0_size( |
353 MAX2(MIN2(_initial_gen0_size, _max_gen0_size), _min_gen0_size)); |
347 MAX2(MIN2(_initial_gen0_size, _max_gen0_size), _min_gen0_size)); |