1 /*
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
37
38 class HeapRegion;
39 class outputStream;
40
41 class G1ParScanThreadState : public StackObj {
42 private:
43 G1CollectedHeap* _g1h;
44 RefToScanQueue* _refs;
45 DirtyCardQueue _dcq;
46 G1SATBCardTableModRefBS* _ct_bs;
47 G1RemSet* _g1_rem;
48
49 G1ParGCAllocator* _g1_par_allocator;
50
51 ageTable _age_table;
52 InCSetState _dest[InCSetState::Num];
53 // Local tenuring threshold.
54 uint _tenuring_threshold;
55 G1ParScanClosure _scanner;
56
57 size_t _alloc_buffer_waste;
58 size_t _undo_waste;
59
60 OopsInHeapRegionClosure* _evac_failure_cl;
61
62 int _hash_seed;
63 uint _queue_num;
64
65 size_t _term_attempts;
66
67 double _start;
68 double _start_strong_roots;
69 double _strong_roots_time;
70 double _start_term;
71 double _term_time;
72
73 // Map from young-age-index (0 == not young, 1 is youngest) to
74 // surviving words. base is what we get back from the malloc call
75 size_t* _surviving_young_words_base;
76 // this points into the array, as we use the first few entries for padding
77 size_t* _surviving_young_words;
78
79 #define PADDING_ELEM_NUM (DEFAULT_CACHE_LINE_SIZE / sizeof(size_t))
80
81 void add_to_alloc_buffer_waste(size_t waste) { _alloc_buffer_waste += waste; }
82 void add_to_undo_waste(size_t waste) { _undo_waste += waste; }
83
84 DirtyCardQueue& dirty_card_queue() { return _dcq; }
85 G1SATBCardTableModRefBS* ctbs() { return _ct_bs; }
86
87 InCSetState dest(InCSetState original) const {
88 assert(original.is_valid(),
89 err_msg("Original state invalid: " CSETSTATE_FORMAT, original.value()));
90 assert(_dest[original.value()].is_valid_gen(),
91 err_msg("Dest state is invalid: " CSETSTATE_FORMAT, _dest[original.value()].value()));
92 return _dest[original.value()];
93 }
94
95 public:
96 G1ParScanThreadState(G1CollectedHeap* g1h, uint queue_num, ReferenceProcessor* rp);
97 ~G1ParScanThreadState();
98
99 ageTable* age_table() { return &_age_table; }
100
101 #ifdef ASSERT
102 bool queue_is_empty() const { return _refs->is_empty(); }
|
1 /*
2 * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
37
38 class HeapRegion;
39 class outputStream;
40
41 class G1ParScanThreadState : public StackObj {
42 private:
43 G1CollectedHeap* _g1h;
44 RefToScanQueue* _refs;
45 DirtyCardQueue _dcq;
46 G1SATBCardTableModRefBS* _ct_bs;
47 G1RemSet* _g1_rem;
48
49 G1ParGCAllocator* _g1_par_allocator;
50
51 ageTable _age_table;
52 InCSetState _dest[InCSetState::Num];
53 // Local tenuring threshold.
54 uint _tenuring_threshold;
55 G1ParScanClosure _scanner;
56
57 OopsInHeapRegionClosure* _evac_failure_cl;
58
59 int _hash_seed;
60 uint _queue_num;
61
62 size_t _term_attempts;
63
64 double _start;
65 double _start_strong_roots;
66 double _strong_roots_time;
67 double _start_term;
68 double _term_time;
69
70 // Map from young-age-index (0 == not young, 1 is youngest) to
71 // surviving words. base is what we get back from the malloc call
72 size_t* _surviving_young_words_base;
73 // this points into the array, as we use the first few entries for padding
74 size_t* _surviving_young_words;
75
76 #define PADDING_ELEM_NUM (DEFAULT_CACHE_LINE_SIZE / sizeof(size_t))
77
78 DirtyCardQueue& dirty_card_queue() { return _dcq; }
79 G1SATBCardTableModRefBS* ctbs() { return _ct_bs; }
80
81 InCSetState dest(InCSetState original) const {
82 assert(original.is_valid(),
83 err_msg("Original state invalid: " CSETSTATE_FORMAT, original.value()));
84 assert(_dest[original.value()].is_valid_gen(),
85 err_msg("Dest state is invalid: " CSETSTATE_FORMAT, _dest[original.value()].value()));
86 return _dest[original.value()];
87 }
88
89 public:
90 G1ParScanThreadState(G1CollectedHeap* g1h, uint queue_num, ReferenceProcessor* rp);
91 ~G1ParScanThreadState();
92
93 ageTable* age_table() { return &_age_table; }
94
95 #ifdef ASSERT
96 bool queue_is_empty() const { return _refs->is_empty(); }
|