< prev index next >

src/hotspot/share/classfile/javaClasses.cpp

Print this page
rev 51374 : 8209120: Archive the Integer.IntegerCache
Reviewed-by: jiangli, alanb, plevart


4234 int java_lang_StackFrameInfo::_memberName_offset;
4235 int java_lang_StackFrameInfo::_bci_offset;
4236 int java_lang_StackFrameInfo::_version_offset;
4237 int java_lang_LiveStackFrameInfo::_monitors_offset;
4238 int java_lang_LiveStackFrameInfo::_locals_offset;
4239 int java_lang_LiveStackFrameInfo::_operands_offset;
4240 int java_lang_LiveStackFrameInfo::_mode_offset;
4241 int java_lang_AssertionStatusDirectives::classes_offset;
4242 int java_lang_AssertionStatusDirectives::classEnabled_offset;
4243 int java_lang_AssertionStatusDirectives::packages_offset;
4244 int java_lang_AssertionStatusDirectives::packageEnabled_offset;
4245 int java_lang_AssertionStatusDirectives::deflt_offset;
4246 int java_nio_Buffer::_limit_offset;
4247 int java_util_concurrent_locks_AbstractOwnableSynchronizer::_owner_offset;
4248 int reflect_ConstantPool::_oop_offset;
4249 int reflect_UnsafeStaticFieldAccessorImpl::_base_offset;
4250 int jdk_internal_module_ArchivedModuleGraph::_archivedSystemModules_offset;
4251 int jdk_internal_module_ArchivedModuleGraph::_archivedModuleFinder_offset;
4252 int jdk_internal_module_ArchivedModuleGraph::_archivedMainModule_offset;
4253 int jdk_internal_module_ArchivedModuleGraph::_archivedConfiguration_offset;

4254 int java_lang_module_Configuration::_EMPTY_CONFIGURATION_offset;
4255 int java_util_ImmutableCollections_ListN::_EMPTY_LIST_offset;
4256 int java_util_ImmutableCollections_SetN::_EMPTY_SET_offset;
4257 int java_util_ImmutableCollections_MapN::_EMPTY_MAP_offset;
4258 
4259 #define STACKTRACEELEMENT_FIELDS_DO(macro) \
4260   macro(declaringClassObject_offset,  k, "declaringClassObject", class_signature, false); \
4261   macro(classLoaderName_offset, k, "classLoaderName", string_signature, false); \
4262   macro(moduleName_offset,      k, "moduleName",      string_signature, false); \
4263   macro(moduleVersion_offset,   k, "moduleVersion",   string_signature, false); \
4264   macro(declaringClass_offset,  k, "declaringClass",  string_signature, false); \
4265   macro(methodName_offset,      k, "methodName",      string_signature, false); \
4266   macro(fileName_offset,        k, "fileName",        string_signature, false); \
4267   macro(lineNumber_offset,      k, "lineNumber",      int_signature,    false)
4268 
4269 // Support for java_lang_StackTraceElement
4270 void java_lang_StackTraceElement::compute_offsets() {
4271   InstanceKlass* k = SystemDictionary::StackTraceElement_klass();
4272   STACKTRACEELEMENT_FIELDS_DO(FIELD_COMPUTE_OFFSET);
4273 }


4400 void java_util_concurrent_locks_AbstractOwnableSynchronizer::compute_offsets() {
4401   InstanceKlass* k = SystemDictionary::java_util_concurrent_locks_AbstractOwnableSynchronizer_klass();
4402   AOS_FIELDS_DO(FIELD_COMPUTE_OFFSET);
4403 }
4404 
4405 oop java_util_concurrent_locks_AbstractOwnableSynchronizer::get_owner_threadObj(oop obj) {
4406   assert(_owner_offset != 0, "Must be initialized");
4407   return obj->obj_field(_owner_offset);
4408 }
4409 
4410 #if INCLUDE_CDS
4411 void java_util_concurrent_locks_AbstractOwnableSynchronizer::serialize(SerializeClosure* f) {
4412   AOS_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
4413 }
4414 #endif
4415 
4416 static int member_offset(int hardcoded_offset) {
4417   return (hardcoded_offset * heapOopSize) + instanceOopDesc::base_offset_in_bytes();
4418 }
4419 















