comparison src/share/vm/memory/generationSpec.hpp @ 6725:da91efe96a93

6964458: Reimplement class meta-data storage to use native memory Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author coleenp
date Sat, 01 Sep 2012 13:25:18 -0400
parents d2a62e0f25eb
children
comparison
equal deleted inserted replaced
6724:36d1d483d5d6 6725:da91efe96a93
1 /* 1 /*
2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
24 24
25 #ifndef SHARE_VM_MEMORY_GENERATIONSPEC_HPP 25 #ifndef SHARE_VM_MEMORY_GENERATIONSPEC_HPP
26 #define SHARE_VM_MEMORY_GENERATIONSPEC_HPP 26 #define SHARE_VM_MEMORY_GENERATIONSPEC_HPP
27 27
28 #include "memory/generation.hpp" 28 #include "memory/generation.hpp"
29 #include "memory/permGen.hpp"
30 29
31 // The specification of a generation. This class also encapsulates 30 // The specification of a generation. This class also encapsulates
32 // some generation-specific behavior. This is done here rather than as a 31 // some generation-specific behavior. This is done here rather than as a
33 // virtual function of Generation because these methods are needed in 32 // virtual function of Generation because these methods are needed in
34 // initialization of the Generations. 33 // initialization of the Generations.
66 virtual int n_covered_regions() const { return 1; } 65 virtual int n_covered_regions() const { return 1; }
67 }; 66 };
68 67
69 typedef GenerationSpec* GenerationSpecPtr; 68 typedef GenerationSpec* GenerationSpecPtr;
70 69
71 // The specification of a permanent generation. This class is very
72 // similar to GenerationSpec in use. Due to PermGen's not being a
73 // true Generation, we cannot combine the spec classes either.
74 class PermanentGenerationSpec : public CHeapObj<mtGC> {
75 friend class VMStructs;
76 private:
77 PermGen::Name _name;
78 size_t _init_size;
79 size_t _max_size;
80 size_t _read_only_size;
81 size_t _read_write_size;
82 size_t _misc_data_size;
83 size_t _misc_code_size;
84 bool _enable_shared_spaces;
85
86 enum {
87 _n_spaces = 2
88 };
89
90 public:
91 PermanentGenerationSpec(PermGen::Name name, size_t init_size,
92 size_t max_size, size_t read_only_size,
93 size_t read_write_size, size_t misc_data_size,
94 size_t misc_code_size);
95
96 PermGen* init(ReservedSpace rs, size_t init_size, GenRemSet* remset);
97
98 void disable_sharing() {
99 _enable_shared_spaces = false;
100 _read_only_size = 0;
101 _read_write_size = 0;
102 _misc_data_size = 0;
103 _misc_code_size = 0;
104 }
105
106 // Accessors
107 PermGen::Name name() const { return _name; }
108 size_t init_size() const { return _init_size; }
109 void set_init_size(size_t size) { _init_size = size; }
110
111 // Max size for user DOES NOT include shared spaces.
112 // Max size for space allocation DOES include shared spaces.
113 size_t max_size() const {
114 return _max_size + _read_only_size + _read_write_size;
115 }
116
117 // Need one covered region for the main space, and one for the shared
118 // spaces (together).
119 int n_covered_regions() const { return 2; }
120
121 void align(size_t alignment);
122
123 size_t read_only_size() const { return _read_only_size; }
124 size_t read_write_size() const { return _read_write_size; }
125 size_t misc_data_size() const { return _misc_data_size; }
126 size_t misc_code_size() const { return _misc_code_size; }
127 bool enable_shared_spaces() const { return _enable_shared_spaces; }
128 };
129
130 #endif // SHARE_VM_MEMORY_GENERATIONSPEC_HPP 70 #endif // SHARE_VM_MEMORY_GENERATIONSPEC_HPP