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