< prev index next >

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

Print this page

607   // LNC functionality
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   if (_last_cur_val_in_gen) {
628     FREE_C_HEAP_ARRAY(CardValue, _last_cur_val_in_gen);
629     _last_cur_val_in_gen = NULL;
630   }
631   if (_lowest_non_clean) {
632     FREE_C_HEAP_ARRAY(CardArr, _lowest_non_clean);
633     _lowest_non_clean = NULL;
634   }
635   if (_lowest_non_clean_chunk_size) {
636     FREE_C_HEAP_ARRAY(size_t, _lowest_non_clean_chunk_size);
637     _lowest_non_clean_chunk_size = NULL;
638   }
639   if (_lowest_non_clean_base_chunk_index) {
640     FREE_C_HEAP_ARRAY(uintptr_t, _lowest_non_clean_base_chunk_index);
641     _lowest_non_clean_base_chunk_index = NULL;
642   }
643   if (_last_LNC_resizing_collection) {
644     FREE_C_HEAP_ARRAY(int, _last_LNC_resizing_collection);
645     _last_LNC_resizing_collection = NULL;
646   }
647 }
648 
649 void CardTableRS::initialize() {
650   CardTable::initialize();
651   _lowest_non_clean =
652     NEW_C_HEAP_ARRAY(CardArr, _max_covered_regions, mtGC);
653   _lowest_non_clean_chunk_size =
654     NEW_C_HEAP_ARRAY(size_t, _max_covered_regions, mtGC);
655   _lowest_non_clean_base_chunk_index =
656     NEW_C_HEAP_ARRAY(uintptr_t, _max_covered_regions, mtGC);
657   _last_LNC_resizing_collection =
658     NEW_C_HEAP_ARRAY(int, _max_covered_regions, mtGC);
659 
660   for (int i = 0; i < _max_covered_regions; i++) {
661     _lowest_non_clean[i] = NULL;
662     _lowest_non_clean_chunk_size[i] = 0;
663     _last_LNC_resizing_collection[i] = -1;
664   }
665 }
666 

607   // LNC functionality
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 >