src/share/vm/gc/g1/concurrentG1Refine.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/gc/g1

src/share/vm/gc/g1/concurrentG1Refine.cpp

Print this page


   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  *


  26 #include "gc/g1/concurrentG1Refine.hpp"
  27 #include "gc/g1/concurrentG1RefineThread.hpp"
  28 #include "gc/g1/g1CollectedHeap.inline.hpp"
  29 #include "gc/g1/g1HotCardCache.hpp"
  30 #include "runtime/java.hpp"
  31 
  32 ConcurrentG1Refine::ConcurrentG1Refine(G1CollectedHeap* g1h) :
  33   _threads(NULL),
  34   _sample_thread(NULL),
  35   _hot_card_cache(g1h)
  36 {
  37   // Ergonomically select initial concurrent refinement parameters
  38   if (FLAG_IS_DEFAULT(G1ConcRefinementGreenZone)) {
  39     FLAG_SET_DEFAULT(G1ConcRefinementGreenZone, (intx)ParallelGCThreads);
  40   }
  41   set_green_zone(G1ConcRefinementGreenZone);
  42 
  43   if (FLAG_IS_DEFAULT(G1ConcRefinementYellowZone)) {
  44     FLAG_SET_DEFAULT(G1ConcRefinementYellowZone, green_zone() * 3);
  45   }
  46   set_yellow_zone(MAX2<int>(G1ConcRefinementYellowZone, green_zone()));
  47 
  48   if (FLAG_IS_DEFAULT(G1ConcRefinementRedZone)) {
  49     FLAG_SET_DEFAULT(G1ConcRefinementRedZone, yellow_zone() * 2);
  50   }
  51   set_red_zone(MAX2<int>(G1ConcRefinementRedZone, yellow_zone()));
  52 }
  53 
  54 ConcurrentG1Refine* ConcurrentG1Refine::create(G1CollectedHeap* g1h, CardTableEntryClosure* refine_closure, jint* ecode) {
  55   ConcurrentG1Refine* cg1r = new ConcurrentG1Refine(g1h);
  56   if (cg1r == NULL) {
  57     *ecode = JNI_ENOMEM;
  58     vm_shutdown_during_initialization("Could not create ConcurrentG1Refine");
  59     return NULL;
  60   }
  61   cg1r->_n_worker_threads = thread_num();
  62 
  63   cg1r->reset_threshold_step();
  64 
  65   cg1r->_threads = NEW_C_HEAP_ARRAY_RETURN_NULL(ConcurrentG1RefineThread*, cg1r->_n_worker_threads, mtGC);
  66   if (cg1r->_threads == NULL) {
  67     *ecode = JNI_ENOMEM;
  68     vm_shutdown_during_initialization("Could not allocate an array for ConcurrentG1RefineThread");
  69     return NULL;
  70   }
  71 


   1 /*
   2  * Copyright (c) 2001, 2016, 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  *


  26 #include "gc/g1/concurrentG1Refine.hpp"
  27 #include "gc/g1/concurrentG1RefineThread.hpp"
  28 #include "gc/g1/g1CollectedHeap.inline.hpp"
  29 #include "gc/g1/g1HotCardCache.hpp"
  30 #include "runtime/java.hpp"
  31 
  32 ConcurrentG1Refine::ConcurrentG1Refine(G1CollectedHeap* g1h) :
  33   _threads(NULL),
  34   _sample_thread(NULL),
  35   _hot_card_cache(g1h)
  36 {
  37   // Ergonomically select initial concurrent refinement parameters
  38   if (FLAG_IS_DEFAULT(G1ConcRefinementGreenZone)) {
  39     FLAG_SET_DEFAULT(G1ConcRefinementGreenZone, (intx)ParallelGCThreads);
  40   }
  41   set_green_zone(G1ConcRefinementGreenZone);
  42 
  43   if (FLAG_IS_DEFAULT(G1ConcRefinementYellowZone)) {
  44     FLAG_SET_DEFAULT(G1ConcRefinementYellowZone, green_zone() * 3);
  45   }
  46   set_yellow_zone(MAX2(G1ConcRefinementYellowZone, green_zone()));
  47 
  48   if (FLAG_IS_DEFAULT(G1ConcRefinementRedZone)) {
  49     FLAG_SET_DEFAULT(G1ConcRefinementRedZone, yellow_zone() * 2);
  50   }
  51   set_red_zone(MAX2(G1ConcRefinementRedZone, yellow_zone()));
  52 }
  53 
  54 ConcurrentG1Refine* ConcurrentG1Refine::create(G1CollectedHeap* g1h, CardTableEntryClosure* refine_closure, jint* ecode) {
  55   ConcurrentG1Refine* cg1r = new ConcurrentG1Refine(g1h);
  56   if (cg1r == NULL) {
  57     *ecode = JNI_ENOMEM;
  58     vm_shutdown_during_initialization("Could not create ConcurrentG1Refine");
  59     return NULL;
  60   }
  61   cg1r->_n_worker_threads = thread_num();
  62 
  63   cg1r->reset_threshold_step();
  64 
  65   cg1r->_threads = NEW_C_HEAP_ARRAY_RETURN_NULL(ConcurrentG1RefineThread*, cg1r->_n_worker_threads, mtGC);
  66   if (cg1r->_threads == NULL) {
  67     *ecode = JNI_ENOMEM;
  68     vm_shutdown_during_initialization("Could not allocate an array for ConcurrentG1RefineThread");
  69     return NULL;
  70   }
  71 


src/share/vm/gc/g1/concurrentG1Refine.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File