59 #include "gc/shared/oopStorageSetParState.inline.hpp"
60 #include "gc/shared/parallelCleaning.hpp"
61 #include "gc/shared/preservedMarks.inline.hpp"
62 #include "gc/shared/referencePolicy.hpp"
63 #include "gc/shared/referenceProcessor.hpp"
64 #include "gc/shared/referenceProcessorPhaseTimes.hpp"
65 #include "gc/shared/spaceDecorator.hpp"
66 #include "gc/shared/taskTerminator.hpp"
67 #include "gc/shared/weakProcessor.inline.hpp"
68 #include "gc/shared/workerPolicy.hpp"
69 #include "gc/shared/workerThread.hpp"
70 #include "gc/shared/workerUtils.hpp"
71 #include "logging/log.hpp"
72 #include "memory/iterator.inline.hpp"
73 #include "memory/memoryReserver.hpp"
74 #include "memory/metaspaceUtils.hpp"
75 #include "memory/resourceArea.hpp"
76 #include "memory/universe.hpp"
77 #include "nmt/memTracker.hpp"
78 #include "oops/access.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/atomicAccess.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
2346
2347 void MoveAndUpdateClosure::do_addr(HeapWord* addr, size_t words) {
2348 assert(destination() != nullptr, "sanity");
2349 _source = addr;
2350
2351 // The start_array must be updated even if the object is not moving.
2352 if (_start_array != nullptr) {
2353 _start_array->update_for_block(destination(), destination() + words);
2354 }
2355
2356 // Avoid overflow
2357 words = MIN2(words, words_remaining());
2358 assert(words > 0, "inv");
2359
2360 if (copy_destination() != source()) {
2361 DEBUG_ONLY(PSParallelCompact::check_new_location(source(), destination());)
2362 assert(source() != destination(), "inv");
2363 assert(FullGCForwarding::is_forwarded(cast_to_oop(source())), "inv");
2364 assert(FullGCForwarding::forwardee(cast_to_oop(source())) == cast_to_oop(destination()), "inv");
2365 Copy::aligned_conjoint_words(source(), copy_destination(), words);
2366 cast_to_oop(copy_destination())->init_mark();
2367 }
2368
2369 update_state(words);
2370 }
2371
2372 void MoveAndUpdateShadowClosure::complete_region(HeapWord* dest_addr, PSParallelCompact::RegionData* region_ptr) {
2373 assert(region_ptr->shadow_state() == ParallelCompactData::RegionData::ShadowRegion, "Region should be shadow");
2374 // Record the shadow region index
2375 region_ptr->set_shadow_region(_shadow);
2376 // Mark the shadow region as filled to indicate the data is ready to be
2377 // copied back
2378 region_ptr->mark_filled();
2379 // Try to copy the content of the shadow region back to its corresponding
2380 // heap region if available; the GC thread that decreases the destination
2381 // count to zero will do the copying otherwise (see
2382 // PSParallelCompact::decrement_destination_counts).
2383 if (((region_ptr->available() && region_ptr->claim()) || region_ptr->claimed()) && region_ptr->mark_copied()) {
2384 region_ptr->set_completed();
2385 PSParallelCompact::copy_back(PSParallelCompact::summary_data().region_to_addr(_shadow), dest_addr);
2386 ParCompactionManager::push_shadow_region_mt_safe(_shadow);
|
59 #include "gc/shared/oopStorageSetParState.inline.hpp"
60 #include "gc/shared/parallelCleaning.hpp"
61 #include "gc/shared/preservedMarks.inline.hpp"
62 #include "gc/shared/referencePolicy.hpp"
63 #include "gc/shared/referenceProcessor.hpp"
64 #include "gc/shared/referenceProcessorPhaseTimes.hpp"
65 #include "gc/shared/spaceDecorator.hpp"
66 #include "gc/shared/taskTerminator.hpp"
67 #include "gc/shared/weakProcessor.inline.hpp"
68 #include "gc/shared/workerPolicy.hpp"
69 #include "gc/shared/workerThread.hpp"
70 #include "gc/shared/workerUtils.hpp"
71 #include "logging/log.hpp"
72 #include "memory/iterator.inline.hpp"
73 #include "memory/memoryReserver.hpp"
74 #include "memory/metaspaceUtils.hpp"
75 #include "memory/resourceArea.hpp"
76 #include "memory/universe.hpp"
77 #include "nmt/memTracker.hpp"
78 #include "oops/access.inline.hpp"
79 #include "oops/flatArrayKlass.inline.hpp"
80 #include "oops/instanceClassLoaderKlass.inline.hpp"
81 #include "oops/instanceKlass.inline.hpp"
82 #include "oops/instanceMirrorKlass.inline.hpp"
83 #include "oops/methodData.hpp"
84 #include "oops/objArrayKlass.inline.hpp"
85 #include "oops/oop.inline.hpp"
86 #include "runtime/atomicAccess.hpp"
87 #include "runtime/handles.inline.hpp"
88 #include "runtime/java.hpp"
89 #include "runtime/safepoint.hpp"
90 #include "runtime/threads.hpp"
91 #include "runtime/vmThread.hpp"
92 #include "services/memoryService.hpp"
93 #include "utilities/align.hpp"
94 #include "utilities/debug.hpp"
95 #include "utilities/events.hpp"
96 #include "utilities/formatBuffer.hpp"
97 #include "utilities/macros.hpp"
98 #include "utilities/stack.inline.hpp"
99 #if INCLUDE_JVMCI
2347
2348 void MoveAndUpdateClosure::do_addr(HeapWord* addr, size_t words) {
2349 assert(destination() != nullptr, "sanity");
2350 _source = addr;
2351
2352 // The start_array must be updated even if the object is not moving.
2353 if (_start_array != nullptr) {
2354 _start_array->update_for_block(destination(), destination() + words);
2355 }
2356
2357 // Avoid overflow
2358 words = MIN2(words, words_remaining());
2359 assert(words > 0, "inv");
2360
2361 if (copy_destination() != source()) {
2362 DEBUG_ONLY(PSParallelCompact::check_new_location(source(), destination());)
2363 assert(source() != destination(), "inv");
2364 assert(FullGCForwarding::is_forwarded(cast_to_oop(source())), "inv");
2365 assert(FullGCForwarding::forwardee(cast_to_oop(source())) == cast_to_oop(destination()), "inv");
2366 Copy::aligned_conjoint_words(source(), copy_destination(), words);
2367 cast_to_oop(copy_destination())->reinit_mark();
2368 }
2369
2370 update_state(words);
2371 }
2372
2373 void MoveAndUpdateShadowClosure::complete_region(HeapWord* dest_addr, PSParallelCompact::RegionData* region_ptr) {
2374 assert(region_ptr->shadow_state() == ParallelCompactData::RegionData::ShadowRegion, "Region should be shadow");
2375 // Record the shadow region index
2376 region_ptr->set_shadow_region(_shadow);
2377 // Mark the shadow region as filled to indicate the data is ready to be
2378 // copied back
2379 region_ptr->mark_filled();
2380 // Try to copy the content of the shadow region back to its corresponding
2381 // heap region if available; the GC thread that decreases the destination
2382 // count to zero will do the copying otherwise (see
2383 // PSParallelCompact::decrement_destination_counts).
2384 if (((region_ptr->available() && region_ptr->claim()) || region_ptr->claimed()) && region_ptr->mark_copied()) {
2385 region_ptr->set_completed();
2386 PSParallelCompact::copy_back(PSParallelCompact::summary_data().region_to_addr(_shadow), dest_addr);
2387 ParCompactionManager::push_shadow_region_mt_safe(_shadow);
|