901 || GC_locker::is_active_and_needs_gc() 902 || gch->incremental_collection_failed(); 903 } 904 905 906 // 907 // MarkSweepPolicy methods 908 // 909 910 void MarkSweepPolicy::initialize_alignments() { 911 _space_alignment = _gen_alignment = (size_t)Generation::GenGrain; 912 _heap_alignment = compute_heap_alignment(); 913 } 914 915 void MarkSweepPolicy::initialize_generations() { 916 _young_gen_spec = new GenerationSpec(Generation::DefNew, _initial_young_size, _max_young_size, _gen_alignment); 917 _old_gen_spec = new GenerationSpec(Generation::MarkSweepCompact, _initial_old_size, _max_old_size, _gen_alignment); 918 } 919 920 void MarkSweepPolicy::initialize_gc_policy_counters() { 921 // Initialize the policy counters - 2 collectors, 3 generations. 922 _gc_policy_counters = new GCPolicyCounters("Copy:MSC", 2, 3); 923 } 924 925 /////////////// Unit tests /////////////// 926 927 #ifndef PRODUCT 928 // Testing that the NewSize flag is handled correct is hard because it 929 // depends on so many other configurable variables. This test only tries to 930 // verify that there are some basic rules for NewSize honored by the policies. 931 class TestGenCollectorPolicy { 932 public: 933 static void test_new_size() { 934 size_t flag_value; 935 936 save_flags(); 937 938 // If NewSize is set on the command line, it should be used 939 // for both min and initial young size if less than min heap. 940 flag_value = 20 * M; 941 set_basic_flag_values(); 942 FLAG_SET_CMDLINE(size_t, NewSize, flag_value); | 901 || GC_locker::is_active_and_needs_gc() 902 || gch->incremental_collection_failed(); 903 } 904 905 906 // 907 // MarkSweepPolicy methods 908 // 909 910 void MarkSweepPolicy::initialize_alignments() { 911 _space_alignment = _gen_alignment = (size_t)Generation::GenGrain; 912 _heap_alignment = compute_heap_alignment(); 913 } 914 915 void MarkSweepPolicy::initialize_generations() { 916 _young_gen_spec = new GenerationSpec(Generation::DefNew, _initial_young_size, _max_young_size, _gen_alignment); 917 _old_gen_spec = new GenerationSpec(Generation::MarkSweepCompact, _initial_old_size, _max_old_size, _gen_alignment); 918 } 919 920 void MarkSweepPolicy::initialize_gc_policy_counters() { 921 // Initialize the policy counters - 2 collectors, 2 generations. 922 _gc_policy_counters = new GCPolicyCounters("Copy:MSC", 2, 2); 923 } 924 925 /////////////// Unit tests /////////////// 926 927 #ifndef PRODUCT 928 // Testing that the NewSize flag is handled correct is hard because it 929 // depends on so many other configurable variables. This test only tries to 930 // verify that there are some basic rules for NewSize honored by the policies. 931 class TestGenCollectorPolicy { 932 public: 933 static void test_new_size() { 934 size_t flag_value; 935 936 save_flags(); 937 938 // If NewSize is set on the command line, it should be used 939 // for both min and initial young size if less than min heap. 940 flag_value = 20 * M; 941 set_basic_flag_values(); 942 FLAG_SET_CMDLINE(size_t, NewSize, flag_value); |