mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-17 09:34:38 +02:00
8212205: VM asserts after CDS archive has been unmapped
Reviewed-by: dholmes, jiangli, hseigel, stuefe
This commit is contained in:
parent
37ef084d73
commit
9a06fc3ea7
4 changed files with 11 additions and 4 deletions
|
@ -244,7 +244,6 @@ class ClassLoaderData;
|
||||||
class MetaspaceClosure;
|
class MetaspaceClosure;
|
||||||
|
|
||||||
class MetaspaceObj {
|
class MetaspaceObj {
|
||||||
friend class MetaspaceShared;
|
|
||||||
// When CDS is enabled, all shared metaspace objects are mapped
|
// When CDS is enabled, all shared metaspace objects are mapped
|
||||||
// into a single contiguous memory block, so we can use these
|
// into a single contiguous memory block, so we can use these
|
||||||
// two pointers to quickly determine if something is in the
|
// two pointers to quickly determine if something is in the
|
||||||
|
@ -263,6 +262,13 @@ class MetaspaceObj {
|
||||||
}
|
}
|
||||||
void print_address_on(outputStream* st) const; // nonvirtual address printing
|
void print_address_on(outputStream* st) const; // nonvirtual address printing
|
||||||
|
|
||||||
|
static void set_shared_metaspace_range(void* base, void* top) {
|
||||||
|
_shared_metaspace_base = base;
|
||||||
|
_shared_metaspace_top = top;
|
||||||
|
}
|
||||||
|
static void* shared_metaspace_base() { return _shared_metaspace_base; }
|
||||||
|
static void* shared_metaspace_top() { return _shared_metaspace_top; }
|
||||||
|
|
||||||
#define METASPACE_OBJ_TYPES_DO(f) \
|
#define METASPACE_OBJ_TYPES_DO(f) \
|
||||||
f(Class) \
|
f(Class) \
|
||||||
f(Symbol) \
|
f(Symbol) \
|
||||||
|
|
|
@ -1355,6 +1355,8 @@ bool FileMapInfo::is_in_shared_region(const void* p, int idx) {
|
||||||
|
|
||||||
// Unmap mapped regions of shared space.
|
// Unmap mapped regions of shared space.
|
||||||
void FileMapInfo::stop_sharing_and_unmap(const char* msg) {
|
void FileMapInfo::stop_sharing_and_unmap(const char* msg) {
|
||||||
|
MetaspaceObj::set_shared_metaspace_range(NULL, NULL);
|
||||||
|
|
||||||
FileMapInfo *map_info = FileMapInfo::current_info();
|
FileMapInfo *map_info = FileMapInfo::current_info();
|
||||||
if (map_info) {
|
if (map_info) {
|
||||||
map_info->fail_continue("%s", msg);
|
map_info->fail_continue("%s", msg);
|
||||||
|
|
|
@ -1957,8 +1957,7 @@ bool MetaspaceShared::map_shared_spaces(FileMapInfo* mapinfo) {
|
||||||
assert(ro_top == md_base, "must be");
|
assert(ro_top == md_base, "must be");
|
||||||
assert(md_top == od_base, "must be");
|
assert(md_top == od_base, "must be");
|
||||||
|
|
||||||
MetaspaceObj::_shared_metaspace_base = (void*)mc_base;
|
MetaspaceObj::set_shared_metaspace_range((void*)mc_base, (void*)od_top);
|
||||||
MetaspaceObj::_shared_metaspace_top = (void*)od_top;
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
// If there was a failure in mapping any of the spaces, unmap the ones
|
// If there was a failure in mapping any of the spaces, unmap the ones
|
||||||
|
|
|
@ -125,7 +125,7 @@ class MetaspaceShared : AllStatic {
|
||||||
static bool is_in_shared_metaspace(const void* p) {
|
static bool is_in_shared_metaspace(const void* p) {
|
||||||
// If no shared metaspace regions are mapped, MetaspceObj::_shared_metaspace_{base,top} will
|
// If no shared metaspace regions are mapped, MetaspceObj::_shared_metaspace_{base,top} will
|
||||||
// both be NULL and all values of p will be rejected quickly.
|
// both be NULL and all values of p will be rejected quickly.
|
||||||
return (p < MetaspaceObj::_shared_metaspace_top && p >= MetaspaceObj::_shared_metaspace_base);
|
return (p < MetaspaceObj::shared_metaspace_top() && p >= MetaspaceObj::shared_metaspace_base());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return true if given address is in the shared region corresponding to the idx
|
// Return true if given address is in the shared region corresponding to the idx
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue