equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
325 } |
325 } |
326 } |
326 } |
327 |
327 |
328 G1ParScanThreadState* G1ParScanThreadStateSet::state_for_worker(uint worker_id) { |
328 G1ParScanThreadState* G1ParScanThreadStateSet::state_for_worker(uint worker_id) { |
329 assert(worker_id < _n_workers, "out of bounds access"); |
329 assert(worker_id < _n_workers, "out of bounds access"); |
|
330 if (_states[worker_id] == NULL) { |
|
331 _states[worker_id] = new_par_scan_state(worker_id, _young_cset_length); |
|
332 } |
330 return _states[worker_id]; |
333 return _states[worker_id]; |
331 } |
334 } |
332 |
335 |
333 void G1ParScanThreadStateSet::add_cards_scanned(uint worker_id, size_t cards_scanned) { |
336 void G1ParScanThreadStateSet::add_cards_scanned(uint worker_id, size_t cards_scanned) { |
334 assert(worker_id < _n_workers, "out of bounds access"); |
337 assert(worker_id < _n_workers, "out of bounds access"); |
349 assert(!_flushed, "thread local state from the per thread states should be flushed once"); |
352 assert(!_flushed, "thread local state from the per thread states should be flushed once"); |
350 assert(_total_cards_scanned == 0, "should have been cleared"); |
353 assert(_total_cards_scanned == 0, "should have been cleared"); |
351 |
354 |
352 for (uint worker_index = 0; worker_index < _n_workers; ++worker_index) { |
355 for (uint worker_index = 0; worker_index < _n_workers; ++worker_index) { |
353 G1ParScanThreadState* pss = _states[worker_index]; |
356 G1ParScanThreadState* pss = _states[worker_index]; |
|
357 |
|
358 if (pss == NULL) { |
|
359 continue; |
|
360 } |
354 |
361 |
355 _total_cards_scanned += _cards_scanned[worker_index]; |
362 _total_cards_scanned += _cards_scanned[worker_index]; |
356 |
363 |
357 pss->flush(_surviving_young_words_total); |
364 pss->flush(_surviving_young_words_total); |
358 delete pss; |
365 delete pss; |