提交 4be998e6 编写于 作者: S simonis

8170409: CMS: Crash in CardTableModRefBSForCTRS::process_chunk_boundaries

Reviewed-by: simonis, tschatzl, mgerdin, dlong
Contributed-by: gunter.haug@sap.com
上级 4054af0a
......@@ -452,9 +452,13 @@ get_LNC_array_for_space(Space* sp,
// event lock and do the read again in case some other thread had already
// succeeded and done the resize.
int cur_collection = Universe::heap()->total_collections();
if (_last_LNC_resizing_collection[i] != cur_collection) {
// Updated _last_LNC_resizing_collection[i] must not be visible before
// _lowest_non_clean and friends are visible. Therefore use acquire/release
// to guarantee this on non TSO architecures.
if (OrderAccess::load_acquire(&_last_LNC_resizing_collection[i]) != cur_collection) {
MutexLocker x(ParGCRareEvent_lock);
if (_last_LNC_resizing_collection[i] != cur_collection) {
// This load_acquire is here for clarity only. The MutexLocker already fences.
if (OrderAccess::load_acquire(&_last_LNC_resizing_collection[i]) != cur_collection) {
if (_lowest_non_clean[i] == NULL ||
n_chunks != _lowest_non_clean_chunk_size[i]) {
......@@ -474,7 +478,8 @@ get_LNC_array_for_space(Space* sp,
_lowest_non_clean[i][j] = NULL;
}
}
_last_LNC_resizing_collection[i] = cur_collection;
// Make sure this gets visible only after _lowest_non_clean* was initialized
OrderAccess::release_store(&_last_LNC_resizing_collection[i], cur_collection);
}
}
// In any case, now do the initialization.
......
......@@ -217,7 +217,7 @@ class CardTableModRefBS: public ModRefBarrierSet {
CardArr* _lowest_non_clean;
size_t* _lowest_non_clean_chunk_size;
uintptr_t* _lowest_non_clean_base_chunk_index;
int* _last_LNC_resizing_collection;
volatile int* _last_LNC_resizing_collection;
// Initializes "lowest_non_clean" to point to the array for the region
// covering "sp", and "lowest_non_clean_base_chunk_index" to the chunk
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册