1089N/A/*
2386N/A * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
1089N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1089N/A *
1089N/A * This code is free software; you can redistribute it and/or modify it
1089N/A * under the terms of the GNU General Public License version 2 only, as
1089N/A * published by the Free Software Foundation.
1089N/A *
1089N/A * This code is distributed in the hope that it will be useful, but WITHOUT
1089N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1089N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1089N/A * version 2 for more details (a copy is included in the LICENSE file that
1089N/A * accompanied this code).
1089N/A *
1089N/A * You should have received a copy of the GNU General Public License version
1089N/A * 2 along with this work; if not, write to the Free Software Foundation,
1089N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1089N/A *
1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1472N/A * or visit www.oracle.com if you need additional information or have any
1472N/A * questions.
1089N/A *
1089N/A */
1089N/A
1879N/A#include "precompiled.hpp"
1879N/A#include "gc_implementation/g1/g1CollectedHeap.hpp"
1879N/A#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
1879N/A#include "gc_implementation/g1/g1CollectorPolicy.hpp"
1879N/A#include "gc_implementation/g1/heapRegion.hpp"
1879N/A#include "services/g1MemoryPool.hpp"
1089N/A
1089N/AG1MemoryPoolSuper::G1MemoryPoolSuper(G1CollectedHeap* g1h,
1089N/A const char* name,
1089N/A size_t init_size,
2816N/A size_t max_size,
1089N/A bool support_usage_threshold) :
2816N/A _g1mm(g1h->g1mm()), CollectedMemoryPool(name,
2816N/A MemoryPool::Heap,
2816N/A init_size,
2816N/A max_size,
2816N/A support_usage_threshold) {
1089N/A assert(UseG1GC, "sanity");
1089N/A}
1089N/A
1089N/AG1EdenPool::G1EdenPool(G1CollectedHeap* g1h) :
1089N/A G1MemoryPoolSuper(g1h,
2810N/A "G1 Eden Space",
2816N/A g1h->g1mm()->eden_space_committed(), /* init_size */
2816N/A _undefined_max,
1674N/A false /* support_usage_threshold */) { }
1089N/A
1089N/AMemoryUsage G1EdenPool::get_memory_usage() {
1092N/A size_t initial_sz = initial_size();
1092N/A size_t max_sz = max_size();
1092N/A size_t used = used_in_bytes();
2816N/A size_t committed = _g1mm->eden_space_committed();
1089N/A
1092N/A return MemoryUsage(initial_sz, used, committed, max_sz);
1089N/A}
1089N/A
1089N/AG1SurvivorPool::G1SurvivorPool(G1CollectedHeap* g1h) :
1089N/A G1MemoryPoolSuper(g1h,
2810N/A "G1 Survivor Space",
2816N/A g1h->g1mm()->survivor_space_committed(), /* init_size */
2816N/A _undefined_max,
1674N/A false /* support_usage_threshold */) { }
1089N/A
1089N/AMemoryUsage G1SurvivorPool::get_memory_usage() {
1092N/A size_t initial_sz = initial_size();
1092N/A size_t max_sz = max_size();
1092N/A size_t used = used_in_bytes();
2816N/A size_t committed = _g1mm->survivor_space_committed();
1089N/A
1092N/A return MemoryUsage(initial_sz, used, committed, max_sz);
1089N/A}
1089N/A
1089N/AG1OldGenPool::G1OldGenPool(G1CollectedHeap* g1h) :
1089N/A G1MemoryPoolSuper(g1h,
1089N/A "G1 Old Gen",
2816N/A g1h->g1mm()->old_space_committed(), /* init_size */
3118N/A g1h->g1mm()->old_gen_max(),
1674N/A true /* support_usage_threshold */) { }
1089N/A
1089N/AMemoryUsage G1OldGenPool::get_memory_usage() {
1092N/A size_t initial_sz = initial_size();
1092N/A size_t max_sz = max_size();
1092N/A size_t used = used_in_bytes();
2816N/A size_t committed = _g1mm->old_space_committed();
1089N/A
1092N/A return MemoryUsage(initial_sz, used, committed, max_sz);
1089N/A}