author | tschatzl |
Wed, 18 Apr 2018 11:36:48 +0200 | |
changeset 49806 | 2d62570a615c |
parent 47216 | 71c04702a3d5 |
child 50676 | 8c0a5b51559b |
permissions | -rw-r--r-- |
42597
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
1 |
/* |
46328
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
2 |
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. |
42597
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
4 |
* |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
8 |
* |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
13 |
* accompanied this code). |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
14 |
* |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
18 |
* |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
21 |
* questions. |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
22 |
* |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
23 |
*/ |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
24 |
|
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
25 |
#include "precompiled.hpp" |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
26 |
#include "gc/g1/g1ConcurrentMark.inline.hpp" |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
27 |
#include "gc/g1/g1ConcurrentMarkObjArrayProcessor.inline.hpp" |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
28 |
|
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
29 |
void G1CMObjArrayProcessor::push_array_slice(HeapWord* what) { |
46328
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
30 |
_task->push(G1TaskQueueEntry::from_slice(what)); |
42597
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
31 |
} |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
32 |
|
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
33 |
size_t G1CMObjArrayProcessor::process_array_slice(objArrayOop obj, HeapWord* start_from, size_t remaining) { |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
34 |
size_t words_to_scan = MIN2(remaining, ObjArrayMarkingStride); |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
35 |
|
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
36 |
if (remaining > ObjArrayMarkingStride) { |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
37 |
push_array_slice(start_from + ObjArrayMarkingStride); |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
38 |
} |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
39 |
|
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
40 |
// Then process current area. |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
41 |
MemRegion mr(start_from, words_to_scan); |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
42 |
return _task->scan_objArray(obj, mr); |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
43 |
} |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
44 |
|
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
45 |
size_t G1CMObjArrayProcessor::process_obj(oop obj) { |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
46 |
assert(should_be_sliced(obj), "Must be an array object %d and large " SIZE_FORMAT, obj->is_objArray(), (size_t)obj->size()); |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
47 |
|
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
48 |
return process_array_slice(objArrayOop(obj), (HeapWord*)obj, (size_t)objArrayOop(obj)->size()); |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
49 |
} |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
50 |
|
46328
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
51 |
size_t G1CMObjArrayProcessor::process_slice(HeapWord* slice) { |
42597
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
52 |
|
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
53 |
// Find the start address of the objArrayOop. |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
54 |
// Shortcut the BOT access if the given address is from a humongous object. The BOT |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
55 |
// slide is fast enough for "smaller" objects in non-humongous regions, but is slower |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
56 |
// than directly using heap region table. |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
57 |
G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
46328
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
58 |
HeapRegion* r = g1h->heap_region_containing(slice); |
42597
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
59 |
|
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
60 |
HeapWord* const start_address = r->is_humongous() ? |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
61 |
r->humongous_start_region()->bottom() : |
46328
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
62 |
g1h->block_start(slice); |
42597
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
63 |
|
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
64 |
assert(oop(start_address)->is_objArray(), "Address " PTR_FORMAT " does not refer to an object array ", p2i(start_address)); |
46328
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
65 |
assert(start_address < slice, |
42597
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
66 |
"Object start address " PTR_FORMAT " must be smaller than decoded address " PTR_FORMAT, |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
67 |
p2i(start_address), |
46328
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
68 |
p2i(slice)); |
42597
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
69 |
|
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
70 |
objArrayOop objArray = objArrayOop(start_address); |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
71 |
|
46328
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
72 |
size_t already_scanned = slice - start_address; |
42597
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
73 |
size_t remaining = objArray->size() - already_scanned; |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
74 |
|
46328
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
75 |
return process_array_slice(objArray, slice, remaining); |
42597
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
diff
changeset
|
76 |
} |