8209545: Simplify HeapShared::archive_module_graph_objects

Added archivable_static_fields array in heapShared.cpp

Reviewed-by: jiangli
This commit is contained in:
Ioi Lam 2018-08-15 11:19:57 -07:00
parent 6355dec98c
commit 2e941724e4
7 changed files with 76 additions and 197 deletions

View file

@ -4248,15 +4248,7 @@ int java_nio_Buffer::_limit_offset;
int java_util_concurrent_locks_AbstractOwnableSynchronizer::_owner_offset;
int reflect_ConstantPool::_oop_offset;
int reflect_UnsafeStaticFieldAccessorImpl::_base_offset;
int jdk_internal_module_ArchivedModuleGraph::_archivedSystemModules_offset;
int jdk_internal_module_ArchivedModuleGraph::_archivedModuleFinder_offset;
int jdk_internal_module_ArchivedModuleGraph::_archivedMainModule_offset;
int jdk_internal_module_ArchivedModuleGraph::_archivedConfiguration_offset;
int java_lang_Integer_IntegerCache::_archivedCache_offset;
int java_lang_module_Configuration::_EMPTY_CONFIGURATION_offset;
int java_util_ImmutableCollections_ListN::_EMPTY_LIST_offset;
int java_util_ImmutableCollections_SetN::_EMPTY_SET_offset;
int java_util_ImmutableCollections_MapN::_EMPTY_MAP_offset;
#define STACKTRACEELEMENT_FIELDS_DO(macro) \
macro(declaringClassObject_offset, k, "declaringClassObject", class_signature, false); \
@ -4419,99 +4411,6 @@ static int member_offset(int hardcoded_offset) {
return (hardcoded_offset * heapOopSize) + instanceOopDesc::base_offset_in_bytes();
}
#define INTEGERCACHE_FIELDS_DO(macro) \
macro(_archivedCache_offset, k, "archivedCache", java_lang_Integer_array_signature, true)
void java_lang_Integer_IntegerCache::compute_offsets() {
InstanceKlass* k = SystemDictionary::Integer_IntegerCache_klass();
assert(k != NULL, "must be loaded");
INTEGERCACHE_FIELDS_DO(FIELD_COMPUTE_OFFSET);
}
#if INCLUDE_CDS
void java_lang_Integer_IntegerCache::serialize_offsets(SerializeClosure* f) {
INTEGERCACHE_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
}
#endif
#define ARCHIVEDMODULEGRAPH_FIELDS_DO(macro) \
macro(_archivedSystemModules_offset, k, "archivedSystemModules", systemModules_signature, true); \
macro(_archivedModuleFinder_offset, k, "archivedModuleFinder", moduleFinder_signature, true); \
macro(_archivedMainModule_offset, k, "archivedMainModule", string_signature, true); \
macro(_archivedConfiguration_offset, k, "archivedConfiguration", configuration_signature, true)
void jdk_internal_module_ArchivedModuleGraph::compute_offsets() {
InstanceKlass* k = SystemDictionary::ArchivedModuleGraph_klass();
assert(k != NULL, "must be loaded");
ARCHIVEDMODULEGRAPH_FIELDS_DO(FIELD_COMPUTE_OFFSET);
}
#if INCLUDE_CDS
void jdk_internal_module_ArchivedModuleGraph::serialize_offsets(SerializeClosure* f) {
ARCHIVEDMODULEGRAPH_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
}
#endif
#define CONFIGURATION_FIELDS_DO(macro) \
macro(_EMPTY_CONFIGURATION_offset, k, "EMPTY_CONFIGURATION", configuration_signature, true)
void java_lang_module_Configuration::compute_offsets() {
InstanceKlass* k = SystemDictionary::Configuration_klass();
assert(k != NULL, "must be loaded");
CONFIGURATION_FIELDS_DO(FIELD_COMPUTE_OFFSET);
}
#if INCLUDE_CDS
void java_lang_module_Configuration::serialize_offsets(SerializeClosure* f) {
CONFIGURATION_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
}
#endif
#define LISTN_FIELDS_DO(macro) \
macro(_EMPTY_LIST_offset, k, "EMPTY_LIST", list_signature, true)
void java_util_ImmutableCollections_ListN::compute_offsets() {
InstanceKlass* k = SystemDictionary::ImmutableCollections_ListN_klass();
assert(k != NULL, "must be loaded");
LISTN_FIELDS_DO(FIELD_COMPUTE_OFFSET);
}
#if INCLUDE_CDS
void java_util_ImmutableCollections_ListN::serialize_offsets(SerializeClosure* f) {
LISTN_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
}
#endif
#define SETN_FIELDS_DO(macro) \
macro(_EMPTY_SET_offset, k, "EMPTY_SET", set_signature, true)
void java_util_ImmutableCollections_SetN::compute_offsets() {
InstanceKlass* k = SystemDictionary::ImmutableCollections_SetN_klass();
assert(k != NULL, "must be loaded");
SETN_FIELDS_DO(FIELD_COMPUTE_OFFSET);
}
#if INCLUDE_CDS
void java_util_ImmutableCollections_SetN::serialize_offsets(SerializeClosure* f) {
SETN_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
}
#endif
#define MAPN_FIELDS_DO(macro) \
macro(_EMPTY_MAP_offset, k, "EMPTY_MAP", map_signature, true)
void java_util_ImmutableCollections_MapN::compute_offsets() {
InstanceKlass* k = SystemDictionary::ImmutableCollections_MapN_klass();
assert(k != NULL, "must be loaded");
MAPN_FIELDS_DO(FIELD_COMPUTE_OFFSET);
}
#if INCLUDE_CDS
void java_util_ImmutableCollections_MapN::serialize_offsets(SerializeClosure* f) {
MAPN_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
}
#endif
// Compute hard-coded offsets
// Invoked before SystemDictionary::initialize, so pre-loaded classes
// are not available to determine the offset_of_static_fields.