4420 #define ARCHIVEDMODULEGRAPH_FIELDS_DO(macro) \
4421   macro(_archivedSystemModules_offset,      k, "archivedSystemModules", systemModules_signature, true); \
4422   macro(_archivedModuleFinder_offset,       k, "archivedModuleFinder",  moduleFinder_signature,  true); \
4423   macro(_archivedMainModule_offset,         k, "archivedMainModule",    string_signature,        true); \
4424   macro(_archivedConfiguration_offset,      k, "archivedConfiguration", configuration_signature, true)
4425 
4426 void jdk_internal_module_ArchivedModuleGraph::compute_offsets() {
4427   InstanceKlass* k = SystemDictionary::ArchivedModuleGraph_klass();
4428   assert(k != NULL, "must be loaded");
4429   ARCHIVEDMODULEGRAPH_FIELDS_DO(FIELD_COMPUTE_OFFSET);
4430 }
4431 
4432 #if INCLUDE_CDS
4433 void jdk_internal_module_ArchivedModuleGraph::serialize(SerializeClosure* f) {
4434   ARCHIVEDMODULEGRAPH_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
4435 }
4436 #endif
4437 
4438 #define CONFIGURATION_FIELDS_DO(macro) \
4439   macro(_EMPTY_CONFIGURATION_offset, k, "EMPTY_CONFIGURATION", configuration_signature, true)


4536   java_lang_invoke_MethodHandleNatives_CallSiteContext::compute_offsets();
4537   java_security_AccessControlContext::compute_offsets();
4538   // Initialize reflection classes. The layouts of these classes
4539   // changed with the new reflection implementation in JDK 1.4, and
4540   // since the Universe doesn't know what JDK version it is until this
4541   // point we defer computation of these offsets until now.
4542   java_lang_reflect_AccessibleObject::compute_offsets();
4543   java_lang_reflect_Method::compute_offsets();
4544   java_lang_reflect_Constructor::compute_offsets();
4545   java_lang_reflect_Field::compute_offsets();
4546   java_nio_Buffer::compute_offsets();
4547   reflect_ConstantPool::compute_offsets();
4548   reflect_UnsafeStaticFieldAccessorImpl::compute_offsets();
4549   java_lang_reflect_Parameter::compute_offsets();
4550   java_lang_Module::compute_offsets();
4551   java_lang_StackTraceElement::compute_offsets();
4552   java_lang_StackFrameInfo::compute_offsets();
4553   java_lang_LiveStackFrameInfo::compute_offsets();
4554   java_util_concurrent_locks_AbstractOwnableSynchronizer::compute_offsets();
4555 

