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
2353
2354 void MoveAndUpdateClosure::do_addr(HeapWord* addr, size_t words) {
2355 assert(destination() != nullptr, "sanity");
2356 _source = addr;
2357
2358 // The start_array must be updated even if the object is not moving.
2359 if (_start_array != nullptr) {
2360 _start_array->update_for_block(destination(), destination() + words);
2361 }
2362
2363 // Avoid overflow
2364 words = MIN2(words, words_remaining());
2365 assert(words > 0, "inv");
2366
2367 if (copy_destination() != source()) {
2368 DEBUG_ONLY(PSParallelCompact::check_new_location(source(), destination());)
2369 assert(source() != destination(), "inv");
2370 assert(FullGCForwarding::is_forwarded(cast_to_oop(source())), "inv");
2371 assert(FullGCForwarding::forwardee(cast_to_oop(source())) == cast_to_oop(destination()), "inv");
2372 Copy::aligned_conjoint_words(source(), copy_destination(), words);
2373 cast_to_oop(copy_destination())->init_mark();
2374 }
2375
2376 update_state(words);
2377 }
2378
2379 void MoveAndUpdateShadowClosure::complete_region(HeapWord* dest_addr, PSParallelCompact::RegionData* region_ptr) {
2380 assert(region_ptr->shadow_state() == ParallelCompactData::RegionData::ShadowRegion, "Region should be shadow");
2381 // Record the shadow region index
2382 region_ptr->set_shadow_region(_shadow);
2383 // Mark the shadow region as filled to indicate the data is ready to be
2384 // copied back
2385 region_ptr->mark_filled();
2386 // Try to copy the content of the shadow region back to its corresponding
2387 // heap region if available; the GC thread that decreases the destination
2388 // count to zero will do the copying otherwise (see
2389 // PSParallelCompact::decrement_destination_counts).
2390 if (((region_ptr->available() && region_ptr->claim()) || region_ptr->claimed()) && region_ptr->mark_copied()) {
2391 region_ptr->set_completed();
2392 PSParallelCompact::copy_back(PSParallelCompact::summary_data().region_to_addr(_shadow), dest_addr);
2393 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
2354
2355 void MoveAndUpdateClosure::do_addr(HeapWord* addr, size_t words) {
2356 assert(destination() != nullptr, "sanity");
2357 _source = addr;
2358
2359 // The start_array must be updated even if the object is not moving.
2360 if (_start_array != nullptr) {
2361 _start_array->update_for_block(destination(), destination() + words);
2362 }
2363
2364 // Avoid overflow
2365 words = MIN2(words, words_remaining());
2366 assert(words > 0, "inv");
2367
2368 if (copy_destination() != source()) {
2369 DEBUG_ONLY(PSParallelCompact::check_new_location(source(), destination());)
2370 assert(source() != destination(), "inv");
2371 assert(FullGCForwarding::is_forwarded(cast_to_oop(source())), "inv");
2372 assert(FullGCForwarding::forwardee(cast_to_oop(source())) == cast_to_oop(destination()), "inv");
2373 Copy::aligned_conjoint_words(source(), copy_destination(), words);
2374 cast_to_oop(copy_destination())->reinit_mark();
2375 }
2376
2377 update_state(words);
2378 }
2379
2380 void MoveAndUpdateShadowClosure::complete_region(HeapWord* dest_addr, PSParallelCompact::RegionData* region_ptr) {
2381 assert(region_ptr->shadow_state() == ParallelCompactData::RegionData::ShadowRegion, "Region should be shadow");
2382 // Record the shadow region index
2383 region_ptr->set_shadow_region(_shadow);
2384 // Mark the shadow region as filled to indicate the data is ready to be
2385 // copied back
2386 region_ptr->mark_filled();
2387 // Try to copy the content of the shadow region back to its corresponding
2388 // heap region if available; the GC thread that decreases the destination
2389 // count to zero will do the copying otherwise (see
2390 // PSParallelCompact::decrement_destination_counts).
2391 if (((region_ptr->available() && region_ptr->claim()) || region_ptr->claimed()) && region_ptr->mark_copied()) {
2392 region_ptr->set_completed();
2393 PSParallelCompact::copy_back(PSParallelCompact::summary_data().region_to_addr(_shadow), dest_addr);
2394 ParCompactionManager::push_shadow_region_mt_safe(_shadow);
|