Mercurial > hg > truffle
diff src/share/vm/gc_implementation/g1/g1OopClosures.cpp @ 20225:cd43876f692e
8040977: G1 crashes when run with -XX:-G1DeferredRSUpdate
Summary: When G1 is run with -XX:-G1DeferredRSUpdate, the VM crashes because of wrong initialization order of member variables. The change makes the initalization explicit, not relying on initialization order any more.
Reviewed-by: brutisso, mgerdin
author | tschatzl |
---|---|
date | Mon, 21 Jul 2014 09:41:06 +0200 |
parents | b0c374311c4e |
children |
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/g1/g1OopClosures.cpp Mon Jul 21 09:41:06 2014 +0200 +++ b/src/share/vm/gc_implementation/g1/g1OopClosures.cpp Mon Jul 21 09:41:06 2014 +0200 @@ -25,11 +25,28 @@ #include "precompiled.hpp" #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" #include "gc_implementation/g1/g1OopClosures.inline.hpp" +#include "gc_implementation/g1/g1ParScanThreadState.hpp" G1ParCopyHelper::G1ParCopyHelper(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state) : G1ParClosureSuper(g1, par_scan_state), _scanned_klass(NULL), _cm(_g1->concurrent_mark()) {} +G1ParClosureSuper::G1ParClosureSuper(G1CollectedHeap* g1) : + _g1(g1), _par_scan_state(NULL), _worker_id(UINT_MAX) { } + G1ParClosureSuper::G1ParClosureSuper(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state) : - _g1(g1), _par_scan_state(par_scan_state), - _worker_id(par_scan_state->queue_num()) { } + _g1(g1), _par_scan_state(NULL), + _worker_id(UINT_MAX) { + set_par_scan_thread_state(par_scan_state); +} + +void G1ParClosureSuper::set_par_scan_thread_state(G1ParScanThreadState* par_scan_state) { + assert(_par_scan_state == NULL, "_par_scan_state must only be set once"); + assert(par_scan_state != NULL, "Must set par_scan_state to non-NULL."); + + _par_scan_state = par_scan_state; + _worker_id = par_scan_state->queue_num(); + + assert(_worker_id < MAX2((uint)ParallelGCThreads, 1u), + err_msg("The given worker id %u must be less than the number of threads %u", _worker_id, MAX2((uint)ParallelGCThreads, 1u))); +}