< prev index next >

src/hotspot/share/gc/shared/cardTableRS.cpp

Print this page

608   _lowest_non_clean(NULL),
609   _lowest_non_clean_chunk_size(NULL),
610   _lowest_non_clean_base_chunk_index(NULL),
611   _last_LNC_resizing_collection(NULL)
612 {
613   // max_gens is really GenCollectedHeap::heap()->gen_policy()->number_of_generations()
614   // (which is always 2, young & old), but GenCollectedHeap has not been initialized yet.
615   uint max_gens = 2;
616   _last_cur_val_in_gen = NEW_C_HEAP_ARRAY3(CardValue, max_gens + 1,
617                          mtGC, CURRENT_PC, AllocFailStrategy::RETURN_NULL);
618   if (_last_cur_val_in_gen == NULL) {
619     vm_exit_during_initialization("Could not create last_cur_val_in_gen array.");
620   }
621   for (uint i = 0; i < max_gens + 1; i++) {
622     _last_cur_val_in_gen[i] = clean_card_val();
623   }
624 }
625 
626 CardTableRS::~CardTableRS() {
627   FREE_C_HEAP_ARRAY(CardValue, _last_cur_val_in_gen);
628   _last_cur_val_in_gen = NULL;
629   FREE_C_HEAP_ARRAY(CardArr, _lowest_non_clean);
630   _lowest_non_clean = NULL;
631   FREE_C_HEAP_ARRAY(size_t, _lowest_non_clean_chunk_size);
632   _lowest_non_clean_chunk_size = NULL;
633   FREE_C_HEAP_ARRAY(uintptr_t, _lowest_non_clean_base_chunk_index);
634   _lowest_non_clean_base_chunk_index = NULL;
635   FREE_C_HEAP_ARRAY(int, _last_LNC_resizing_collection);
636   _last_LNC_resizing_collection = NULL;
637 }
638 
639 void CardTableRS::initialize() {
640   CardTable::initialize();
641   _lowest_non_clean =
642     NEW_C_HEAP_ARRAY(CardArr, _max_covered_regions, mtGC);
643   _lowest_non_clean_chunk_size =
644     NEW_C_HEAP_ARRAY(size_t, _max_covered_regions, mtGC);
645   _lowest_non_clean_base_chunk_index =
646     NEW_C_HEAP_ARRAY(uintptr_t, _max_covered_regions, mtGC);
647   _last_LNC_resizing_collection =
648     NEW_C_HEAP_ARRAY(int, _max_covered_regions, mtGC);
649 
650   for (int i = 0; i < _max_covered_regions; i++) {
651     _lowest_non_clean[i] = NULL;
652     _lowest_non_clean_chunk_size[i] = 0;
653     _last_LNC_resizing_collection[i] = -1;
654   }
655 }
656 

608   _lowest_non_clean(NULL),
609   _lowest_non_clean_chunk_size(NULL),
610   _lowest_non_clean_base_chunk_index(NULL),
611   _last_LNC_resizing_collection(NULL)
612 {
613   // max_gens is really GenCollectedHeap::heap()->gen_policy()->number_of_generations()
614   // (which is always 2, young & old), but GenCollectedHeap has not been initialized yet.
615   uint max_gens = 2;
616   _last_cur_val_in_gen = NEW_C_HEAP_ARRAY3(CardValue, max_gens + 1,
617                          mtGC, CURRENT_PC, AllocFailStrategy::RETURN_NULL);
618   if (_last_cur_val_in_gen == NULL) {
619     vm_exit_during_initialization("Could not create last_cur_val_in_gen array.");
620   }
621   for (uint i = 0; i < max_gens + 1; i++) {
622     _last_cur_val_in_gen[i] = clean_card_val();
623   }
624 }
625 
626 CardTableRS::~CardTableRS() {
627   FREE_C_HEAP_ARRAY(CardValue, _last_cur_val_in_gen);

628   FREE_C_HEAP_ARRAY(CardArr, _lowest_non_clean);

629   FREE_C_HEAP_ARRAY(size_t, _lowest_non_clean_chunk_size);

630   FREE_C_HEAP_ARRAY(uintptr_t, _lowest_non_clean_base_chunk_index);

631   FREE_C_HEAP_ARRAY(int, _last_LNC_resizing_collection);

632 }
633 
634 void CardTableRS::initialize() {
635   CardTable::initialize();
636   _lowest_non_clean =
637     NEW_C_HEAP_ARRAY(CardArr, _max_covered_regions, mtGC);
638   _lowest_non_clean_chunk_size =
639     NEW_C_HEAP_ARRAY(size_t, _max_covered_regions, mtGC);
640   _lowest_non_clean_base_chunk_index =
641     NEW_C_HEAP_ARRAY(uintptr_t, _max_covered_regions, mtGC);
642   _last_LNC_resizing_collection =
643     NEW_C_HEAP_ARRAY(int, _max_covered_regions, mtGC);
644 
645   for (int i = 0; i < _max_covered_regions; i++) {
646     _lowest_non_clean[i] = NULL;
647     _lowest_non_clean_chunk_size[i] = 0;
648     _last_LNC_resizing_collection[i] = -1;
649   }
650 }
651 
< prev index next >