8184323: compile-time guard some UseSharedSpaces-only coding with the INCLUDE_CDS macro
Reviewed-by: jiangli, shade, simonis
This commit is contained in:
parent
62da378f03
commit
cf1044d114
@ -147,6 +147,7 @@ void VMError::reset_signal_handlers() {
|
|||||||
// Write a hint to the stream in case siginfo relates to a segv/bus error
|
// Write a hint to the stream in case siginfo relates to a segv/bus error
|
||||||
// and the offending address points into CDS archive.
|
// and the offending address points into CDS archive.
|
||||||
void VMError::check_failing_cds_access(outputStream* st, const void* siginfo) {
|
void VMError::check_failing_cds_access(outputStream* st, const void* siginfo) {
|
||||||
|
#if INCLUDE_CDS
|
||||||
if (siginfo && UseSharedSpaces) {
|
if (siginfo && UseSharedSpaces) {
|
||||||
const siginfo_t* const si = (siginfo_t*)siginfo;
|
const siginfo_t* const si = (siginfo_t*)siginfo;
|
||||||
if (si->si_signo == SIGBUS || si->si_signo == SIGSEGV) {
|
if (si->si_signo == SIGBUS || si->si_signo == SIGSEGV) {
|
||||||
@ -160,5 +161,6 @@ void VMError::check_failing_cds_access(outputStream* st, const void* siginfo) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,6 +51,7 @@ void VMError::reset_signal_handlers() {
|
|||||||
// Write a hint to the stream in case siginfo relates to a segv/bus error
|
// Write a hint to the stream in case siginfo relates to a segv/bus error
|
||||||
// and the offending address points into CDS archive.
|
// and the offending address points into CDS archive.
|
||||||
void VMError::check_failing_cds_access(outputStream* st, const void* siginfo) {
|
void VMError::check_failing_cds_access(outputStream* st, const void* siginfo) {
|
||||||
|
#if INCLUDE_CDS
|
||||||
if (siginfo && UseSharedSpaces) {
|
if (siginfo && UseSharedSpaces) {
|
||||||
const EXCEPTION_RECORD* const er = (const EXCEPTION_RECORD*)siginfo;
|
const EXCEPTION_RECORD* const er = (const EXCEPTION_RECORD*)siginfo;
|
||||||
if (er->ExceptionCode == EXCEPTION_IN_PAGE_ERROR &&
|
if (er->ExceptionCode == EXCEPTION_IN_PAGE_ERROR &&
|
||||||
@ -61,10 +62,11 @@ void VMError::check_failing_cds_access(outputStream* st, const void* siginfo) {
|
|||||||
if (mapinfo->is_in_shared_space(fault_addr)) {
|
if (mapinfo->is_in_shared_space(fault_addr)) {
|
||||||
st->print("Error accessing class data sharing archive. "
|
st->print("Error accessing class data sharing archive. "
|
||||||
"Mapped file inaccessible during execution, possible disk/network problem.");
|
"Mapped file inaccessible during execution, possible disk/network problem.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Error reporting cancellation: there is no easy way to implement this on Windows, because we do
|
// Error reporting cancellation: there is no easy way to implement this on Windows, because we do
|
||||||
|
@ -2122,12 +2122,15 @@ void SystemDictionary::initialize_preloaded_classes(TRAPS) {
|
|||||||
// Preload commonly used klasses
|
// Preload commonly used klasses
|
||||||
WKID scan = FIRST_WKID;
|
WKID scan = FIRST_WKID;
|
||||||
// first do Object, then String, Class
|
// first do Object, then String, Class
|
||||||
|
#if INCLUDE_CDS
|
||||||
if (UseSharedSpaces) {
|
if (UseSharedSpaces) {
|
||||||
initialize_wk_klasses_through(WK_KLASS_ENUM_NAME(Object_klass), scan, CHECK);
|
initialize_wk_klasses_through(WK_KLASS_ENUM_NAME(Object_klass), scan, CHECK);
|
||||||
// Initialize the constant pool for the Object_class
|
// Initialize the constant pool for the Object_class
|
||||||
Object_klass()->constants()->restore_unshareable_info(CHECK);
|
Object_klass()->constants()->restore_unshareable_info(CHECK);
|
||||||
initialize_wk_klasses_through(WK_KLASS_ENUM_NAME(Class_klass), scan, CHECK);
|
initialize_wk_klasses_through(WK_KLASS_ENUM_NAME(Class_klass), scan, CHECK);
|
||||||
} else {
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
initialize_wk_klasses_through(WK_KLASS_ENUM_NAME(Class_klass), scan, CHECK);
|
initialize_wk_klasses_through(WK_KLASS_ENUM_NAME(Class_klass), scan, CHECK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,11 +267,14 @@ void Universe::check_alignment(uintx size, uintx alignment, const char* name) {
|
|||||||
|
|
||||||
void initialize_basic_type_klass(Klass* k, TRAPS) {
|
void initialize_basic_type_klass(Klass* k, TRAPS) {
|
||||||
Klass* ok = SystemDictionary::Object_klass();
|
Klass* ok = SystemDictionary::Object_klass();
|
||||||
|
#if INCLUDE_CDS
|
||||||
if (UseSharedSpaces) {
|
if (UseSharedSpaces) {
|
||||||
ClassLoaderData* loader_data = ClassLoaderData::the_null_class_loader_data();
|
ClassLoaderData* loader_data = ClassLoaderData::the_null_class_loader_data();
|
||||||
assert(k->super() == ok, "u3");
|
assert(k->super() == ok, "u3");
|
||||||
k->restore_unshareable_info(loader_data, Handle(), CHECK);
|
k->restore_unshareable_info(loader_data, Handle(), CHECK);
|
||||||
} else {
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
k->initialize_supers(ok, CHECK);
|
k->initialize_supers(ok, CHECK);
|
||||||
}
|
}
|
||||||
k->append_to_sibling_list();
|
k->append_to_sibling_list();
|
||||||
@ -325,6 +328,7 @@ void Universe::genesis(TRAPS) {
|
|||||||
_the_null_string = StringTable::intern("null", CHECK);
|
_the_null_string = StringTable::intern("null", CHECK);
|
||||||
_the_min_jint_string = StringTable::intern("-2147483648", CHECK);
|
_the_min_jint_string = StringTable::intern("-2147483648", CHECK);
|
||||||
|
|
||||||
|
#if INCLUDE_CDS
|
||||||
if (UseSharedSpaces) {
|
if (UseSharedSpaces) {
|
||||||
// Verify shared interfaces array.
|
// Verify shared interfaces array.
|
||||||
assert(_the_array_interfaces_array->at(0) ==
|
assert(_the_array_interfaces_array->at(0) ==
|
||||||
@ -332,7 +336,9 @@ void Universe::genesis(TRAPS) {
|
|||||||
assert(_the_array_interfaces_array->at(1) ==
|
assert(_the_array_interfaces_array->at(1) ==
|
||||||
SystemDictionary::Serializable_klass(), "u3");
|
SystemDictionary::Serializable_klass(), "u3");
|
||||||
MetaspaceShared::fixup_shared_string_regions();
|
MetaspaceShared::fixup_shared_string_regions();
|
||||||
} else {
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
// Set up shared interfaces array. (Do this before supers are set up.)
|
// Set up shared interfaces array. (Do this before supers are set up.)
|
||||||
_the_array_interfaces_array->at_put(0, SystemDictionary::Cloneable_klass());
|
_the_array_interfaces_array->at_put(0, SystemDictionary::Cloneable_klass());
|
||||||
_the_array_interfaces_array->at_put(1, SystemDictionary::Serializable_klass());
|
_the_array_interfaces_array->at_put(1, SystemDictionary::Serializable_klass());
|
||||||
@ -670,6 +676,7 @@ jint universe_init() {
|
|||||||
Universe::_throw_illegal_access_error_cache = new LatestMethodCache();
|
Universe::_throw_illegal_access_error_cache = new LatestMethodCache();
|
||||||
Universe::_do_stack_walk_cache = new LatestMethodCache();
|
Universe::_do_stack_walk_cache = new LatestMethodCache();
|
||||||
|
|
||||||
|
#if INCLUDE_CDS
|
||||||
if (UseSharedSpaces) {
|
if (UseSharedSpaces) {
|
||||||
// Read the data structures supporting the shared spaces (shared
|
// Read the data structures supporting the shared spaces (shared
|
||||||
// system dictionary, symbol table, etc.). After that, access to
|
// system dictionary, symbol table, etc.). After that, access to
|
||||||
@ -678,13 +685,17 @@ jint universe_init() {
|
|||||||
// currently mapped regions.
|
// currently mapped regions.
|
||||||
MetaspaceShared::initialize_shared_spaces();
|
MetaspaceShared::initialize_shared_spaces();
|
||||||
StringTable::create_table();
|
StringTable::create_table();
|
||||||
} else {
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
SymbolTable::create_table();
|
SymbolTable::create_table();
|
||||||
StringTable::create_table();
|
StringTable::create_table();
|
||||||
|
|
||||||
|
#if INCLUDE_CDS
|
||||||
if (DumpSharedSpaces) {
|
if (DumpSharedSpaces) {
|
||||||
MetaspaceShared::prepare_for_dumping();
|
MetaspaceShared::prepare_for_dumping();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
if (strlen(VerifySubSet) > 0) {
|
if (strlen(VerifySubSet) > 0) {
|
||||||
Universe::initialize_verify_flags();
|
Universe::initialize_verify_flags();
|
||||||
|
@ -175,6 +175,7 @@ bool VM_RedefineClasses::doit_prologue() {
|
|||||||
void VM_RedefineClasses::doit() {
|
void VM_RedefineClasses::doit() {
|
||||||
Thread *thread = Thread::current();
|
Thread *thread = Thread::current();
|
||||||
|
|
||||||
|
#if INCLUDE_CDS
|
||||||
if (UseSharedSpaces) {
|
if (UseSharedSpaces) {
|
||||||
// Sharing is enabled so we remap the shared readonly space to
|
// Sharing is enabled so we remap the shared readonly space to
|
||||||
// shared readwrite, private just in case we need to redefine
|
// shared readwrite, private just in case we need to redefine
|
||||||
@ -186,6 +187,7 @@ void VM_RedefineClasses::doit() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Mark methods seen on stack and everywhere else so old methods are not
|
// Mark methods seen on stack and everywhere else so old methods are not
|
||||||
// cleaned up if they're on the stack.
|
// cleaned up if they're on the stack.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user