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 };
47
48 class MSCMemoryManager : public GCMemoryManager {
49 private:
50 public:
51 MSCMemoryManager() : GCMemoryManager() {}
52
53 const char* name() { return "MarkSweepCompact"; }
54 };
55
56 GrowableArray<GCMemoryManager*> SerialHeap::memory_managers() {
57 _minor_mgr = new CopyMemoryManager();
58 _major_mgr = new MSCMemoryManager();
59 GrowableArray<GCMemoryManager*> mem_mgrs;
60 mem_mgrs.append(_minor_mgr);
61 mem_mgrs.append(_major_mgr);
62 return mem_mgrs;
63 }
64
65 GrowableArray<MemoryPool*> SerialHeap::memory_pools() {
66 DefNewGeneration* young = (DefNewGeneration*) young_gen();
67
68 // Add a memory pool for each space and young gen doesn't
69 // support low memory detection as it is expected to get filled up.
70 MemoryPool* eden = new ContiguousSpacePool(young->eden(),
71 "Eden Space",
72 MemoryPool::Heap,
73 young->max_eden_size(),
74 false /* support_usage_threshold */);
75 MemoryPool* survivor = new SurvivorContiguousSpacePool(young,
76 "Survivor Space",
77 MemoryPool::Heap,
78 young->max_survivor_size(),
79 false /* support_usage_threshold */);
80 GenerationPool* old = new GenerationPool(old_gen(), "Tenured Gen", MemoryPool::Heap, true);
81
82 GrowableArray<MemoryPool*> mem_pools;
83 mem_pools.append(eden);
84 mem_pools.append(survivor);
85 mem_pools.append(old);
86
87 _minor_mgr->add_pool(eden);
88 _minor_mgr->add_pool(survivor);
89
90 _major_mgr->add_pool(eden);
91 _major_mgr->add_pool(survivor);
92 _major_mgr->add_pool(old);
93
94 return mem_pools;
95 }
|