1049 Klass *k = m->klass(); |
1049 Klass *k = m->klass(); |
1050 Handle archived_mirror_h(THREAD, archived_m); |
1050 Handle archived_mirror_h(THREAD, archived_m); |
1051 ResetMirrorField reset(archived_mirror_h); |
1051 ResetMirrorField reset(archived_mirror_h); |
1052 InstanceKlass::cast(k)->do_nonstatic_fields(&reset); |
1052 InstanceKlass::cast(k)->do_nonstatic_fields(&reset); |
1053 |
1053 |
1054 log_trace(cds, mirror)("Archived %s mirror object from " PTR_FORMAT " ==> " PTR_FORMAT, |
1054 log_trace(cds, heap, mirror)( |
1055 type2name((BasicType)t), p2i(Universe::_mirrors[t]), p2i(archived_m)); |
1055 "Archived %s mirror object from " PTR_FORMAT " ==> " PTR_FORMAT, |
|
1056 type2name((BasicType)t), p2i(Universe::_mirrors[t]), p2i(archived_m)); |
1056 |
1057 |
1057 Universe::_mirrors[t] = archived_m; |
1058 Universe::_mirrors[t] = archived_m; |
1058 } |
1059 } |
1059 } |
1060 } |
1060 |
1061 |
1131 k->set_archived_java_mirror_raw(archived_mirror); |
1132 k->set_archived_java_mirror_raw(archived_mirror); |
1132 |
1133 |
1133 k->set_has_raw_archived_mirror(); |
1134 k->set_has_raw_archived_mirror(); |
1134 |
1135 |
1135 ResourceMark rm; |
1136 ResourceMark rm; |
1136 log_trace(cds, mirror)("Archived %s mirror object from " PTR_FORMAT " ==> " PTR_FORMAT, |
1137 log_trace(cds, heap, mirror)( |
1137 k->external_name(), p2i(mirror), p2i(archived_mirror)); |
1138 "Archived %s mirror object from " PTR_FORMAT " ==> " PTR_FORMAT, |
|
1139 k->external_name(), p2i(mirror), p2i(archived_mirror)); |
1138 |
1140 |
1139 return archived_mirror; |
1141 return archived_mirror; |
1140 } |
1142 } |
1141 |
1143 |
1142 // The process is based on create_mirror(). |
1144 // The process is based on create_mirror(). |
1184 |
1186 |
1185 // The archived mirror's field at _klass_offset is still pointing to the original |
1187 // The archived mirror's field at _klass_offset is still pointing to the original |
1186 // klass. Updated the field in the archived mirror to point to the relocated |
1188 // klass. Updated the field in the archived mirror to point to the relocated |
1187 // klass in the archive. |
1189 // klass in the archive. |
1188 Klass *reloc_k = MetaspaceShared::get_relocated_klass(as_Klass(mirror)); |
1190 Klass *reloc_k = MetaspaceShared::get_relocated_klass(as_Klass(mirror)); |
1189 log_debug(cds, mirror)("Relocate mirror metadata field at _klass_offset from " PTR_FORMAT " ==> " PTR_FORMAT, |
1191 log_debug(cds, heap, mirror)( |
1190 p2i(as_Klass(mirror)), p2i(reloc_k)); |
1192 "Relocate mirror metadata field at _klass_offset from " PTR_FORMAT " ==> " PTR_FORMAT, |
|
1193 p2i(as_Klass(mirror)), p2i(reloc_k)); |
1191 archived_mirror->metadata_field_put(_klass_offset, reloc_k); |
1194 archived_mirror->metadata_field_put(_klass_offset, reloc_k); |
1192 |
1195 |
1193 // The field at _array_klass_offset is pointing to the original one dimension |
1196 // The field at _array_klass_offset is pointing to the original one dimension |
1194 // higher array klass if exists. Relocate the pointer. |
1197 // higher array klass if exists. Relocate the pointer. |
1195 Klass *arr = array_klass_acquire(mirror); |
1198 Klass *arr = array_klass_acquire(mirror); |
1196 if (arr != NULL) { |
1199 if (arr != NULL) { |
1197 Klass *reloc_arr = MetaspaceShared::get_relocated_klass(arr); |
1200 Klass *reloc_arr = MetaspaceShared::get_relocated_klass(arr); |
1198 log_debug(cds, mirror)("Relocate mirror metadata field at _array_klass_offset from " PTR_FORMAT " ==> " PTR_FORMAT, |
1201 log_debug(cds, heap, mirror)( |
1199 p2i(arr), p2i(reloc_arr)); |
1202 "Relocate mirror metadata field at _array_klass_offset from " PTR_FORMAT " ==> " PTR_FORMAT, |
|
1203 p2i(arr), p2i(reloc_arr)); |
1200 archived_mirror->metadata_field_put(_array_klass_offset, reloc_arr); |
1204 archived_mirror->metadata_field_put(_array_klass_offset, reloc_arr); |
1201 } |
1205 } |
1202 return archived_mirror; |
1206 return archived_mirror; |
1203 } |
1207 } |
1204 |
1208 |
1245 k->clear_has_raw_archived_mirror(); |
1249 k->clear_has_raw_archived_mirror(); |
1246 |
1250 |
1247 set_mirror_module_field(k, mirror, module, THREAD); |
1251 set_mirror_module_field(k, mirror, module, THREAD); |
1248 |
1252 |
1249 ResourceMark rm; |
1253 ResourceMark rm; |
1250 log_trace(cds, mirror)("Restored %s archived mirror " PTR_FORMAT, k->external_name(), p2i(mirror())); |
1254 log_trace(cds, heap, mirror)( |
|
1255 "Restored %s archived mirror " PTR_FORMAT, k->external_name(), p2i(mirror())); |
1251 |
1256 |
1252 return true; |
1257 return true; |
1253 } |
1258 } |
1254 #endif // INCLUDE_CDS_JAVA_HEAP |
1259 #endif // INCLUDE_CDS_JAVA_HEAP |
1255 |
1260 |
4271 int java_lang_AssertionStatusDirectives::deflt_offset; |
4276 int java_lang_AssertionStatusDirectives::deflt_offset; |
4272 int java_nio_Buffer::_limit_offset; |
4277 int java_nio_Buffer::_limit_offset; |
4273 int java_util_concurrent_locks_AbstractOwnableSynchronizer::_owner_offset; |
4278 int java_util_concurrent_locks_AbstractOwnableSynchronizer::_owner_offset; |
4274 int reflect_ConstantPool::_oop_offset; |
4279 int reflect_ConstantPool::_oop_offset; |
4275 int reflect_UnsafeStaticFieldAccessorImpl::_base_offset; |
4280 int reflect_UnsafeStaticFieldAccessorImpl::_base_offset; |
|
4281 int jdk_internal_module_ArchivedModuleGraph::_archivedSystemModules_offset; |
|
4282 int jdk_internal_module_ArchivedModuleGraph::_archivedModuleFinder_offset; |
|
4283 int jdk_internal_module_ArchivedModuleGraph::_archivedMainModule_offset; |
4276 |
4284 |
4277 #define STACKTRACEELEMENT_FIELDS_DO(macro) \ |
4285 #define STACKTRACEELEMENT_FIELDS_DO(macro) \ |
4278 macro(declaringClassObject_offset, k, "declaringClassObject", class_signature, false); \ |
4286 macro(declaringClassObject_offset, k, "declaringClassObject", class_signature, false); \ |
4279 macro(classLoaderName_offset, k, "classLoaderName", string_signature, false); \ |
4287 macro(classLoaderName_offset, k, "classLoaderName", string_signature, false); \ |
4280 macro(moduleName_offset, k, "moduleName", string_signature, false); \ |
4288 macro(moduleName_offset, k, "moduleName", string_signature, false); \ |
4432 #endif |
4440 #endif |
4433 |
4441 |
4434 static int member_offset(int hardcoded_offset) { |
4442 static int member_offset(int hardcoded_offset) { |
4435 return (hardcoded_offset * heapOopSize) + instanceOopDesc::base_offset_in_bytes(); |
4443 return (hardcoded_offset * heapOopSize) + instanceOopDesc::base_offset_in_bytes(); |
4436 } |
4444 } |
|
4445 |
|
4446 #define MODULEBOOTSTRAP_FIELDS_DO(macro) \ |
|
4447 macro(_archivedSystemModules_offset, k, "archivedSystemModules", systemModules_signature, true); \ |
|
4448 macro(_archivedModuleFinder_offset, k, "archivedModuleFinder", moduleFinder_signature, true); \ |
|
4449 macro(_archivedMainModule_offset, k, "archivedMainModule", string_signature, true) |
|
4450 |
|
4451 void jdk_internal_module_ArchivedModuleGraph::compute_offsets() { |
|
4452 InstanceKlass* k = SystemDictionary::ArchivedModuleGraph_klass(); |
|
4453 assert(k != NULL, "must be loaded"); |
|
4454 MODULEBOOTSTRAP_FIELDS_DO(FIELD_COMPUTE_OFFSET); |
|
4455 } |
|
4456 |
|
4457 #if INCLUDE_CDS |
|
4458 void jdk_internal_module_ArchivedModuleGraph::serialize(SerializeClosure* f) { |
|
4459 MODULEBOOTSTRAP_FIELDS_DO(FIELD_SERIALIZE_OFFSET); |
|
4460 } |
|
4461 #endif |
4437 |
4462 |
4438 // Compute hard-coded offsets |
4463 // Compute hard-coded offsets |
4439 // Invoked before SystemDictionary::initialize, so pre-loaded classes |
4464 // Invoked before SystemDictionary::initialize, so pre-loaded classes |
4440 // are not available to determine the offset_of_static_fields. |
4465 // are not available to determine the offset_of_static_fields. |
4441 void JavaClasses::compute_hard_coded_offsets() { |
4466 void JavaClasses::compute_hard_coded_offsets() { |
4491 java_lang_StackTraceElement::compute_offsets(); |
4516 java_lang_StackTraceElement::compute_offsets(); |
4492 java_lang_StackFrameInfo::compute_offsets(); |
4517 java_lang_StackFrameInfo::compute_offsets(); |
4493 java_lang_LiveStackFrameInfo::compute_offsets(); |
4518 java_lang_LiveStackFrameInfo::compute_offsets(); |
4494 java_util_concurrent_locks_AbstractOwnableSynchronizer::compute_offsets(); |
4519 java_util_concurrent_locks_AbstractOwnableSynchronizer::compute_offsets(); |
4495 |
4520 |
|
4521 jdk_internal_module_ArchivedModuleGraph::compute_offsets(); |
|
4522 |
4496 // generated interpreter code wants to know about the offsets we just computed: |
4523 // generated interpreter code wants to know about the offsets we just computed: |
4497 AbstractAssembler::update_delayed_values(); |
4524 AbstractAssembler::update_delayed_values(); |
4498 } |
4525 } |
4499 |
4526 |
4500 #ifndef PRODUCT |
4527 #ifndef PRODUCT |