Mercurial > hg > truffle
comparison src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp @ 6725:da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author | coleenp |
---|---|
date | Sat, 01 Sep 2012 13:25:18 -0400 |
parents | d2a62e0f25eb |
children | f81a7c0c618d |
comparison
equal
deleted
inserted
replaced
6724:36d1d483d5d6 | 6725:da91efe96a93 |
---|---|
282 | 282 |
283 bool promotion_failure_occurred = false; | 283 bool promotion_failure_occurred = false; |
284 | 284 |
285 PSYoungGen* young_gen = heap->young_gen(); | 285 PSYoungGen* young_gen = heap->young_gen(); |
286 PSOldGen* old_gen = heap->old_gen(); | 286 PSOldGen* old_gen = heap->old_gen(); |
287 PSPermGen* perm_gen = heap->perm_gen(); | |
288 PSAdaptiveSizePolicy* size_policy = heap->size_policy(); | 287 PSAdaptiveSizePolicy* size_policy = heap->size_policy(); |
289 heap->increment_total_collections(); | 288 heap->increment_total_collections(); |
290 | 289 |
291 AdaptiveSizePolicyOutput(size_policy, heap->total_collections()); | 290 AdaptiveSizePolicyOutput(size_policy, heap->total_collections()); |
292 | 291 |
336 | 335 |
337 // Verify the object start arrays. | 336 // Verify the object start arrays. |
338 if (VerifyObjectStartArray && | 337 if (VerifyObjectStartArray && |
339 VerifyBeforeGC) { | 338 VerifyBeforeGC) { |
340 old_gen->verify_object_start_array(); | 339 old_gen->verify_object_start_array(); |
341 perm_gen->verify_object_start_array(); | |
342 } | 340 } |
343 | 341 |
344 // Verify no unmarked old->young roots | 342 // Verify no unmarked old->young roots |
345 if (VerifyRememberedSets) { | 343 if (VerifyRememberedSets) { |
346 CardTableExtension::verify_all_young_refs_imprecise(); | 344 CardTableExtension::verify_all_young_refs_imprecise(); |
368 size_t young_gen_used_before = young_gen->used_in_bytes(); | 366 size_t young_gen_used_before = young_gen->used_in_bytes(); |
369 | 367 |
370 // Reset our survivor overflow. | 368 // Reset our survivor overflow. |
371 set_survivor_overflow(false); | 369 set_survivor_overflow(false); |
372 | 370 |
373 // We need to save the old/perm top values before | 371 // We need to save the old top values before |
374 // creating the promotion_manager. We pass the top | 372 // creating the promotion_manager. We pass the top |
375 // values to the card_table, to prevent it from | 373 // values to the card_table, to prevent it from |
376 // straying into the promotion labs. | 374 // straying into the promotion labs. |
377 HeapWord* old_top = old_gen->object_space()->top(); | 375 HeapWord* old_top = old_gen->object_space()->top(); |
378 HeapWord* perm_top = perm_gen->object_space()->top(); | |
379 | 376 |
380 // Release all previously held resources | 377 // Release all previously held resources |
381 gc_task_manager()->release_all_resources(); | 378 gc_task_manager()->release_all_resources(); |
382 | 379 |
383 // Set the number of GC threads to be used in this collection | 380 // Set the number of GC threads to be used in this collection |
400 | 397 |
401 uint stripe_total = active_workers; | 398 uint stripe_total = active_workers; |
402 for(uint i=0; i < stripe_total; i++) { | 399 for(uint i=0; i < stripe_total; i++) { |
403 q->enqueue(new OldToYoungRootsTask(old_gen, old_top, i, stripe_total)); | 400 q->enqueue(new OldToYoungRootsTask(old_gen, old_top, i, stripe_total)); |
404 } | 401 } |
405 | |
406 q->enqueue(new SerialOldToYoungRootsTask(perm_gen, perm_top)); | |
407 | 402 |
408 q->enqueue(new ScavengeRootsTask(ScavengeRootsTask::universe)); | 403 q->enqueue(new ScavengeRootsTask(ScavengeRootsTask::universe)); |
409 q->enqueue(new ScavengeRootsTask(ScavengeRootsTask::jni_handles)); | 404 q->enqueue(new ScavengeRootsTask(ScavengeRootsTask::jni_handles)); |
410 // We scan the thread roots in parallel | 405 // We scan the thread roots in parallel |
411 Threads::create_thread_roots_tasks(q); | 406 Threads::create_thread_roots_tasks(q); |
452 reference_processor()->enqueue_discovered_references(&task_executor); | 447 reference_processor()->enqueue_discovered_references(&task_executor); |
453 } else { | 448 } else { |
454 reference_processor()->enqueue_discovered_references(NULL); | 449 reference_processor()->enqueue_discovered_references(NULL); |
455 } | 450 } |
456 | 451 |
457 if (!JavaObjectsInPerm) { | |
458 // Unlink any dead interned Strings | 452 // Unlink any dead interned Strings |
459 StringTable::unlink(&_is_alive_closure); | 453 StringTable::unlink(&_is_alive_closure); |
460 // Process the remaining live ones | 454 // Process the remaining live ones |
461 PSScavengeRootsClosure root_closure(promotion_manager); | 455 PSScavengeRootsClosure root_closure(promotion_manager); |
462 StringTable::oops_do(&root_closure); | 456 StringTable::oops_do(&root_closure); |
463 } | |
464 | 457 |
465 // Finally, flush the promotion_manager's labs, and deallocate its stacks. | 458 // Finally, flush the promotion_manager's labs, and deallocate its stacks. |
466 PSPromotionManager::post_scavenge(); | 459 PSPromotionManager::post_scavenge(); |
467 | 460 |
468 promotion_failure_occurred = promotion_failed(); | 461 promotion_failure_occurred = promotion_failed(); |
501 gclog_or_tty->stamp(); | 494 gclog_or_tty->stamp(); |
502 gclog_or_tty->print_cr(" collection: %d ", | 495 gclog_or_tty->print_cr(" collection: %d ", |
503 heap->total_collections()); | 496 heap->total_collections()); |
504 | 497 |
505 if (Verbose) { | 498 if (Verbose) { |
506 gclog_or_tty->print("old_gen_capacity: %d young_gen_capacity: %d" | 499 gclog_or_tty->print("old_gen_capacity: %d young_gen_capacity: %d", |
507 " perm_gen_capacity: %d ", | 500 old_gen->capacity_in_bytes(), young_gen->capacity_in_bytes()); |
508 old_gen->capacity_in_bytes(), young_gen->capacity_in_bytes(), | |
509 perm_gen->capacity_in_bytes()); | |
510 } | 501 } |
511 } | 502 } |
512 | 503 |
513 | 504 |
514 if (UsePerfData) { | 505 if (UsePerfData) { |
562 young_gen->from_space()->capacity_in_bytes() - | 553 young_gen->from_space()->capacity_in_bytes() - |
563 young_gen->to_space()->capacity_in_bytes(); | 554 young_gen->to_space()->capacity_in_bytes(); |
564 size_policy->compute_generation_free_space(young_gen->used_in_bytes(), | 555 size_policy->compute_generation_free_space(young_gen->used_in_bytes(), |
565 young_gen->eden_space()->used_in_bytes(), | 556 young_gen->eden_space()->used_in_bytes(), |
566 old_gen->used_in_bytes(), | 557 old_gen->used_in_bytes(), |
567 perm_gen->used_in_bytes(), | |
568 young_gen->eden_space()->capacity_in_bytes(), | 558 young_gen->eden_space()->capacity_in_bytes(), |
569 old_gen->max_gen_size(), | 559 old_gen->max_gen_size(), |
570 max_eden_size, | 560 max_eden_size, |
571 false /* full gc*/, | 561 false /* full gc*/, |
572 gc_cause, | 562 gc_cause, |
612 | 602 |
613 // Re-verify object start arrays | 603 // Re-verify object start arrays |
614 if (VerifyObjectStartArray && | 604 if (VerifyObjectStartArray && |
615 VerifyAfterGC) { | 605 VerifyAfterGC) { |
616 old_gen->verify_object_start_array(); | 606 old_gen->verify_object_start_array(); |
617 perm_gen->verify_object_start_array(); | |
618 } | 607 } |
619 | 608 |
620 // Verify all old -> young cards are now precise | 609 // Verify all old -> young cards are now precise |
621 if (VerifyRememberedSets) { | 610 if (VerifyRememberedSets) { |
622 // Precise verification will give false positives. Until this is fixed, | 611 // Precise verification will give false positives. Until this is fixed, |
808 ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap(); | 797 ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap(); |
809 assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity"); | 798 assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity"); |
810 | 799 |
811 PSYoungGen* young_gen = heap->young_gen(); | 800 PSYoungGen* young_gen = heap->young_gen(); |
812 PSOldGen* old_gen = heap->old_gen(); | 801 PSOldGen* old_gen = heap->old_gen(); |
813 PSPermGen* perm_gen = heap->perm_gen(); | |
814 | 802 |
815 // Set boundary between young_gen and old_gen | 803 // Set boundary between young_gen and old_gen |
816 assert(perm_gen->reserved().end() <= old_gen->object_space()->bottom(), | |
817 "perm above old"); | |
818 assert(old_gen->reserved().end() <= young_gen->eden_space()->bottom(), | 804 assert(old_gen->reserved().end() <= young_gen->eden_space()->bottom(), |
819 "old above young"); | 805 "old above young"); |
820 _young_generation_boundary = young_gen->eden_space()->bottom(); | 806 _young_generation_boundary = young_gen->eden_space()->bottom(); |
821 | 807 |
822 // Initialize ref handling object for scavenging. | 808 // Initialize ref handling object for scavenging. |