hotspot/src/share/vm/services/g1MemoryPool.hpp
author ikrylov
Wed, 01 Dec 2010 18:26:32 -0500
changeset 7405 e6fc8d3926f8
parent 7397 5b173b4ca846
child 9338 05ee447bd420
permissions -rw-r--r--
6348631: remove the use of the HPI library from Hotspot Summary: move functions from hpi library to hotspot, communicate with licensees and open source community, check jdk for dependency, file CCC request Reviewed-by: coleenp, acorn, dsamersoff
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4459
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
     1
/*
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6424
diff changeset
     2
 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
4459
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
     4
 *
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
     7
 * published by the Free Software Foundation.
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
     8
 *
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    13
 * accompanied this code).
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    14
 *
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4463
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4463
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4463
diff changeset
    21
 * questions.
4459
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    22
 *
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    23
 */
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6424
diff changeset
    25
#ifndef SHARE_VM_SERVICES_G1MEMORYPOOL_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6424
diff changeset
    26
#define SHARE_VM_SERVICES_G1MEMORYPOOL_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6424
diff changeset
    27
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6424
diff changeset
    28
#ifndef SERIALGC
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6424
diff changeset
    29
#include "services/memoryPool.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6424
diff changeset
    30
#include "services/memoryUsage.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6424
diff changeset
    31
#endif
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6424
diff changeset
    32
4459
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    33
class G1CollectedHeap;
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    34
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    35
// This file contains the three classes that represent the memory
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    36
// pools of the G1 spaces: G1EdenPool, G1SurvivorPool, and
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    37
// G1OldGenPool. In G1, unlike our other GCs, we do not have a
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    38
// physical space for each of those spaces. Instead, we allocate
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    39
// regions for all three spaces out of a single pool of regions (that
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    40
// pool basically covers the entire heap). As a result, the eden,
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    41
// survivor, and old gen are considered logical spaces in G1, as each
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    42
// is a set of non-contiguous regions. This is also reflected in the
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    43
// way we map them to memory pools here. The easiest way to have done
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    44
// this would have been to map the entire G1 heap to a single memory
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    45
// pool. However, it's helpful to show how large the eden and survivor
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    46
// get, as this does affect the performance and behavior of G1. Which
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    47
// is why we introduce the three memory pools implemented here.
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    48
//
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    49
// The above approach inroduces a couple of challenging issues in the
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    50
// implementation of the three memory pools:
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    51
//
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    52
// 1) The used space calculation for a pool is not necessarily
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    53
// independent of the others. We can easily get from G1 the overall
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    54
// used space in the entire heap, the number of regions in the young
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    55
// generation (includes both eden and survivors), and the number of
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    56
// survivor regions. So, from that we calculate:
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    57
//
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    58
//  survivor_used = survivor_num * region_size
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    59
//  eden_used     = young_region_num * region_size - survivor_used
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    60
//  old_gen_used  = overall_used - eden_used - survivor_used
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    61
//
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    62
// Note that survivor_used and eden_used are upper bounds. To get the
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    63
// actual value we would have to iterate over the regions and add up
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    64
// ->used(). But that'd be expensive. So, we'll accept some lack of
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    65
// accuracy for those two. But, we have to be careful when calculating
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    66
// old_gen_used, in case we subtract from overall_used more then the
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    67
// actual number and our result goes negative.
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    68
//
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    69
// 2) Calculating the used space is straightforward, as described
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    70
// above. However, how do we calculate the committed space, given that
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    71
// we allocate space for the eden, survivor, and old gen out of the
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    72
// same pool of regions? One way to do this is to use the used value
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    73
// as also the committed value for the eden and survivor spaces and
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    74
// then calculate the old gen committed space as follows:
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    75
//
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    76
//  old_gen_committed = overall_committed - eden_committed - survivor_committed
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    77
//
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    78
// Maybe a better way to do that would be to calculate used for eden
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    79
// and survivor as a sum of ->used() over their regions and then
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    80
// calculate committed as region_num * region_size (i.e., what we use
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    81
// to calculate the used space now). This is something to consider
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    82
// in the future.
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    83
//
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    84
// 3) Another decision that is again not straightforward is what is
6424
9ab433735f7c 6941275: G1: The MemoryPools are incorrectly supported for G1
tonyp
parents: 5547
diff changeset
    85
// the max size that each memory pool can grow to. One way to do this
9ab433735f7c 6941275: G1: The MemoryPools are incorrectly supported for G1
tonyp
parents: 5547
diff changeset
    86
// would be to use the committed size for the max for the eden and
9ab433735f7c 6941275: G1: The MemoryPools are incorrectly supported for G1
tonyp
parents: 5547
diff changeset
    87
// survivors and calculate the old gen max as follows (basically, it's
9ab433735f7c 6941275: G1: The MemoryPools are incorrectly supported for G1
tonyp
parents: 5547
diff changeset
    88
// a similar pattern to what we use for the committed space, as
9ab433735f7c 6941275: G1: The MemoryPools are incorrectly supported for G1
tonyp
parents: 5547
diff changeset
    89
// described above):
4459
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    90
//
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    91
//  old_gen_max = overall_max - eden_max - survivor_max
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    92
//
6424
9ab433735f7c 6941275: G1: The MemoryPools are incorrectly supported for G1
tonyp
parents: 5547
diff changeset
    93
// Unfortunately, the above makes the max of each pool fluctuate over
9ab433735f7c 6941275: G1: The MemoryPools are incorrectly supported for G1
tonyp
parents: 5547
diff changeset
    94
// time and, even though this is allowed according to the spec, it
9ab433735f7c 6941275: G1: The MemoryPools are incorrectly supported for G1
tonyp
parents: 5547
diff changeset
    95
// broke several assumptions in the M&M framework (there were cases
9ab433735f7c 6941275: G1: The MemoryPools are incorrectly supported for G1
tonyp
parents: 5547
diff changeset
    96
// where used would reach a value greater than max). So, for max we
9ab433735f7c 6941275: G1: The MemoryPools are incorrectly supported for G1
tonyp
parents: 5547
diff changeset
    97
// use -1, which means "undefined" according to the spec.
9ab433735f7c 6941275: G1: The MemoryPools are incorrectly supported for G1
tonyp
parents: 5547
diff changeset
    98
//
4459
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    99
// 4) Now, there is a very subtle issue with all the above. The
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   100
// framework will call get_memory_usage() on the three pools
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   101
// asynchronously. As a result, each call might get a different value
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   102
// for, say, survivor_num which will yield inconsistent values for
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   103
// eden_used, survivor_used, and old_gen_used (as survivor_num is used
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   104
// in the calculation of all three). This would normally be
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   105
// ok. However, it's possible that this might cause the sum of
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   106
// eden_used, survivor_used, and old_gen_used to go over the max heap
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   107
// size and this seems to sometimes cause JConsole (and maybe other
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   108
// clients) to get confused. There's not a really an easy / clean
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   109
// solution to this problem, due to the asynchrounous nature of the
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   110
// framework.
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   111
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   112
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   113
// This class is shared by the three G1 memory pool classes
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   114
// (G1EdenPool, G1SurvivorPool, G1OldGenPool). Given that the way we
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   115
// calculate used / committed bytes for these three pools is related
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   116
// (see comment above), we put the calculations in this class so that
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   117
// we can easily share them among the subclasses.
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   118
class G1MemoryPoolSuper : public CollectedMemoryPool {
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   119
private:
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   120
  // It returns x - y if x > y, 0 otherwise.
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   121
  // As described in the comment above, some of the inputs to the
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   122
  // calculations we have to do are obtained concurrently and hence
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   123
  // may be inconsistent with each other. So, this provides a
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   124
  // defensive way of performing the subtraction and avoids the value
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   125
  // going negative (which would mean a very large result, given that
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   126
  // the parameter are size_t).
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   127
  static size_t subtract_up_to_zero(size_t x, size_t y) {
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   128
    if (x > y) {
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   129
      return x - y;
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   130
    } else {
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   131
      return 0;
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   132
    }
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   133
  }
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   134
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   135
protected:
4463
699f80df7faa 6906565: G1: deal with compilation warning in g1MemoryPool.hpp
tonyp
parents: 4462
diff changeset
   136
  G1CollectedHeap* _g1h;
699f80df7faa 6906565: G1: deal with compilation warning in g1MemoryPool.hpp
tonyp
parents: 4462
diff changeset
   137
4459
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   138
  // Would only be called from subclasses.
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   139
  G1MemoryPoolSuper(G1CollectedHeap* g1h,
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   140
                    const char* name,
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   141
                    size_t init_size,
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   142
                    bool support_usage_threshold);
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   143
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   144
  // The reason why all the code is in static methods is so that it
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   145
  // can be safely called from the constructors of the subclasses.
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   146
6424
9ab433735f7c 6941275: G1: The MemoryPools are incorrectly supported for G1
tonyp
parents: 5547
diff changeset
   147
  static size_t undefined_max() {
9ab433735f7c 6941275: G1: The MemoryPools are incorrectly supported for G1
tonyp
parents: 5547
diff changeset
   148
    return (size_t) -1;
9ab433735f7c 6941275: G1: The MemoryPools are incorrectly supported for G1
tonyp
parents: 5547
diff changeset
   149
  }
9ab433735f7c 6941275: G1: The MemoryPools are incorrectly supported for G1
tonyp
parents: 5547
diff changeset
   150
4459
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   151
  static size_t overall_committed(G1CollectedHeap* g1h) {
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   152
    return g1h->capacity();
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   153
  }
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   154
  static size_t overall_used(G1CollectedHeap* g1h) {
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   155
    return g1h->used_unlocked();
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   156
  }
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   157
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   158
  static size_t eden_space_committed(G1CollectedHeap* g1h);
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   159
  static size_t eden_space_used(G1CollectedHeap* g1h);
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   160
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   161
  static size_t survivor_space_committed(G1CollectedHeap* g1h);
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   162
  static size_t survivor_space_used(G1CollectedHeap* g1h);
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   163
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   164
  static size_t old_space_committed(G1CollectedHeap* g1h);
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   165
  static size_t old_space_used(G1CollectedHeap* g1h);
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   166
};
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   167
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   168
// Memory pool that represents the G1 eden.
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   169
class G1EdenPool : public G1MemoryPoolSuper {
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   170
public:
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   171
  G1EdenPool(G1CollectedHeap* g1h);
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   172
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   173
  size_t used_in_bytes() {
4463
699f80df7faa 6906565: G1: deal with compilation warning in g1MemoryPool.hpp
tonyp
parents: 4462
diff changeset
   174
    return eden_space_used(_g1h);
4459
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   175
  }
4463
699f80df7faa 6906565: G1: deal with compilation warning in g1MemoryPool.hpp
tonyp
parents: 4462
diff changeset
   176
  size_t max_size() const {
6424
9ab433735f7c 6941275: G1: The MemoryPools are incorrectly supported for G1
tonyp
parents: 5547
diff changeset
   177
    return undefined_max();
4459
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   178
  }
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   179
  MemoryUsage get_memory_usage();
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   180
};
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   181
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   182
// Memory pool that represents the G1 survivor.
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   183
class G1SurvivorPool : public G1MemoryPoolSuper {
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   184
public:
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   185
  G1SurvivorPool(G1CollectedHeap* g1h);
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   186
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   187
  size_t used_in_bytes() {
4463
699f80df7faa 6906565: G1: deal with compilation warning in g1MemoryPool.hpp
tonyp
parents: 4462
diff changeset
   188
    return survivor_space_used(_g1h);
4459
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   189
  }
4463
699f80df7faa 6906565: G1: deal with compilation warning in g1MemoryPool.hpp
tonyp
parents: 4462
diff changeset
   190
  size_t max_size() const {
6424
9ab433735f7c 6941275: G1: The MemoryPools are incorrectly supported for G1
tonyp
parents: 5547
diff changeset
   191
    return undefined_max();
4459
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   192
  }
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   193
  MemoryUsage get_memory_usage();
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   194
};
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   195
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   196
// Memory pool that represents the G1 old gen.
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   197
class G1OldGenPool : public G1MemoryPoolSuper {
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   198
public:
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   199
  G1OldGenPool(G1CollectedHeap* g1h);
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   200
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   201
  size_t used_in_bytes() {
4463
699f80df7faa 6906565: G1: deal with compilation warning in g1MemoryPool.hpp
tonyp
parents: 4462
diff changeset
   202
    return old_space_used(_g1h);
4459
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   203
  }
4463
699f80df7faa 6906565: G1: deal with compilation warning in g1MemoryPool.hpp
tonyp
parents: 4462
diff changeset
   204
  size_t max_size() const {
6424
9ab433735f7c 6941275: G1: The MemoryPools are incorrectly supported for G1
tonyp
parents: 5547
diff changeset
   205
    return undefined_max();
4459
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   206
  }
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   207
  MemoryUsage get_memory_usage();
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   208
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6424
diff changeset
   209
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6424
diff changeset
   210
#endif // SHARE_VM_SERVICES_G1MEMORYPOOL_HPP