13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24 #ifndef SHARE_VM_MEMORY_METASPACE_SHARED_HPP
25 #define SHARE_VM_MEMORY_METASPACE_SHARED_HPP
26
27 #include "memory/allocation.hpp"
28 #include "memory/memRegion.hpp"
29 #include "runtime/virtualspace.hpp"
30 #include "utilities/exceptions.hpp"
31 #include "utilities/macros.hpp"
32
33 class FileMapInfo;
34
35 // Class Data Sharing Support
36 class MetaspaceShared : AllStatic {
37
38 // CDS support
39 static ReservedSpace* _shared_rs;
40 static int _max_alignment;
41 static bool _link_classes_made_progress;
42 static bool _check_classes_made_progress;
43 static bool _has_error_classes;
44 static bool _archive_loading_failed;
45 public:
46 enum {
47 vtbl_list_size = 17, // number of entries in the shared space vtable list.
48 num_virtuals = 200 // maximum number of virtual functions
49 // If virtual functions are added to Metadata,
50 // this number needs to be increased. Also,
51 // SharedMiscCodeSize will need to be increased.
52 };
95 static bool is_in_shared_space(const void* p) NOT_CDS_RETURN_(false);
96
97 static void generate_vtable_methods(void** vtbl_list,
98 void** vtable,
99 char** md_top, char* md_end,
100 char** mc_top, char* mc_end);
101 static void serialize(SerializeClosure* sc);
102
103 // JVM/TI RedefineClasses() support:
104 // Remap the shared readonly space to shared readwrite, private if
105 // sharing is enabled. Simply returns true if sharing is not enabled
106 // or if the remapping has already been done by a prior call.
107 static bool remap_shared_readonly_as_readwrite() NOT_CDS_RETURN_(true);
108
109 static void print_shared_spaces();
110
111 static bool try_link_class(InstanceKlass* ik, TRAPS);
112 static void link_one_shared_class(Klass* obj, TRAPS);
113 static void check_one_shared_class(Klass* obj);
114 static void link_and_cleanup_shared_classes(TRAPS);
115 };
116 #endif // SHARE_VM_MEMORY_METASPACE_SHARED_HPP
|
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24 #ifndef SHARE_VM_MEMORY_METASPACE_SHARED_HPP
25 #define SHARE_VM_MEMORY_METASPACE_SHARED_HPP
26
27 #include "memory/allocation.hpp"
28 #include "memory/memRegion.hpp"
29 #include "runtime/virtualspace.hpp"
30 #include "utilities/exceptions.hpp"
31 #include "utilities/macros.hpp"
32
33 #define LargeSharedArchiveSize (300*M)
34 #define HugeSharedArchiveSize (800*M)
35 #define ReadOnlyRegionPercentage 0.4
36 #define ReadWriteRegionPercentage 0.55
37 #define MiscDataRegionPercentage 0.03
38 #define MiscCodeRegionPercentage 0.02
39 #define LargeThresholdClassCount 5000
40 #define HugeThresholdClassCount 40000
41
42 #define SET_ESTIMATED_SIZE(type, region) \
43 Shared ##region## Size = FLAG_IS_DEFAULT(Shared ##region## Size) ? \
44 (type ## SharedArchiveSize * region ## RegionPercentage) : Shared ## region ## Size
45
46 class FileMapInfo;
47
48 // Class Data Sharing Support
49 class MetaspaceShared : AllStatic {
50
51 // CDS support
52 static ReservedSpace* _shared_rs;
53 static int _max_alignment;
54 static bool _link_classes_made_progress;
55 static bool _check_classes_made_progress;
56 static bool _has_error_classes;
57 static bool _archive_loading_failed;
58 public:
59 enum {
60 vtbl_list_size = 17, // number of entries in the shared space vtable list.
61 num_virtuals = 200 // maximum number of virtual functions
62 // If virtual functions are added to Metadata,
63 // this number needs to be increased. Also,
64 // SharedMiscCodeSize will need to be increased.
65 };
108 static bool is_in_shared_space(const void* p) NOT_CDS_RETURN_(false);
109
110 static void generate_vtable_methods(void** vtbl_list,
111 void** vtable,
112 char** md_top, char* md_end,
113 char** mc_top, char* mc_end);
114 static void serialize(SerializeClosure* sc);
115
116 // JVM/TI RedefineClasses() support:
117 // Remap the shared readonly space to shared readwrite, private if
118 // sharing is enabled. Simply returns true if sharing is not enabled
119 // or if the remapping has already been done by a prior call.
120 static bool remap_shared_readonly_as_readwrite() NOT_CDS_RETURN_(true);
121
122 static void print_shared_spaces();
123
124 static bool try_link_class(InstanceKlass* ik, TRAPS);
125 static void link_one_shared_class(Klass* obj, TRAPS);
126 static void check_one_shared_class(Klass* obj);
127 static void link_and_cleanup_shared_classes(TRAPS);
128
129 static int count_class(const char* classlist_file);
130 static void estimate_regions_size() NOT_CDS_RETURN;
131 };
132 #endif // SHARE_VM_MEMORY_METASPACE_SHARED_HPP
|