< prev index next >

src/hotspot/share/gc/parallel/psParallelCompact.cpp

Print this page

  56 #include "gc/shared/oopStorage.inline.hpp"
  57 #include "gc/shared/oopStorageSet.inline.hpp"
  58 #include "gc/shared/oopStorageSetParState.inline.hpp"
  59 #include "gc/shared/preservedMarks.inline.hpp"
  60 #include "gc/shared/referencePolicy.hpp"
  61 #include "gc/shared/referenceProcessor.hpp"
  62 #include "gc/shared/referenceProcessorPhaseTimes.hpp"
  63 #include "gc/shared/strongRootsScope.hpp"
  64 #include "gc/shared/taskTerminator.hpp"
  65 #include "gc/shared/weakProcessor.inline.hpp"
  66 #include "gc/shared/workerPolicy.hpp"
  67 #include "gc/shared/workerThread.hpp"
  68 #include "gc/shared/workerUtils.hpp"
  69 #include "logging/log.hpp"
  70 #include "memory/iterator.inline.hpp"
  71 #include "memory/metaspaceUtils.hpp"
  72 #include "memory/resourceArea.hpp"
  73 #include "memory/universe.hpp"
  74 #include "nmt/memTracker.hpp"
  75 #include "oops/access.inline.hpp"

  76 #include "oops/instanceClassLoaderKlass.inline.hpp"
  77 #include "oops/instanceKlass.inline.hpp"
  78 #include "oops/instanceMirrorKlass.inline.hpp"
  79 #include "oops/methodData.hpp"
  80 #include "oops/objArrayKlass.inline.hpp"
  81 #include "oops/oop.inline.hpp"
  82 #include "runtime/atomic.hpp"
  83 #include "runtime/handles.inline.hpp"
  84 #include "runtime/java.hpp"
  85 #include "runtime/safepoint.hpp"
  86 #include "runtime/threads.hpp"
  87 #include "runtime/vmThread.hpp"
  88 #include "services/memoryService.hpp"
  89 #include "utilities/align.hpp"
  90 #include "utilities/debug.hpp"
  91 #include "utilities/events.hpp"
  92 #include "utilities/formatBuffer.hpp"
  93 #include "utilities/macros.hpp"
  94 #include "utilities/stack.inline.hpp"
  95 #if INCLUDE_JVMCI

