author | coleenp |
Thu, 10 Jan 2019 15:13:51 -0500 | |
changeset 53244 | 9807daeb47c4 |
parent 50034 | 01a88f825a84 |
child 54375 | a5ce9300462f |
permissions | -rw-r--r-- |
47819
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
1 |
/* |
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
50034
diff
changeset
|
2 |
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. |
47819
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
4 |
* |
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
8 |
* |
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
13 |
* accompanied this code). |
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
14 |
* |
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
18 |
* |
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
21 |
* questions. |
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
22 |
* |
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
23 |
*/ |
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
24 |
|
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
50034
diff
changeset
|
25 |
#ifndef SHARE_GC_SERIAL_SERIALHEAP_HPP |
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
50034
diff
changeset
|
26 |
#define SHARE_GC_SERIAL_SERIALHEAP_HPP |
47819
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
27 |
|
50033
000c697c81db
8202639: Use concrete Generation classes in SerialHeap and CMSHeap
stefank
parents:
49628
diff
changeset
|
28 |
#include "gc/serial/defNewGeneration.hpp" |
000c697c81db
8202639: Use concrete Generation classes in SerialHeap and CMSHeap
stefank
parents:
49628
diff
changeset
|
29 |
#include "gc/serial/tenuredGeneration.hpp" |
47819
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
30 |
#include "gc/shared/genCollectedHeap.hpp" |
48168
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
31 |
#include "utilities/growableArray.hpp" |
47819
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
32 |
|
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
33 |
class GenCollectorPolicy; |
48168
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
34 |
class GCMemoryManager; |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
35 |
class MemoryPool; |
50033
000c697c81db
8202639: Use concrete Generation classes in SerialHeap and CMSHeap
stefank
parents:
49628
diff
changeset
|
36 |
class TenuredGeneration; |
47819
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
37 |
|
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
38 |
class SerialHeap : public GenCollectedHeap { |
48168
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
39 |
private: |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
40 |
MemoryPool* _eden_pool; |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
41 |
MemoryPool* _survivor_pool; |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
42 |
MemoryPool* _old_pool; |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
43 |
|
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
44 |
virtual void initialize_serviceability(); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
45 |
|
50033
000c697c81db
8202639: Use concrete Generation classes in SerialHeap and CMSHeap
stefank
parents:
49628
diff
changeset
|
46 |
public: |
000c697c81db
8202639: Use concrete Generation classes in SerialHeap and CMSHeap
stefank
parents:
49628
diff
changeset
|
47 |
static SerialHeap* heap(); |
47819
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
48 |
|
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
49 |
SerialHeap(GenCollectorPolicy* policy); |
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
50 |
|
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
51 |
virtual Name kind() const { |
49628
88478047bc8f
8199918: Shorten names of CollectedHeap::Name members
pliden
parents:
48961
diff
changeset
|
52 |
return CollectedHeap::Serial; |
47819
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
53 |
} |
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
54 |
|
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
55 |
virtual const char* name() const { |
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
56 |
return "Serial"; |
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
57 |
} |
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
58 |
|
48168
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
59 |
virtual GrowableArray<GCMemoryManager*> memory_managers(); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
60 |
virtual GrowableArray<MemoryPool*> memory_pools(); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
61 |
|
47819
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
62 |
// override |
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
63 |
virtual bool is_in_closed_subset(const void* p) const { |
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
64 |
return is_in(p); |
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
65 |
} |
50033
000c697c81db
8202639: Use concrete Generation classes in SerialHeap and CMSHeap
stefank
parents:
49628
diff
changeset
|
66 |
|
000c697c81db
8202639: Use concrete Generation classes in SerialHeap and CMSHeap
stefank
parents:
49628
diff
changeset
|
67 |
DefNewGeneration* young_gen() const { |
000c697c81db
8202639: Use concrete Generation classes in SerialHeap and CMSHeap
stefank
parents:
49628
diff
changeset
|
68 |
assert(_young_gen->kind() == Generation::DefNew, "Wrong generation type"); |
000c697c81db
8202639: Use concrete Generation classes in SerialHeap and CMSHeap
stefank
parents:
49628
diff
changeset
|
69 |
return static_cast<DefNewGeneration*>(_young_gen); |
000c697c81db
8202639: Use concrete Generation classes in SerialHeap and CMSHeap
stefank
parents:
49628
diff
changeset
|
70 |
} |
000c697c81db
8202639: Use concrete Generation classes in SerialHeap and CMSHeap
stefank
parents:
49628
diff
changeset
|
71 |
|
000c697c81db
8202639: Use concrete Generation classes in SerialHeap and CMSHeap
stefank
parents:
49628
diff
changeset
|
72 |
TenuredGeneration* old_gen() const { |
000c697c81db
8202639: Use concrete Generation classes in SerialHeap and CMSHeap
stefank
parents:
49628
diff
changeset
|
73 |
assert(_old_gen->kind() == Generation::MarkSweepCompact, "Wrong generation type"); |
000c697c81db
8202639: Use concrete Generation classes in SerialHeap and CMSHeap
stefank
parents:
49628
diff
changeset
|
74 |
return static_cast<TenuredGeneration*>(_old_gen); |
000c697c81db
8202639: Use concrete Generation classes in SerialHeap and CMSHeap
stefank
parents:
49628
diff
changeset
|
75 |
} |
50034
01a88f825a84
8202641: Replace OOP_SINCE_SAVE_MARKS with templates
stefank
parents:
50033
diff
changeset
|
76 |
|
01a88f825a84
8202641: Replace OOP_SINCE_SAVE_MARKS with templates
stefank
parents:
50033
diff
changeset
|
77 |
// Apply "cur->do_oop" or "older->do_oop" to all the oops in objects |
01a88f825a84
8202641: Replace OOP_SINCE_SAVE_MARKS with templates
stefank
parents:
50033
diff
changeset
|
78 |
// allocated since the last call to save_marks in the young generation. |
01a88f825a84
8202641: Replace OOP_SINCE_SAVE_MARKS with templates
stefank
parents:
50033
diff
changeset
|
79 |
// The "cur" closure is applied to references in the younger generation |
01a88f825a84
8202641: Replace OOP_SINCE_SAVE_MARKS with templates
stefank
parents:
50033
diff
changeset
|
80 |
// at "level", and the "older" closure to older generations. |
01a88f825a84
8202641: Replace OOP_SINCE_SAVE_MARKS with templates
stefank
parents:
50033
diff
changeset
|
81 |
template <typename OopClosureType1, typename OopClosureType2> |
01a88f825a84
8202641: Replace OOP_SINCE_SAVE_MARKS with templates
stefank
parents:
50033
diff
changeset
|
82 |
void oop_since_save_marks_iterate(OopClosureType1* cur, |
01a88f825a84
8202641: Replace OOP_SINCE_SAVE_MARKS with templates
stefank
parents:
50033
diff
changeset
|
83 |
OopClosureType2* older); |
47819
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
84 |
}; |
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
85 |
|
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
50034
diff
changeset
|
86 |
#endif // SHARE_GC_SERIAL_SERIALHEAP_HPP |