4556   java_lang_module_Configuration::compute_offsets();
4557   java_util_ImmutableCollections_ListN::compute_offsets();
4558   java_util_ImmutableCollections_MapN::compute_offsets();
4559   java_util_ImmutableCollections_SetN::compute_offsets();
4560   jdk_internal_module_ArchivedModuleGraph::compute_offsets();
4561 
4562   // generated interpreter code wants to know about the offsets we just computed:
4563   AbstractAssembler::update_delayed_values();
4564 }
4565 
4566 #ifndef PRODUCT
4567 
4568 // These functions exist to assert the validity of hard-coded field offsets to guard
4569 // against changes in the class files
4570 
4571 bool JavaClasses::check_offset(const char *klass_name, int hardcoded_offset, const char *field_name, const char* field_sig) {
4572   EXCEPTION_MARK;
4573   fieldDescriptor fd;
4574   TempNewSymbol klass_sym = SymbolTable::new_symbol(klass_name, CATCH);
4575   Klass* k = SystemDictionary::resolve_or_fail(klass_sym, true, CATCH);




4234 int java_lang_StackFrameInfo::_memberName_offset;
4235 int java_lang_StackFrameInfo::_bci_offset;
4236 int java_lang_StackFrameInfo::_version_offset;
4237 int java_lang_LiveStackFrameInfo::_monitors_offset;
4238 int java_lang_LiveStackFrameInfo::_locals_offset;
4239 int java_lang_LiveStackFrameInfo::_operands_offset;
4240 int java_lang_LiveStackFrameInfo::_mode_offset;
4241 int java_lang_AssertionStatusDirectives::classes_offset;
4242 int java_lang_AssertionStatusDirectives::classEnabled_offset;
4243 int java_lang_AssertionStatusDirectives::packages_offset;
4244 int java_lang_AssertionStatusDirectives::packageEnabled_offset;
4245 int java_lang_AssertionStatusDirectives::deflt_offset;
4246 int java_nio_Buffer::_limit_offset;
4247 int java_util_concurrent_locks_AbstractOwnableSynchronizer::_owner_offset;
4248 int reflect_ConstantPool::_oop_offset;
4249 int reflect_UnsafeStaticFieldAccessorImpl::_base_offset;
4250 int jdk_internal_module_ArchivedModuleGraph::_archivedSystemModules_offset;
4251 int jdk_internal_module_ArchivedModuleGraph::_archivedModuleFinder_offset;
4252 int jdk_internal_module_ArchivedModuleGraph::_archivedMainModule_offset;
4253 int jdk_internal_module_ArchivedModuleGraph::_archivedConfiguration_offset;
4254 int java_lang_Integer_IntegerCache::_archivedCache_offset;
4255 int java_lang_module_Configuration::_EMPTY_CONFIGURATION_offset;
4256 int java_util_ImmutableCollections_ListN::_EMPTY_LIST_offset;
4257 int java_util_ImmutableCollections_SetN::_EMPTY_SET_offset;
4258 int java_util_ImmutableCollections_MapN::_EMPTY_MAP_offset;
4259 
4260 #define STACKTRACEELEMENT_FIELDS_DO(macro) \
4261   macro(declaringClassObject_offset,  k, "declaringClassObject", class_signature, false); \
4262   macro(classLoaderName_offset, k, "classLoaderName", string_signature, false); \
4263   macro(moduleName_offset,      k, "moduleName",      string_signature, false); \
4264   macro(moduleVersion_offset,   k, "moduleVersion",   string_signature, false); \
4265   macro(declaringClass_offset,  k, "declaringClass",  string_signature, false); \
4266   macro(methodName_offset,      k, "methodName",      string_signature, false); \
4267   macro(fileName_offset,        k, "fileName",        string_signature, false); \
4268   macro(lineNumber_offset,      k, "lineNumber",      int_signature,    false)
4269 
4270 // Support for java_lang_StackTraceElement
4271 void java_lang_StackTraceElement::compute_offsets() {
4272   InstanceKlass* k = SystemDictionary::StackTraceElement_klass();
4273   STACKTRACEELEMENT_FIELDS_DO(FIELD_COMPUTE_OFFSET);
4274 }


4401 void java_util_concurrent_locks_AbstractOwnableSynchronizer::compute_offsets() {
4402   InstanceKlass* k = SystemDictionary::java_util_concurrent_locks_AbstractOwnableSynchronizer_klass();
4403   AOS_FIELDS_DO(FIELD_COMPUTE_OFFSET);
4404 }
4405 
4406 oop java_util_concurrent_locks_AbstractOwnableSynchronizer::get_owner_threadObj(oop obj) {
4407   assert(_owner_offset != 0, "Must be initialized");
4408   return obj->obj_field(_owner_offset);
4409 }
4410 
4411 #if INCLUDE_CDS
4412 void java_util_concurrent_locks_AbstractOwnableSynchronizer::serialize(SerializeClosure* f) {
4413   AOS_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
4414 }
4415 #endif
4416 
4417 static int member_offset(int hardcoded_offset) {
4418   return (hardcoded_offset * heapOopSize) + instanceOopDesc::base_offset_in_bytes();
4419 }
4420 
4421 #define INTEGERCACHE_FIELDS_DO(macro) \
4422   macro(_archivedCache_offset,  k, "archivedCache",  java_lang_Integer_array_signature, true)
4423 
4424 void java_lang_Integer_IntegerCache::compute_offsets() {
4425   InstanceKlass* k = SystemDictionary::Integer_IntegerCache_klass();
4426   assert(k != NULL, "must be loaded");
4427   INTEGERCACHE_FIELDS_DO(FIELD_COMPUTE_OFFSET);
4428 }
4429 
4430 #if INCLUDE_CDS
4431 void java_lang_Integer_IntegerCache::serialize(SerializeClosure* f) {
4432   INTEGERCACHE_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
4433 }
4434 #endif
4435 
4436 #define ARCHIVEDMODULEGRAPH_FIELDS_DO(macro) \
4437   macro(_archivedSystemModules_offset,      k, "archivedSystemModules", systemModules_signature, true); \
4438   macro(_archivedModuleFinder_offset,       k, "archivedModuleFinder",  moduleFinder_signature,  true); \
4439   macro(_archivedMainModule_offset,         k, "archivedMainModule",    string_signature,        true); \
4440   macro(_archivedConfiguration_offset,      k, "archivedConfiguration", configuration_signature, true)
4441 
4442 void jdk_internal_module_ArchivedModuleGraph::compute_offsets() {
4443   InstanceKlass* k = SystemDictionary::ArchivedModuleGraph_klass();
4444   assert(k != NULL, "must be loaded");
4445   ARCHIVEDMODULEGRAPH_FIELDS_DO(FIELD_COMPUTE_OFFSET);
4446 }
4447 
4448 #if INCLUDE_CDS
4449 void jdk_internal_module_ArchivedModuleGraph::serialize(SerializeClosure* f) {
4450   ARCHIVEDMODULEGRAPH_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
4451 }
4452 #endif
4453 
4454 #define CONFIGURATION_FIELDS_DO(macro) \
4455   macro(_EMPTY_CONFIGURATION_offset, k, "EMPTY_CONFIGURATION", configuration_signature, true)


4552   java_lang_invoke_MethodHandleNatives_CallSiteContext::compute_offsets();
4553   java_security_AccessControlContext::compute_offsets();
4554   // Initialize reflection classes. The layouts of these classes
4555   // changed with the new reflection implementation in JDK 1.4, and
4556   // since the Universe doesn't know what JDK version it is until this
4557   // point we defer computation of these offsets until now.
4558   java_lang_reflect_AccessibleObject::compute_offsets();
4559   java_lang_reflect_Method::compute_offsets();
4560   java_lang_reflect_Constructor::compute_offsets();
4561   java_lang_reflect_Field::compute_offsets();
4562   java_nio_Buffer::compute_offsets();
4563   reflect_ConstantPool::compute_offsets();
4564   reflect_UnsafeStaticFieldAccessorImpl::compute_offsets();
4565   java_lang_reflect_Parameter::compute_offsets();
4566   java_lang_Module::compute_offsets();
4567   java_lang_StackTraceElement::compute_offsets();
4568   java_lang_StackFrameInfo::compute_offsets();
4569   java_lang_LiveStackFrameInfo::compute_offsets();
4570   java_util_concurrent_locks_AbstractOwnableSynchronizer::compute_offsets();
4571 
4572   java_lang_Integer_IntegerCache::compute_offsets();
4573   java_lang_module_Configuration::compute_offsets();
4574   java_util_ImmutableCollections_ListN::compute_offsets();
4575   java_util_ImmutableCollections_MapN::compute_offsets();
4576   java_util_ImmutableCollections_SetN::compute_offsets();
4577   jdk_internal_module_ArchivedModuleGraph::compute_offsets();
4578 
4579   // generated interpreter code wants to know about the offsets we just computed:
4580   AbstractAssembler::update_delayed_values();
4581 }
4582 
4583 #ifndef PRODUCT
4584 
4585 // These functions exist to assert the validity of hard-coded field offsets to guard
4586 // against changes in the class files
4587 
4588 bool JavaClasses::check_offset(const char *klass_name, int hardcoded_offset, const char *field_name, const char* field_sig) {
4589   EXCEPTION_MARK;
4590   fieldDescriptor fd;
4591   TempNewSymbol klass_sym = SymbolTable::new_symbol(klass_name, CATCH);
4592   Klass* k = SystemDictionary::resolve_or_fail(klass_sym, true, CATCH);


< prev index next >