Print this page
rev 3708 : 8000244: G1: Ergonomically set MarkStackSize and use virtual space for global marking stack
Summary: Set the value of MarkStackSize to a value based on the number of parallel marking threads with a reasonable minimum. Expand the marking stack if we have to restart marking due to an overflow up to a reasonable maximum. Allocate the underlying space for the marking stack from virtual memory.
Reviewed-by: jmasa

Split Close
Expand all
Collapse all
          --- old/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
          +++ new/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
↓ open down ↓ 2071 lines elided ↑ open up ↑
2072 2072     _in_cset_fast_test = _in_cset_fast_test_base -
2073 2073                 ((uintx) _g1_reserved.start() >> HeapRegion::LogOfHRGrainBytes);
2074 2074  
2075 2075     // Clear the _cset_fast_test bitmap in anticipation of adding
2076 2076     // regions to the incremental collection set for the first
2077 2077     // evacuation pause.
2078 2078     clear_cset_fast_test();
2079 2079  
2080 2080    // Create the ConcurrentMark data structure and thread.
2081 2081    // (Must do this late, so that "max_regions" is defined.)
2082      -  _cm       = new ConcurrentMark(heap_rs, max_regions());
     2082 +  _cm = new ConcurrentMark(this, heap_rs);
     2083 +  if (_cm == NULL || !_cm->completed_initialization()) {
     2084 +    vm_shutdown_during_initialization("Could not create/initialize ConcurrentMark");
     2085 +    return JNI_ENOMEM;
     2086 +  }
2083 2087    _cmThread = _cm->cmThread();
2084 2088  
2085 2089    // Initialize the from_card cache structure of HeapRegionRemSet.
2086 2090    HeapRegionRemSet::init_heap(max_regions());
2087 2091  
2088 2092    // Now expand into the initial heap size.
2089 2093    if (!expand(init_byte_size)) {
2090      -    vm_exit_during_initialization("Failed to allocate initial heap.");
     2094 +    vm_shutdown_during_initialization("Failed to allocate initial heap.");
2091 2095      return JNI_ENOMEM;
2092 2096    }
2093 2097  
2094 2098    // Perform any initialization actions delegated to the policy.
2095 2099    g1_policy()->init();
2096 2100  
2097 2101    _refine_cte_cl =
2098 2102      new RefineCardTableEntryClosure(ConcurrentG1RefineThread::sts(),
2099 2103                                      g1_rem_set(),
2100 2104                                      concurrent_g1_refine());
↓ open down ↓ 4365 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX