<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    <meta http-equiv="content-type" content="text/html;
      charset=ISO-8859-1">
    Hi everyone,<br>
    <br>
    Could I have a couple of reviews for this small change?<br>
    <a class="moz-txt-link-freetext" href="http://cr.openjdk.java.net/~brutisso/8023145/webrev.00/">http://cr.openjdk.java.net/~brutisso/8023145/webrev.00/</a><br>
    <br>
    From the bug report:<br>
    <br>
    <meta http-equiv="content-type" content="text/html;
      charset=ISO-8859-1">
    With the fix for JDK-7145569 the method
    G1CollectedHeap::mark_strong_code_roots() was introduced. However,
    this method assumes that the work gang has been set up. If we are
    running with ParallelGCThreads=0 we don't set up the work gang and
    thus get a null pointer:<br>
    <br>
    This simple JTreg test illustrates the issue:<br>
    <br>
    <br>
    <tt>/**</tt><tt><br>
    </tt><tt>&nbsp;* @test Test8000311</tt><tt><br>
    </tt><tt>&nbsp;* @key gc</tt><tt><br>
    </tt><tt>&nbsp;* @bug 8000311</tt><tt><br>
    </tt><tt>&nbsp;* @summary G1: ParallelGCThreads==0 broken</tt><tt><br>
    </tt><tt>&nbsp;* @run main/othervm -XX:+UseG1GC -XX:ParallelGCThreads=0
      -XX:+ResizePLAB -XX:+ExplicitGCInvokesConcurrent Test8000311</tt><tt><br>
    </tt><tt>&nbsp;* @author <a class="moz-txt-link-abbreviated" href="mailto:filipp.zhinkin@oracle.com">filipp.zhinkin@oracle.com</a></tt><tt><br>
    </tt><tt>&nbsp;*/</tt><tt><br>
    </tt><tt><br>
    </tt><tt>import java.util.*;</tt><tt><br>
    </tt><tt><br>
    </tt><tt>public class Test8000311 {</tt><tt><br>
    </tt><tt>&nbsp; public static void main(String args[]) {</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp; for(int i = 0; i&lt;100; i++) {</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; byte[] garbage = new byte[1000];</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.gc();</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp; }</tt><tt><br>
    </tt><tt>&nbsp; }</tt><tt><br>
    </tt><tt>}</tt><tt><br>
    </tt><tt><br>
    </tt><tt>It crashes with a null pointer:</tt><tt><br>
    </tt><tt><br>
    </tt><tt># SIGSEGV (0xb) at pc=0xffffffff7d3fadf4, pid=22622, tid=6</tt><tt><br>
    </tt><tt><br>
    </tt><tt>si_addr=0x0000000000000000</tt><tt><br>
    </tt><tt><br>
    </tt><tt>Native frames: (J=compiled Java code, j=interpreted, Vv=VM
      code, C=native code)</tt><tt><br>
    </tt><tt>V [libjvm.so+0x7fadf4] void
      G1CollectedHeap::mark_strong_code_roots(unsigned)+0x44;;
      __1cPG1CollectedHeapWmark_strong_code_roots6MI_v_+0x44</tt><tt><br>
    </tt><tt>V [libjvm.so+0x7f5f80] void
      G1CollectedHeap::g1_process_strong_roots(bool,SharedHeap::ScanningOption,OopClosure*,OopsInHeapRegionClosure*,G1KlassScanClosure*,int)+0x5e0;;
__1cPG1CollectedHeapXg1_process_strong_roots6MbnKSharedHeapOScanningOption_pnKOopClosure_pnXOopsInHeapRegionClosure_pnSG1KlassScanClosure_i_v_+0x5e0</tt><tt><br>
    </tt><tt>V [libjvm.so+0x7fccdc] void
      G1ParTask::work(unsigned)+0x67c;; __1cJG1ParTaskEwork6MI_v_+0x67c</tt><tt><br>
    </tt><tt>V [libjvm.so+0x7f7500] void
      G1CollectedHeap::evacuate_collection_set(EvacuationInfo&amp;)+0x418;;
__1cPG1CollectedHeapXevacuate_collection_set6MrnOEvacuationInfo__v_+0x418</tt><tt><br>
    </tt><tt>V [libjvm.so+0x7f1a84] bool
      G1CollectedHeap::do_collection_pause_at_safepoint(double)+0x824;;
      __1cPG1CollectedHeapbGdo_collection_pause_at_safepoint6Md_b_+0x824</tt><tt><br>
    </tt><tt>V [libjvm.so+0x1241a7c] void
      VM_G1IncCollectionPause::doit()+0x2e4;;
      __1cXVM_G1IncCollectionPauseEdoit6M_v_+0x2e4</tt><tt><br>
    </tt><tt>V [libjvm.so+0x123de38] void
      VM_Operation::evaluate()+0xf8;;
      __1cMVM_OperationIevaluate6M_v_+0xf8</tt><tt><br>
    </tt><tt>V [libjvm.so+0x1239dcc] void
      VMThread::evaluate_operation(VM_Operation*)+0x254;;
      __1cIVMThreadSevaluate_operation6MpnMVM_Operation__v_+0x254</tt><tt><br>
    </tt><tt>V [libjvm.so+0x123a83c] void VMThread::loop()+0x654;;
      __1cIVMThreadEloop6M_v_+0x654</tt><tt><br>
    </tt><tt>V [libjvm.so+0x1239834] void VMThread::run()+0xe4;;
      __1cIVMThreadDrun6M_v_+0xe4</tt><tt><br>
    </tt><tt>V [libjvm.so+0xef8af0] java_start+0x258;; java_start+0x258
    </tt><br>
    <br>
    With the proposed fix the test passes.<br>
    <br>
    Thanks,<br>
    Bengt<br>
  </body>
</html>