Print this page
rev 6864 : 8061651: Interface to the Lookup Index Cache to improve URLClassPath search time
Summary: Implemented the interface in sun.misc.URLClassPath and corresponding JVM_XXX APIs
Reviewed-by: mchung, acorn, jiangli, dholmes
Split |
Split |
Close |
Expand all |
Collapse all |
--- old/src/share/vm/memory/metaspaceShared.hpp
+++ new/src/share/vm/memory/metaspaceShared.hpp
1 1 /*
2 2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 4 *
5 5 * This code is free software; you can redistribute it and/or modify it
6 6 * under the terms of the GNU General Public License version 2 only, as
7 7 * published by the Free Software Foundation.
8 8 *
9 9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 12 * version 2 for more details (a copy is included in the LICENSE file that
13 13 * accompanied this code).
14 14 *
15 15 * You should have received a copy of the GNU General Public License version
16 16 * 2 along with this work; if not, write to the Free Software Foundation,
17 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 18 *
19 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 20 * or visit www.oracle.com if you need additional information or have any
21 21 * questions.
22 22 *
23 23 */
24 24 #ifndef SHARE_VM_MEMORY_METASPACE_SHARED_HPP
↓ open down ↓ |
24 lines elided |
↑ open up ↑ |
25 25 #define SHARE_VM_MEMORY_METASPACE_SHARED_HPP
26 26
27 27 #include "memory/allocation.hpp"
28 28 #include "memory/memRegion.hpp"
29 29 #include "runtime/virtualspace.hpp"
30 30 #include "utilities/exceptions.hpp"
31 31 #include "utilities/macros.hpp"
32 32
33 33 #define LargeSharedArchiveSize (300*M)
34 34 #define HugeSharedArchiveSize (800*M)
35 -#define ReadOnlyRegionPercentage 0.4
36 -#define ReadWriteRegionPercentage 0.55
37 -#define MiscDataRegionPercentage 0.03
35 +#define ReadOnlyRegionPercentage 0.39
36 +#define ReadWriteRegionPercentage 0.50
37 +#define MiscDataRegionPercentage 0.09
38 38 #define MiscCodeRegionPercentage 0.02
39 39 #define LargeThresholdClassCount 5000
40 40 #define HugeThresholdClassCount 40000
41 41
42 42 #define SET_ESTIMATED_SIZE(type, region) \
43 43 Shared ##region## Size = FLAG_IS_DEFAULT(Shared ##region## Size) ? \
44 44 (uintx)(type ## SharedArchiveSize * region ## RegionPercentage) : Shared ## region ## Size
45 45
46 46 class FileMapInfo;
47 47
48 48 // Class Data Sharing Support
49 49 class MetaspaceShared : AllStatic {
50 50
51 51 // CDS support
52 52 static ReservedSpace* _shared_rs;
53 53 static int _max_alignment;
54 54 static bool _link_classes_made_progress;
55 55 static bool _check_classes_made_progress;
56 56 static bool _has_error_classes;
57 57 static bool _archive_loading_failed;
58 58 public:
59 59 enum {
60 60 vtbl_list_size = 17, // number of entries in the shared space vtable list.
61 61 num_virtuals = 200, // maximum number of virtual functions
62 62 // If virtual functions are added to Metadata,
63 63 // this number needs to be increased. Also,
64 64 // SharedMiscCodeSize will need to be increased.
65 65 // The following 2 sizes were based on
66 66 // MetaspaceShared::generate_vtable_methods()
67 67 vtbl_method_size = 16, // conservative size of the mov1 and jmp instructions
68 68 // for the x64 platform
69 69 vtbl_common_code_size = (1*K) // conservative size of the "common_code" for the x64 platform
70 70 };
71 71
72 72 enum {
73 73 ro = 0, // read-only shared space in the heap
74 74 rw = 1, // read-write shared space in the heap
75 75 md = 2, // miscellaneous data for initializing tables, etc.
76 76 mc = 3, // miscellaneous code - vtable replacement.
77 77 n_regions = 4
78 78 };
79 79
80 80 // Accessor functions to save shared space created for metadata, which has
81 81 // extra space allocated at the end for miscellaneous data and code.
82 82 static void set_max_alignment(int alignment) {
83 83 CDS_ONLY(_max_alignment = alignment);
84 84 }
85 85
86 86 static int max_alignment() {
87 87 CDS_ONLY(return _max_alignment);
88 88 NOT_CDS(return 0);
89 89 }
90 90
91 91 static void prepare_for_dumping() NOT_CDS_RETURN;
92 92 static void preload_and_dump(TRAPS) NOT_CDS_RETURN;
93 93 static int preload_and_dump(const char * class_list_path,
94 94 GrowableArray<Klass*>* class_promote_order,
95 95 TRAPS) NOT_CDS_RETURN;
96 96
97 97 static ReservedSpace* shared_rs() {
98 98 CDS_ONLY(return _shared_rs);
99 99 NOT_CDS(return NULL);
100 100 }
101 101
102 102 static void set_shared_rs(ReservedSpace* rs) {
103 103 CDS_ONLY(_shared_rs = rs;)
104 104 }
105 105
106 106 static void set_archive_loading_failed() {
107 107 _archive_loading_failed = true;
108 108 }
109 109 static bool map_shared_spaces(FileMapInfo* mapinfo) NOT_CDS_RETURN_(false);
110 110 static void initialize_shared_spaces() NOT_CDS_RETURN;
111 111
112 112 // Return true if given address is in the mapped shared space.
113 113 static bool is_in_shared_space(const void* p) NOT_CDS_RETURN_(false);
114 114
115 115 static void generate_vtable_methods(void** vtbl_list,
116 116 void** vtable,
117 117 char** md_top, char* md_end,
118 118 char** mc_top, char* mc_end);
119 119 static void serialize(SerializeClosure* sc);
120 120
121 121 // JVM/TI RedefineClasses() support:
122 122 // Remap the shared readonly space to shared readwrite, private if
123 123 // sharing is enabled. Simply returns true if sharing is not enabled
124 124 // or if the remapping has already been done by a prior call.
125 125 static bool remap_shared_readonly_as_readwrite() NOT_CDS_RETURN_(true);
126 126
127 127 static void print_shared_spaces();
128 128
129 129 static bool try_link_class(InstanceKlass* ik, TRAPS);
130 130 static void link_one_shared_class(Klass* obj, TRAPS);
131 131 static void check_one_shared_class(Klass* obj);
132 132 static void link_and_cleanup_shared_classes(TRAPS);
133 133
134 134 static int count_class(const char* classlist_file);
135 135 static void estimate_regions_size() NOT_CDS_RETURN;
136 136 };
137 137 #endif // SHARE_VM_MEMORY_METASPACE_SHARED_HPP
↓ open down ↓ |
90 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX