< prev index next >

src/share/vm/gc/shenandoah/shenandoahHeap.cpp

Print this page
rev 12191 : Improve handling of cancelled-gc flag.


 359 void ShenandoahHeap::reset_prev_mark_bitmap_range(HeapWord* from, HeapWord* to) {
 360   _prev_mark_bit_map->clear_range(MemRegion(from, to));
 361 }
 362 
 363 bool ShenandoahHeap::is_bitmap_clear() {
 364   HeapWord* start = _ordered_regions->bottom();
 365   HeapWord* end = _ordered_regions->end();
 366   return _next_mark_bit_map->getNextMarkedWordAddress(start, end) == end;
 367 }
 368 
 369 void ShenandoahHeap::print_on(outputStream* st) const {
 370   st->print("Shenandoah Heap");
 371   st->print(" total = " SIZE_FORMAT " K, used " SIZE_FORMAT " K ", capacity()/ K, used() /K);
 372   st->print("Region size = " SIZE_FORMAT "K ", ShenandoahHeapRegion::RegionSizeBytes / K);
 373   if (_concurrent_mark_in_progress) {
 374     st->print("marking ");
 375   }
 376   if (_evacuation_in_progress) {
 377     st->print("evacuating ");
 378   }
 379   if (_cancelled_concgc) {
 380     st->print("cancelled ");
 381   }
 382   st->print("\n");
 383 
 384   if (Verbose) {
 385     print_heap_regions(st);
 386   }
 387 }
 388 
 389 class InitGCLABClosure : public ThreadClosure {
 390 public:
 391   void do_thread(Thread* thread) {
 392     thread->gclab().initialize(true);
 393   }
 394 };
 395 
 396 void ShenandoahHeap::post_initialize() {
 397 
 398   {
 399     if (UseTLAB) {


2033 #endif
2034 
2035 size_t ShenandoahHeap::num_regions() {
2036   return _num_regions;
2037 }
2038 
2039 size_t ShenandoahHeap::max_regions() {
2040   return _max_regions;
2041 }
2042 
2043 GCTracer* ShenandoahHeap::tracer() {
2044   return shenandoahPolicy()->tracer();
2045 }
2046 
2047 size_t ShenandoahHeap::tlab_used(Thread* thread) const {
2048   return _free_regions->used();
2049 }
2050 
2051 void ShenandoahHeap::cancel_concgc() {
2052   // only report it once
2053   if (!_cancelled_concgc) {
2054     log_info(gc)("Cancelling GC");
2055     _cancelled_concgc = true;
2056     OrderAccess::fence();
2057     _shenandoah_policy->report_concgc_cancelled();
2058   }
2059 
2060 }
2061 
2062 void ShenandoahHeap::clear_cancelled_concgc() {
2063   _cancelled_concgc = false;
2064 }
2065 
2066 uint ShenandoahHeap::max_workers() {
2067   return _max_workers;
2068 }
2069 
2070 uint ShenandoahHeap::max_parallel_workers() {
2071   return _max_parallel_workers;
2072 }
2073 uint ShenandoahHeap::max_conc_workers() {
2074   return _max_conc_workers;
2075 }
2076 
2077 void ShenandoahHeap::stop() {
2078   // We set this early here, to let GC threads terminate before we ask the concurrent thread
2079   // to terminate, which would otherwise block until all GC threads come to finish normally.
2080   _cancelled_concgc = true;
2081   _concurrent_gc_thread->stop();
2082   cancel_concgc();
2083 }
2084 
2085 void ShenandoahHeap::unlink_string_and_symbol_table(BoolObjectClosure* is_alive, bool process_strings, bool process_symbols) {
2086 
2087   StringSymbolTableUnlinkTask shenandoah_unlink_task(is_alive, process_strings, process_symbols);
2088   workers()->run_task(&shenandoah_unlink_task);
2089 
2090   //  if (G1StringDedup::is_enabled()) {
2091   //    G1StringDedup::unlink(is_alive);
2092   //  }
2093 }
2094 
2095 void ShenandoahHeap::set_need_update_refs(bool need_update_refs) {
2096   _need_update_refs = need_update_refs;
2097 }
2098 
2099 //fixme this should be in heapregionset
2100 ShenandoahHeapRegion* ShenandoahHeap::next_compaction_region(const ShenandoahHeapRegion* r) {




 359 void ShenandoahHeap::reset_prev_mark_bitmap_range(HeapWord* from, HeapWord* to) {
 360   _prev_mark_bit_map->clear_range(MemRegion(from, to));
 361 }
 362 
 363 bool ShenandoahHeap::is_bitmap_clear() {
 364   HeapWord* start = _ordered_regions->bottom();
 365   HeapWord* end = _ordered_regions->end();
 366   return _next_mark_bit_map->getNextMarkedWordAddress(start, end) == end;
 367 }
 368 
 369 void ShenandoahHeap::print_on(outputStream* st) const {
 370   st->print("Shenandoah Heap");
 371   st->print(" total = " SIZE_FORMAT " K, used " SIZE_FORMAT " K ", capacity()/ K, used() /K);
 372   st->print("Region size = " SIZE_FORMAT "K ", ShenandoahHeapRegion::RegionSizeBytes / K);
 373   if (_concurrent_mark_in_progress) {
 374     st->print("marking ");
 375   }
 376   if (_evacuation_in_progress) {
 377     st->print("evacuating ");
 378   }
 379   if (cancelled_concgc()) {
 380     st->print("cancelled ");
 381   }
 382   st->print("\n");
 383 
 384   if (Verbose) {
 385     print_heap_regions(st);
 386   }
 387 }
 388 
 389 class InitGCLABClosure : public ThreadClosure {
 390 public:
 391   void do_thread(Thread* thread) {
 392     thread->gclab().initialize(true);
 393   }
 394 };
 395 
 396 void ShenandoahHeap::post_initialize() {
 397 
 398   {
 399     if (UseTLAB) {


2033 #endif
2034 
2035 size_t ShenandoahHeap::num_regions() {
2036   return _num_regions;
2037 }
2038 
2039 size_t ShenandoahHeap::max_regions() {
2040   return _max_regions;
2041 }
2042 
2043 GCTracer* ShenandoahHeap::tracer() {
2044   return shenandoahPolicy()->tracer();
2045 }
2046 
2047 size_t ShenandoahHeap::tlab_used(Thread* thread) const {
2048   return _free_regions->used();
2049 }
2050 
2051 void ShenandoahHeap::cancel_concgc() {
2052   // only report it once
2053   if (! cancelled_concgc()) {
2054     log_info(gc)("Cancelling GC");
2055     set_cancelled_concgc(true);

2056     _shenandoah_policy->report_concgc_cancelled();
2057   }
2058 
2059 }
2060 
2061 void ShenandoahHeap::clear_cancelled_concgc() {
2062   set_cancelled_concgc(false);
2063 }
2064 
2065 uint ShenandoahHeap::max_workers() {
2066   return _max_workers;
2067 }
2068 
2069 uint ShenandoahHeap::max_parallel_workers() {
2070   return _max_parallel_workers;
2071 }
2072 uint ShenandoahHeap::max_conc_workers() {
2073   return _max_conc_workers;
2074 }
2075 
2076 void ShenandoahHeap::stop() {
2077   // We set this early here, to let GC threads terminate before we ask the concurrent thread
2078   // to terminate, which would otherwise block until all GC threads come to finish normally.
2079   set_cancelled_concgc(true);
2080   _concurrent_gc_thread->stop();
2081   cancel_concgc();
2082 }
2083 
2084 void ShenandoahHeap::unlink_string_and_symbol_table(BoolObjectClosure* is_alive, bool process_strings, bool process_symbols) {
2085 
2086   StringSymbolTableUnlinkTask shenandoah_unlink_task(is_alive, process_strings, process_symbols);
2087   workers()->run_task(&shenandoah_unlink_task);
2088 
2089   //  if (G1StringDedup::is_enabled()) {
2090   //    G1StringDedup::unlink(is_alive);
2091   //  }
2092 }
2093 
2094 void ShenandoahHeap::set_need_update_refs(bool need_update_refs) {
2095   _need_update_refs = need_update_refs;
2096 }
2097 
2098 //fixme this should be in heapregionset
2099 ShenandoahHeapRegion* ShenandoahHeap::next_compaction_region(const ShenandoahHeapRegion* r) {


< prev index next >