256 if (ZUnmapBadViews) { 257 // Flip pages 258 ZPageTableIterator iter(&_pagetable); 259 for (ZPage* page; iter.next(&page);) { 260 if (!page->is_detached()) { 261 _page_allocator.flip_page(page); 262 } 263 } 264 265 // Flip pre-mapped memory 266 _page_allocator.flip_pre_mapped(); 267 } 268 } 269 270 void ZHeap::mark_start() { 271 assert(SafepointSynchronize::is_at_safepoint(), "Should be at safepoint"); 272 273 // Update statistics 274 ZStatSample(ZSamplerHeapUsedBeforeMark, used()); 275 276 // Retire TLABs 277 _object_allocator.retire_tlabs(); 278 279 // Flip address view 280 ZAddressMasks::flip_to_marked(); 281 flip_views(); 282 283 // Reset allocated/reclaimed/used statistics 284 _page_allocator.reset_statistics(); 285 286 // Reset encountered/dropped/enqueued statistics 287 _reference_processor.reset_statistics(); 288 289 // Enter mark phase 290 ZGlobalPhase = ZPhaseMark; 291 292 // Reset marking information and mark roots 293 _mark.start(); 294 295 // Update statistics 296 ZStatHeap::set_at_mark_start(capacity(), used()); 297 } 298 299 void ZHeap::mark() { 300 _mark.mark(); 301 } 302 457 void ZHeap::reset_relocation_set() { 458 ZRelocationSetIterator iter(&_relocation_set); 459 for (ZPage* page; iter.next(&page);) { 460 // Reset relocation information 461 page->reset_forwarding(); 462 463 // Update pagetable 464 _pagetable.clear_relocating(page); 465 } 466 } 467 468 void ZHeap::relocate_start() { 469 assert(SafepointSynchronize::is_at_safepoint(), "Should be at safepoint"); 470 471 // Update statistics 472 ZStatSample(ZSamplerHeapUsedBeforeRelocation, used()); 473 474 // Flip address view 475 ZAddressMasks::flip_to_remapped(); 476 flip_views(); 477 478 // Remap TLABs 479 _object_allocator.remap_tlabs(); 480 481 // Enter relocate phase 482 ZGlobalPhase = ZPhaseRelocate; 483 484 // Update statistics 485 ZStatHeap::set_at_relocate_start(capacity(), allocated(), used()); 486 487 // Remap/Relocate roots 488 _relocate.start(); 489 } 490 491 uintptr_t ZHeap::relocate_object(uintptr_t addr) { 492 assert(ZGlobalPhase == ZPhaseRelocate, "Relocate not allowed"); 493 ZPage* const page = _pagetable.get(addr); 494 const bool retained = retain_page(page); 495 const uintptr_t new_addr = page->relocate_object(addr); 496 if (retained) { 497 release_page(page, true /* reclaimed */); 498 } 499 | 256 if (ZUnmapBadViews) { 257 // Flip pages 258 ZPageTableIterator iter(&_pagetable); 259 for (ZPage* page; iter.next(&page);) { 260 if (!page->is_detached()) { 261 _page_allocator.flip_page(page); 262 } 263 } 264 265 // Flip pre-mapped memory 266 _page_allocator.flip_pre_mapped(); 267 } 268 } 269 270 void ZHeap::mark_start() { 271 assert(SafepointSynchronize::is_at_safepoint(), "Should be at safepoint"); 272 273 // Update statistics 274 ZStatSample(ZSamplerHeapUsedBeforeMark, used()); 275 276 // Flip address view 277 ZAddressMasks::flip_to_marked(); 278 flip_views(); 279 280 // Retire allocating pages 281 _object_allocator.retire_pages(); 282 283 // Reset allocated/reclaimed/used statistics 284 _page_allocator.reset_statistics(); 285 286 // Reset encountered/dropped/enqueued statistics 287 _reference_processor.reset_statistics(); 288 289 // Enter mark phase 290 ZGlobalPhase = ZPhaseMark; 291 292 // Reset marking information and mark roots 293 _mark.start(); 294 295 // Update statistics 296 ZStatHeap::set_at_mark_start(capacity(), used()); 297 } 298 299 void ZHeap::mark() { 300 _mark.mark(); 301 } 302 457 void ZHeap::reset_relocation_set() { 458 ZRelocationSetIterator iter(&_relocation_set); 459 for (ZPage* page; iter.next(&page);) { 460 // Reset relocation information 461 page->reset_forwarding(); 462 463 // Update pagetable 464 _pagetable.clear_relocating(page); 465 } 466 } 467 468 void ZHeap::relocate_start() { 469 assert(SafepointSynchronize::is_at_safepoint(), "Should be at safepoint"); 470 471 // Update statistics 472 ZStatSample(ZSamplerHeapUsedBeforeRelocation, used()); 473 474 // Flip address view 475 ZAddressMasks::flip_to_remapped(); 476 flip_views(); 477 478 // Enter relocate phase 479 ZGlobalPhase = ZPhaseRelocate; 480 481 // Update statistics 482 ZStatHeap::set_at_relocate_start(capacity(), allocated(), used()); 483 484 // Remap/Relocate roots 485 _relocate.start(); 486 } 487 488 uintptr_t ZHeap::relocate_object(uintptr_t addr) { 489 assert(ZGlobalPhase == ZPhaseRelocate, "Relocate not allowed"); 490 ZPage* const page = _pagetable.get(addr); 491 const bool retained = retain_page(page); 492 const uintptr_t new_addr = page->relocate_object(addr); 493 if (retained) { 494 release_page(page, true /* reclaimed */); 495 } 496 |