author | stefank |
Thu, 22 Feb 2018 18:37:23 +0100 | |
changeset 49049 | effb50eeea4e |
parent 48168 | cb5d2d4453d0 |
child 49050 | 170c7b36aea6 |
permissions | -rw-r--r-- |
47819
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
1 |
/* |
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
2 |
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. |
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 |
|
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
25 |
#include "precompiled.hpp" |
48168
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
26 |
#include "gc/serial/defNewGeneration.hpp" |
47819
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
27 |
#include "gc/serial/serialHeap.hpp" |
48168
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
28 |
#include "gc/shared/genMemoryPools.hpp" |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
29 |
#include "services/memoryManager.hpp" |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
30 |
|
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
31 |
SerialHeap::SerialHeap(GenCollectorPolicy* policy) : |
49049
effb50eeea4e
8198528: Move GenerationSpecs from GenCollectorPolicy to GenCollectedHeap
stefank
parents:
48168
diff
changeset
|
32 |
GenCollectedHeap(policy, |
effb50eeea4e
8198528: Move GenerationSpecs from GenCollectorPolicy to GenCollectedHeap
stefank
parents:
48168
diff
changeset
|
33 |
Generation::DefNew, |
effb50eeea4e
8198528: Move GenerationSpecs from GenCollectorPolicy to GenCollectedHeap
stefank
parents:
48168
diff
changeset
|
34 |
Generation::MarkSweepCompact), |
effb50eeea4e
8198528: Move GenerationSpecs from GenCollectorPolicy to GenCollectedHeap
stefank
parents:
48168
diff
changeset
|
35 |
_eden_pool(NULL), |
effb50eeea4e
8198528: Move GenerationSpecs from GenCollectorPolicy to GenCollectedHeap
stefank
parents:
48168
diff
changeset
|
36 |
_survivor_pool(NULL), |
effb50eeea4e
8198528: Move GenerationSpecs from GenCollectorPolicy to GenCollectedHeap
stefank
parents:
48168
diff
changeset
|
37 |
_old_pool(NULL) { |
48168
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
38 |
_young_manager = new GCMemoryManager("Copy", "end of minor GC"); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
39 |
_old_manager = new GCMemoryManager("MarkSweepCompact", "end of major GC"); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
40 |
} |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
41 |
|
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
42 |
void SerialHeap::initialize_serviceability() { |
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 |
DefNewGeneration* young = (DefNewGeneration*) young_gen(); |
47819
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
45 |
|
48168
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
46 |
// Add a memory pool for each space and young gen doesn't |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
47 |
// support low memory detection as it is expected to get filled up. |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
48 |
_eden_pool = new ContiguousSpacePool(young->eden(), |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
49 |
"Eden Space", |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
50 |
young->max_eden_size(), |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
51 |
false /* support_usage_threshold */); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
52 |
_survivor_pool = new SurvivorContiguousSpacePool(young, |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
53 |
"Survivor Space", |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
54 |
young->max_survivor_size(), |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
55 |
false /* support_usage_threshold */); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
56 |
Generation* old = old_gen(); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
57 |
_old_pool = new GenerationPool(old, "Tenured Gen", true); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
58 |
|
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
59 |
_young_manager->add_pool(_eden_pool); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
60 |
_young_manager->add_pool(_survivor_pool); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
61 |
young->set_gc_manager(_young_manager); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
62 |
|
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
63 |
_old_manager->add_pool(_eden_pool); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
64 |
_old_manager->add_pool(_survivor_pool); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
65 |
_old_manager->add_pool(_old_pool); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
66 |
old->set_gc_manager(_old_manager); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
67 |
|
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
68 |
} |
47819
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
69 |
|
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
70 |
void SerialHeap::check_gen_kinds() { |
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
71 |
assert(young_gen()->kind() == Generation::DefNew, |
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
72 |
"Wrong youngest generation type"); |
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
73 |
assert(old_gen()->kind() == Generation::MarkSweepCompact, |
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
74 |
"Wrong generation kind"); |
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
75 |
} |
48168
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
76 |
|
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
77 |
GrowableArray<GCMemoryManager*> SerialHeap::memory_managers() { |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
78 |
GrowableArray<GCMemoryManager*> memory_managers(2); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
79 |
memory_managers.append(_young_manager); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
80 |
memory_managers.append(_old_manager); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
81 |
return memory_managers; |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
82 |
} |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
83 |
|
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
84 |
GrowableArray<MemoryPool*> SerialHeap::memory_pools() { |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
85 |
GrowableArray<MemoryPool*> memory_pools(3); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
86 |
memory_pools.append(_eden_pool); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
87 |
memory_pools.append(_survivor_pool); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
88 |
memory_pools.append(_old_pool); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
89 |
return memory_pools; |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
90 |
} |