2383 }
2384 
2385 void MoveAndUpdateClosure::do_addr(HeapWord* addr, size_t words) {
2386   assert(destination() != nullptr, "sanity");
2387   _source = addr;
2388 
2389   // The start_array must be updated even if the object is not moving.
2390   if (_start_array != nullptr) {
2391     _start_array->update_for_block(destination(), destination() + words);
2392   }
2393 
2394   // Avoid overflow
2395   words = MIN2(words, words_remaining());
2396   assert(words > 0, "inv");
2397 
2398   if (copy_destination() != source()) {
2399     DEBUG_ONLY(PSParallelCompact::check_new_location(source(), destination());)
2400     assert(source() != destination(), "inv");
2401     assert(cast_to_oop(source())->is_forwarded(), "inv");
2402     assert(cast_to_oop(source())->forwardee() == cast_to_oop(destination()), "inv");



2403     Copy::aligned_conjoint_words(source(), copy_destination(), words);
2404     cast_to_oop(copy_destination())->init_mark();
2405   }
2406 
2407   update_state(words);
2408 }
2409 
2410 void MoveAndUpdateShadowClosure::complete_region(HeapWord* dest_addr, PSParallelCompact::RegionData* region_ptr) {
2411   assert(region_ptr->shadow_state() == ParallelCompactData::RegionData::ShadowRegion, "Region should be shadow");
2412   // Record the shadow region index
2413   region_ptr->set_shadow_region(_shadow);
2414   // Mark the shadow region as filled to indicate the data is ready to be
2415   // copied back
2416   region_ptr->mark_filled();
2417   // Try to copy the content of the shadow region back to its corresponding
2418   // heap region if available; the GC thread that decreases the destination
2419   // count to zero will do the copying otherwise (see
2420   // PSParallelCompact::decrement_destination_counts).
2421   if (((region_ptr->available() && region_ptr->claim()) || region_ptr->claimed()) && region_ptr->mark_copied()) {
2422     region_ptr->set_completed();
2423     PSParallelCompact::copy_back(PSParallelCompact::summary_data().region_to_addr(_shadow), dest_addr);
2424     ParCompactionManager::push_shadow_region_mt_safe(_shadow);

  56 #include "gc/shared/oopStorage.inline.hpp"
  57 #include "gc/shared/oopStorageSet.inline.hpp"
  58 #include "gc/shared/oopStorageSetParState.inline.hpp"
  59 #include "gc/shared/preservedMarks.inline.hpp"
  60 #include "gc/shared/referencePolicy.hpp"
  61 #include "gc/shared/referenceProcessor.hpp"
  62 #include "gc/shared/referenceProcessorPhaseTimes.hpp"
  63 #include "gc/shared/strongRootsScope.hpp"
  64 #include "gc/shared/taskTerminator.hpp"
  65 #include "gc/shared/weakProcessor.inline.hpp"
  66 #include "gc/shared/workerPolicy.hpp"
  67 #include "gc/shared/workerThread.hpp"
  68 #include "gc/shared/workerUtils.hpp"
  69 #include "logging/log.hpp"
  70 #include "memory/iterator.inline.hpp"
  71 #include "memory/metaspaceUtils.hpp"
  72 #include "memory/resourceArea.hpp"
  73 #include "memory/universe.hpp"
  74 #include "nmt/memTracker.hpp"
  75 #include "oops/access.inline.hpp"
  76 #include "oops/flatArrayKlass.inline.hpp"
  77 #include "oops/instanceClassLoaderKlass.inline.hpp"
  78 #include "oops/instanceKlass.inline.hpp"
  79 #include "oops/instanceMirrorKlass.inline.hpp"
  80 #include "oops/methodData.hpp"
  81 #include "oops/objArrayKlass.inline.hpp"
  82 #include "oops/oop.inline.hpp"
  83 #include "runtime/atomic.hpp"
  84 #include "runtime/handles.inline.hpp"
  85 #include "runtime/java.hpp"
  86 #include "runtime/safepoint.hpp"
  87 #include "runtime/threads.hpp"
  88 #include "runtime/vmThread.hpp"
  89 #include "services/memoryService.hpp"
  90 #include "utilities/align.hpp"
  91 #include "utilities/debug.hpp"
  92 #include "utilities/events.hpp"
  93 #include "utilities/formatBuffer.hpp"
  94 #include "utilities/macros.hpp"
  95 #include "utilities/stack.inline.hpp"
  96 #if INCLUDE_JVMCI

2384 }
2385 
2386 void MoveAndUpdateClosure::do_addr(HeapWord* addr, size_t words) {
2387   assert(destination() != nullptr, "sanity");
2388   _source = addr;
2389 
2390   // The start_array must be updated even if the object is not moving.
2391   if (_start_array != nullptr) {
2392     _start_array->update_for_block(destination(), destination() + words);
2393   }
2394 
2395   // Avoid overflow
2396   words = MIN2(words, words_remaining());
2397   assert(words > 0, "inv");
2398 
2399   if (copy_destination() != source()) {
2400     DEBUG_ONLY(PSParallelCompact::check_new_location(source(), destination());)
2401     assert(source() != destination(), "inv");
2402     assert(cast_to_oop(source())->is_forwarded(), "inv");
2403     assert(cast_to_oop(source())->forwardee() == cast_to_oop(destination()), "inv");
2404     // Read the klass before the copying, since it might destroy the klass (i.e. overlapping copy)
2405     // and if partial copy, the destination klass may not be copied yet
2406     Klass* klass = cast_to_oop(source())->klass();
2407     Copy::aligned_conjoint_words(source(), copy_destination(), words);
2408     cast_to_oop(copy_destination())->set_mark(Klass::default_prototype_header(klass));
2409   }
2410 
2411   update_state(words);
2412 }
2413 
2414 void MoveAndUpdateShadowClosure::complete_region(HeapWord* dest_addr, PSParallelCompact::RegionData* region_ptr) {
2415   assert(region_ptr->shadow_state() == ParallelCompactData::RegionData::ShadowRegion, "Region should be shadow");
2416   // Record the shadow region index
2417   region_ptr->set_shadow_region(_shadow);
2418   // Mark the shadow region as filled to indicate the data is ready to be
2419   // copied back
2420   region_ptr->mark_filled();
2421   // Try to copy the content of the shadow region back to its corresponding
2422   // heap region if available; the GC thread that decreases the destination
2423   // count to zero will do the copying otherwise (see
2424   // PSParallelCompact::decrement_destination_counts).
2425   if (((region_ptr->available() && region_ptr->claim()) || region_ptr->claimed()) && region_ptr->mark_copied()) {
2426     region_ptr->set_completed();
2427     PSParallelCompact::copy_back(PSParallelCompact::summary_data().region_to_addr(_shadow), dest_addr);
2428     ParCompactionManager::push_shadow_region_mt_safe(_shadow);
< prev index next >