mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8150629: Initializing all ParScanThreadStates causes significant unaccounted "Other" times
Lazily allocate ParScanThreadStates within the worker threads instead of doing this work upfront serially. Reviewed-by: mgerdin, jmasa
This commit is contained in:
parent
6fe8d6e7de
commit
d090b74744
2 changed files with 12 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -327,6 +327,9 @@ oop G1ParScanThreadState::copy_to_survivor_space(InCSetState const state,
|
||||||
|
|
||||||
G1ParScanThreadState* G1ParScanThreadStateSet::state_for_worker(uint worker_id) {
|
G1ParScanThreadState* G1ParScanThreadStateSet::state_for_worker(uint worker_id) {
|
||||||
assert(worker_id < _n_workers, "out of bounds access");
|
assert(worker_id < _n_workers, "out of bounds access");
|
||||||
|
if (_states[worker_id] == NULL) {
|
||||||
|
_states[worker_id] = new_par_scan_state(worker_id, _young_cset_length);
|
||||||
|
}
|
||||||
return _states[worker_id];
|
return _states[worker_id];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,6 +355,10 @@ void G1ParScanThreadStateSet::flush() {
|
||||||
for (uint worker_index = 0; worker_index < _n_workers; ++worker_index) {
|
for (uint worker_index = 0; worker_index < _n_workers; ++worker_index) {
|
||||||
G1ParScanThreadState* pss = _states[worker_index];
|
G1ParScanThreadState* pss = _states[worker_index];
|
||||||
|
|
||||||
|
if (pss == NULL) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
_total_cards_scanned += _cards_scanned[worker_index];
|
_total_cards_scanned += _cards_scanned[worker_index];
|
||||||
|
|
||||||
pss->flush(_surviving_young_words_total);
|
pss->flush(_surviving_young_words_total);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -200,6 +200,7 @@ class G1ParScanThreadStateSet : public StackObj {
|
||||||
size_t* _surviving_young_words_total;
|
size_t* _surviving_young_words_total;
|
||||||
size_t* _cards_scanned;
|
size_t* _cards_scanned;
|
||||||
size_t _total_cards_scanned;
|
size_t _total_cards_scanned;
|
||||||
|
size_t _young_cset_length;
|
||||||
uint _n_workers;
|
uint _n_workers;
|
||||||
bool _flushed;
|
bool _flushed;
|
||||||
|
|
||||||
|
@ -210,10 +211,11 @@ class G1ParScanThreadStateSet : public StackObj {
|
||||||
_surviving_young_words_total(NEW_C_HEAP_ARRAY(size_t, young_cset_length, mtGC)),
|
_surviving_young_words_total(NEW_C_HEAP_ARRAY(size_t, young_cset_length, mtGC)),
|
||||||
_cards_scanned(NEW_C_HEAP_ARRAY(size_t, n_workers, mtGC)),
|
_cards_scanned(NEW_C_HEAP_ARRAY(size_t, n_workers, mtGC)),
|
||||||
_total_cards_scanned(0),
|
_total_cards_scanned(0),
|
||||||
|
_young_cset_length(young_cset_length),
|
||||||
_n_workers(n_workers),
|
_n_workers(n_workers),
|
||||||
_flushed(false) {
|
_flushed(false) {
|
||||||
for (uint i = 0; i < n_workers; ++i) {
|
for (uint i = 0; i < n_workers; ++i) {
|
||||||
_states[i] = new_par_scan_state(i, young_cset_length);
|
_states[i] = NULL;
|
||||||
}
|
}
|
||||||
memset(_surviving_young_words_total, 0, young_cset_length * sizeof(size_t));
|
memset(_surviving_young_words_total, 0, young_cset_length * sizeof(size_t));
|
||||||
memset(_cards_scanned, 0, n_workers * sizeof(size_t));
|
memset(_cards_scanned, 0, n_workers * sizeof(size_t));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue