hotspot/src/share/vm/memory/generationSpec.hpp
author kvn
Wed, 29 Dec 2010 10:41:43 -0800
changeset 7715 12998f95a334
parent 7397 5b173b4ca846
child 13195 be27e1b6a4b9
permissions -rw-r--r--
7008325: CodeCache exhausted on sparc starting from hs20b04 Summary: remove clear_scratch_buffer_blob and let init_scratch_buffer_blob free and allocate a new blob if required. Reviewed-by: twisti
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
     2
 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
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: 1
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    25
#ifndef SHARE_VM_MEMORY_GENERATIONSPEC_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#define SHARE_VM_MEMORY_GENERATIONSPEC_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "memory/generation.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
#include "memory/permGen.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
// The specification of a generation.  This class also encapsulates
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
// some generation-specific behavior.  This is done here rather than as a
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
// virtual function of Generation because these methods are needed in
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
// initialization of the Generations.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
class GenerationSpec : public CHeapObj {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
  friend class VMStructs;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
  Generation::Name _name;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
  size_t           _init_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
  size_t           _max_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
  GenerationSpec(Generation::Name name, size_t init_size, size_t max_size) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
    _name = name;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
    _init_size = init_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
    _max_size = max_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
  Generation* init(ReservedSpace rs, int level, GenRemSet* remset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
  // Accessors
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
  Generation::Name name()        const { return _name; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  size_t init_size()             const { return _init_size; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
  void set_init_size(size_t size)      { _init_size = size; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
  size_t max_size()              const { return _max_size; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  void set_max_size(size_t size)       { _max_size = size; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  // Alignment
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  void align(size_t alignment) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
    set_init_size(align_size_up(init_size(), alignment));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
    set_max_size(align_size_up(max_size(), alignment));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  // Return the number of regions contained in the generation which
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  // might need to be independently covered by a remembered set.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  virtual int n_covered_regions() const { return 1; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
typedef GenerationSpec* GenerationSpecPtr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
// The specification of a permanent generation. This class is very
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
// similar to GenerationSpec in use. Due to PermGen's not being a
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
// true Generation, we cannot combine the spec classes either.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
class PermanentGenerationSpec : public CHeapObj {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  friend class VMStructs;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  PermGen::Name    _name;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  size_t           _init_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  size_t           _max_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  size_t           _read_only_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
  size_t           _read_write_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  size_t           _misc_data_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
  size_t           _misc_code_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
  bool             _enable_shared_spaces;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  enum {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
    _n_spaces = 2
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  PermanentGenerationSpec(PermGen::Name name, size_t init_size,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
                          size_t max_size, size_t read_only_size,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
                          size_t read_write_size, size_t misc_data_size,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
                          size_t misc_code_size);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  PermGen* init(ReservedSpace rs, size_t init_size, GenRemSet* remset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
  void disable_sharing() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
    _enable_shared_spaces = false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
    _read_only_size = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
    _read_write_size = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
    _misc_data_size = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
    _misc_code_size = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
  // Accessors
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  PermGen::Name name()           const { return _name; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  size_t init_size()             const { return _init_size; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
  void set_init_size(size_t size)      { _init_size = size; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  // Max size for user DOES NOT include shared spaces.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
  // Max size for space allocation DOES include shared spaces.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  size_t max_size() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
    return _max_size + _read_only_size + _read_write_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
  // Need one covered region for the main space, and one for the shared
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
  // spaces (together).
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
  int n_covered_regions() const { return 2; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
  void align(size_t alignment);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  size_t read_only_size() const { return _read_only_size; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
  size_t read_write_size() const { return _read_write_size; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
  size_t misc_data_size() const { return _misc_data_size; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
  size_t misc_code_size() const { return _misc_code_size; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
  bool enable_shared_spaces()    const { return _enable_shared_spaces; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   129
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   130
#endif // SHARE_VM_MEMORY_GENERATIONSPEC_HPP