annotate src/share/vm/memory/generationSpec.hpp @ 948:89e0543e1737

6884624: Update copyright year Summary: Update copyright for files that have been modified in 2009 through Septermber Reviewed-by: tbell, ohair
author xdono
date Tue, 22 Sep 2009 14:06:10 -0700
parents a61af66fc99e
children c18cbe5936b8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
2 * Copyright 2001-2004 Sun Microsystems, Inc. All Rights Reserved.
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
a61af66fc99e Initial load
duke
parents:
diff changeset
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
a61af66fc99e Initial load
duke
parents:
diff changeset
20 * CA 95054 USA or visit www.sun.com if you need additional information or
a61af66fc99e Initial load
duke
parents:
diff changeset
21 * have any questions.
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 // The specification of a generation. This class also encapsulates
a61af66fc99e Initial load
duke
parents:
diff changeset
26 // some generation-specific behavior. This is done here rather than as a
a61af66fc99e Initial load
duke
parents:
diff changeset
27 // virtual function of Generation because these methods are needed in
a61af66fc99e Initial load
duke
parents:
diff changeset
28 // initialization of the Generations.
a61af66fc99e Initial load
duke
parents:
diff changeset
29 class GenerationSpec : public CHeapObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
30 friend class VMStructs;
a61af66fc99e Initial load
duke
parents:
diff changeset
31 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
32 Generation::Name _name;
a61af66fc99e Initial load
duke
parents:
diff changeset
33 size_t _init_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
34 size_t _max_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
35
a61af66fc99e Initial load
duke
parents:
diff changeset
36 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
37 GenerationSpec(Generation::Name name, size_t init_size, size_t max_size) {
a61af66fc99e Initial load
duke
parents:
diff changeset
38 _name = name;
a61af66fc99e Initial load
duke
parents:
diff changeset
39 _init_size = init_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
40 _max_size = max_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
41 }
a61af66fc99e Initial load
duke
parents:
diff changeset
42
a61af66fc99e Initial load
duke
parents:
diff changeset
43 Generation* init(ReservedSpace rs, int level, GenRemSet* remset);
a61af66fc99e Initial load
duke
parents:
diff changeset
44
a61af66fc99e Initial load
duke
parents:
diff changeset
45 // Accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
46 Generation::Name name() const { return _name; }
a61af66fc99e Initial load
duke
parents:
diff changeset
47 size_t init_size() const { return _init_size; }
a61af66fc99e Initial load
duke
parents:
diff changeset
48 void set_init_size(size_t size) { _init_size = size; }
a61af66fc99e Initial load
duke
parents:
diff changeset
49 size_t max_size() const { return _max_size; }
a61af66fc99e Initial load
duke
parents:
diff changeset
50 void set_max_size(size_t size) { _max_size = size; }
a61af66fc99e Initial load
duke
parents:
diff changeset
51
a61af66fc99e Initial load
duke
parents:
diff changeset
52 // Alignment
a61af66fc99e Initial load
duke
parents:
diff changeset
53 void align(size_t alignment) {
a61af66fc99e Initial load
duke
parents:
diff changeset
54 set_init_size(align_size_up(init_size(), alignment));
a61af66fc99e Initial load
duke
parents:
diff changeset
55 set_max_size(align_size_up(max_size(), alignment));
a61af66fc99e Initial load
duke
parents:
diff changeset
56 }
a61af66fc99e Initial load
duke
parents:
diff changeset
57
a61af66fc99e Initial load
duke
parents:
diff changeset
58 // Return the number of regions contained in the generation which
a61af66fc99e Initial load
duke
parents:
diff changeset
59 // might need to be independently covered by a remembered set.
a61af66fc99e Initial load
duke
parents:
diff changeset
60 virtual int n_covered_regions() const { return 1; }
a61af66fc99e Initial load
duke
parents:
diff changeset
61 };
a61af66fc99e Initial load
duke
parents:
diff changeset
62
a61af66fc99e Initial load
duke
parents:
diff changeset
63 typedef GenerationSpec* GenerationSpecPtr;
a61af66fc99e Initial load
duke
parents:
diff changeset
64
a61af66fc99e Initial load
duke
parents:
diff changeset
65 // The specification of a permanent generation. This class is very
a61af66fc99e Initial load
duke
parents:
diff changeset
66 // similar to GenerationSpec in use. Due to PermGen's not being a
a61af66fc99e Initial load
duke
parents:
diff changeset
67 // true Generation, we cannot combine the spec classes either.
a61af66fc99e Initial load
duke
parents:
diff changeset
68 class PermanentGenerationSpec : public CHeapObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
69 friend class VMStructs;
a61af66fc99e Initial load
duke
parents:
diff changeset
70 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
71 PermGen::Name _name;
a61af66fc99e Initial load
duke
parents:
diff changeset
72 size_t _init_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
73 size_t _max_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
74 size_t _read_only_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
75 size_t _read_write_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
76 size_t _misc_data_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
77 size_t _misc_code_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
78 bool _enable_shared_spaces;
a61af66fc99e Initial load
duke
parents:
diff changeset
79
a61af66fc99e Initial load
duke
parents:
diff changeset
80 enum {
a61af66fc99e Initial load
duke
parents:
diff changeset
81 _n_spaces = 2
a61af66fc99e Initial load
duke
parents:
diff changeset
82 };
a61af66fc99e Initial load
duke
parents:
diff changeset
83
a61af66fc99e Initial load
duke
parents:
diff changeset
84 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
85 PermanentGenerationSpec(PermGen::Name name, size_t init_size,
a61af66fc99e Initial load
duke
parents:
diff changeset
86 size_t max_size, size_t read_only_size,
a61af66fc99e Initial load
duke
parents:
diff changeset
87 size_t read_write_size, size_t misc_data_size,
a61af66fc99e Initial load
duke
parents:
diff changeset
88 size_t misc_code_size);
a61af66fc99e Initial load
duke
parents:
diff changeset
89
a61af66fc99e Initial load
duke
parents:
diff changeset
90 PermGen* init(ReservedSpace rs, size_t init_size, GenRemSet* remset);
a61af66fc99e Initial load
duke
parents:
diff changeset
91
a61af66fc99e Initial load
duke
parents:
diff changeset
92 void disable_sharing() {
a61af66fc99e Initial load
duke
parents:
diff changeset
93 _enable_shared_spaces = false;
a61af66fc99e Initial load
duke
parents:
diff changeset
94 _read_only_size = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
95 _read_write_size = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
96 _misc_data_size = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
97 _misc_code_size = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
98 }
a61af66fc99e Initial load
duke
parents:
diff changeset
99
a61af66fc99e Initial load
duke
parents:
diff changeset
100 // Accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
101 PermGen::Name name() const { return _name; }
a61af66fc99e Initial load
duke
parents:
diff changeset
102 size_t init_size() const { return _init_size; }
a61af66fc99e Initial load
duke
parents:
diff changeset
103 void set_init_size(size_t size) { _init_size = size; }
a61af66fc99e Initial load
duke
parents:
diff changeset
104
a61af66fc99e Initial load
duke
parents:
diff changeset
105 // Max size for user DOES NOT include shared spaces.
a61af66fc99e Initial load
duke
parents:
diff changeset
106 // Max size for space allocation DOES include shared spaces.
a61af66fc99e Initial load
duke
parents:
diff changeset
107 size_t max_size() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
108 return _max_size + _read_only_size + _read_write_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
109 }
a61af66fc99e Initial load
duke
parents:
diff changeset
110
a61af66fc99e Initial load
duke
parents:
diff changeset
111 // Need one covered region for the main space, and one for the shared
a61af66fc99e Initial load
duke
parents:
diff changeset
112 // spaces (together).
a61af66fc99e Initial load
duke
parents:
diff changeset
113 int n_covered_regions() const { return 2; }
a61af66fc99e Initial load
duke
parents:
diff changeset
114
a61af66fc99e Initial load
duke
parents:
diff changeset
115 void align(size_t alignment);
a61af66fc99e Initial load
duke
parents:
diff changeset
116
a61af66fc99e Initial load
duke
parents:
diff changeset
117 size_t read_only_size() const { return _read_only_size; }
a61af66fc99e Initial load
duke
parents:
diff changeset
118 size_t read_write_size() const { return _read_write_size; }
a61af66fc99e Initial load
duke
parents:
diff changeset
119 size_t misc_data_size() const { return _misc_data_size; }
a61af66fc99e Initial load
duke
parents:
diff changeset
120 size_t misc_code_size() const { return _misc_code_size; }
a61af66fc99e Initial load
duke
parents:
diff changeset
121 bool enable_shared_spaces() const { return _enable_shared_spaces; }
a61af66fc99e Initial load
duke
parents:
diff changeset
122 };