8224497: Remove FIXME in metaspaceClosure.cpp

Also cleaned up some comment and code related to the od (optional data) region.

Reviewed-by: iklam, jiangli
This commit is contained in:
Calvin Cheung 2019-06-07 14:03:17 -07:00
parent 12bb59fb63
commit d0725682a8
4 changed files with 13 additions and 20 deletions

View file

@ -1080,7 +1080,7 @@ ReservedSpace FileMapInfo::reserve_shared_memory() {
} }
// Memory map a region in the address space. // Memory map a region in the address space.
static const char* shared_region_name[] = { "MiscData", "ReadWrite", "ReadOnly", "MiscCode", "OptionalData", static const char* shared_region_name[] = { "MiscData", "ReadWrite", "ReadOnly", "MiscCode",
"String1", "String2", "OpenArchive1", "OpenArchive2" }; "String1", "String2", "OpenArchive1", "OpenArchive2" };
char* FileMapInfo::map_regions(int regions[], char* saved_base[], size_t len) { char* FileMapInfo::map_regions(int regions[], char* saved_base[], size_t len) {
@ -1094,7 +1094,7 @@ char* FileMapInfo::map_regions(int regions[], char* saved_base[], size_t len) {
return NULL; return NULL;
} }
if (i > 0) { if (i > 0) {
// We require that mc->rw->ro->md->od to be laid out consecutively, with no // We require that mc->rw->ro->md to be laid out consecutively, with no
// gaps between them. That way, we can ensure that the OS won't be able to // gaps between them. That way, we can ensure that the OS won't be able to
// allocate any new memory spaces inside _shared_metaspace_{base,top}, which // allocate any new memory spaces inside _shared_metaspace_{base,top}, which
// would mess up the simple comparision in MetaspaceShared::is_in_shared_metaspace(). // would mess up the simple comparision in MetaspaceShared::is_in_shared_metaspace().

View file

@ -45,7 +45,7 @@ void MetaspaceClosure::push_impl(MetaspaceClosure::Ref* ref) {
} }
void MetaspaceClosure::do_push(MetaspaceClosure::Ref* ref) { void MetaspaceClosure::do_push(MetaspaceClosure::Ref* ref) {
if (ref->not_null()) { // FIXME: make this configurable, so DynamicArchiveBuilder mark all pointers if (ref->not_null()) {
bool read_only; bool read_only;
Writability w = ref->writability(); Writability w = ref->writability();
switch (w) { switch (w) {

View file

@ -90,18 +90,17 @@ void* MetaspaceShared::_shared_metaspace_static_top = NULL;
// rw - read-write metadata // rw - read-write metadata
// ro - read-only metadata and read-only tables // ro - read-only metadata and read-only tables
// md - misc data (the c++ vtables) // md - misc data (the c++ vtables)
// od - optional data (original class files)
// //
// ca0 - closed archive heap space #0 // ca0 - closed archive heap space #0
// ca1 - closed archive heap space #1 (may be empty) // ca1 - closed archive heap space #1 (may be empty)
// oa0 - open archive heap space #0 // oa0 - open archive heap space #0
// oa1 - open archive heap space #1 (may be empty) // oa1 - open archive heap space #1 (may be empty)
// //
// The mc, rw, ro, md and od regions are linearly allocated, starting from // The mc, rw, ro, and md regions are linearly allocated, starting from
// SharedBaseAddress, in the order of mc->rw->ro->md->od. The size of these 5 regions // SharedBaseAddress, in the order of mc->rw->ro->md. The size of these 4 regions
// are page-aligned, and there's no gap between any consecutive regions. // are page-aligned, and there's no gap between any consecutive regions.
// //
// These 5 regions are populated in the following steps: // These 4 regions are populated in the following steps:
// [1] All classes are loaded in MetaspaceShared::preload_classes(). All metadata are // [1] All classes are loaded in MetaspaceShared::preload_classes(). All metadata are
// temporarily allocated outside of the shared regions. Only the method entry // temporarily allocated outside of the shared regions. Only the method entry
// trampolines are written into the mc region. // trampolines are written into the mc region.
@ -110,10 +109,9 @@ void* MetaspaceShared::_shared_metaspace_static_top = NULL;
// [4] SymbolTable, StringTable, SystemDictionary, and a few other read-only data // [4] SymbolTable, StringTable, SystemDictionary, and a few other read-only data
// are copied into the ro region as read-only tables. // are copied into the ro region as read-only tables.
// [5] C++ vtables are copied into the md region. // [5] C++ vtables are copied into the md region.
// [6] Original class files are copied into the od region.
// //
// The s0/s1 and oa0/oa1 regions are populated inside HeapShared::archive_java_heap_objects. // The s0/s1 and oa0/oa1 regions are populated inside HeapShared::archive_java_heap_objects.
// Their layout is independent of the other 5 regions. // Their layout is independent of the other 4 regions.
char* DumpRegion::expand_top_to(char* newtop) { char* DumpRegion::expand_top_to(char* newtop) {
assert(is_allocatable(), "must be initialized and not packed"); assert(is_allocatable(), "must be initialized and not packed");
@ -174,7 +172,7 @@ void DumpRegion::pack(DumpRegion* next) {
} }
} }
DumpRegion _mc_region("mc"), _ro_region("ro"), _rw_region("rw"), _md_region("md"), _od_region("od"); DumpRegion _mc_region("mc"), _ro_region("ro"), _rw_region("rw"), _md_region("md");
size_t _total_closed_archive_region_size = 0, _total_open_archive_region_size = 0; size_t _total_closed_archive_region_size = 0, _total_open_archive_region_size = 0;
void MetaspaceShared::init_shared_dump_space(DumpRegion* first_space, address first_space_bottom) { void MetaspaceShared::init_shared_dump_space(DumpRegion* first_space, address first_space_bottom) {
@ -198,10 +196,6 @@ DumpRegion* MetaspaceShared::read_only_dump_space() {
return &_ro_region; return &_ro_region;
} }
DumpRegion* MetaspaceShared::optional_data_dump_space() {
return &_od_region;
}
void MetaspaceShared::pack_dump_space(DumpRegion* current, DumpRegion* next, void MetaspaceShared::pack_dump_space(DumpRegion* current, DumpRegion* next,
ReservedSpace* rs) { ReservedSpace* rs) {
current->pack(next); current->pack(next);
@ -290,10 +284,10 @@ void MetaspaceShared::initialize_dumptime_shared_and_meta_spaces() {
// //
// +-- SharedBaseAddress (default = 0x800000000) // +-- SharedBaseAddress (default = 0x800000000)
// v // v
// +-..---------+---------+ ... +----+----+----+----+----+---------------+ // +-..---------+---------+ ... +----+----+----+----+---------------+
// | Heap | Archive | | MC | RW | RO | MD | OD | class space | // | Heap | Archive | | MC | RW | RO | MD | class space |
// +-..---------+---------+ ... +----+----+----+----+----+---------------+ // +-..---------+---------+ ... +----+----+----+----+---------------+
// |<-- MaxHeapSize -->| |<-- UnscaledClassSpaceMax = 4GB ------->| // |<-- MaxHeapSize -->| |<-- UnscaledClassSpaceMax = 4GB -->|
// //
const uint64_t UnscaledClassSpaceMax = (uint64_t(max_juint) + 1); const uint64_t UnscaledClassSpaceMax = (uint64_t(max_juint) + 1);
const size_t cds_total = align_down(UnscaledClassSpaceMax, reserve_alignment); const size_t cds_total = align_down(UnscaledClassSpaceMax, reserve_alignment);
@ -1074,7 +1068,7 @@ void DumpAllocStats::print_stats(int ro_all, int rw_all, int mc_all, int md_all)
LogMessage(cds) msg; LogMessage(cds) msg;
msg.info("Detailed metadata info (excluding od/st regions; rw stats include md/mc regions):"); msg.info("Detailed metadata info (excluding st regions; rw stats include md/mc regions):");
msg.info("%s", hdr); msg.info("%s", hdr);
msg.info("%s", sep); msg.info("%s", sep);
for (int type = 0; type < int(_number_of_types); type ++) { for (int type = 0; type < int(_number_of_types); type ++) {

View file

@ -304,7 +304,6 @@ class MetaspaceShared : AllStatic {
static DumpRegion* misc_code_dump_space(); static DumpRegion* misc_code_dump_space();
static DumpRegion* read_write_dump_space(); static DumpRegion* read_write_dump_space();
static DumpRegion* read_only_dump_space(); static DumpRegion* read_only_dump_space();
static DumpRegion* optional_data_dump_space();
static void pack_dump_space(DumpRegion* current, DumpRegion* next, static void pack_dump_space(DumpRegion* current, DumpRegion* next,
ReservedSpace* rs); ReservedSpace* rs);