1 /*
 2  * Copyright (c) 2013, 2019, Red Hat, Inc. All rights reserved.
 3  * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
 4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 5  *
 6  * This code is free software; you can redistribute it and/or modify it
 7  * under the terms of the GNU General Public License version 2 only, as
 8  * published by the Free Software Foundation.
 9  *
10  * This code is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
13  * version 2 for more details (a copy is included in the LICENSE file that
14  * accompanied this code).
15  *
16  * You should have received a copy of the GNU General Public License version
17  * 2 along with this work; if not, write to the Free Software Foundation,
18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19  *
20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21  * or visit www.oracle.com if you need additional information or have any
22  * questions.
23  *
24  */
25 
26 #ifndef SHARE_GC_SHENANDOAH_SHENANDOAHMEMORYPOOL_HPP
27 #define SHARE_GC_SHENANDOAH_SHENANDOAHMEMORYPOOL_HPP
28 
29 #ifndef SERIALGC
30 #include "gc/shenandoah/shenandoahHeap.hpp"
31 #include "services/memoryPool.hpp"
32 #include "services/memoryUsage.hpp"
33 #endif
34 
35 class ShenandoahMemoryPool : public CollectedMemoryPool {
36 protected:
37    ShenandoahHeap* _heap;
38 
39 public:
40   ShenandoahMemoryPool(ShenandoahHeap* pool,
41                        const char* name = "Shenandoah");
42   virtual MemoryUsage get_memory_usage();
43   virtual size_t used_in_bytes();
44   virtual size_t max_size() const;
45 
46 protected:
47   ShenandoahMemoryPool(ShenandoahHeap* pool,
48                        const char* name,
49                        size_t initial_capacity,
50                        size_t max_capacity);
51 };
52 
53 class ShenandoahYoungGenMemoryPool : public ShenandoahMemoryPool {
54 public:
55   ShenandoahYoungGenMemoryPool(ShenandoahHeap* pool);
56   MemoryUsage get_memory_usage() override;
57   size_t used_in_bytes() override;
58   size_t max_size() const override;
59 };
60 
61 class ShenandoahOldGenMemoryPool : public ShenandoahMemoryPool {
62 public:
63   ShenandoahOldGenMemoryPool(ShenandoahHeap* pool);
64   MemoryUsage get_memory_usage() override;
65   size_t used_in_bytes() override;
66   size_t max_size() const override;
67 };
68 
69 #endif // SHARE_GC_SHENANDOAH_SHENANDOAHMEMORYPOOL_HPP