author | coleenp |
Wed, 15 Feb 2017 22:59:57 -0500 (2017-02-16) | |
changeset 46271 | 979ebd346ecf |
parent 41182 | dbd59c1da636 |
child 46324 | 8764956ec928 |
permissions | -rw-r--r-- |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
1 |
/* |
37995 | 2 |
* Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
4 |
* |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
8 |
* |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
13 |
* accompanied this code). |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
14 |
* |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
18 |
* |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
21 |
* questions. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
22 |
* |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
23 |
*/ |
30578 | 24 |
|
25 |
#ifndef SHARE_VM_MEMORY_METASPACESHARED_HPP |
|
26 |
#define SHARE_VM_MEMORY_METASPACESHARED_HPP |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
27 |
|
28363
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
28023
diff
changeset
|
28 |
#include "classfile/compactHashtable.hpp" |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
29 |
#include "memory/allocation.hpp" |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
30 |
#include "memory/memRegion.hpp" |
30291
54cdc5c1a9cb
8068352: Move virtualspace.* out of src/share/vm/runtime to memory directory
coleenp
parents:
28363
diff
changeset
|
31 |
#include "memory/virtualspace.hpp" |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
32 |
#include "utilities/exceptions.hpp" |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
33 |
#include "utilities/macros.hpp" |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
34 |
|
34242
e530decd7c63
8138983: Runtime: implement ranges for Shared*** flags
gziemski
parents:
31345
diff
changeset
|
35 |
#define DEFAULT_VTBL_LIST_SIZE (17) // number of entries in the shared space vtable list. |
e530decd7c63
8138983: Runtime: implement ranges for Shared*** flags
gziemski
parents:
31345
diff
changeset
|
36 |
#define DEFAULT_VTBL_VIRTUALS_COUNT (200) // maximum number of virtual functions |
e530decd7c63
8138983: Runtime: implement ranges for Shared*** flags
gziemski
parents:
31345
diff
changeset
|
37 |
// If virtual functions are added to Metadata, |
e530decd7c63
8138983: Runtime: implement ranges for Shared*** flags
gziemski
parents:
31345
diff
changeset
|
38 |
// this number needs to be increased. Also, |
e530decd7c63
8138983: Runtime: implement ranges for Shared*** flags
gziemski
parents:
31345
diff
changeset
|
39 |
// SharedMiscCodeSize will need to be increased. |
e530decd7c63
8138983: Runtime: implement ranges for Shared*** flags
gziemski
parents:
31345
diff
changeset
|
40 |
// The following 2 sizes were based on |
e530decd7c63
8138983: Runtime: implement ranges for Shared*** flags
gziemski
parents:
31345
diff
changeset
|
41 |
// MetaspaceShared::generate_vtable_methods() |
e530decd7c63
8138983: Runtime: implement ranges for Shared*** flags
gziemski
parents:
31345
diff
changeset
|
42 |
#define DEFAULT_VTBL_METHOD_SIZE (16) // conservative size of the mov1 and jmp instructions |
e530decd7c63
8138983: Runtime: implement ranges for Shared*** flags
gziemski
parents:
31345
diff
changeset
|
43 |
// for the x64 platform |
e530decd7c63
8138983: Runtime: implement ranges for Shared*** flags
gziemski
parents:
31345
diff
changeset
|
44 |
#define DEFAULT_VTBL_COMMON_CODE_SIZE (1*K) // conservative size of the "common_code" for the x64 platform |
e530decd7c63
8138983: Runtime: implement ranges for Shared*** flags
gziemski
parents:
31345
diff
changeset
|
45 |
|
38634
176eda5b3359
8157090: SharedArchiveFile/SpaceUtilizationCheck.java fails as space utilization is below 30 percent
redestad
parents:
38303
diff
changeset
|
46 |
#define DEFAULT_SHARED_READ_WRITE_SIZE (NOT_LP64(6*M) LP64_ONLY(10*M)) |
176eda5b3359
8157090: SharedArchiveFile/SpaceUtilizationCheck.java fails as space utilization is below 30 percent
redestad
parents:
38303
diff
changeset
|
47 |
#define MIN_SHARED_READ_WRITE_SIZE (NOT_LP64(6*M) LP64_ONLY(10*M)) |
34242
e530decd7c63
8138983: Runtime: implement ranges for Shared*** flags
gziemski
parents:
31345
diff
changeset
|
48 |
|
38634
176eda5b3359
8157090: SharedArchiveFile/SpaceUtilizationCheck.java fails as space utilization is below 30 percent
redestad
parents:
38303
diff
changeset
|
49 |
#define DEFAULT_SHARED_READ_ONLY_SIZE (NOT_LP64(6*M) LP64_ONLY(10*M)) |
176eda5b3359
8157090: SharedArchiveFile/SpaceUtilizationCheck.java fails as space utilization is below 30 percent
redestad
parents:
38303
diff
changeset
|
50 |
#define MIN_SHARED_READ_ONLY_SIZE (NOT_LP64(6*M) LP64_ONLY(10*M)) |
34242
e530decd7c63
8138983: Runtime: implement ranges for Shared*** flags
gziemski
parents:
31345
diff
changeset
|
51 |
|
e530decd7c63
8138983: Runtime: implement ranges for Shared*** flags
gziemski
parents:
31345
diff
changeset
|
52 |
// the MIN_SHARED_MISC_DATA_SIZE and MIN_SHARED_MISC_CODE_SIZE estimates are based on |
37439
e8970711113b
8145221: Use trampolines for i2i and i2c entries in Methods that are stored in CDS archive
ccheung
parents:
36508
diff
changeset
|
53 |
// the sizes required for dumping the archive using the default classlist. The sizes |
e8970711113b
8145221: Use trampolines for i2i and i2c entries in Methods that are stored in CDS archive
ccheung
parents:
36508
diff
changeset
|
54 |
// are multiplied by 1.5 for a safety margin. |
34242
e530decd7c63
8138983: Runtime: implement ranges for Shared*** flags
gziemski
parents:
31345
diff
changeset
|
55 |
|
e530decd7c63
8138983: Runtime: implement ranges for Shared*** flags
gziemski
parents:
31345
diff
changeset
|
56 |
#define DEFAULT_SHARED_MISC_DATA_SIZE (NOT_LP64(2*M) LP64_ONLY(4*M)) |
37439
e8970711113b
8145221: Use trampolines for i2i and i2c entries in Methods that are stored in CDS archive
ccheung
parents:
36508
diff
changeset
|
57 |
#define MIN_SHARED_MISC_DATA_SIZE (NOT_LP64(1*M) LP64_ONLY(1200*K)) |
34242
e530decd7c63
8138983: Runtime: implement ranges for Shared*** flags
gziemski
parents:
31345
diff
changeset
|
58 |
|
e530decd7c63
8138983: Runtime: implement ranges for Shared*** flags
gziemski
parents:
31345
diff
changeset
|
59 |
#define DEFAULT_SHARED_MISC_CODE_SIZE (120*K) |
37439
e8970711113b
8145221: Use trampolines for i2i and i2c entries in Methods that are stored in CDS archive
ccheung
parents:
36508
diff
changeset
|
60 |
#define MIN_SHARED_MISC_CODE_SIZE (NOT_LP64(63*K) LP64_ONLY(69*K)) |
34242
e530decd7c63
8138983: Runtime: implement ranges for Shared*** flags
gziemski
parents:
31345
diff
changeset
|
61 |
#define DEFAULT_COMBINED_SIZE (DEFAULT_SHARED_READ_WRITE_SIZE+DEFAULT_SHARED_READ_ONLY_SIZE+DEFAULT_SHARED_MISC_DATA_SIZE+DEFAULT_SHARED_MISC_CODE_SIZE) |
e530decd7c63
8138983: Runtime: implement ranges for Shared*** flags
gziemski
parents:
31345
diff
changeset
|
62 |
|
e530decd7c63
8138983: Runtime: implement ranges for Shared*** flags
gziemski
parents:
31345
diff
changeset
|
63 |
// the max size is the MAX size (ie. 0x7FFFFFFF) - the total size of |
e530decd7c63
8138983: Runtime: implement ranges for Shared*** flags
gziemski
parents:
31345
diff
changeset
|
64 |
// the other 3 sections - page size (to avoid overflow in case the final |
e530decd7c63
8138983: Runtime: implement ranges for Shared*** flags
gziemski
parents:
31345
diff
changeset
|
65 |
// size will get aligned up on page size) |
e530decd7c63
8138983: Runtime: implement ranges for Shared*** flags
gziemski
parents:
31345
diff
changeset
|
66 |
#define SHARED_PAGE ((size_t)os::vm_page_size()) |
e530decd7c63
8138983: Runtime: implement ranges for Shared*** flags
gziemski
parents:
31345
diff
changeset
|
67 |
#define MAX_SHARED_DELTA (0x7FFFFFFF) |
e530decd7c63
8138983: Runtime: implement ranges for Shared*** flags
gziemski
parents:
31345
diff
changeset
|
68 |
#define MAX_SHARED_READ_WRITE_SIZE (MAX_SHARED_DELTA-(MIN_SHARED_READ_ONLY_SIZE+MIN_SHARED_MISC_DATA_SIZE+MIN_SHARED_MISC_CODE_SIZE)-SHARED_PAGE) |
e530decd7c63
8138983: Runtime: implement ranges for Shared*** flags
gziemski
parents:
31345
diff
changeset
|
69 |
#define MAX_SHARED_READ_ONLY_SIZE (MAX_SHARED_DELTA-(MIN_SHARED_READ_WRITE_SIZE+MIN_SHARED_MISC_DATA_SIZE+MIN_SHARED_MISC_CODE_SIZE)-SHARED_PAGE) |
e530decd7c63
8138983: Runtime: implement ranges for Shared*** flags
gziemski
parents:
31345
diff
changeset
|
70 |
#define MAX_SHARED_MISC_DATA_SIZE (MAX_SHARED_DELTA-(MIN_SHARED_READ_WRITE_SIZE+MIN_SHARED_READ_ONLY_SIZE+MIN_SHARED_MISC_CODE_SIZE)-SHARED_PAGE) |
e530decd7c63
8138983: Runtime: implement ranges for Shared*** flags
gziemski
parents:
31345
diff
changeset
|
71 |
#define MAX_SHARED_MISC_CODE_SIZE (MAX_SHARED_DELTA-(MIN_SHARED_READ_WRITE_SIZE+MIN_SHARED_READ_ONLY_SIZE+MIN_SHARED_MISC_DATA_SIZE)-SHARED_PAGE) |
e530decd7c63
8138983: Runtime: implement ranges for Shared*** flags
gziemski
parents:
31345
diff
changeset
|
72 |
|
e530decd7c63
8138983: Runtime: implement ranges for Shared*** flags
gziemski
parents:
31345
diff
changeset
|
73 |
#define LargeSharedArchiveSize (300*M) |
e530decd7c63
8138983: Runtime: implement ranges for Shared*** flags
gziemski
parents:
31345
diff
changeset
|
74 |
#define HugeSharedArchiveSize (800*M) |
e530decd7c63
8138983: Runtime: implement ranges for Shared*** flags
gziemski
parents:
31345
diff
changeset
|
75 |
#define ReadOnlyRegionPercentage 0.4 |
e530decd7c63
8138983: Runtime: implement ranges for Shared*** flags
gziemski
parents:
31345
diff
changeset
|
76 |
#define ReadWriteRegionPercentage 0.55 |
e530decd7c63
8138983: Runtime: implement ranges for Shared*** flags
gziemski
parents:
31345
diff
changeset
|
77 |
#define MiscDataRegionPercentage 0.03 |
e530decd7c63
8138983: Runtime: implement ranges for Shared*** flags
gziemski
parents:
31345
diff
changeset
|
78 |
#define MiscCodeRegionPercentage 0.02 |
e530decd7c63
8138983: Runtime: implement ranges for Shared*** flags
gziemski
parents:
31345
diff
changeset
|
79 |
#define LargeThresholdClassCount 5000 |
e530decd7c63
8138983: Runtime: implement ranges for Shared*** flags
gziemski
parents:
31345
diff
changeset
|
80 |
#define HugeThresholdClassCount 40000 |
26304
a28e6335ce60
8048150: Allow easy configurations for large CDS archives
ccheung
parents:
26135
diff
changeset
|
81 |
|
a28e6335ce60
8048150: Allow easy configurations for large CDS archives
ccheung
parents:
26135
diff
changeset
|
82 |
#define SET_ESTIMATED_SIZE(type, region) \ |
a28e6335ce60
8048150: Allow easy configurations for large CDS archives
ccheung
parents:
26135
diff
changeset
|
83 |
Shared ##region## Size = FLAG_IS_DEFAULT(Shared ##region## Size) ? \ |
26408
d6defe172e25
8056175: Change "8048150: Allow easy configurations for large CDS archives" triggers conversion warning with older GCC
ccheung
parents:
26304
diff
changeset
|
84 |
(uintx)(type ## SharedArchiveSize * region ## RegionPercentage) : Shared ## region ## Size |
26304
a28e6335ce60
8048150: Allow easy configurations for large CDS archives
ccheung
parents:
26135
diff
changeset
|
85 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
86 |
class FileMapInfo; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
87 |
|
28363
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
28023
diff
changeset
|
88 |
class MetaspaceSharedStats VALUE_OBJ_CLASS_SPEC { |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
28023
diff
changeset
|
89 |
public: |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
28023
diff
changeset
|
90 |
MetaspaceSharedStats() { |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
28023
diff
changeset
|
91 |
memset(this, 0, sizeof(*this)); |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
28023
diff
changeset
|
92 |
} |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
28023
diff
changeset
|
93 |
CompactHashtableStats symbol; |
31345
1bba15125d8d
8015086: add interned strings to the shared archive.
jiangli
parents:
30579
diff
changeset
|
94 |
CompactHashtableStats string; |
28363
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
28023
diff
changeset
|
95 |
}; |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
28023
diff
changeset
|
96 |
|
35231 | 97 |
class SharedMiscRegion VALUE_OBJ_CLASS_SPEC { |
98 |
private: |
|
99 |
VirtualSpace _vs; |
|
100 |
char* _alloc_top; |
|
101 |
SharedSpaceType _space_type; |
|
102 |
||
103 |
public: |
|
104 |
void initialize(ReservedSpace rs, size_t committed_byte_size, SharedSpaceType space_type); |
|
105 |
VirtualSpace* virtual_space() { |
|
106 |
return &_vs; |
|
107 |
} |
|
108 |
char* low() const { |
|
109 |
return _vs.low(); |
|
110 |
} |
|
111 |
char* alloc_top() const { |
|
112 |
return _alloc_top; |
|
113 |
} |
|
114 |
char* alloc(size_t num_bytes) NOT_CDS_RETURN_(NULL); |
|
115 |
}; |
|
116 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
117 |
// Class Data Sharing Support |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
118 |
class MetaspaceShared : AllStatic { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
119 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
120 |
// CDS support |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
121 |
static ReservedSpace* _shared_rs; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
122 |
static int _max_alignment; |
28363
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
28023
diff
changeset
|
123 |
static MetaspaceSharedStats _stats; |
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
13975
diff
changeset
|
124 |
static bool _link_classes_made_progress; |
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
13975
diff
changeset
|
125 |
static bool _check_classes_made_progress; |
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
13975
diff
changeset
|
126 |
static bool _has_error_classes; |
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
13975
diff
changeset
|
127 |
static bool _archive_loading_failed; |
39714 | 128 |
static bool _remapped_readwrite; |
37439
e8970711113b
8145221: Use trampolines for i2i and i2c entries in Methods that are stored in CDS archive
ccheung
parents:
36508
diff
changeset
|
129 |
static address _cds_i2i_entry_code_buffers; |
e8970711113b
8145221: Use trampolines for i2i and i2c entries in Methods that are stored in CDS archive
ccheung
parents:
36508
diff
changeset
|
130 |
static size_t _cds_i2i_entry_code_buffers_size; |
35231 | 131 |
|
132 |
// Used only during dumping. |
|
133 |
static SharedMiscRegion _md; |
|
134 |
static SharedMiscRegion _mc; |
|
41182 | 135 |
static SharedMiscRegion _od; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
136 |
public: |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
137 |
enum { |
34242
e530decd7c63
8138983: Runtime: implement ranges for Shared*** flags
gziemski
parents:
31345
diff
changeset
|
138 |
vtbl_list_size = DEFAULT_VTBL_LIST_SIZE, |
e530decd7c63
8138983: Runtime: implement ranges for Shared*** flags
gziemski
parents:
31345
diff
changeset
|
139 |
num_virtuals = DEFAULT_VTBL_VIRTUALS_COUNT, |
e530decd7c63
8138983: Runtime: implement ranges for Shared*** flags
gziemski
parents:
31345
diff
changeset
|
140 |
vtbl_method_size = DEFAULT_VTBL_METHOD_SIZE, |
e530decd7c63
8138983: Runtime: implement ranges for Shared*** flags
gziemski
parents:
31345
diff
changeset
|
141 |
vtbl_common_code_size = DEFAULT_VTBL_COMMON_CODE_SIZE |
28018
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
142 |
}; |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
143 |
|
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
144 |
enum { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
145 |
ro = 0, // read-only shared space in the heap |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
146 |
rw = 1, // read-write shared space in the heap |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
147 |
md = 2, // miscellaneous data for initializing tables, etc. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
148 |
mc = 3, // miscellaneous code - vtable replacement. |
31345
1bba15125d8d
8015086: add interned strings to the shared archive.
jiangli
parents:
30579
diff
changeset
|
149 |
max_strings = 2, // max number of string regions in string space |
1bba15125d8d
8015086: add interned strings to the shared archive.
jiangli
parents:
30579
diff
changeset
|
150 |
num_non_strings = 4, // number of non-string regions |
1bba15125d8d
8015086: add interned strings to the shared archive.
jiangli
parents:
30579
diff
changeset
|
151 |
first_string = num_non_strings, // index of first string region |
41182 | 152 |
// The optional data region is the last region. |
153 |
// Currently it only contains class file data. |
|
154 |
od = max_strings + num_non_strings, |
|
155 |
n_regions = od + 1 // total number of regions |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
156 |
}; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
157 |
|
13975
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
13728
diff
changeset
|
158 |
// Accessor functions to save shared space created for metadata, which has |
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
13728
diff
changeset
|
159 |
// extra space allocated at the end for miscellaneous data and code. |
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
13728
diff
changeset
|
160 |
static void set_max_alignment(int alignment) { |
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
13728
diff
changeset
|
161 |
CDS_ONLY(_max_alignment = alignment); |
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
13728
diff
changeset
|
162 |
} |
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
13728
diff
changeset
|
163 |
|
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
13728
diff
changeset
|
164 |
static int max_alignment() { |
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
13728
diff
changeset
|
165 |
CDS_ONLY(return _max_alignment); |
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
13728
diff
changeset
|
166 |
NOT_CDS(return 0); |
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
13728
diff
changeset
|
167 |
} |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
168 |
|
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
13975
diff
changeset
|
169 |
static void prepare_for_dumping() NOT_CDS_RETURN; |
13975
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
13728
diff
changeset
|
170 |
static void preload_and_dump(TRAPS) NOT_CDS_RETURN; |
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
13975
diff
changeset
|
171 |
static int preload_and_dump(const char * class_list_path, |
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
13975
diff
changeset
|
172 |
GrowableArray<Klass*>* class_promote_order, |
27677 | 173 |
TRAPS) NOT_CDS_RETURN_(0); |
13975
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
13728
diff
changeset
|
174 |
|
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
13728
diff
changeset
|
175 |
static ReservedSpace* shared_rs() { |
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
13728
diff
changeset
|
176 |
CDS_ONLY(return _shared_rs); |
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
13728
diff
changeset
|
177 |
NOT_CDS(return NULL); |
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
13728
diff
changeset
|
178 |
} |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
179 |
|
35231 | 180 |
static void initialize_shared_rs(ReservedSpace* rs) NOT_CDS_RETURN; |
13975
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
13728
diff
changeset
|
181 |
|
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
13975
diff
changeset
|
182 |
static void set_archive_loading_failed() { |
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
13975
diff
changeset
|
183 |
_archive_loading_failed = true; |
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
13975
diff
changeset
|
184 |
} |
13975
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
13728
diff
changeset
|
185 |
static bool map_shared_spaces(FileMapInfo* mapinfo) NOT_CDS_RETURN_(false); |
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
13728
diff
changeset
|
186 |
static void initialize_shared_spaces() NOT_CDS_RETURN; |
31345
1bba15125d8d
8015086: add interned strings to the shared archive.
jiangli
parents:
30579
diff
changeset
|
187 |
static void fixup_shared_string_regions() NOT_CDS_RETURN; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
188 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
189 |
// Return true if given address is in the mapped shared space. |
13975
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
13728
diff
changeset
|
190 |
static bool is_in_shared_space(const void* p) NOT_CDS_RETURN_(false); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
191 |
|
37439
e8970711113b
8145221: Use trampolines for i2i and i2c entries in Methods that are stored in CDS archive
ccheung
parents:
36508
diff
changeset
|
192 |
// Return true if given address is in the shared region corresponding to the idx |
e8970711113b
8145221: Use trampolines for i2i and i2c entries in Methods that are stored in CDS archive
ccheung
parents:
36508
diff
changeset
|
193 |
static bool is_in_shared_region(const void* p, int idx) NOT_CDS_RETURN_(false); |
e8970711113b
8145221: Use trampolines for i2i and i2c entries in Methods that are stored in CDS archive
ccheung
parents:
36508
diff
changeset
|
194 |
|
31345
1bba15125d8d
8015086: add interned strings to the shared archive.
jiangli
parents:
30579
diff
changeset
|
195 |
static bool is_string_region(int idx) NOT_CDS_RETURN_(false); |
1bba15125d8d
8015086: add interned strings to the shared archive.
jiangli
parents:
30579
diff
changeset
|
196 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
197 |
static void generate_vtable_methods(void** vtbl_list, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
198 |
void** vtable, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
199 |
char** md_top, char* md_end, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
200 |
char** mc_top, char* mc_end); |
37995 | 201 |
static void serialize(SerializeClosure* sc, GrowableArray<MemRegion> *string_space, |
202 |
size_t* space_size); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
203 |
|
28363
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
28023
diff
changeset
|
204 |
static MetaspaceSharedStats* stats() { |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
28023
diff
changeset
|
205 |
return &_stats; |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
28023
diff
changeset
|
206 |
} |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
28023
diff
changeset
|
207 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
208 |
// JVM/TI RedefineClasses() support: |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
209 |
// Remap the shared readonly space to shared readwrite, private if |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
210 |
// sharing is enabled. Simply returns true if sharing is not enabled |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
211 |
// or if the remapping has already been done by a prior call. |
13975
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
13728
diff
changeset
|
212 |
static bool remap_shared_readonly_as_readwrite() NOT_CDS_RETURN_(true); |
39714 | 213 |
static bool remapped_readwrite() { |
214 |
CDS_ONLY(return _remapped_readwrite); |
|
215 |
NOT_CDS(return false); |
|
216 |
} |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
217 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
218 |
static void print_shared_spaces(); |
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
13975
diff
changeset
|
219 |
|
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
13975
diff
changeset
|
220 |
static bool try_link_class(InstanceKlass* ik, TRAPS); |
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
13975
diff
changeset
|
221 |
static void link_one_shared_class(Klass* obj, TRAPS); |
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
13975
diff
changeset
|
222 |
static void check_one_shared_class(Klass* obj); |
36508 | 223 |
static void check_shared_class_loader_type(Klass* obj); |
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
13975
diff
changeset
|
224 |
static void link_and_cleanup_shared_classes(TRAPS); |
26304
a28e6335ce60
8048150: Allow easy configurations for large CDS archives
ccheung
parents:
26135
diff
changeset
|
225 |
|
a28e6335ce60
8048150: Allow easy configurations for large CDS archives
ccheung
parents:
26135
diff
changeset
|
226 |
static int count_class(const char* classlist_file); |
a28e6335ce60
8048150: Allow easy configurations for large CDS archives
ccheung
parents:
26135
diff
changeset
|
227 |
static void estimate_regions_size() NOT_CDS_RETURN; |
34257
4be3504cc03b
8140802: Clean up and refactor of class loading code for CDS
iklam
parents:
31345
diff
changeset
|
228 |
|
41182 | 229 |
// Allocate a block of memory from the "mc", "md", or "od" regions. |
35231 | 230 |
static char* misc_code_space_alloc(size_t num_bytes) { return _mc.alloc(num_bytes); } |
231 |
static char* misc_data_space_alloc(size_t num_bytes) { return _md.alloc(num_bytes); } |
|
41182 | 232 |
static char* optional_data_space_alloc(size_t num_bytes) { return _od.alloc(num_bytes); } |
35231 | 233 |
|
37439
e8970711113b
8145221: Use trampolines for i2i and i2c entries in Methods that are stored in CDS archive
ccheung
parents:
36508
diff
changeset
|
234 |
static address cds_i2i_entry_code_buffers(size_t total_size); |
e8970711113b
8145221: Use trampolines for i2i and i2c entries in Methods that are stored in CDS archive
ccheung
parents:
36508
diff
changeset
|
235 |
|
e8970711113b
8145221: Use trampolines for i2i and i2c entries in Methods that are stored in CDS archive
ccheung
parents:
36508
diff
changeset
|
236 |
static address cds_i2i_entry_code_buffers() { |
e8970711113b
8145221: Use trampolines for i2i and i2c entries in Methods that are stored in CDS archive
ccheung
parents:
36508
diff
changeset
|
237 |
return _cds_i2i_entry_code_buffers; |
e8970711113b
8145221: Use trampolines for i2i and i2c entries in Methods that are stored in CDS archive
ccheung
parents:
36508
diff
changeset
|
238 |
} |
e8970711113b
8145221: Use trampolines for i2i and i2c entries in Methods that are stored in CDS archive
ccheung
parents:
36508
diff
changeset
|
239 |
static size_t cds_i2i_entry_code_buffers_size() { |
e8970711113b
8145221: Use trampolines for i2i and i2c entries in Methods that are stored in CDS archive
ccheung
parents:
36508
diff
changeset
|
240 |
return _cds_i2i_entry_code_buffers_size; |
e8970711113b
8145221: Use trampolines for i2i and i2c entries in Methods that are stored in CDS archive
ccheung
parents:
36508
diff
changeset
|
241 |
} |
e8970711113b
8145221: Use trampolines for i2i and i2c entries in Methods that are stored in CDS archive
ccheung
parents:
36508
diff
changeset
|
242 |
|
35231 | 243 |
static SharedMiscRegion* misc_code_region() { |
244 |
assert(DumpSharedSpaces, "used during dumping only"); |
|
245 |
return &_mc; |
|
246 |
} |
|
247 |
static SharedMiscRegion* misc_data_region() { |
|
248 |
assert(DumpSharedSpaces, "used during dumping only"); |
|
249 |
return &_md; |
|
250 |
} |
|
41182 | 251 |
static SharedMiscRegion* optional_data_region() { |
252 |
assert(DumpSharedSpaces, "used during dumping only"); |
|
253 |
return &_od; |
|
254 |
} |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
255 |
}; |
30578 | 256 |
#endif // SHARE_VM_MEMORY_METASPACESHARED_HPP |