author | sjohanss |
Thu, 21 Sep 2017 14:32:05 +0200 | |
changeset 47546 | 64ba55ba8516 |
parent 47216 | 71c04702a3d5 |
child 49730 | c2761ef9fd95 |
permissions | -rw-r--r-- |
28031 | 1 |
/* |
30764 | 2 |
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. |
28031 | 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 |
* |
|
23 |
*/ |
|
24 |
||
30764 | 25 |
#ifndef SHARE_VM_GC_SHARED_CARDGENERATION_HPP |
26 |
#define SHARE_VM_GC_SHARED_CARDGENERATION_HPP |
|
28031 | 27 |
|
28 |
// Class CardGeneration is a generation that is covered by a card table, |
|
29 |
// and uses a card-size block-offset array to implement block_start. |
|
30 |
||
30764 | 31 |
#include "gc/shared/generation.hpp" |
28031 | 32 |
|
33 |
class BlockOffsetSharedArray; |
|
28033
ab63acbd99ec
8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents:
28031
diff
changeset
|
34 |
class CompactibleSpace; |
28031 | 35 |
|
36 |
class CardGeneration: public Generation { |
|
37 |
friend class VMStructs; |
|
38 |
protected: |
|
39 |
// This is shared with other generations. |
|
33212 | 40 |
CardTableRS* _rs; |
28031 | 41 |
// This is local to this generation. |
42 |
BlockOffsetSharedArray* _bts; |
|
43 |
||
28033
ab63acbd99ec
8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents:
28031
diff
changeset
|
44 |
// Current shrinking effect: this damps shrinking when the heap gets empty. |
28031 | 45 |
size_t _shrink_factor; |
46 |
||
47 |
size_t _min_heap_delta_bytes; // Minimum amount to expand. |
|
48 |
||
49 |
// Some statistics from before gc started. |
|
50 |
// These are gathered in the gc_prologue (and should_collect) |
|
51 |
// to control growing/shrinking policy in spite of promotions. |
|
52 |
size_t _capacity_at_prologue; |
|
53 |
size_t _used_at_prologue; |
|
54 |
||
33212 | 55 |
CardGeneration(ReservedSpace rs, size_t initial_byte_size, CardTableRS* remset); |
28031 | 56 |
|
28033
ab63acbd99ec
8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents:
28031
diff
changeset
|
57 |
virtual void assert_correct_size_change_locking() = 0; |
ab63acbd99ec
8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents:
28031
diff
changeset
|
58 |
|
ab63acbd99ec
8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents:
28031
diff
changeset
|
59 |
virtual CompactibleSpace* space() const = 0; |
ab63acbd99ec
8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents:
28031
diff
changeset
|
60 |
|
28031 | 61 |
public: |
62 |
||
63 |
// Attempt to expand the generation by "bytes". Expand by at a |
|
64 |
// minimum "expand_bytes". Return true if some amount (not |
|
65 |
// necessarily the full "bytes") was done. |
|
66 |
virtual bool expand(size_t bytes, size_t expand_bytes); |
|
67 |
||
68 |
// Shrink generation with specified size |
|
28033
ab63acbd99ec
8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents:
28031
diff
changeset
|
69 |
virtual void shrink(size_t bytes); |
28031 | 70 |
|
71 |
virtual void compute_new_size(); |
|
72 |
||
73 |
virtual void clear_remembered_set(); |
|
74 |
||
75 |
virtual void invalidate_remembered_set(); |
|
76 |
||
77 |
virtual void prepare_for_verify(); |
|
78 |
||
79 |
// Grow generation with specified size (returns false if unable to grow) |
|
28033
ab63acbd99ec
8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents:
28031
diff
changeset
|
80 |
bool grow_by(size_t bytes); |
28031 | 81 |
// Grow generation to reserved size. |
28033
ab63acbd99ec
8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents:
28031
diff
changeset
|
82 |
bool grow_to_reserved(); |
ab63acbd99ec
8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents:
28031
diff
changeset
|
83 |
|
ab63acbd99ec
8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents:
28031
diff
changeset
|
84 |
size_t capacity() const; |
ab63acbd99ec
8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents:
28031
diff
changeset
|
85 |
size_t used() const; |
ab63acbd99ec
8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents:
28031
diff
changeset
|
86 |
size_t free() const; |
ab63acbd99ec
8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents:
28031
diff
changeset
|
87 |
MemRegion used_region() const; |
ab63acbd99ec
8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents:
28031
diff
changeset
|
88 |
|
ab63acbd99ec
8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents:
28031
diff
changeset
|
89 |
void space_iterate(SpaceClosure* blk, bool usedOnly = false); |
ab63acbd99ec
8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents:
28031
diff
changeset
|
90 |
|
30870
3050fdcdc60b
8080112: Replace and remove the last usages of CollectedHeap::n_par_threads()
stefank
parents:
30764
diff
changeset
|
91 |
void younger_refs_iterate(OopsInGenClosure* blk, uint n_threads); |
28033
ab63acbd99ec
8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents:
28031
diff
changeset
|
92 |
|
ab63acbd99ec
8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents:
28031
diff
changeset
|
93 |
bool is_in(const void* p) const; |
ab63acbd99ec
8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents:
28031
diff
changeset
|
94 |
|
ab63acbd99ec
8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents:
28031
diff
changeset
|
95 |
CompactibleSpace* first_compaction_space() const; |
28031 | 96 |
}; |
97 |
||
30764 | 98 |
#endif // SHARE_VM_GC_SHARED_CARDGENERATION_HPP |