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
25 #include "precompiled.hpp"
26 #include "gc/serial/serialHeap.hpp"
27
28 SerialHeap::SerialHeap(GenCollectorPolicy* policy) : GenCollectedHeap(policy) {}
29
30 void SerialHeap::check_gen_kinds() {
31 assert(young_gen()->kind() == Generation::DefNew,
32 "Wrong youngest generation type");
33 assert(old_gen()->kind() == Generation::MarkSweepCompact,
34 "Wrong generation kind");
35 }
|
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
25 #include "precompiled.hpp"
26 #include "gc/serial/defNewGeneration.hpp"
27 #include "gc/serial/serialHeap.hpp"
28 #include "services/memoryManager.hpp"
29 #include "services/memoryPool.hpp"
30
31 SerialHeap::SerialHeap(GenCollectorPolicy* policy) : GenCollectedHeap(policy) {}
32
33 void SerialHeap::check_gen_kinds() {
34 assert(young_gen()->kind() == Generation::DefNew,
35 "Wrong youngest generation type");
36 assert(old_gen()->kind() == Generation::MarkSweepCompact,
37 "Wrong generation kind");
38 }
39
40 class CopyMemoryManager : public GCMemoryManager {
41 private:
42 public:
43 CopyMemoryManager() : GCMemoryManager() {}
44
45 const char* name() { return "Copy"; }
46 virtual const char* gc_end_message() { return "end of minor GC"; }
47 };
48
49 class MSCMemoryManager : public GCMemoryManager {
50 private:
51 public:
52 MSCMemoryManager() : GCMemoryManager() {}
53
54 const char* name() { return "MarkSweepCompact"; }
55 virtual const char* gc_end_message() { return "end of major GC"; }
56 };
57
58 void SerialHeap::init_memory_managers() {
59 _minor_mgr = new CopyMemoryManager();
60 _major_mgr = new MSCMemoryManager();
61 }
62
63 GrowableArray<MemoryManager*> SerialHeap::memory_managers() {
64 GrowableArray<MemoryManager*> mem_mgrs;
65 mem_mgrs.append(_minor_mgr);
66 mem_mgrs.append(_major_mgr);
67 return mem_mgrs;
68 }
69
70 GrowableArray<MemoryPool*> SerialHeap::memory_pools() {
71 DefNewGeneration* young = (DefNewGeneration*) young_gen();
72
73 // Add a memory pool for each space and young gen doesn't
74 // support low memory detection as it is expected to get filled up.
75 MemoryPool* eden = new ContiguousSpacePool(young->eden(),
76 "Eden Space",
77 MemoryPool::Heap,
78 young->max_eden_size(),
79 false /* support_usage_threshold */);
80 MemoryPool* survivor = new SurvivorContiguousSpacePool(young,
81 "Survivor Space",
82 MemoryPool::Heap,
83 young->max_survivor_size(),
84 false /* support_usage_threshold */);
85 GenerationPool* old = new GenerationPool(old_gen(), "Tenured Gen", MemoryPool::Heap, true);
86
87 GrowableArray<MemoryPool*> mem_pools;
88 mem_pools.append(eden);
89 mem_pools.append(survivor);
90 mem_pools.append(old);
91
92 _minor_mgr->add_pool(eden);
93 _minor_mgr->add_pool(survivor);
94
95 _major_mgr->add_pool(eden);
96 _major_mgr->add_pool(survivor);
97 _major_mgr->add_pool(old);
98
99 return mem_pools;
100 }
|