annotate src/share/vm/gc_implementation/g1/g1ParScanThreadState.hpp @ 20446:c10b463abc6e

8057824: methods to copy allocation context statistics Reviewed-by: mikael, jmasa, tschatzl
author jcoomes
date Wed, 10 Sep 2014 13:01:13 -0700
parents 227a9e5e4b4a
children 6948da6d7c13
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
20223
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
1 /*
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
4 *
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
7 * published by the Free Software Foundation.
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
8 *
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
13 * accompanied this code).
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
14 *
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
18 *
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
21 * questions.
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
22 *
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
23 */
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
24
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1PARSCANTHREADSTATE_HPP
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1PARSCANTHREADSTATE_HPP
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
27
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
28 #include "gc_implementation/g1/dirtyCardQueue.hpp"
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
29 #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
30 #include "gc_implementation/g1/g1CollectedHeap.hpp"
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
31 #include "gc_implementation/g1/g1CollectorPolicy.hpp"
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
32 #include "gc_implementation/g1/g1OopClosures.hpp"
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
33 #include "gc_implementation/g1/g1RemSet.hpp"
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
34 #include "gc_implementation/shared/ageTable.hpp"
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
35 #include "memory/allocation.hpp"
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
36 #include "oops/oop.hpp"
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
37
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
38 class HeapRegion;
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
39 class outputStream;
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
40
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
41 class G1ParScanThreadState : public StackObj {
20224
a2328cbebb23 8035401: Fix visibility of G1ParScanThreadState members
tschatzl
parents: 20223
diff changeset
42 private:
20223
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
43 G1CollectedHeap* _g1h;
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
44 RefToScanQueue* _refs;
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
45 DirtyCardQueue _dcq;
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
46 G1SATBCardTableModRefBS* _ct_bs;
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
47 G1RemSet* _g1_rem;
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
48
20404
227a9e5e4b4a 8057536: Refactor G1 to allow context specific allocations
sjohanss
parents: 20224
diff changeset
49 G1ParGCAllocator* _g1_par_allocator;
227a9e5e4b4a 8057536: Refactor G1 to allow context specific allocations
sjohanss
parents: 20224
diff changeset
50
20223
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
51 ageTable _age_table;
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
52
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
53 G1ParScanClosure _scanner;
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
54
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
55 size_t _alloc_buffer_waste;
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
56 size_t _undo_waste;
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
57
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
58 OopsInHeapRegionClosure* _evac_failure_cl;
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
59
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
60 int _hash_seed;
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
61 uint _queue_num;
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
62
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
63 size_t _term_attempts;
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
64
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
65 double _start;
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
66 double _start_strong_roots;
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
67 double _strong_roots_time;
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
68 double _start_term;
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
69 double _term_time;
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
70
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
71 // Map from young-age-index (0 == not young, 1 is youngest) to
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
72 // surviving words. base is what we get back from the malloc call
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
73 size_t* _surviving_young_words_base;
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
74 // this points into the array, as we use the first few entries for padding
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
75 size_t* _surviving_young_words;
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
76
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
77 #define PADDING_ELEM_NUM (DEFAULT_CACHE_LINE_SIZE / sizeof(size_t))
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
78
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
79 void add_to_alloc_buffer_waste(size_t waste) { _alloc_buffer_waste += waste; }
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
80 void add_to_undo_waste(size_t waste) { _undo_waste += waste; }
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
81
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
82 DirtyCardQueue& dirty_card_queue() { return _dcq; }
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
83 G1SATBCardTableModRefBS* ctbs() { return _ct_bs; }
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
84
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
85 template <class T> inline void immediate_rs_update(HeapRegion* from, T* p, int tid);
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
86
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
87 template <class T> void deferred_rs_update(HeapRegion* from, T* p, int tid) {
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
88 // If the new value of the field points to the same region or
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
89 // is the to-space, we don't need to include it in the Rset updates.
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
90 if (!from->is_in_reserved(oopDesc::load_decode_heap_oop(p)) && !from->is_survivor()) {
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
91 size_t card_index = ctbs()->index_for(p);
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
92 // If the card hasn't been added to the buffer, do it.
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
93 if (ctbs()->mark_card_deferred(card_index)) {
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
94 dirty_card_queue().enqueue((jbyte*)ctbs()->byte_for_index(card_index));
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
95 }
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
96 }
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
97 }
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
98
20224
a2328cbebb23 8035401: Fix visibility of G1ParScanThreadState members
tschatzl
parents: 20223
diff changeset
99 public:
20223
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
100 G1ParScanThreadState(G1CollectedHeap* g1h, uint queue_num, ReferenceProcessor* rp);
20224
a2328cbebb23 8035401: Fix visibility of G1ParScanThreadState members
tschatzl
parents: 20223
diff changeset
101 ~G1ParScanThreadState();
20223
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
102
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
103 ageTable* age_table() { return &_age_table; }
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
104
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
105 #ifdef ASSERT
20224
a2328cbebb23 8035401: Fix visibility of G1ParScanThreadState members
tschatzl
parents: 20223
diff changeset
106 bool queue_is_empty() const { return _refs->is_empty(); }
a2328cbebb23 8035401: Fix visibility of G1ParScanThreadState members
tschatzl
parents: 20223
diff changeset
107
20223
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
108 bool verify_ref(narrowOop* ref) const;
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
109 bool verify_ref(oop* ref) const;
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
110 bool verify_task(StarTask ref) const;
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
111 #endif // ASSERT
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
112
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
113 template <class T> void push_on_queue(T* ref) {
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
114 assert(verify_ref(ref), "sanity");
20224
a2328cbebb23 8035401: Fix visibility of G1ParScanThreadState members
tschatzl
parents: 20223
diff changeset
115 _refs->push(ref);
20223
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
116 }
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
117
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
118 template <class T> inline void update_rs(HeapRegion* from, T* p, int tid);
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
119
20224
a2328cbebb23 8035401: Fix visibility of G1ParScanThreadState members
tschatzl
parents: 20223
diff changeset
120 public:
20223
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
121
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
122 void set_evac_failure_closure(OopsInHeapRegionClosure* evac_failure_cl) {
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
123 _evac_failure_cl = evac_failure_cl;
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
124 }
20224
a2328cbebb23 8035401: Fix visibility of G1ParScanThreadState members
tschatzl
parents: 20223
diff changeset
125
a2328cbebb23 8035401: Fix visibility of G1ParScanThreadState members
tschatzl
parents: 20223
diff changeset
126 OopsInHeapRegionClosure* evac_failure_closure() { return _evac_failure_cl; }
20223
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
127
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
128 int* hash_seed() { return &_hash_seed; }
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
129 uint queue_num() { return _queue_num; }
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
130
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
131 size_t term_attempts() const { return _term_attempts; }
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
132 void note_term_attempt() { _term_attempts++; }
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
133
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
134 void start_strong_roots() {
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
135 _start_strong_roots = os::elapsedTime();
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
136 }
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
137 void end_strong_roots() {
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
138 _strong_roots_time += (os::elapsedTime() - _start_strong_roots);
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
139 }
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
140 double strong_roots_time() const { return _strong_roots_time; }
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
141
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
142 void start_term_time() {
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
143 note_term_attempt();
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
144 _start_term = os::elapsedTime();
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
145 }
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
146 void end_term_time() {
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
147 _term_time += (os::elapsedTime() - _start_term);
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
148 }
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
149 double term_time() const { return _term_time; }
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
150
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
151 double elapsed_time() const {
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
152 return os::elapsedTime() - _start;
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
153 }
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
154
20224
a2328cbebb23 8035401: Fix visibility of G1ParScanThreadState members
tschatzl
parents: 20223
diff changeset
155 static void print_termination_stats_hdr(outputStream* const st = gclog_or_tty);
a2328cbebb23 8035401: Fix visibility of G1ParScanThreadState members
tschatzl
parents: 20223
diff changeset
156 void print_termination_stats(int i, outputStream* const st = gclog_or_tty) const;
20223
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
157
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
158 size_t* surviving_young_words() {
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
159 // We add on to hide entry 0 which accumulates surviving words for
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
160 // age -1 regions (i.e. non-young ones)
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
161 return _surviving_young_words;
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
162 }
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
163
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
164 private:
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
165 #define G1_PARTIAL_ARRAY_MASK 0x2
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
166
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
167 inline bool has_partial_array_mask(oop* ref) const {
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
168 return ((uintptr_t)ref & G1_PARTIAL_ARRAY_MASK) == G1_PARTIAL_ARRAY_MASK;
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
169 }
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
170
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
171 // We never encode partial array oops as narrowOop*, so return false immediately.
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
172 // This allows the compiler to create optimized code when popping references from
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
173 // the work queue.
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
174 inline bool has_partial_array_mask(narrowOop* ref) const {
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
175 assert(((uintptr_t)ref & G1_PARTIAL_ARRAY_MASK) != G1_PARTIAL_ARRAY_MASK, "Partial array oop reference encoded as narrowOop*");
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
176 return false;
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
177 }
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
178
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
179 // Only implement set_partial_array_mask() for regular oops, not for narrowOops.
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
180 // We always encode partial arrays as regular oop, to allow the
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
181 // specialization for has_partial_array_mask() for narrowOops above.
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
182 // This means that unintentional use of this method with narrowOops are caught
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
183 // by the compiler.
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
184 inline oop* set_partial_array_mask(oop obj) const {
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
185 assert(((uintptr_t)(void *)obj & G1_PARTIAL_ARRAY_MASK) == 0, "Information loss!");
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
186 return (oop*) ((uintptr_t)(void *)obj | G1_PARTIAL_ARRAY_MASK);
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
187 }
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
188
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
189 inline oop clear_partial_array_mask(oop* ref) const {
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
190 return cast_to_oop((intptr_t)ref & ~G1_PARTIAL_ARRAY_MASK);
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
191 }
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
192
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
193 inline void do_oop_partial_array(oop* p);
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
194
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
195 // This method is applied to the fields of the objects that have just been copied.
20224
a2328cbebb23 8035401: Fix visibility of G1ParScanThreadState members
tschatzl
parents: 20223
diff changeset
196 template <class T> inline void do_oop_evac(T* p, HeapRegion* from);
20223
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
197
20224
a2328cbebb23 8035401: Fix visibility of G1ParScanThreadState members
tschatzl
parents: 20223
diff changeset
198 template <class T> inline void deal_with_reference(T* ref_to_scan);
20223
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
199
20224
a2328cbebb23 8035401: Fix visibility of G1ParScanThreadState members
tschatzl
parents: 20223
diff changeset
200 inline void dispatch_reference(StarTask ref);
a2328cbebb23 8035401: Fix visibility of G1ParScanThreadState members
tschatzl
parents: 20223
diff changeset
201 public:
20223
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
202
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
203 oop copy_to_survivor_space(oop const obj);
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
204
20224
a2328cbebb23 8035401: Fix visibility of G1ParScanThreadState members
tschatzl
parents: 20223
diff changeset
205 void trim_queue();
20223
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
206
20224
a2328cbebb23 8035401: Fix visibility of G1ParScanThreadState members
tschatzl
parents: 20223
diff changeset
207 inline void steal_and_trim_queue(RefToScanQueueSet *task_queues);
20223
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
208 };
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
209
b0c374311c4e 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
210 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1PARSCANTHREADSTATE_HPP