author | tschatzl |
Wed, 13 Mar 2019 21:01:56 +0100 | |
changeset 54110 | f4f0dce5d0bb |
parent 49733 | 6f0a3ea5ab75 |
permissions | -rw-r--r-- |
49733
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
1 |
/* |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
2 |
* Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
4 |
* |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
8 |
* |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
13 |
* accompanied this code). |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
14 |
* |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
18 |
* |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
21 |
* questions. |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
22 |
* |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
23 |
*/ |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
24 |
|
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
25 |
#ifndef SHARE_GC_CMS_CMSCARDTABLE_HPP |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
26 |
#define SHARE_GC_CMS_CMSCARDTABLE_HPP |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
27 |
|
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
28 |
#include "gc/shared/cardTableRS.hpp" |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
29 |
#include "utilities/globalDefinitions.hpp" |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
30 |
|
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
31 |
class DirtyCardToOopClosure; |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
32 |
class MemRegion; |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
33 |
class OopsInGenClosure; |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
34 |
class Space; |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
35 |
|
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
36 |
class CMSCardTable : public CardTableRS { |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
37 |
private: |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
38 |
// Returns the number of chunks necessary to cover "mr". |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
39 |
size_t chunks_to_cover(MemRegion mr); |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
40 |
|
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
41 |
// Returns the index of the chunk in a stride which |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
42 |
// covers the given address. |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
43 |
uintptr_t addr_to_chunk_index(const void* addr); |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
44 |
|
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
45 |
// Initializes "lowest_non_clean" to point to the array for the region |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
46 |
// covering "sp", and "lowest_non_clean_base_chunk_index" to the chunk |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
47 |
// index of the corresponding to the first element of that array. |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
48 |
// Ensures that these arrays are of sufficient size, allocating if necessary. |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
49 |
// May be called by several threads concurrently. |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
50 |
void get_LNC_array_for_space(Space* sp, |
54110 | 51 |
CardValue**& lowest_non_clean, |
49733
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
52 |
uintptr_t& lowest_non_clean_base_chunk_index, |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
53 |
size_t& lowest_non_clean_chunk_size); |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
54 |
|
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
55 |
// Apply cl, which must either itself apply dcto_cl or be dcto_cl, |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
56 |
// to the cards in the stride (of n_strides) within the given space. |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
57 |
void process_stride(Space* sp, |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
58 |
MemRegion used, |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
59 |
jint stride, int n_strides, |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
60 |
OopsInGenClosure* cl, |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
61 |
CardTableRS* ct, |
54110 | 62 |
CardValue** lowest_non_clean, |
49733
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
63 |
uintptr_t lowest_non_clean_base_chunk_index, |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
64 |
size_t lowest_non_clean_chunk_size); |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
65 |
|
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
66 |
// Makes sure that chunk boundaries are handled appropriately, by |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
67 |
// adjusting the min_done of dcto_cl, and by using a special card-table |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
68 |
// value to indicate how min_done should be set. |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
69 |
void process_chunk_boundaries(Space* sp, |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
70 |
DirtyCardToOopClosure* dcto_cl, |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
71 |
MemRegion chunk_mr, |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
72 |
MemRegion used, |
54110 | 73 |
CardValue** lowest_non_clean, |
49733
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
74 |
uintptr_t lowest_non_clean_base_chunk_index, |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
75 |
size_t lowest_non_clean_chunk_size); |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
76 |
|
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
77 |
virtual void verify_used_region_at_save_marks(Space* sp) const NOT_DEBUG_RETURN; |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
78 |
|
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
79 |
protected: |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
80 |
// Work method used to implement non_clean_card_iterate_possibly_parallel() |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
81 |
// above in the parallel case. |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
82 |
virtual void non_clean_card_iterate_parallel_work(Space* sp, MemRegion mr, |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
83 |
OopsInGenClosure* cl, CardTableRS* ct, |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
84 |
uint n_threads); |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
85 |
|
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
86 |
public: |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
87 |
CMSCardTable(MemRegion whole_heap); |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
88 |
}; |
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
89 |
|
6f0a3ea5ab75
8201209: Separate out CMS specific functions into CMSCardTable
stefank
parents:
diff
changeset
|
90 |
#endif // SHARE_GC_CMS_CMSCARDTABLE_HPP |