8206115: Use shared macros for JavaClasses::compute_offsets and MetaspaceShared::serialize_well_known_classes

Added BASIC_JAVA_CLASSES_DO in javaClasses.hpp

Reviewed-by: jiangli, redestad, coleenp
This commit is contained in:
Ioi Lam 2018-08-14 20:46:46 -07:00
parent efa05e1c62
commit e12ee81ff0
4 changed files with 136 additions and 157 deletions

View file

@ -209,7 +209,7 @@ void java_lang_String::compute_offsets() {
}
#if INCLUDE_CDS
void java_lang_String::serialize(SerializeClosure* f) {
void java_lang_String::serialize_offsets(SerializeClosure* f) {
STRING_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
f->do_u4((u4*)&initialized);
}
@ -1534,7 +1534,7 @@ void java_lang_Class::compute_offsets() {
}
#if INCLUDE_CDS
void java_lang_Class::serialize(SerializeClosure* f) {
void java_lang_Class::serialize_offsets(SerializeClosure* f) {
f->do_u4((u4*)&offsets_computed);
f->do_u4((u4*)&_init_lock_offset);
@ -1608,7 +1608,7 @@ void java_lang_Thread::compute_offsets() {
}
#if INCLUDE_CDS
void java_lang_Thread::serialize(SerializeClosure* f) {
void java_lang_Thread::serialize_offsets(SerializeClosure* f) {
THREAD_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
}
#endif
@ -1860,7 +1860,7 @@ void java_lang_ThreadGroup::compute_offsets() {
}
#if INCLUDE_CDS
void java_lang_ThreadGroup::serialize(SerializeClosure* f) {
void java_lang_ThreadGroup::serialize_offsets(SerializeClosure* f) {
THREADGROUP_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
}
#endif
@ -1878,7 +1878,7 @@ void java_lang_Throwable::compute_offsets() {
}
#if INCLUDE_CDS
void java_lang_Throwable::serialize(SerializeClosure* f) {
void java_lang_Throwable::serialize_offsets(SerializeClosure* f) {
THROWABLE_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
}
#endif
@ -2654,7 +2654,7 @@ void java_lang_StackFrameInfo::compute_offsets() {
}
#if INCLUDE_CDS
void java_lang_StackFrameInfo::serialize(SerializeClosure* f) {
void java_lang_StackFrameInfo::serialize_offsets(SerializeClosure* f) {
STACKFRAMEINFO_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
STACKFRAMEINFO_INJECTED_FIELDS(INJECTED_FIELD_SERIALIZE_OFFSET);
}
@ -2672,7 +2672,7 @@ void java_lang_LiveStackFrameInfo::compute_offsets() {
}
#if INCLUDE_CDS
void java_lang_LiveStackFrameInfo::serialize(SerializeClosure* f) {
void java_lang_LiveStackFrameInfo::serialize_offsets(SerializeClosure* f) {
LIVESTACKFRAMEINFO_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
}
#endif
@ -2686,7 +2686,7 @@ void java_lang_reflect_AccessibleObject::compute_offsets() {
}
#if INCLUDE_CDS
void java_lang_reflect_AccessibleObject::serialize(SerializeClosure* f) {
void java_lang_reflect_AccessibleObject::serialize_offsets(SerializeClosure* f) {
ACCESSIBLEOBJECT_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
}
#endif
@ -2727,7 +2727,7 @@ void java_lang_reflect_Method::compute_offsets() {
}
#if INCLUDE_CDS
void java_lang_reflect_Method::serialize(SerializeClosure* f) {
void java_lang_reflect_Method::serialize_offsets(SerializeClosure* f) {
METHOD_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
}
#endif
@ -2914,7 +2914,7 @@ void java_lang_reflect_Constructor::compute_offsets() {
}
#if INCLUDE_CDS
void java_lang_reflect_Constructor::serialize(SerializeClosure* f) {
void java_lang_reflect_Constructor::serialize_offsets(SerializeClosure* f) {
CONSTRUCTOR_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
}
#endif
@ -3063,7 +3063,7 @@ void java_lang_reflect_Field::compute_offsets() {
}
#if INCLUDE_CDS
void java_lang_reflect_Field::serialize(SerializeClosure* f) {
void java_lang_reflect_Field::serialize_offsets(SerializeClosure* f) {
FIELD_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
}
#endif
@ -3186,7 +3186,7 @@ void reflect_ConstantPool::compute_offsets() {
}
#if INCLUDE_CDS
void reflect_ConstantPool::serialize(SerializeClosure* f) {
void reflect_ConstantPool::serialize_offsets(SerializeClosure* f) {
CONSTANTPOOL_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
}
#endif
@ -3203,7 +3203,7 @@ void java_lang_reflect_Parameter::compute_offsets() {
}
#if INCLUDE_CDS
void java_lang_reflect_Parameter::serialize(SerializeClosure* f) {
void java_lang_reflect_Parameter::serialize_offsets(SerializeClosure* f) {
PARAMETER_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
}
#endif
@ -3281,7 +3281,7 @@ void java_lang_Module::compute_offsets() {
}
#if INCLUDE_CDS
void java_lang_Module::serialize(SerializeClosure* f) {
void java_lang_Module::serialize_offsets(SerializeClosure* f) {
MODULE_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
MODULE_INJECTED_FIELDS(INJECTED_FIELD_SERIALIZE_OFFSET);
}
@ -3371,7 +3371,7 @@ void reflect_UnsafeStaticFieldAccessorImpl::compute_offsets() {
}
#if INCLUDE_CDS
void reflect_UnsafeStaticFieldAccessorImpl::serialize(SerializeClosure* f) {
void reflect_UnsafeStaticFieldAccessorImpl::serialize_offsets(SerializeClosure* f) {
UNSAFESTATICFIELDACCESSORIMPL_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
}
#endif
@ -3543,7 +3543,7 @@ void java_lang_ref_SoftReference::compute_offsets() {
}
#if INCLUDE_CDS
void java_lang_ref_SoftReference::serialize(SerializeClosure* f) {
void java_lang_ref_SoftReference::serialize_offsets(SerializeClosure* f) {
SOFTREFERENCE_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
}
#endif
@ -3584,7 +3584,7 @@ void java_lang_invoke_DirectMethodHandle::compute_offsets() {
}
#if INCLUDE_CDS
void java_lang_invoke_DirectMethodHandle::serialize(SerializeClosure* f) {
void java_lang_invoke_DirectMethodHandle::serialize_offsets(SerializeClosure* f) {
DIRECTMETHODHANDLE_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
}
#endif
@ -3616,7 +3616,7 @@ void java_lang_invoke_MethodHandle::compute_offsets() {
}
#if INCLUDE_CDS
void java_lang_invoke_MethodHandle::serialize(SerializeClosure* f) {
void java_lang_invoke_MethodHandle::serialize_offsets(SerializeClosure* f) {
METHODHANDLE_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
}
#endif
@ -3635,7 +3635,7 @@ void java_lang_invoke_MemberName::compute_offsets() {
}
#if INCLUDE_CDS
void java_lang_invoke_MemberName::serialize(SerializeClosure* f) {
void java_lang_invoke_MemberName::serialize_offsets(SerializeClosure* f) {
MEMBERNAME_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
MEMBERNAME_INJECTED_FIELDS(INJECTED_FIELD_SERIALIZE_OFFSET);
}
@ -3648,7 +3648,7 @@ void java_lang_invoke_ResolvedMethodName::compute_offsets() {
}
#if INCLUDE_CDS
void java_lang_invoke_ResolvedMethodName::serialize(SerializeClosure* f) {
void java_lang_invoke_ResolvedMethodName::serialize_offsets(SerializeClosure* f) {
RESOLVEDMETHOD_INJECTED_FIELDS(INJECTED_FIELD_SERIALIZE_OFFSET);
}
#endif
@ -3663,7 +3663,7 @@ void java_lang_invoke_LambdaForm::compute_offsets() {
}
#if INCLUDE_CDS
void java_lang_invoke_LambdaForm::serialize(SerializeClosure* f) {
void java_lang_invoke_LambdaForm::serialize_offsets(SerializeClosure* f) {
LAMBDAFORM_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
}
#endif
@ -3815,7 +3815,7 @@ void java_lang_invoke_MethodType::compute_offsets() {
}
#if INCLUDE_CDS
void java_lang_invoke_MethodType::serialize(SerializeClosure* f) {
void java_lang_invoke_MethodType::serialize_offsets(SerializeClosure* f) {
METHODTYPE_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
}
#endif
@ -3909,7 +3909,7 @@ void java_lang_invoke_CallSite::compute_offsets() {
}
#if INCLUDE_CDS
void java_lang_invoke_CallSite::serialize(SerializeClosure* f) {
void java_lang_invoke_CallSite::serialize_offsets(SerializeClosure* f) {
CALLSITE_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
}
#endif
@ -3931,7 +3931,7 @@ void java_lang_invoke_MethodHandleNatives_CallSiteContext::compute_offsets() {
}
#if INCLUDE_CDS
void java_lang_invoke_MethodHandleNatives_CallSiteContext::serialize(SerializeClosure* f) {
void java_lang_invoke_MethodHandleNatives_CallSiteContext::serialize_offsets(SerializeClosure* f) {
CALLSITECONTEXT_INJECTED_FIELDS(INJECTED_FIELD_SERIALIZE_OFFSET);
}
#endif
@ -3963,7 +3963,7 @@ void java_security_AccessControlContext::compute_offsets() {
}
#if INCLUDE_CDS
void java_security_AccessControlContext::serialize(SerializeClosure* f) {
void java_security_AccessControlContext::serialize_offsets(SerializeClosure* f) {
ACCESSCONTROLCONTEXT_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
}
#endif
@ -4029,7 +4029,7 @@ void java_lang_ClassLoader::compute_offsets() {
}
#if INCLUDE_CDS
void java_lang_ClassLoader::serialize(SerializeClosure* f) {
void java_lang_ClassLoader::serialize_offsets(SerializeClosure* f) {
CLASSLOADER_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
CLASSLOADER_INJECTED_FIELDS(INJECTED_FIELD_SERIALIZE_OFFSET);
}
@ -4143,7 +4143,7 @@ void java_lang_System::compute_offsets() {
}
#if INCLUDE_CDS
void java_lang_System::serialize(SerializeClosure* f) {
void java_lang_System::serialize_offsets(SerializeClosure* f) {
SYSTEM_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
}
#endif
@ -4274,7 +4274,7 @@ void java_lang_StackTraceElement::compute_offsets() {
}
#if INCLUDE_CDS
void java_lang_StackTraceElement::serialize(SerializeClosure* f) {
void java_lang_StackTraceElement::serialize_offsets(SerializeClosure* f) {
STACKTRACEELEMENT_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
}
#endif
@ -4349,7 +4349,7 @@ void java_lang_AssertionStatusDirectives::compute_offsets() {
}
#if INCLUDE_CDS
void java_lang_AssertionStatusDirectives::serialize(SerializeClosure* f) {
void java_lang_AssertionStatusDirectives::serialize_offsets(SerializeClosure* f) {
ASSERTIONSTATUSDIRECTIVES_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
}
#endif
@ -4390,7 +4390,7 @@ void java_nio_Buffer::compute_offsets() {
}
#if INCLUDE_CDS
void java_nio_Buffer::serialize(SerializeClosure* f) {
void java_nio_Buffer::serialize_offsets(SerializeClosure* f) {
BUFFER_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
}
#endif
@ -4409,7 +4409,7 @@ oop java_util_concurrent_locks_AbstractOwnableSynchronizer::get_owner_threadObj(
}
#if INCLUDE_CDS
void java_util_concurrent_locks_AbstractOwnableSynchronizer::serialize(SerializeClosure* f) {
void java_util_concurrent_locks_AbstractOwnableSynchronizer::serialize_offsets(SerializeClosure* f) {
AOS_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
}
#endif
@ -4428,7 +4428,7 @@ void java_lang_Integer_IntegerCache::compute_offsets() {
}
#if INCLUDE_CDS
void java_lang_Integer_IntegerCache::serialize(SerializeClosure* f) {
void java_lang_Integer_IntegerCache::serialize_offsets(SerializeClosure* f) {
INTEGERCACHE_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
}
#endif
@ -4446,7 +4446,7 @@ void jdk_internal_module_ArchivedModuleGraph::compute_offsets() {
}
#if INCLUDE_CDS
void jdk_internal_module_ArchivedModuleGraph::serialize(SerializeClosure* f) {
void jdk_internal_module_ArchivedModuleGraph::serialize_offsets(SerializeClosure* f) {
ARCHIVEDMODULEGRAPH_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
}
#endif
@ -4461,7 +4461,7 @@ void java_lang_module_Configuration::compute_offsets() {
}
#if INCLUDE_CDS
void java_lang_module_Configuration::serialize(SerializeClosure* f) {
void java_lang_module_Configuration::serialize_offsets(SerializeClosure* f) {
CONFIGURATION_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
}
#endif
@ -4476,7 +4476,7 @@ void java_util_ImmutableCollections_ListN::compute_offsets() {
}
#if INCLUDE_CDS
void java_util_ImmutableCollections_ListN::serialize(SerializeClosure* f) {
void java_util_ImmutableCollections_ListN::serialize_offsets(SerializeClosure* f) {
LISTN_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
}
#endif
@ -4491,7 +4491,7 @@ void java_util_ImmutableCollections_SetN::compute_offsets() {
}
#if INCLUDE_CDS
void java_util_ImmutableCollections_SetN::serialize(SerializeClosure* f) {
void java_util_ImmutableCollections_SetN::serialize_offsets(SerializeClosure* f) {
SETN_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
}
#endif
@ -4506,7 +4506,7 @@ void java_util_ImmutableCollections_MapN::compute_offsets() {
}
#if INCLUDE_CDS
void java_util_ImmutableCollections_MapN::serialize(SerializeClosure* f) {
void java_util_ImmutableCollections_MapN::serialize_offsets(SerializeClosure* f) {
MAPN_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
}
#endif
@ -4527,6 +4527,7 @@ void JavaClasses::compute_hard_coded_offsets() {
java_lang_ref_Reference::discovered_offset = member_offset(java_lang_ref_Reference::hc_discovered_offset);
}
#define DO_COMPUTE_OFFSETS(k) k::compute_offsets();
// Compute non-hard-coded field offsets of all the classes in this file
void JavaClasses::compute_offsets() {
@ -4534,52 +4535,24 @@ void JavaClasses::compute_offsets() {
return; // field offsets are loaded from archive
}
// java_lang_Class::compute_offsets was called earlier in bootstrap
java_lang_System::compute_offsets();
java_lang_ClassLoader::compute_offsets();
java_lang_Throwable::compute_offsets();
java_lang_Thread::compute_offsets();
java_lang_ThreadGroup::compute_offsets();
java_lang_AssertionStatusDirectives::compute_offsets();
java_lang_ref_SoftReference::compute_offsets();
java_lang_invoke_MethodHandle::compute_offsets();
java_lang_invoke_DirectMethodHandle::compute_offsets();
java_lang_invoke_MemberName::compute_offsets();
java_lang_invoke_ResolvedMethodName::compute_offsets();
java_lang_invoke_LambdaForm::compute_offsets();
java_lang_invoke_MethodType::compute_offsets();
java_lang_invoke_CallSite::compute_offsets();
java_lang_invoke_MethodHandleNatives_CallSiteContext::compute_offsets();
java_security_AccessControlContext::compute_offsets();
// Initialize reflection classes. The layouts of these classes
// changed with the new reflection implementation in JDK 1.4, and
// since the Universe doesn't know what JDK version it is until this
// point we defer computation of these offsets until now.
java_lang_reflect_AccessibleObject::compute_offsets();
java_lang_reflect_Method::compute_offsets();
java_lang_reflect_Constructor::compute_offsets();
java_lang_reflect_Field::compute_offsets();
java_nio_Buffer::compute_offsets();
reflect_ConstantPool::compute_offsets();
reflect_UnsafeStaticFieldAccessorImpl::compute_offsets();
java_lang_reflect_Parameter::compute_offsets();
java_lang_Module::compute_offsets();
java_lang_StackTraceElement::compute_offsets();
java_lang_StackFrameInfo::compute_offsets();
java_lang_LiveStackFrameInfo::compute_offsets();
java_util_concurrent_locks_AbstractOwnableSynchronizer::compute_offsets();
java_lang_Integer_IntegerCache::compute_offsets();
java_lang_module_Configuration::compute_offsets();
java_util_ImmutableCollections_ListN::compute_offsets();
java_util_ImmutableCollections_MapN::compute_offsets();
java_util_ImmutableCollections_SetN::compute_offsets();
jdk_internal_module_ArchivedModuleGraph::compute_offsets();
// We have already called the compute_offsets() of the
// BASIC_JAVA_CLASSES_DO_PART1 classes (java_lang_String and java_lang_Class)
// earlier inside SystemDictionary::resolve_preloaded_classes()
BASIC_JAVA_CLASSES_DO_PART2(DO_COMPUTE_OFFSETS);
// generated interpreter code wants to know about the offsets we just computed:
AbstractAssembler::update_delayed_values();
}
#if INCLUDE_CDS
#define DO_SERIALIZE_OFFSETS(k) k::serialize_offsets(soc);
void JavaClasses::serialize_offsets(SerializeClosure* soc) {
BASIC_JAVA_CLASSES_DO(DO_SERIALIZE_OFFSETS);
}
#endif
#ifndef PRODUCT
// These functions exist to assert the validity of hard-coded field offsets to guard