comparison src/share/vm/memory/defNewGeneration.cpp @ 20804:7848fc12602b

Merge with jdk8u40-b25
author Gilles Duboscq <gilles.m.duboscq@oracle.com>
date Tue, 07 Apr 2015 14:58:49 +0200
parents 52b4284cb496 ee019285a52c
children
comparison
equal deleted inserted replaced
20184:84105dcdb05b 20804:7848fc12602b
40 #include "memory/referencePolicy.hpp" 40 #include "memory/referencePolicy.hpp"
41 #include "memory/space.inline.hpp" 41 #include "memory/space.inline.hpp"
42 #include "oops/instanceRefKlass.hpp" 42 #include "oops/instanceRefKlass.hpp"
43 #include "oops/oop.inline.hpp" 43 #include "oops/oop.inline.hpp"
44 #include "runtime/java.hpp" 44 #include "runtime/java.hpp"
45 #include "runtime/prefetch.inline.hpp"
45 #include "runtime/thread.inline.hpp" 46 #include "runtime/thread.inline.hpp"
46 #include "utilities/copy.hpp" 47 #include "utilities/copy.hpp"
47 #include "utilities/stack.inline.hpp" 48 #include "utilities/stack.inline.hpp"
48 49
49 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC 50 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
582 } 583 }
583 assert(to()->is_empty(), "Else not collection_attempt_is_safe"); 584 assert(to()->is_empty(), "Else not collection_attempt_is_safe");
584 585
585 init_assuming_no_promotion_failure(); 586 init_assuming_no_promotion_failure();
586 587
587 GCTraceTime t1(GCCauseString("GC", gch->gc_cause()), PrintGC && !PrintGCDetails, true, NULL); 588 GCTraceTime t1(GCCauseString("GC", gch->gc_cause()), PrintGC && !PrintGCDetails, true, NULL, gc_tracer.gc_id());
588 // Capture heap used before collection (for printing). 589 // Capture heap used before collection (for printing).
589 size_t gch_prev_used = gch->used(); 590 size_t gch_prev_used = gch->used();
590 591
591 gch->trace_heap_before_gc(&gc_tracer); 592 gch->trace_heap_before_gc(&gc_tracer);
592 593
610 FastScanClosure fsc_with_no_gc_barrier(this, false); 611 FastScanClosure fsc_with_no_gc_barrier(this, false);
611 FastScanClosure fsc_with_gc_barrier(this, true); 612 FastScanClosure fsc_with_gc_barrier(this, true);
612 613
613 KlassScanClosure klass_scan_closure(&fsc_with_no_gc_barrier, 614 KlassScanClosure klass_scan_closure(&fsc_with_no_gc_barrier,
614 gch->rem_set()->klass_rem_set()); 615 gch->rem_set()->klass_rem_set());
616 CLDToKlassAndOopClosure cld_scan_closure(&klass_scan_closure,
617 &fsc_with_no_gc_barrier,
618 false);
615 619
616 set_promo_failure_scan_stack_closure(&fsc_with_no_gc_barrier); 620 set_promo_failure_scan_stack_closure(&fsc_with_no_gc_barrier);
617 FastEvacuateFollowersClosure evacuate_followers(gch, _level, this, 621 FastEvacuateFollowersClosure evacuate_followers(gch, _level, this,
618 &fsc_with_no_gc_barrier, 622 &fsc_with_no_gc_barrier,
619 &fsc_with_gc_barrier); 623 &fsc_with_gc_barrier);
620 624
621 assert(gch->no_allocs_since_save_marks(0), 625 assert(gch->no_allocs_since_save_marks(0),
622 "save marks have not been newly set."); 626 "save marks have not been newly set.");
623 627
624 int so = SharedHeap::SO_AllClasses | SharedHeap::SO_Strings | SharedHeap::SO_CodeCache; 628 gch->gen_process_roots(_level,
625 629 true, // Process younger gens, if any,
626 gch->gen_process_strong_roots(_level, 630 // as strong roots.
627 true, // Process younger gens, if any, 631 true, // activate StrongRootsScope
628 // as strong roots. 632 SharedHeap::SO_ScavengeCodeCache,
629 true, // activate StrongRootsScope 633 GenCollectedHeap::StrongAndWeakRoots,
630 true, // is scavenging 634 &fsc_with_no_gc_barrier,
631 SharedHeap::ScanningOption(so), 635 &fsc_with_gc_barrier,
632 &fsc_with_no_gc_barrier, 636 &cld_scan_closure);
633 true, // walk *all* scavengable nmethods
634 &fsc_with_gc_barrier,
635 &klass_scan_closure);
636 637
637 // "evacuate followers". 638 // "evacuate followers".
638 evacuate_followers.do_void(); 639 evacuate_followers.do_void();
639 640
640 FastKeepAliveClosure keep_alive(this, &scan_weak_ref); 641 FastKeepAliveClosure keep_alive(this, &scan_weak_ref);
641 ReferenceProcessor* rp = ref_processor(); 642 ReferenceProcessor* rp = ref_processor();
642 rp->setup_policy(clear_all_soft_refs); 643 rp->setup_policy(clear_all_soft_refs);
643 const ReferenceProcessorStats& stats = 644 const ReferenceProcessorStats& stats =
644 rp->process_discovered_references(&is_alive, &keep_alive, &evacuate_followers, 645 rp->process_discovered_references(&is_alive, &keep_alive, &evacuate_followers,
645 NULL, _gc_timer); 646 NULL, _gc_timer, gc_tracer.gc_id());
646 gc_tracer.report_gc_reference_stats(stats); 647 gc_tracer.report_gc_reference_stats(stats);
647 648
648 if (!_promotion_failed) { 649 if (!_promotion_failed) {
649 // Swap the survivor spaces. 650 // Swap the survivor spaces.
650 eden()->clear(SpaceDecorator::Mangle); 651 eden()->clear(SpaceDecorator::Mangle);
786 size_t s = old->size(); 787 size_t s = old->size();
787 oop obj = NULL; 788 oop obj = NULL;
788 789
789 // Try allocating obj in to-space (unless too old) 790 // Try allocating obj in to-space (unless too old)
790 if (old->age() < tenuring_threshold()) { 791 if (old->age() < tenuring_threshold()) {
791 obj = (oop) to()->allocate(s); 792 obj = (oop) to()->allocate_aligned(s);
792 } 793 }
793 794
794 // Otherwise try allocating obj tenured 795 // Otherwise try allocating obj tenured
795 if (obj == NULL) { 796 if (obj == NULL) {
796 obj = _next_gen->promote(old, s); 797 obj = _next_gen->promote(old, s);