< prev index next >

src/share/vm/memory/cardTableRS.cpp

Print this page


   1 /*
   2  * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  25 #include "precompiled.hpp"
  26 #include "memory/allocation.inline.hpp"
  27 #include "memory/cardTableRS.hpp"
  28 #include "memory/genCollectedHeap.hpp"
  29 #include "memory/generation.hpp"
  30 #include "memory/space.inline.hpp"
  31 #include "oops/oop.inline.hpp"
  32 #include "runtime/atomic.inline.hpp"
  33 #include "runtime/java.hpp"
  34 #include "runtime/os.hpp"
  35 #include "utilities/macros.hpp"
  36 
  37 CardTableRS::CardTableRS(MemRegion whole_heap) :
  38   GenRemSet(),
  39   _cur_youngergen_card_val(youngergenP1_card)
  40 {
  41   guarantee(Universe::heap()->kind() == CollectedHeap::GenCollectedHeap, "sanity");
  42   _ct_bs = new CardTableModRefBSForCTRS(whole_heap);
  43   _ct_bs->initialize();
  44   set_bs(_ct_bs);
  45   _last_cur_val_in_gen = NEW_C_HEAP_ARRAY3(jbyte, GenCollectedHeap::max_gens + 1,



  46                          mtGC, CURRENT_PC, AllocFailStrategy::RETURN_NULL);
  47   if (_last_cur_val_in_gen == NULL) {
  48     vm_exit_during_initialization("Could not create last_cur_val_in_gen array.");
  49   }
  50   for (int i = 0; i < GenCollectedHeap::max_gens + 1; i++) {
  51     _last_cur_val_in_gen[i] = clean_card_val();
  52   }
  53   _ct_bs->set_CTRS(this);
  54 }
  55 
  56 CardTableRS::~CardTableRS() {
  57   if (_ct_bs) {
  58     delete _ct_bs;
  59     _ct_bs = NULL;
  60   }
  61   if (_last_cur_val_in_gen) {
  62     FREE_C_HEAP_ARRAY(jbyte, _last_cur_val_in_gen);
  63   }
  64 }
  65 
  66 void CardTableRS::resize_covered_region(MemRegion new_region) {
  67   _ct_bs->resize_covered_region(new_region);
  68 }
  69 
  70 jbyte CardTableRS::find_unused_youngergenP_card_value() {


   1 /*
   2  * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  25 #include "precompiled.hpp"
  26 #include "memory/allocation.inline.hpp"
  27 #include "memory/cardTableRS.hpp"
  28 #include "memory/genCollectedHeap.hpp"
  29 #include "memory/generation.hpp"
  30 #include "memory/space.inline.hpp"
  31 #include "oops/oop.inline.hpp"
  32 #include "runtime/atomic.inline.hpp"
  33 #include "runtime/java.hpp"
  34 #include "runtime/os.hpp"
  35 #include "utilities/macros.hpp"
  36 
  37 CardTableRS::CardTableRS(MemRegion whole_heap) :
  38   GenRemSet(),
  39   _cur_youngergen_card_val(youngergenP1_card)
  40 {
  41   guarantee(Universe::heap()->kind() == CollectedHeap::GenCollectedHeap, "sanity");
  42   _ct_bs = new CardTableModRefBSForCTRS(whole_heap);
  43   _ct_bs->initialize();
  44   set_bs(_ct_bs);
  45   // max_gens is really GenCollectedHeap::heap()->gen_policy()->number_of_generations()
  46   // (which is always 2, young & old), but GenCollectedHeap has not been initialized yet.
  47   uint max_gens = 2;
  48   _last_cur_val_in_gen = NEW_C_HEAP_ARRAY3(jbyte, max_gens + 1,
  49                          mtGC, CURRENT_PC, AllocFailStrategy::RETURN_NULL);
  50   if (_last_cur_val_in_gen == NULL) {
  51     vm_exit_during_initialization("Could not create last_cur_val_in_gen array.");
  52   }
  53   for (uint i = 0; i < max_gens + 1; i++) {
  54     _last_cur_val_in_gen[i] = clean_card_val();
  55   }
  56   _ct_bs->set_CTRS(this);
  57 }
  58 
  59 CardTableRS::~CardTableRS() {
  60   if (_ct_bs) {
  61     delete _ct_bs;
  62     _ct_bs = NULL;
  63   }
  64   if (_last_cur_val_in_gen) {
  65     FREE_C_HEAP_ARRAY(jbyte, _last_cur_val_in_gen);
  66   }
  67 }
  68 
  69 void CardTableRS::resize_covered_region(MemRegion new_region) {
  70   _ct_bs->resize_covered_region(new_region);
  71 }
  72 
  73 jbyte CardTableRS::find_unused_youngergenP_card_value() {


< prev index next >