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


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




   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/genCollectedHeap.hpp"

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


 434 
 435 void CardTableModRefBS::write_ref_field_work(void* field, oop newVal, bool release) {
 436   inline_write_ref_field(field, newVal, release);
 437 }
 438 
 439 
 440 void CardTableModRefBS::non_clean_card_iterate_possibly_parallel(Space* sp,
 441                                                                  MemRegion mr,
 442                                                                  OopsInGenClosure* cl,
 443                                                                  CardTableRS* ct) {
 444   if (!mr.is_empty()) {
 445     // Caller (process_roots()) claims that all GC threads
 446     // execute this call.  With UseDynamicNumberOfGCThreads now all
 447     // active GC threads execute this call.  The number of active GC
 448     // threads needs to be passed to par_non_clean_card_iterate_work()
 449     // to get proper partitioning and termination.
 450     //
 451     // This is an example of where n_par_threads() is used instead
 452     // of workers()->active_workers().  n_par_threads can be set to 0 to
 453     // turn off parallelism.  For example when this code is called as
 454     // part of verification during root processing then n_par_threads()
 455     // may have been set to 0. active_workers is not overloaded with
 456     // the meaning that it is a switch to disable parallelism and so keeps
 457     // the meaning of the number of active gc workers. If parallelism has
 458     // not been shut off by setting n_par_threads to 0, then n_par_threads
 459     // should be equal to active_workers.  When a different mechanism for
 460     // shutting 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 
 475       DirtyCardToOopClosure* dcto_cl = sp->new_dcto_cl(cl, precision(), cl->gen_boundary());
 476       ClearNoncleanCardWrapper clear_cl(dcto_cl, ct);
 477 
 478       clear_cl.do_MemRegion(mr);
 479     }
 480   }


< prev index next >