< prev index next >

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

Print this page

  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/spaceDecorator.hpp"
  64 #include "gc/shared/strongRootsScope.hpp"
  65 #include "gc/shared/taskTerminator.hpp"
  66 #include "gc/shared/weakProcessor.inline.hpp"
  67 #include "gc/shared/workerPolicy.hpp"
  68 #include "gc/shared/workerThread.hpp"
  69 #include "gc/shared/workerUtils.hpp"
  70 #include "logging/log.hpp"
  71 #include "memory/iterator.inline.hpp"
  72 #include "memory/memoryReserver.hpp"
  73 #include "memory/metaspaceUtils.hpp"
  74 #include "memory/resourceArea.hpp"
  75 #include "memory/universe.hpp"
  76 #include "nmt/memTracker.hpp"
  77 #include "oops/access.inline.hpp"

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

2433 }
2434 
2435 void MoveAndUpdateClosure::do_addr(HeapWord* addr, size_t words) {
2436   assert(destination() != nullptr, "sanity");
2437   _source = addr;
2438 
2439   // The start_array must be updated even if the object is not moving.
2440   if (_start_array != nullptr) {
2441     _start_array->update_for_block(destination(), destination() + words);
2442   }
2443 
2444   // Avoid overflow
2445   words = MIN2(words, words_remaining());
2446   assert(words > 0, "inv");
2447 
2448   if (copy_destination() != source()) {
2449     DEBUG_ONLY(PSParallelCompact::check_new_location(source(), destination());)
2450     assert(source() != destination(), "inv");
2451     assert(FullGCForwarding::is_forwarded(cast_to_oop(source())), "inv");
2452     assert(FullGCForwarding::forwardee(cast_to_oop(source())) == cast_to_oop(destination()), "inv");



2453     Copy::aligned_conjoint_words(source(), copy_destination(), words);
2454     cast_to_oop(copy_destination())->init_mark();
2455   }
2456 
2457   update_state(words);
2458 }
2459 
2460 void MoveAndUpdateShadowClosure::complete_region(HeapWord* dest_addr, PSParallelCompact::RegionData* region_ptr) {
2461   assert(region_ptr->shadow_state() == ParallelCompactData::RegionData::ShadowRegion, "Region should be shadow");
2462   // Record the shadow region index
2463   region_ptr->set_shadow_region(_shadow);
2464   // Mark the shadow region as filled to indicate the data is ready to be
2465   // copied back
2466   region_ptr->mark_filled();
2467   // Try to copy the content of the shadow region back to its corresponding
2468   // heap region if available; the GC thread that decreases the destination
2469   // count to zero will do the copying otherwise (see
2470   // PSParallelCompact::decrement_destination_counts).
2471   if (((region_ptr->available() && region_ptr->claim()) || region_ptr->claimed()) && region_ptr->mark_copied()) {
2472     region_ptr->set_completed();
2473     PSParallelCompact::copy_back(PSParallelCompact::summary_data().region_to_addr(_shadow), dest_addr);
2474     ParCompactionManager::push_shadow_region_mt_safe(_shadow);

  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/spaceDecorator.hpp"
  64 #include "gc/shared/strongRootsScope.hpp"
  65 #include "gc/shared/taskTerminator.hpp"
  66 #include "gc/shared/weakProcessor.inline.hpp"
  67 #include "gc/shared/workerPolicy.hpp"
  68 #include "gc/shared/workerThread.hpp"
  69 #include "gc/shared/workerUtils.hpp"
  70 #include "logging/log.hpp"
  71 #include "memory/iterator.inline.hpp"
  72 #include "memory/memoryReserver.hpp"
  73 #include "memory/metaspaceUtils.hpp"
  74 #include "memory/resourceArea.hpp"
  75 #include "memory/universe.hpp"
  76 #include "nmt/memTracker.hpp"
  77 #include "oops/access.inline.hpp"
  78 #include "oops/flatArrayKlass.inline.hpp"
  79 #include "oops/instanceClassLoaderKlass.inline.hpp"
  80 #include "oops/instanceKlass.inline.hpp"
  81 #include "oops/instanceMirrorKlass.inline.hpp"
  82 #include "oops/methodData.hpp"
  83 #include "oops/objArrayKlass.inline.hpp"
  84 #include "oops/oop.inline.hpp"
  85 #include "runtime/atomic.hpp"
  86 #include "runtime/handles.inline.hpp"
  87 #include "runtime/java.hpp"
  88 #include "runtime/safepoint.hpp"
  89 #include "runtime/threads.hpp"
  90 #include "runtime/vmThread.hpp"
  91 #include "services/memoryService.hpp"
  92 #include "utilities/align.hpp"
  93 #include "utilities/debug.hpp"
  94 #include "utilities/events.hpp"
  95 #include "utilities/formatBuffer.hpp"
  96 #include "utilities/macros.hpp"
  97 #include "utilities/stack.inline.hpp"
  98 #if INCLUDE_JVMCI

2434 }
2435 
2436 void MoveAndUpdateClosure::do_addr(HeapWord* addr, size_t words) {
2437   assert(destination() != nullptr, "sanity");
2438   _source = addr;
2439 
2440   // The start_array must be updated even if the object is not moving.
2441   if (_start_array != nullptr) {
2442     _start_array->update_for_block(destination(), destination() + words);
2443   }
2444 
2445   // Avoid overflow
2446   words = MIN2(words, words_remaining());
2447   assert(words > 0, "inv");
2448 
2449   if (copy_destination() != source()) {
2450     DEBUG_ONLY(PSParallelCompact::check_new_location(source(), destination());)
2451     assert(source() != destination(), "inv");
2452     assert(FullGCForwarding::is_forwarded(cast_to_oop(source())), "inv");
2453     assert(FullGCForwarding::forwardee(cast_to_oop(source())) == cast_to_oop(destination()), "inv");
2454     // Read the klass before the copying, since it might destroy the klass (i.e. overlapping copy)
2455     // and if partial copy, the destination klass may not be copied yet
2456     Klass* klass = cast_to_oop(source())->klass();
2457     Copy::aligned_conjoint_words(source(), copy_destination(), words);
2458     cast_to_oop(copy_destination())->set_mark(Klass::default_prototype_header(klass));
2459   }
2460 
2461   update_state(words);
2462 }
2463 
2464 void MoveAndUpdateShadowClosure::complete_region(HeapWord* dest_addr, PSParallelCompact::RegionData* region_ptr) {
2465   assert(region_ptr->shadow_state() == ParallelCompactData::RegionData::ShadowRegion, "Region should be shadow");
2466   // Record the shadow region index
2467   region_ptr->set_shadow_region(_shadow);
2468   // Mark the shadow region as filled to indicate the data is ready to be
2469   // copied back
2470   region_ptr->mark_filled();
2471   // Try to copy the content of the shadow region back to its corresponding
2472   // heap region if available; the GC thread that decreases the destination
2473   // count to zero will do the copying otherwise (see
2474   // PSParallelCompact::decrement_destination_counts).
2475   if (((region_ptr->available() && region_ptr->claim()) || region_ptr->claimed()) && region_ptr->mark_copied()) {
2476     region_ptr->set_completed();
2477     PSParallelCompact::copy_back(PSParallelCompact::summary_data().region_to_addr(_shadow), dest_addr);
2478     ParCompactionManager::push_shadow_region_mt_safe(_shadow);
< prev index next >