< prev index next >

src/share/vm/memory/cardTableModRefBS.cpp

Print this page




   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  *
  23  */
  24 
  25 #include "precompiled.hpp"

  26 #include "memory/allocation.inline.hpp"
  27 #include "memory/cardTableModRefBS.inline.hpp"
  28 #include "memory/cardTableRS.hpp"
  29 #include "memory/sharedHeap.hpp"
  30 #include "memory/space.hpp"
  31 #include "memory/space.inline.hpp"
  32 #include "memory/universe.hpp"
  33 #include "runtime/java.hpp"
  34 #include "runtime/mutexLocker.hpp"
  35 #include "runtime/virtualspace.hpp"
  36 #include "services/memTracker.hpp"
  37 #include "utilities/macros.hpp"
  38 #ifdef COMPILER1
  39 #include "c1/c1_LIR.hpp"
  40 #include "c1/c1_LIRGenerator.hpp"
  41 #endif
  42 
  43 // This kind of "BarrierSet" allows a "CollectedHeap" to detect and
  44 // enumerate ref fields that have been modified (since the last
  45 // enumeration.)
  46 
  47 size_t CardTableModRefBS::compute_byte_map_size()
  48 {
  49   assert(_guard_index == cards_required(_whole_heap.word_size()) - 1,


 433 
 434 void CardTableModRefBS::write_ref_field_work(void* field, oop newVal, bool release) {
 435   inline_write_ref_field(field, newVal, release);
 436 }
 437 
 438 
 439 void CardTableModRefBS::non_clean_card_iterate_possibly_parallel(Space* sp,
 440                                                                  MemRegion mr,
 441                                                                  OopsInGenClosure* cl,
 442                                                                  CardTableRS* ct) {
 443   if (!mr.is_empty()) {
 444     // Caller (process_roots()) claims that all GC threads
 445     // execute this call.  With UseDynamicNumberOfGCThreads now all
 446     // active GC threads execute this call.  The number of active GC
 447     // threads needs to be passed to par_non_clean_card_iterate_work()
 448     // to get proper partitioning and termination.
 449     //
 450     // This is an example of where n_par_threads() is used instead
 451     // of workers()->active_workers().  n_par_threads can be set to 0 to
 452     // turn off parallelism.  For example when this code is called as
 453     // part of verification and SharedHeap::process_roots() is being
 454     // used, then n_par_threads() may have been set to 0.  active_workers
 455     // is not overloaded with the meaning that it is a switch to disable
 456     // parallelism and so keeps the meaning of the number of
 457     // active gc workers.  If parallelism has not been shut off by
 458     // setting n_par_threads to 0, then n_par_threads should be
 459     // equal to active_workers.  When a different mechanism for shutting
 460     // off parallelism is used, then active_workers can be used in
 461     // place of n_par_threads.
 462     int n_threads =  GenCollectedHeap::heap()->n_par_threads();
 463     bool is_par = n_threads > 0;
 464     if (is_par) {
 465 #if INCLUDE_ALL_GCS
 466       assert(GenCollectedHeap::heap()->n_par_threads() ==
 467              GenCollectedHeap::heap()->workers()->active_workers(), "Mismatch");
 468       non_clean_card_iterate_parallel_work(sp, mr, cl, ct, n_threads);
 469 #else  // INCLUDE_ALL_GCS
 470       fatal("Parallel gc not supported here.");
 471 #endif // INCLUDE_ALL_GCS
 472     } else {
 473       // clear_cl finds contiguous dirty ranges of cards to process and clear.
 474 




   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  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "gc_interface/collectedHeap.hpp"
  27 #include "memory/allocation.inline.hpp"
  28 #include "memory/cardTableModRefBS.inline.hpp"
  29 #include "memory/cardTableRS.hpp"

  30 #include "memory/space.hpp"
  31 #include "memory/space.inline.hpp"
  32 #include "memory/universe.hpp"
  33 #include "runtime/java.hpp"
  34 #include "runtime/mutexLocker.hpp"
  35 #include "runtime/virtualspace.hpp"
  36 #include "services/memTracker.hpp"
  37 #include "utilities/macros.hpp"
  38 #ifdef COMPILER1
  39 #include "c1/c1_LIR.hpp"
  40 #include "c1/c1_LIRGenerator.hpp"
  41 #endif
  42 
  43 // This kind of "BarrierSet" allows a "CollectedHeap" to detect and
  44 // enumerate ref fields that have been modified (since the last
  45 // enumeration.)
  46 
  47 size_t CardTableModRefBS::compute_byte_map_size()
  48 {
  49   assert(_guard_index == cards_required(_whole_heap.word_size()) - 1,


 433 
 434 void CardTableModRefBS::write_ref_field_work(void* field, oop newVal, bool release) {
 435   inline_write_ref_field(field, newVal, release);
 436 }
 437 
 438 
 439 void CardTableModRefBS::non_clean_card_iterate_possibly_parallel(Space* sp,
 440                                                                  MemRegion mr,
 441                                                                  OopsInGenClosure* cl,
 442                                                                  CardTableRS* ct) {
 443   if (!mr.is_empty()) {
 444     // Caller (process_roots()) claims that all GC threads
 445     // execute this call.  With UseDynamicNumberOfGCThreads now all
 446     // active GC threads execute this call.  The number of active GC
 447     // threads needs to be passed to par_non_clean_card_iterate_work()
 448     // to get proper partitioning and termination.
 449     //
 450     // This is an example of where n_par_threads() is used instead
 451     // of workers()->active_workers().  n_par_threads can be set to 0 to
 452     // turn off parallelism.  For example when this code is called as
 453     // part of verification during root processing then n_par_threads()
 454     // may have been set to 0.  active_workers
 455     // is not overloaded with the meaning that it is a switch to disable
 456     // parallelism and so keeps the meaning of the number of
 457     // active gc workers.  If parallelism has not been shut off by
 458     // setting n_par_threads to 0, then n_par_threads should be
 459     // equal to active_workers.  When a different mechanism for shutting
 460     // off parallelism is used, then active_workers can be used in
 461     // place of n_par_threads.
 462     int n_threads =  GenCollectedHeap::heap()->n_par_threads();
 463     bool is_par = n_threads > 0;
 464     if (is_par) {
 465 #if INCLUDE_ALL_GCS
 466       assert(GenCollectedHeap::heap()->n_par_threads() ==
 467              GenCollectedHeap::heap()->workers()->active_workers(), "Mismatch");
 468       non_clean_card_iterate_parallel_work(sp, mr, cl, ct, n_threads);
 469 #else  // INCLUDE_ALL_GCS
 470       fatal("Parallel gc not supported here.");
 471 #endif // INCLUDE_ALL_GCS
 472     } else {
 473       // clear_cl finds contiguous dirty ranges of cards to process and clear.
 474 


< prev index next >