| File: | jdk/src/hotspot/share/gc/parallel/psPromotionManager.cpp |
| Warning: | line 188, column 25 Value stored to 'heap' during its initialization is never read |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
| 1 | /* |
| 2 | * Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved. |
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 4 | * |
| 5 | * This code is free software; you can redistribute it and/or modify it |
| 6 | * under the terms of the GNU General Public License version 2 only, as |
| 7 | * published by the Free Software Foundation. |
| 8 | * |
| 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
| 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 12 | * version 2 for more details (a copy is included in the LICENSE file that |
| 13 | * accompanied this code). |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License version |
| 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
| 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 18 | * |
| 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
| 20 | * or visit www.oracle.com if you need additional information or have any |
| 21 | * questions. |
| 22 | * |
| 23 | */ |
| 24 | |
| 25 | #include "precompiled.hpp" |
| 26 | #include "classfile/javaClasses.inline.hpp" |
| 27 | #include "gc/parallel/mutableSpace.hpp" |
| 28 | #include "gc/parallel/parallelScavengeHeap.hpp" |
| 29 | #include "gc/parallel/psOldGen.hpp" |
| 30 | #include "gc/parallel/psPromotionManager.inline.hpp" |
| 31 | #include "gc/parallel/psScavenge.inline.hpp" |
| 32 | #include "gc/shared/gcTrace.hpp" |
| 33 | #include "gc/shared/preservedMarks.inline.hpp" |
| 34 | #include "gc/shared/taskqueue.inline.hpp" |
| 35 | #include "logging/log.hpp" |
| 36 | #include "logging/logStream.hpp" |
| 37 | #include "memory/allocation.inline.hpp" |
| 38 | #include "memory/iterator.inline.hpp" |
| 39 | #include "memory/memRegion.hpp" |
| 40 | #include "memory/padded.inline.hpp" |
| 41 | #include "memory/resourceArea.hpp" |
| 42 | #include "oops/access.inline.hpp" |
| 43 | #include "oops/compressedOops.inline.hpp" |
| 44 | |
| 45 | PaddedEnd<PSPromotionManager>* PSPromotionManager::_manager_array = NULL__null; |
| 46 | PSPromotionManager::PSScannerTasksQueueSet* PSPromotionManager::_stack_array_depth = NULL__null; |
| 47 | PreservedMarksSet* PSPromotionManager::_preserved_marks_set = NULL__null; |
| 48 | PSOldGen* PSPromotionManager::_old_gen = NULL__null; |
| 49 | MutableSpace* PSPromotionManager::_young_space = NULL__null; |
| 50 | |
| 51 | void PSPromotionManager::initialize() { |
| 52 | ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); |
| 53 | |
| 54 | _old_gen = heap->old_gen(); |
| 55 | _young_space = heap->young_gen()->to_space(); |
| 56 | |
| 57 | const uint promotion_manager_num = ParallelGCThreads + 1; |
| 58 | |
| 59 | // To prevent false sharing, we pad the PSPromotionManagers |
| 60 | // and make sure that the first instance starts at a cache line. |
| 61 | assert(_manager_array == NULL, "Attempt to initialize twice")do { if (!(_manager_array == __null)) { (*g_assert_poison) = 'X' ;; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psPromotionManager.cpp" , 61, "assert(" "_manager_array == __null" ") failed", "Attempt to initialize twice" ); ::breakpoint(); } } while (0); |
| 62 | _manager_array = PaddedArray<PSPromotionManager, mtGC>::create_unfreeable(promotion_manager_num); |
| 63 | |
| 64 | _stack_array_depth = new PSScannerTasksQueueSet(ParallelGCThreads); |
| 65 | |
| 66 | // Create and register the PSPromotionManager(s) for the worker threads. |
| 67 | for(uint i=0; i<ParallelGCThreads; i++) { |
| 68 | stack_array_depth()->register_queue(i, _manager_array[i].claimed_stack_depth()); |
| 69 | } |
| 70 | // The VMThread gets its own PSPromotionManager, which is not available |
| 71 | // for work stealing. |
| 72 | |
| 73 | assert(_preserved_marks_set == NULL, "Attempt to initialize twice")do { if (!(_preserved_marks_set == __null)) { (*g_assert_poison ) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psPromotionManager.cpp" , 73, "assert(" "_preserved_marks_set == __null" ") failed", "Attempt to initialize twice" ); ::breakpoint(); } } while (0); |
| 74 | _preserved_marks_set = new PreservedMarksSet(true /* in_c_heap */); |
| 75 | _preserved_marks_set->init(promotion_manager_num); |
| 76 | for (uint i = 0; i < promotion_manager_num; i += 1) { |
| 77 | _manager_array[i].register_preserved_marks(_preserved_marks_set->get(i)); |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | // Helper functions to get around the circular dependency between |
| 82 | // psScavenge.inline.hpp and psPromotionManager.inline.hpp. |
| 83 | bool PSPromotionManager::should_scavenge(oop* p, bool check_to_space) { |
| 84 | return PSScavenge::should_scavenge(p, check_to_space); |
| 85 | } |
| 86 | bool PSPromotionManager::should_scavenge(narrowOop* p, bool check_to_space) { |
| 87 | return PSScavenge::should_scavenge(p, check_to_space); |
| 88 | } |
| 89 | |
| 90 | PSPromotionManager* PSPromotionManager::gc_thread_promotion_manager(uint index) { |
| 91 | assert(index < ParallelGCThreads, "index out of range")do { if (!(index < ParallelGCThreads)) { (*g_assert_poison ) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psPromotionManager.cpp" , 91, "assert(" "index < ParallelGCThreads" ") failed", "index out of range" ); ::breakpoint(); } } while (0); |
| 92 | assert(_manager_array != NULL, "Sanity")do { if (!(_manager_array != __null)) { (*g_assert_poison) = 'X' ;; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psPromotionManager.cpp" , 92, "assert(" "_manager_array != __null" ") failed", "Sanity" ); ::breakpoint(); } } while (0); |
| 93 | return &_manager_array[index]; |
| 94 | } |
| 95 | |
| 96 | PSPromotionManager* PSPromotionManager::vm_thread_promotion_manager() { |
| 97 | assert(_manager_array != NULL, "Sanity")do { if (!(_manager_array != __null)) { (*g_assert_poison) = 'X' ;; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psPromotionManager.cpp" , 97, "assert(" "_manager_array != __null" ") failed", "Sanity" ); ::breakpoint(); } } while (0); |
| 98 | return &_manager_array[ParallelGCThreads]; |
| 99 | } |
| 100 | |
| 101 | void PSPromotionManager::pre_scavenge() { |
| 102 | ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); |
| 103 | |
| 104 | _preserved_marks_set->assert_empty(); |
| 105 | _young_space = heap->young_gen()->to_space(); |
| 106 | |
| 107 | for(uint i=0; i<ParallelGCThreads+1; i++) { |
| 108 | manager_array(i)->reset(); |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | bool PSPromotionManager::post_scavenge(YoungGCTracer& gc_tracer) { |
| 113 | bool promotion_failure_occurred = false; |
| 114 | |
| 115 | TASKQUEUE_STATS_ONLY(print_taskqueue_stats())print_taskqueue_stats(); |
| 116 | for (uint i = 0; i < ParallelGCThreads + 1; i++) { |
| 117 | PSPromotionManager* manager = manager_array(i); |
| 118 | assert(manager->claimed_stack_depth()->is_empty(), "should be empty")do { if (!(manager->claimed_stack_depth()->is_empty())) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psPromotionManager.cpp" , 118, "assert(" "manager->claimed_stack_depth()->is_empty()" ") failed", "should be empty"); ::breakpoint(); } } while (0 ); |
| 119 | if (manager->_promotion_failed_info.has_failed()) { |
| 120 | gc_tracer.report_promotion_failed(manager->_promotion_failed_info); |
| 121 | promotion_failure_occurred = true; |
| 122 | } |
| 123 | manager->flush_labs(); |
| 124 | manager->flush_string_dedup_requests(); |
| 125 | } |
| 126 | if (!promotion_failure_occurred) { |
| 127 | // If there was no promotion failure, the preserved mark stacks |
| 128 | // should be empty. |
| 129 | _preserved_marks_set->assert_empty(); |
| 130 | } |
| 131 | return promotion_failure_occurred; |
| 132 | } |
| 133 | |
| 134 | #if TASKQUEUE_STATS1 |
| 135 | void |
| 136 | PSPromotionManager::print_local_stats(outputStream* const out, uint i) const { |
| 137 | #define FMT " " SIZE_FORMAT_W(10)"%" "10" "l" "u" |
| 138 | out->print_cr("%3u" FMT FMT FMT FMT, |
| 139 | i, _array_chunk_pushes, _array_chunk_steals, |
| 140 | _arrays_chunked, _array_chunks_processed); |
| 141 | #undef FMT |
| 142 | } |
| 143 | |
| 144 | static const char* const pm_stats_hdr[] = { |
| 145 | " ----partial array---- arrays array", |
| 146 | "thr push steal chunked chunks", |
| 147 | "--- ---------- ---------- ---------- ----------" |
| 148 | }; |
| 149 | |
| 150 | void |
| 151 | PSPromotionManager::print_taskqueue_stats() { |
| 152 | if (!log_is_enabled(Trace, gc, task, stats)(LogImpl<(LogTag::_gc), (LogTag::_task), (LogTag::_stats), (LogTag::__NO_TAG), (LogTag::__NO_TAG), (LogTag::__NO_TAG)> ::is_level(LogLevel::Trace))) { |
| 153 | return; |
| 154 | } |
| 155 | Log(gc, task, stats)LogImpl<(LogTag::_gc), (LogTag::_task), (LogTag::_stats), ( LogTag::__NO_TAG), (LogTag::__NO_TAG), (LogTag::__NO_TAG)> log; |
| 156 | ResourceMark rm; |
| 157 | LogStream ls(log.trace()); |
| 158 | outputStream* out = &ls; |
| 159 | out->print_cr("== GC Tasks Stats, GC %3d", |
| 160 | ParallelScavengeHeap::heap()->total_collections()); |
| 161 | |
| 162 | TaskQueueStats totals; |
| 163 | out->print("thr "); TaskQueueStats::print_header(1, out); out->cr(); |
| 164 | out->print("--- "); TaskQueueStats::print_header(2, out); out->cr(); |
| 165 | for (uint i = 0; i < ParallelGCThreads + 1; ++i) { |
| 166 | TaskQueueStats& next = manager_array(i)->_claimed_stack_depth.stats; |
| 167 | out->print("%3d ", i); next.print(out); out->cr(); |
| 168 | totals += next; |
| 169 | } |
| 170 | out->print("tot "); totals.print(out); out->cr(); |
| 171 | |
| 172 | const uint hlines = sizeof(pm_stats_hdr) / sizeof(pm_stats_hdr[0]); |
| 173 | for (uint i = 0; i < hlines; ++i) out->print_cr("%s", pm_stats_hdr[i]); |
| 174 | for (uint i = 0; i < ParallelGCThreads + 1; ++i) { |
| 175 | manager_array(i)->print_local_stats(out, i); |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | void |
| 180 | PSPromotionManager::reset_stats() { |
| 181 | claimed_stack_depth()->stats.reset(); |
| 182 | _array_chunk_pushes = _array_chunk_steals = 0; |
| 183 | _arrays_chunked = _array_chunks_processed = 0; |
| 184 | } |
| 185 | #endif // TASKQUEUE_STATS |
| 186 | |
| 187 | PSPromotionManager::PSPromotionManager() { |
| 188 | ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); |
Value stored to 'heap' during its initialization is never read | |
| 189 | |
| 190 | // We set the old lab's start array. |
| 191 | _old_lab.set_start_array(old_gen()->start_array()); |
| 192 | |
| 193 | uint queue_size; |
| 194 | queue_size = claimed_stack_depth()->max_elems(); |
| 195 | |
| 196 | _totally_drain = (ParallelGCThreads == 1) || (GCDrainStackTargetSize == 0); |
| 197 | if (_totally_drain) { |
| 198 | _target_stack_size = 0; |
| 199 | } else { |
| 200 | // don't let the target stack size to be more than 1/4 of the entries |
| 201 | _target_stack_size = (uint) MIN2((uint) GCDrainStackTargetSize, |
| 202 | (uint) (queue_size / 4)); |
| 203 | } |
| 204 | |
| 205 | _array_chunk_size = ParGCArrayScanChunk; |
| 206 | // let's choose 1.5x the chunk size |
| 207 | _min_array_size_for_chunking = 3 * _array_chunk_size / 2; |
| 208 | |
| 209 | _preserved_marks = NULL__null; |
| 210 | |
| 211 | reset(); |
| 212 | } |
| 213 | |
| 214 | void PSPromotionManager::reset() { |
| 215 | assert(stacks_empty(), "reset of non-empty stack")do { if (!(stacks_empty())) { (*g_assert_poison) = 'X';; report_vm_error ("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psPromotionManager.cpp" , 215, "assert(" "stacks_empty()" ") failed", "reset of non-empty stack" ); ::breakpoint(); } } while (0); |
| 216 | |
| 217 | // We need to get an assert in here to make sure the labs are always flushed. |
| 218 | |
| 219 | ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); |
| 220 | |
| 221 | // Do not prefill the LAB's, save heap wastage! |
| 222 | HeapWord* lab_base = young_space()->top(); |
| 223 | _young_lab.initialize(MemRegion(lab_base, (size_t)0)); |
| 224 | _young_gen_is_full = false; |
| 225 | |
| 226 | lab_base = old_gen()->object_space()->top(); |
| 227 | _old_lab.initialize(MemRegion(lab_base, (size_t)0)); |
| 228 | _old_gen_is_full = false; |
| 229 | |
| 230 | _promotion_failed_info.reset(); |
| 231 | |
| 232 | TASKQUEUE_STATS_ONLY(reset_stats())reset_stats(); |
| 233 | } |
| 234 | |
| 235 | void PSPromotionManager::register_preserved_marks(PreservedMarks* preserved_marks) { |
| 236 | assert(_preserved_marks == NULL, "do not set it twice")do { if (!(_preserved_marks == __null)) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psPromotionManager.cpp" , 236, "assert(" "_preserved_marks == __null" ") failed", "do not set it twice" ); ::breakpoint(); } } while (0); |
| 237 | _preserved_marks = preserved_marks; |
| 238 | } |
| 239 | |
| 240 | void PSPromotionManager::restore_preserved_marks() { |
| 241 | _preserved_marks_set->restore(&ParallelScavengeHeap::heap()->workers()); |
| 242 | } |
| 243 | |
| 244 | void PSPromotionManager::drain_stacks_depth(bool totally_drain) { |
| 245 | totally_drain = totally_drain || _totally_drain; |
| 246 | |
| 247 | #ifdef ASSERT1 |
| 248 | ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); |
| 249 | MutableSpace* to_space = heap->young_gen()->to_space(); |
| 250 | MutableSpace* old_space = heap->old_gen()->object_space(); |
| 251 | #endif /* ASSERT */ |
| 252 | |
| 253 | PSScannerTasksQueue* const tq = claimed_stack_depth(); |
| 254 | do { |
| 255 | ScannerTask task; |
| 256 | |
| 257 | // Drain overflow stack first, so other threads can steal from |
| 258 | // claimed stack while we work. |
| 259 | while (tq->pop_overflow(task)) { |
| 260 | process_popped_location_depth(task); |
| 261 | } |
| 262 | |
| 263 | if (totally_drain) { |
| 264 | while (tq->pop_local(task)) { |
| 265 | process_popped_location_depth(task); |
| 266 | } |
| 267 | } else { |
| 268 | while (tq->size() > _target_stack_size && tq->pop_local(task)) { |
| 269 | process_popped_location_depth(task); |
| 270 | } |
| 271 | } |
| 272 | } while ((totally_drain && !tq->taskqueue_empty()) || !tq->overflow_empty()); |
| 273 | |
| 274 | assert(!totally_drain || tq->taskqueue_empty(), "Sanity")do { if (!(!totally_drain || tq->taskqueue_empty())) { (*g_assert_poison ) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psPromotionManager.cpp" , 274, "assert(" "!totally_drain || tq->taskqueue_empty()" ") failed", "Sanity"); ::breakpoint(); } } while (0); |
| 275 | assert(totally_drain || tq->size() <= _target_stack_size, "Sanity")do { if (!(totally_drain || tq->size() <= _target_stack_size )) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psPromotionManager.cpp" , 275, "assert(" "totally_drain || tq->size() <= _target_stack_size" ") failed", "Sanity"); ::breakpoint(); } } while (0); |
| 276 | assert(tq->overflow_empty(), "Sanity")do { if (!(tq->overflow_empty())) { (*g_assert_poison) = 'X' ;; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psPromotionManager.cpp" , 276, "assert(" "tq->overflow_empty()" ") failed", "Sanity" ); ::breakpoint(); } } while (0); |
| 277 | } |
| 278 | |
| 279 | void PSPromotionManager::flush_labs() { |
| 280 | assert(stacks_empty(), "Attempt to flush lab with live stack")do { if (!(stacks_empty())) { (*g_assert_poison) = 'X';; report_vm_error ("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psPromotionManager.cpp" , 280, "assert(" "stacks_empty()" ") failed", "Attempt to flush lab with live stack" ); ::breakpoint(); } } while (0); |
| 281 | |
| 282 | // If either promotion lab fills up, we can flush the |
| 283 | // lab but not refill it, so check first. |
| 284 | assert(!_young_lab.is_flushed() || _young_gen_is_full, "Sanity")do { if (!(!_young_lab.is_flushed() || _young_gen_is_full)) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psPromotionManager.cpp" , 284, "assert(" "!_young_lab.is_flushed() || _young_gen_is_full" ") failed", "Sanity"); ::breakpoint(); } } while (0); |
| 285 | if (!_young_lab.is_flushed()) |
| 286 | _young_lab.flush(); |
| 287 | |
| 288 | assert(!_old_lab.is_flushed() || _old_gen_is_full, "Sanity")do { if (!(!_old_lab.is_flushed() || _old_gen_is_full)) { (*g_assert_poison ) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psPromotionManager.cpp" , 288, "assert(" "!_old_lab.is_flushed() || _old_gen_is_full" ") failed", "Sanity"); ::breakpoint(); } } while (0); |
| 289 | if (!_old_lab.is_flushed()) |
| 290 | _old_lab.flush(); |
| 291 | |
| 292 | // Let PSScavenge know if we overflowed |
| 293 | if (_young_gen_is_full) { |
| 294 | PSScavenge::set_survivor_overflow(true); |
| 295 | } |
| 296 | } |
| 297 | |
| 298 | template <class T> void PSPromotionManager::process_array_chunk_work( |
| 299 | oop obj, |
| 300 | int start, int end) { |
| 301 | assert(start <= end, "invariant")do { if (!(start <= end)) { (*g_assert_poison) = 'X';; report_vm_error ("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psPromotionManager.cpp" , 301, "assert(" "start <= end" ") failed", "invariant"); :: breakpoint(); } } while (0); |
| 302 | T* const base = (T*)objArrayOop(obj)->base(); |
| 303 | T* p = base + start; |
| 304 | T* const chunk_end = base + end; |
| 305 | while (p < chunk_end) { |
| 306 | if (PSScavenge::should_scavenge(p)) { |
| 307 | claim_or_forward_depth(p); |
| 308 | } |
| 309 | ++p; |
| 310 | } |
| 311 | } |
| 312 | |
| 313 | void PSPromotionManager::process_array_chunk(PartialArrayScanTask task) { |
| 314 | assert(PSChunkLargeArrays, "invariant")do { if (!(PSChunkLargeArrays)) { (*g_assert_poison) = 'X';; report_vm_error ("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psPromotionManager.cpp" , 314, "assert(" "PSChunkLargeArrays" ") failed", "invariant" ); ::breakpoint(); } } while (0); |
| 315 | |
| 316 | oop old = task.to_source_array(); |
| 317 | assert(old->is_objArray(), "invariant")do { if (!(old->is_objArray())) { (*g_assert_poison) = 'X' ;; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psPromotionManager.cpp" , 317, "assert(" "old->is_objArray()" ") failed", "invariant" ); ::breakpoint(); } } while (0); |
| 318 | assert(old->is_forwarded(), "invariant")do { if (!(old->is_forwarded())) { (*g_assert_poison) = 'X' ;; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psPromotionManager.cpp" , 318, "assert(" "old->is_forwarded()" ") failed", "invariant" ); ::breakpoint(); } } while (0); |
| 319 | |
| 320 | TASKQUEUE_STATS_ONLY(++_array_chunks_processed)++_array_chunks_processed; |
| 321 | |
| 322 | oop const obj = old->forwardee(); |
| 323 | |
| 324 | int start; |
| 325 | int const end = arrayOop(old)->length(); |
| 326 | if (end > (int) _min_array_size_for_chunking) { |
| 327 | // we'll chunk more |
| 328 | start = end - _array_chunk_size; |
| 329 | assert(start > 0, "invariant")do { if (!(start > 0)) { (*g_assert_poison) = 'X';; report_vm_error ("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psPromotionManager.cpp" , 329, "assert(" "start > 0" ") failed", "invariant"); ::breakpoint (); } } while (0); |
| 330 | arrayOop(old)->set_length(start); |
| 331 | push_depth(ScannerTask(PartialArrayScanTask(old))); |
| 332 | TASKQUEUE_STATS_ONLY(++_array_chunk_pushes)++_array_chunk_pushes; |
| 333 | } else { |
| 334 | // this is the final chunk for this array |
| 335 | start = 0; |
| 336 | int const actual_length = arrayOop(obj)->length(); |
| 337 | arrayOop(old)->set_length(actual_length); |
| 338 | } |
| 339 | |
| 340 | if (UseCompressedOops) { |
| 341 | process_array_chunk_work<narrowOop>(obj, start, end); |
| 342 | } else { |
| 343 | process_array_chunk_work<oop>(obj, start, end); |
| 344 | } |
| 345 | } |
| 346 | |
| 347 | oop PSPromotionManager::oop_promotion_failed(oop obj, markWord obj_mark) { |
| 348 | assert(_old_gen_is_full || PromotionFailureALot, "Sanity")do { if (!(_old_gen_is_full || PromotionFailureALot)) { (*g_assert_poison ) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psPromotionManager.cpp" , 348, "assert(" "_old_gen_is_full || PromotionFailureALot" ") failed" , "Sanity"); ::breakpoint(); } } while (0); |
| 349 | |
| 350 | // Attempt to CAS in the header. |
| 351 | // This tests if the header is still the same as when |
| 352 | // this started. If it is the same (i.e., no forwarding |
| 353 | // pointer has been installed), then this thread owns |
| 354 | // it. |
| 355 | if (obj->forward_to_atomic(obj, obj_mark) == NULL__null) { |
| 356 | // We won any races, we "own" this object. |
| 357 | assert(obj == obj->forwardee(), "Sanity")do { if (!(obj == obj->forwardee())) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psPromotionManager.cpp" , 357, "assert(" "obj == obj->forwardee()" ") failed", "Sanity" ); ::breakpoint(); } } while (0); |
| 358 | |
| 359 | _promotion_failed_info.register_copy_failure(obj->size()); |
| 360 | |
| 361 | push_contents(obj); |
| 362 | |
| 363 | _preserved_marks->push_if_necessary(obj, obj_mark); |
| 364 | } else { |
| 365 | // We lost, someone else "owns" this object |
| 366 | guarantee(obj->is_forwarded(), "Object must be forwarded if the cas failed.")do { if (!(obj->is_forwarded())) { (*g_assert_poison) = 'X' ;; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psPromotionManager.cpp" , 366, "guarantee(" "obj->is_forwarded()" ") failed", "Object must be forwarded if the cas failed." ); ::breakpoint(); } } while (0); |
| 367 | |
| 368 | // No unallocation to worry about. |
| 369 | obj = obj->forwardee(); |
| 370 | } |
| 371 | |
| 372 | return obj; |
| 373 | } |