author | kbarrett |
Sat, 26 May 2018 03:11:50 -0400 | |
changeset 50277 | f84ae8aa5d88 |
parent 49592 | 77fb0be7d19f |
child 50752 | 9d62da00bf15 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
49041
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5080
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5080
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5080
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
26 |
#include "classfile/systemDictionary.hpp" |
|
30764 | 27 |
#include "gc/parallel/gcTaskManager.hpp" |
28 |
#include "gc/parallel/objectStartArray.hpp" |
|
46502
116a09d8f142
8180755: Remove use of bitMap.inline.hpp include from instanceKlass.hpp and c1_ValueSet.hpp
tschatzl
parents:
40655
diff
changeset
|
29 |
#include "gc/parallel/parMarkBitMap.inline.hpp" |
30764 | 30 |
#include "gc/parallel/parallelScavengeHeap.hpp" |
31 |
#include "gc/parallel/psCompactionManager.inline.hpp" |
|
32 |
#include "gc/parallel/psOldGen.hpp" |
|
33 |
#include "gc/parallel/psParallelCompact.inline.hpp" |
|
34 |
#include "gc/shared/taskqueue.inline.hpp" |
|
35061 | 35 |
#include "logging/log.hpp" |
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
36 |
#include "memory/iterator.inline.hpp" |
49592
77fb0be7d19f
8199946: Move load/store and encode/decode out of oopDesc
stefank
parents:
49041
diff
changeset
|
37 |
#include "oops/access.inline.hpp" |
77fb0be7d19f
8199946: Move load/store and encode/decode out of oopDesc
stefank
parents:
49041
diff
changeset
|
38 |
#include "oops/compressedOops.inline.hpp" |
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
39 |
#include "oops/instanceKlass.inline.hpp" |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
40 |
#include "oops/instanceMirrorKlass.inline.hpp" |
7397 | 41 |
#include "oops/objArrayKlass.inline.hpp" |
42 |
#include "oops/oop.inline.hpp" |
|
40655
9f644073d3a0
8157907: Incorrect inclusion of atomic.hpp instead of atomic.inline.hpp
dholmes
parents:
38170
diff
changeset
|
43 |
#include "runtime/atomic.hpp" |
1 | 44 |
|
45 |
PSOldGen* ParCompactionManager::_old_gen = NULL; |
|
46 |
ParCompactionManager** ParCompactionManager::_manager_array = NULL; |
|
11174
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
47 |
|
1 | 48 |
OopTaskQueueSet* ParCompactionManager::_stack_array = NULL; |
5076
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
3795
diff
changeset
|
49 |
ParCompactionManager::ObjArrayTaskQueueSet* |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
3795
diff
changeset
|
50 |
ParCompactionManager::_objarray_queues = NULL; |
1 | 51 |
ObjectStartArray* ParCompactionManager::_start_array = NULL; |
52 |
ParMarkBitMap* ParCompactionManager::_mark_bitmap = NULL; |
|
5918 | 53 |
RegionTaskQueueSet* ParCompactionManager::_region_array = NULL; |
1 | 54 |
|
55 |
ParCompactionManager::ParCompactionManager() : |
|
38170
ff88a25a7799
8150994: UseParallelGC fails with UseDynamicNumberOfGCThreads with specjbb2005
jmasa
parents:
35877
diff
changeset
|
56 |
_action(CopyAndUpdate) { |
1 | 57 |
|
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
30151
diff
changeset
|
58 |
ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); |
1 | 59 |
|
60 |
_old_gen = heap->old_gen(); |
|
61 |
_start_array = old_gen()->start_array(); |
|
62 |
||
63 |
marking_stack()->initialize(); |
|
5918 | 64 |
_objarray_stack.initialize(); |
38170
ff88a25a7799
8150994: UseParallelGC fails with UseDynamicNumberOfGCThreads with specjbb2005
jmasa
parents:
35877
diff
changeset
|
65 |
_region_stack.initialize(); |
35877
a2a62511d0f8
8146987: Improve Parallel GC Full GC by caching results of live_words_in_range()
tschatzl
parents:
35061
diff
changeset
|
66 |
|
a2a62511d0f8
8146987: Improve Parallel GC Full GC by caching results of live_words_in_range()
tschatzl
parents:
35061
diff
changeset
|
67 |
reset_bitmap_query_cache(); |
11174
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
68 |
} |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
69 |
|
1 | 70 |
void ParCompactionManager::initialize(ParMarkBitMap* mbm) { |
71 |
assert(PSParallelCompact::gc_task_manager() != NULL, |
|
72 |
"Needed for initialization"); |
|
73 |
||
74 |
_mark_bitmap = mbm; |
|
75 |
||
76 |
uint parallel_gc_threads = PSParallelCompact::gc_task_manager()->workers(); |
|
77 |
||
78 |
assert(_manager_array == NULL, "Attempt to initialize twice"); |
|
13195 | 79 |
_manager_array = NEW_C_HEAP_ARRAY(ParCompactionManager*, parallel_gc_threads+1, mtGC); |
5076
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
3795
diff
changeset
|
80 |
guarantee(_manager_array != NULL, "Could not allocate manager_array"); |
1 | 81 |
|
82 |
_stack_array = new OopTaskQueueSet(parallel_gc_threads); |
|
5076
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
3795
diff
changeset
|
83 |
guarantee(_stack_array != NULL, "Could not allocate stack_array"); |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
3795
diff
changeset
|
84 |
_objarray_queues = new ObjArrayTaskQueueSet(parallel_gc_threads); |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
3795
diff
changeset
|
85 |
guarantee(_objarray_queues != NULL, "Could not allocate objarray_queues"); |
1407
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
1
diff
changeset
|
86 |
_region_array = new RegionTaskQueueSet(parallel_gc_threads); |
5076
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
3795
diff
changeset
|
87 |
guarantee(_region_array != NULL, "Could not allocate region_array"); |
1 | 88 |
|
89 |
// Create and register the ParCompactionManager(s) for the worker threads. |
|
90 |
for(uint i=0; i<parallel_gc_threads; i++) { |
|
91 |
_manager_array[i] = new ParCompactionManager(); |
|
92 |
guarantee(_manager_array[i] != NULL, "Could not create ParCompactionManager"); |
|
93 |
stack_array()->register_queue(i, _manager_array[i]->marking_stack()); |
|
5918 | 94 |
_objarray_queues->register_queue(i, &_manager_array[i]->_objarray_stack); |
38170
ff88a25a7799
8150994: UseParallelGC fails with UseDynamicNumberOfGCThreads with specjbb2005
jmasa
parents:
35877
diff
changeset
|
95 |
region_array()->register_queue(i, _manager_array[i]->region_stack()); |
1 | 96 |
} |
97 |
||
98 |
// The VMThread gets its own ParCompactionManager, which is not available |
|
99 |
// for work stealing. |
|
100 |
_manager_array[parallel_gc_threads] = new ParCompactionManager(); |
|
101 |
guarantee(_manager_array[parallel_gc_threads] != NULL, |
|
102 |
"Could not create ParCompactionManager"); |
|
103 |
assert(PSParallelCompact::gc_task_manager()->workers() != 0, |
|
104 |
"Not initialized?"); |
|
105 |
} |
|
106 |
||
35877
a2a62511d0f8
8146987: Improve Parallel GC Full GC by caching results of live_words_in_range()
tschatzl
parents:
35061
diff
changeset
|
107 |
void ParCompactionManager::reset_all_bitmap_query_caches() { |
a2a62511d0f8
8146987: Improve Parallel GC Full GC by caching results of live_words_in_range()
tschatzl
parents:
35061
diff
changeset
|
108 |
uint parallel_gc_threads = PSParallelCompact::gc_task_manager()->workers(); |
a2a62511d0f8
8146987: Improve Parallel GC Full GC by caching results of live_words_in_range()
tschatzl
parents:
35061
diff
changeset
|
109 |
for (uint i=0; i<=parallel_gc_threads; i++) { |
a2a62511d0f8
8146987: Improve Parallel GC Full GC by caching results of live_words_in_range()
tschatzl
parents:
35061
diff
changeset
|
110 |
_manager_array[i]->reset_bitmap_query_cache(); |
a2a62511d0f8
8146987: Improve Parallel GC Full GC by caching results of live_words_in_range()
tschatzl
parents:
35061
diff
changeset
|
111 |
} |
a2a62511d0f8
8146987: Improve Parallel GC Full GC by caching results of live_words_in_range()
tschatzl
parents:
35061
diff
changeset
|
112 |
} |
a2a62511d0f8
8146987: Improve Parallel GC Full GC by caching results of live_words_in_range()
tschatzl
parents:
35061
diff
changeset
|
113 |
|
1 | 114 |
bool ParCompactionManager::should_update() { |
115 |
assert(action() != NotValid, "Action is not set"); |
|
116 |
return (action() == ParCompactionManager::Update) || |
|
117 |
(action() == ParCompactionManager::CopyAndUpdate) || |
|
118 |
(action() == ParCompactionManager::UpdateAndCopy); |
|
119 |
} |
|
120 |
||
121 |
bool ParCompactionManager::should_copy() { |
|
122 |
assert(action() != NotValid, "Action is not set"); |
|
123 |
return (action() == ParCompactionManager::Copy) || |
|
124 |
(action() == ParCompactionManager::CopyAndUpdate) || |
|
125 |
(action() == ParCompactionManager::UpdateAndCopy); |
|
126 |
} |
|
127 |
||
128 |
ParCompactionManager* |
|
31330
77061bb01b18
8081382: Make flags ParallelGCThreads and ConcGCThreads of type uint
david
parents:
30764
diff
changeset
|
129 |
ParCompactionManager::gc_thread_compaction_manager(uint index) { |
77061bb01b18
8081382: Make flags ParallelGCThreads and ConcGCThreads of type uint
david
parents:
30764
diff
changeset
|
130 |
assert(index < ParallelGCThreads, "index out of range"); |
1 | 131 |
assert(_manager_array != NULL, "Sanity"); |
132 |
return _manager_array[index]; |
|
133 |
} |
|
134 |
||
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
135 |
void InstanceKlass::oop_pc_follow_contents(oop obj, ParCompactionManager* cm) { |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
136 |
assert(obj != NULL, "can't follow the content of NULL object"); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
137 |
|
30556
750fee2bdb45
8078345: Move PSParallelCompact::mark_and_push to ParCompactionManager
stefank
parents:
30173
diff
changeset
|
138 |
cm->follow_klass(this); |
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
139 |
// Only mark the header and let the scan of the meta-data mark |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
140 |
// everything else. |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
141 |
|
30556
750fee2bdb45
8078345: Move PSParallelCompact::mark_and_push to ParCompactionManager
stefank
parents:
30173
diff
changeset
|
142 |
ParCompactionManager::MarkAndPushClosure cl(cm); |
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
143 |
InstanceKlass::oop_oop_iterate_oop_maps<true>(obj, &cl); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
144 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
145 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
146 |
void InstanceMirrorKlass::oop_pc_follow_contents(oop obj, ParCompactionManager* cm) { |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
147 |
InstanceKlass::oop_pc_follow_contents(obj, cm); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
148 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
149 |
// Follow the klass field in the mirror. |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
150 |
Klass* klass = java_lang_Class::as_Klass(obj); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
151 |
if (klass != NULL) { |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
152 |
// An anonymous class doesn't have its own class loader, so the call |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
153 |
// to follow_klass will mark and push its java mirror instead of the |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
154 |
// class loader. When handling the java mirror for an anonymous class |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
155 |
// we need to make sure its class loader data is claimed, this is done |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
156 |
// by calling follow_class_loader explicitly. For non-anonymous classes |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
157 |
// the call to follow_class_loader is made when the class loader itself |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
158 |
// is handled. |
33611
9abd65805e19
8139203: Consistent naming for klass type predicates
coleenp
parents:
31330
diff
changeset
|
159 |
if (klass->is_instance_klass() && InstanceKlass::cast(klass)->is_anonymous()) { |
30556
750fee2bdb45
8078345: Move PSParallelCompact::mark_and_push to ParCompactionManager
stefank
parents:
30173
diff
changeset
|
160 |
cm->follow_class_loader(klass->class_loader_data()); |
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
161 |
} else { |
30556
750fee2bdb45
8078345: Move PSParallelCompact::mark_and_push to ParCompactionManager
stefank
parents:
30173
diff
changeset
|
162 |
cm->follow_klass(klass); |
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
163 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
164 |
} else { |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
165 |
// If klass is NULL then this a mirror for a primitive type. |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
166 |
// We don't have to follow them, since they are handled as strong |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
167 |
// roots in Universe::oops_do. |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
168 |
assert(java_lang_Class::is_primitive(obj), "Sanity check"); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
169 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
170 |
|
30556
750fee2bdb45
8078345: Move PSParallelCompact::mark_and_push to ParCompactionManager
stefank
parents:
30173
diff
changeset
|
171 |
ParCompactionManager::MarkAndPushClosure cl(cm); |
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
172 |
oop_oop_iterate_statics<true>(obj, &cl); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
173 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
174 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
175 |
void InstanceClassLoaderKlass::oop_pc_follow_contents(oop obj, ParCompactionManager* cm) { |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
176 |
InstanceKlass::oop_pc_follow_contents(obj, cm); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
177 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
178 |
ClassLoaderData * const loader_data = java_lang_ClassLoader::loader_data(obj); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
179 |
if (loader_data != NULL) { |
30556
750fee2bdb45
8078345: Move PSParallelCompact::mark_and_push to ParCompactionManager
stefank
parents:
30173
diff
changeset
|
180 |
cm->follow_class_loader(loader_data); |
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
181 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
182 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
183 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
184 |
template <class T> |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
185 |
static void oop_pc_follow_contents_specialized(InstanceRefKlass* klass, oop obj, ParCompactionManager* cm) { |
49041
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
47216
diff
changeset
|
186 |
T* referent_addr = (T*)java_lang_ref_Reference::referent_addr_raw(obj); |
49592
77fb0be7d19f
8199946: Move load/store and encode/decode out of oopDesc
stefank
parents:
49041
diff
changeset
|
187 |
T heap_oop = RawAccess<>::oop_load(referent_addr); |
35061 | 188 |
log_develop_trace(gc, ref)("InstanceRefKlass::oop_pc_follow_contents " PTR_FORMAT, p2i(obj)); |
49592
77fb0be7d19f
8199946: Move load/store and encode/decode out of oopDesc
stefank
parents:
49041
diff
changeset
|
189 |
if (!CompressedOops::is_null(heap_oop)) { |
77fb0be7d19f
8199946: Move load/store and encode/decode out of oopDesc
stefank
parents:
49041
diff
changeset
|
190 |
oop referent = CompressedOops::decode_not_null(heap_oop); |
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
191 |
if (PSParallelCompact::mark_bitmap()->is_unmarked(referent) && |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
192 |
PSParallelCompact::ref_processor()->discover_reference(obj, klass->reference_type())) { |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
193 |
// reference already enqueued, referent will be traversed later |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
194 |
klass->InstanceKlass::oop_pc_follow_contents(obj, cm); |
35061 | 195 |
log_develop_trace(gc, ref)(" Non NULL enqueued " PTR_FORMAT, p2i(obj)); |
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
196 |
return; |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
197 |
} else { |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
198 |
// treat referent as normal oop |
35061 | 199 |
log_develop_trace(gc, ref)(" Non NULL normal " PTR_FORMAT, p2i(obj)); |
30556
750fee2bdb45
8078345: Move PSParallelCompact::mark_and_push to ParCompactionManager
stefank
parents:
30173
diff
changeset
|
200 |
cm->mark_and_push(referent_addr); |
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
201 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
202 |
} |
50277
f84ae8aa5d88
8203028: Simplify reference processing in light of JDK-8175797
kbarrett
parents:
49592
diff
changeset
|
203 |
// Treat discovered as normal oop. |
f84ae8aa5d88
8203028: Simplify reference processing in light of JDK-8175797
kbarrett
parents:
49592
diff
changeset
|
204 |
T* discovered_addr = (T*)java_lang_ref_Reference::discovered_addr_raw(obj); |
f84ae8aa5d88
8203028: Simplify reference processing in light of JDK-8175797
kbarrett
parents:
49592
diff
changeset
|
205 |
cm->mark_and_push(discovered_addr); |
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
206 |
klass->InstanceKlass::oop_pc_follow_contents(obj, cm); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
207 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
208 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
209 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
210 |
void InstanceRefKlass::oop_pc_follow_contents(oop obj, ParCompactionManager* cm) { |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
211 |
if (UseCompressedOops) { |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
212 |
oop_pc_follow_contents_specialized<narrowOop>(this, obj, cm); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
213 |
} else { |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
214 |
oop_pc_follow_contents_specialized<oop>(this, obj, cm); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
215 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
216 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
217 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
218 |
void ObjArrayKlass::oop_pc_follow_contents(oop obj, ParCompactionManager* cm) { |
30556
750fee2bdb45
8078345: Move PSParallelCompact::mark_and_push to ParCompactionManager
stefank
parents:
30173
diff
changeset
|
219 |
cm->follow_klass(this); |
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
220 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
221 |
if (UseCompressedOops) { |
30151
c7cdaa576875
8076456: Remove unnecessary oopDesc::klass() calls
stefank
parents:
30150
diff
changeset
|
222 |
oop_pc_follow_contents_specialized<narrowOop>(objArrayOop(obj), 0, cm); |
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
223 |
} else { |
30151
c7cdaa576875
8076456: Remove unnecessary oopDesc::klass() calls
stefank
parents:
30150
diff
changeset
|
224 |
oop_pc_follow_contents_specialized<oop>(objArrayOop(obj), 0, cm); |
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
225 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
226 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
227 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
228 |
void TypeArrayKlass::oop_pc_follow_contents(oop obj, ParCompactionManager* cm) { |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
229 |
assert(obj->is_typeArray(),"must be a type array"); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
230 |
// Performance tweak: We skip iterating over the klass pointer since we |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
231 |
// know that Universe::TypeArrayKlass never moves. |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
232 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
233 |
|
5076
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
3795
diff
changeset
|
234 |
void ParCompactionManager::follow_marking_stacks() { |
1 | 235 |
do { |
5076
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
3795
diff
changeset
|
236 |
// Drain the overflow stack first, to allow stealing from the marking stack. |
5080
eff0cc882603
6935839: excessive marking stack growth during full gcs
jcoomes
parents:
5076
diff
changeset
|
237 |
oop obj; |
5918 | 238 |
while (marking_stack()->pop_overflow(obj)) { |
29792
8c6fa07f0869
8075957: Reduce calls to the GC specific object visitors in oopDesc
stefank
parents:
25351
diff
changeset
|
239 |
follow_contents(obj); |
5076
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
3795
diff
changeset
|
240 |
} |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
3795
diff
changeset
|
241 |
while (marking_stack()->pop_local(obj)) { |
29792
8c6fa07f0869
8075957: Reduce calls to the GC specific object visitors in oopDesc
stefank
parents:
25351
diff
changeset
|
242 |
follow_contents(obj); |
1 | 243 |
} |
244 |
||
5080
eff0cc882603
6935839: excessive marking stack growth during full gcs
jcoomes
parents:
5076
diff
changeset
|
245 |
// Process ObjArrays one at a time to avoid marking stack bloat. |
5076
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
3795
diff
changeset
|
246 |
ObjArrayTask task; |
17370
59a0620561fa
8003557: NPG: Klass* const k should be const Klass* k.
minqi
parents:
13952
diff
changeset
|
247 |
if (_objarray_stack.pop_overflow(task) || _objarray_stack.pop_local(task)) { |
29792
8c6fa07f0869
8075957: Reduce calls to the GC specific object visitors in oopDesc
stefank
parents:
25351
diff
changeset
|
248 |
follow_contents((objArrayOop)task.obj(), task.index()); |
5076
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
3795
diff
changeset
|
249 |
} |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
3795
diff
changeset
|
250 |
} while (!marking_stacks_empty()); |
1 | 251 |
|
5076
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
3795
diff
changeset
|
252 |
assert(marking_stacks_empty(), "Sanity"); |
1 | 253 |
} |
254 |
||
1407
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
1
diff
changeset
|
255 |
void ParCompactionManager::drain_region_stacks() { |
1 | 256 |
do { |
5918 | 257 |
// Drain overflow stack first so other threads can steal. |
258 |
size_t region_index; |
|
259 |
while (region_stack()->pop_overflow(region_index)) { |
|
1407
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
1
diff
changeset
|
260 |
PSParallelCompact::fill_and_update_region(this, region_index); |
1 | 261 |
} |
262 |
||
5918 | 263 |
while (region_stack()->pop_local(region_index)) { |
1407
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
1
diff
changeset
|
264 |
PSParallelCompact::fill_and_update_region(this, region_index); |
1 | 265 |
} |
1407
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
1
diff
changeset
|
266 |
} while (!region_stack()->is_empty()); |
1 | 267 |
} |