mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-19 02:24:40 +02:00
8145221: Use trampolines for i2i and i2c entries in Methods that are stored in CDS archive
This optimization reduces the size of the RW region of the CDS archive. It also reduces the amount of pages in the RW region that are actually written into during runtime. Co-authored-by: Ioi Lam <ioi.lam@oracle.com> Co-authored-by: Goetz Lindenmaier <goetz.lindenmaier@sap.com> Reviewed-by: dlong, iklam, jiangli
This commit is contained in:
parent
2d2abce433
commit
28edd79d64
27 changed files with 408 additions and 47 deletions
|
@ -59,6 +59,8 @@ bool MetaspaceShared::_link_classes_made_progress;
|
|||
bool MetaspaceShared::_check_classes_made_progress;
|
||||
bool MetaspaceShared::_has_error_classes;
|
||||
bool MetaspaceShared::_archive_loading_failed = false;
|
||||
address MetaspaceShared::_cds_i2i_entry_code_buffers = NULL;
|
||||
size_t MetaspaceShared::_cds_i2i_entry_code_buffers_size = 0;
|
||||
SharedMiscRegion MetaspaceShared::_mc;
|
||||
SharedMiscRegion MetaspaceShared::_md;
|
||||
|
||||
|
@ -129,6 +131,21 @@ void MetaspaceShared::serialize(SerializeClosure* soc) {
|
|||
soc->do_tag(666);
|
||||
}
|
||||
|
||||
address MetaspaceShared::cds_i2i_entry_code_buffers(size_t total_size) {
|
||||
if (DumpSharedSpaces) {
|
||||
if (_cds_i2i_entry_code_buffers == NULL) {
|
||||
_cds_i2i_entry_code_buffers = (address)misc_data_space_alloc(total_size);
|
||||
_cds_i2i_entry_code_buffers_size = total_size;
|
||||
}
|
||||
} else if (UseSharedSpaces) {
|
||||
assert(_cds_i2i_entry_code_buffers != NULL, "must already been initialized");
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
assert(_cds_i2i_entry_code_buffers_size == total_size, "must not change");
|
||||
return _cds_i2i_entry_code_buffers;
|
||||
}
|
||||
|
||||
// CDS code for dumping shared archive.
|
||||
|
||||
|
@ -576,6 +593,8 @@ void VM_PopulateDumpSharedSpace::doit() {
|
|||
&md_top, md_end,
|
||||
&mc_top, mc_end);
|
||||
|
||||
guarantee(md_top <= md_end, "Insufficient space for vtables.");
|
||||
|
||||
// Reorder the system dictionary. (Moving the symbols affects
|
||||
// how the hash table indices are calculated.)
|
||||
// Not doing this either.
|
||||
|
@ -668,6 +687,8 @@ void VM_PopulateDumpSharedSpace::doit() {
|
|||
FileMapInfo* mapinfo = new FileMapInfo();
|
||||
mapinfo->populate_header(MetaspaceShared::max_alignment());
|
||||
mapinfo->set_misc_data_patching_start((char*)vtbl_list);
|
||||
mapinfo->set_cds_i2i_entry_code_buffers(MetaspaceShared::cds_i2i_entry_code_buffers());
|
||||
mapinfo->set_cds_i2i_entry_code_buffers_size(MetaspaceShared::cds_i2i_entry_code_buffers_size());
|
||||
|
||||
for (int pass=1; pass<=2; pass++) {
|
||||
if (pass == 1) {
|
||||
|
@ -686,7 +707,7 @@ void VM_PopulateDumpSharedSpace::doit() {
|
|||
mapinfo->write_region(MetaspaceShared::md, _md_vs.low(),
|
||||
pointer_delta(md_top, _md_vs.low(), sizeof(char)),
|
||||
SharedMiscDataSize,
|
||||
false, false);
|
||||
false, true);
|
||||
mapinfo->write_region(MetaspaceShared::mc, _mc_vs.low(),
|
||||
pointer_delta(mc_top, _mc_vs.low(), sizeof(char)),
|
||||
SharedMiscCodeSize,
|
||||
|
@ -980,6 +1001,11 @@ bool MetaspaceShared::is_in_shared_space(const void* p) {
|
|||
return UseSharedSpaces && FileMapInfo::current_info()->is_in_shared_space(p);
|
||||
}
|
||||
|
||||
// Return true if given address is in the misc data region
|
||||
bool MetaspaceShared::is_in_shared_region(const void* p, int idx) {
|
||||
return UseSharedSpaces && FileMapInfo::current_info()->is_in_shared_region(p, idx);
|
||||
}
|
||||
|
||||
bool MetaspaceShared::is_string_region(int idx) {
|
||||
return (idx >= MetaspaceShared::first_string &&
|
||||
idx < MetaspaceShared::first_string + MetaspaceShared::max_strings);
|
||||
|
@ -1053,6 +1079,8 @@ bool MetaspaceShared::map_shared_spaces(FileMapInfo* mapinfo) {
|
|||
|
||||
void MetaspaceShared::initialize_shared_spaces() {
|
||||
FileMapInfo *mapinfo = FileMapInfo::current_info();
|
||||
_cds_i2i_entry_code_buffers = mapinfo->cds_i2i_entry_code_buffers();
|
||||
_cds_i2i_entry_code_buffers_size = mapinfo->cds_i2i_entry_code_buffers_size();
|
||||
char* buffer = mapinfo->misc_data_patching_start();
|
||||
|
||||
// Skip over (reserve space for) a list of addresses of C++ vtables
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue