Mercurial > hg > truffle
comparison src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @ 17774:2775f322649a
Merge
author | jwilhelm |
---|---|
date | Mon, 24 Mar 2014 14:23:02 -0700 |
parents | 8ee855b4e667 595c0f60d50d |
children | bfdf528be8e8 |
comparison
equal
deleted
inserted
replaced
17773:8ee855b4e667 | 17774:2775f322649a |
---|---|
37 #include "gc_implementation/g1/g1GCPhaseTimes.hpp" | 37 #include "gc_implementation/g1/g1GCPhaseTimes.hpp" |
38 #include "gc_implementation/g1/g1Log.hpp" | 38 #include "gc_implementation/g1/g1Log.hpp" |
39 #include "gc_implementation/g1/g1MarkSweep.hpp" | 39 #include "gc_implementation/g1/g1MarkSweep.hpp" |
40 #include "gc_implementation/g1/g1OopClosures.inline.hpp" | 40 #include "gc_implementation/g1/g1OopClosures.inline.hpp" |
41 #include "gc_implementation/g1/g1RemSet.inline.hpp" | 41 #include "gc_implementation/g1/g1RemSet.inline.hpp" |
42 #include "gc_implementation/g1/g1StringDedup.hpp" | |
42 #include "gc_implementation/g1/g1YCTypes.hpp" | 43 #include "gc_implementation/g1/g1YCTypes.hpp" |
43 #include "gc_implementation/g1/heapRegion.inline.hpp" | 44 #include "gc_implementation/g1/heapRegion.inline.hpp" |
44 #include "gc_implementation/g1/heapRegionRemSet.hpp" | 45 #include "gc_implementation/g1/heapRegionRemSet.hpp" |
45 #include "gc_implementation/g1/heapRegionSeq.inline.hpp" | 46 #include "gc_implementation/g1/heapRegionSeq.inline.hpp" |
46 #include "gc_implementation/g1/vm_operations_g1.hpp" | 47 #include "gc_implementation/g1/vm_operations_g1.hpp" |
2170 | 2171 |
2171 // Do create of the monitoring and management support so that | 2172 // Do create of the monitoring and management support so that |
2172 // values in the heap have been properly initialized. | 2173 // values in the heap have been properly initialized. |
2173 _g1mm = new G1MonitoringSupport(this); | 2174 _g1mm = new G1MonitoringSupport(this); |
2174 | 2175 |
2176 G1StringDedup::initialize(); | |
2177 | |
2175 return JNI_OK; | 2178 return JNI_OK; |
2176 } | 2179 } |
2177 | 2180 |
2178 size_t G1CollectedHeap::conservative_max_heap_alignment() { | 2181 size_t G1CollectedHeap::conservative_max_heap_alignment() { |
2179 return HeapRegion::max_region_size(); | 2182 return HeapRegion::max_region_size(); |
3472 } | 3475 } |
3473 } | 3476 } |
3474 if (!silent) gclog_or_tty->print("RemSet "); | 3477 if (!silent) gclog_or_tty->print("RemSet "); |
3475 rem_set()->verify(); | 3478 rem_set()->verify(); |
3476 | 3479 |
3480 if (G1StringDedup::is_enabled()) { | |
3481 if (!silent) gclog_or_tty->print("StrDedup "); | |
3482 G1StringDedup::verify(); | |
3483 } | |
3484 | |
3477 if (failures) { | 3485 if (failures) { |
3478 gclog_or_tty->print_cr("Heap:"); | 3486 gclog_or_tty->print_cr("Heap:"); |
3479 // It helps to have the per-region information in the output to | 3487 // It helps to have the per-region information in the output to |
3480 // help us track down what went wrong. This is why we call | 3488 // help us track down what went wrong. This is why we call |
3481 // print_extended_on() instead of print_on(). | 3489 // print_extended_on() instead of print_on(). |
3489 #endif | 3497 #endif |
3490 gclog_or_tty->flush(); | 3498 gclog_or_tty->flush(); |
3491 } | 3499 } |
3492 guarantee(!failures, "there should not have been any failures"); | 3500 guarantee(!failures, "there should not have been any failures"); |
3493 } else { | 3501 } else { |
3494 if (!silent) | 3502 if (!silent) { |
3495 gclog_or_tty->print("(SKIPPING roots, heapRegionSets, heapRegions, remset) "); | 3503 gclog_or_tty->print("(SKIPPING Roots, HeapRegionSets, HeapRegions, RemSet"); |
3504 if (G1StringDedup::is_enabled()) { | |
3505 gclog_or_tty->print(", StrDedup"); | |
3506 } | |
3507 gclog_or_tty->print(") "); | |
3508 } | |
3496 } | 3509 } |
3497 } | 3510 } |
3498 | 3511 |
3499 void G1CollectedHeap::verify(bool silent) { | 3512 void G1CollectedHeap::verify(bool silent) { |
3500 verify(silent, VerifyOption_G1UsePrevMarking); | 3513 verify(silent, VerifyOption_G1UsePrevMarking); |
3583 } | 3596 } |
3584 _cmThread->print_on(st); | 3597 _cmThread->print_on(st); |
3585 st->cr(); | 3598 st->cr(); |
3586 _cm->print_worker_threads_on(st); | 3599 _cm->print_worker_threads_on(st); |
3587 _cg1r->print_worker_threads_on(st); | 3600 _cg1r->print_worker_threads_on(st); |
3601 if (G1StringDedup::is_enabled()) { | |
3602 G1StringDedup::print_worker_threads_on(st); | |
3603 } | |
3588 } | 3604 } |
3589 | 3605 |
3590 void G1CollectedHeap::gc_threads_do(ThreadClosure* tc) const { | 3606 void G1CollectedHeap::gc_threads_do(ThreadClosure* tc) const { |
3591 if (G1CollectedHeap::use_parallel_gc_threads()) { | 3607 if (G1CollectedHeap::use_parallel_gc_threads()) { |
3592 workers()->threads_do(tc); | 3608 workers()->threads_do(tc); |
3593 } | 3609 } |
3594 tc->do_thread(_cmThread); | 3610 tc->do_thread(_cmThread); |
3595 _cg1r->threads_do(tc); | 3611 _cg1r->threads_do(tc); |
3612 if (G1StringDedup::is_enabled()) { | |
3613 G1StringDedup::threads_do(tc); | |
3614 } | |
3596 } | 3615 } |
3597 | 3616 |
3598 void G1CollectedHeap::print_tracing_info() const { | 3617 void G1CollectedHeap::print_tracing_info() const { |
3599 // We'll overload this to mean "trace GC pause statistics." | 3618 // We'll overload this to mean "trace GC pause statistics." |
3600 if (TraceGen0Time || TraceGen1Time) { | 3619 if (TraceGen0Time || TraceGen1Time) { |
4771 age_table()->add(obj, word_sz); | 4790 age_table()->add(obj, word_sz); |
4772 } else { | 4791 } else { |
4773 obj->set_mark(m); | 4792 obj->set_mark(m); |
4774 } | 4793 } |
4775 | 4794 |
4795 if (G1StringDedup::is_enabled()) { | |
4796 G1StringDedup::enqueue_from_evacuation(from_region->is_young(), | |
4797 to_region->is_young(), | |
4798 queue_num(), | |
4799 obj); | |
4800 } | |
4801 | |
4776 size_t* surv_young_words = surviving_young_words(); | 4802 size_t* surv_young_words = surviving_young_words(); |
4777 surv_young_words[young_index] += word_sz; | 4803 surv_young_words[young_index] += word_sz; |
4778 | 4804 |
4779 if (obj->is_objArray() && arrayOop(obj)->length() >= ParGCArrayScanChunk) { | 4805 if (obj->is_objArray() && arrayOop(obj)->length() >= ParGCArrayScanChunk) { |
4780 // We keep track of the next start index in the length field of | 4806 // We keep track of the next start index in the length field of |
5246 "strings: "SIZE_FORMAT" processed, "SIZE_FORMAT" removed, " | 5272 "strings: "SIZE_FORMAT" processed, "SIZE_FORMAT" removed, " |
5247 "symbols: "SIZE_FORMAT" processed, "SIZE_FORMAT" removed", | 5273 "symbols: "SIZE_FORMAT" processed, "SIZE_FORMAT" removed", |
5248 g1_unlink_task.strings_processed(), g1_unlink_task.strings_removed(), | 5274 g1_unlink_task.strings_processed(), g1_unlink_task.strings_removed(), |
5249 g1_unlink_task.symbols_processed(), g1_unlink_task.symbols_removed()); | 5275 g1_unlink_task.symbols_processed(), g1_unlink_task.symbols_removed()); |
5250 } | 5276 } |
5277 | |
5278 if (G1StringDedup::is_enabled()) { | |
5279 G1StringDedup::unlink(is_alive); | |
5280 } | |
5251 } | 5281 } |
5252 | 5282 |
5253 class RedirtyLoggedCardTableEntryFastClosure : public CardTableEntryClosure { | 5283 class RedirtyLoggedCardTableEntryFastClosure : public CardTableEntryClosure { |
5254 public: | 5284 public: |
5255 bool do_card_ptr(jbyte* card_ptr, int worker_i) { | 5285 bool do_card_ptr(jbyte* card_ptr, int worker_i) { |
5869 // Weak root processing. | 5899 // Weak root processing. |
5870 { | 5900 { |
5871 G1STWIsAliveClosure is_alive(this); | 5901 G1STWIsAliveClosure is_alive(this); |
5872 G1KeepAliveClosure keep_alive(this); | 5902 G1KeepAliveClosure keep_alive(this); |
5873 JNIHandles::weak_oops_do(&is_alive, &keep_alive); | 5903 JNIHandles::weak_oops_do(&is_alive, &keep_alive); |
5904 if (G1StringDedup::is_enabled()) { | |
5905 G1StringDedup::unlink_or_oops_do(&is_alive, &keep_alive); | |
5906 } | |
5874 } | 5907 } |
5875 | 5908 |
5876 release_gc_alloc_regions(n_workers, evacuation_info); | 5909 release_gc_alloc_regions(n_workers, evacuation_info); |
5877 g1_rem_set()->cleanup_after_oops_into_collection_set_do(); | 5910 g1_rem_set()->cleanup_after_oops_into_collection_set_do(); |
5878 | 5911 |
6349 | 6382 |
6350 if (!free_list_only) { | 6383 if (!free_list_only) { |
6351 TearDownRegionSetsClosure cl(&_old_set); | 6384 TearDownRegionSetsClosure cl(&_old_set); |
6352 heap_region_iterate(&cl); | 6385 heap_region_iterate(&cl); |
6353 | 6386 |
6354 // Need to do this after the heap iteration to be able to | 6387 // Note that emptying the _young_list is postponed and instead done as |
6355 // recognize the young regions and ignore them during the iteration. | 6388 // the first step when rebuilding the regions sets again. The reason for |
6356 _young_list->empty_list(); | 6389 // this is that during a full GC string deduplication needs to know if |
6390 // a collected region was young or old when the full GC was initiated. | |
6357 } | 6391 } |
6358 _free_list.remove_all(); | 6392 _free_list.remove_all(); |
6359 } | 6393 } |
6360 | 6394 |
6361 class RebuildRegionSetsClosure : public HeapRegionClosure { | 6395 class RebuildRegionSetsClosure : public HeapRegionClosure { |
6404 } | 6438 } |
6405 }; | 6439 }; |
6406 | 6440 |
6407 void G1CollectedHeap::rebuild_region_sets(bool free_list_only) { | 6441 void G1CollectedHeap::rebuild_region_sets(bool free_list_only) { |
6408 assert_at_safepoint(true /* should_be_vm_thread */); | 6442 assert_at_safepoint(true /* should_be_vm_thread */); |
6443 | |
6444 if (!free_list_only) { | |
6445 _young_list->empty_list(); | |
6446 } | |
6409 | 6447 |
6410 RebuildRegionSetsClosure cl(free_list_only, &_old_set, &_free_list); | 6448 RebuildRegionSetsClosure cl(free_list_only, &_old_set, &_free_list); |
6411 heap_region_iterate(&cl); | 6449 heap_region_iterate(&cl); |
6412 | 6450 |
6413 if (!free_list_only) { | 6451 if (!free_list_only) { |