< prev index next >

src/hotspot/share/classfile/javaClasses.cpp

Print this page




4107   }
4108   return false;
4109 }
4110 
4111 oop java_lang_ClassLoader::non_reflection_class_loader(oop loader) {
4112   // See whether this is one of the class loaders associated with
4113   // the generated bytecodes for reflection, and if so, "magically"
4114   // delegate to its parent to prevent class loading from occurring
4115   // in places where applications using reflection didn't expect it.
4116   if (is_reflection_class_loader(loader)) {
4117     return parent(loader);
4118   }
4119   return loader;
4120 }
4121 
4122 oop java_lang_ClassLoader::unnamedModule(oop loader) {
4123   assert(is_instance(loader), "loader must be oop");
4124   return loader->obj_field(unnamedModule_offset);
4125 }
4126 
4127 // Caller needs ResourceMark.
4128 const char* java_lang_ClassLoader::describe_external(const oop loader) {
4129   ClassLoaderData *cld = ClassLoaderData::class_loader_data(loader);
4130   const char* name = cld->loader_name_and_id();
4131 
4132   // bootstrap loader
4133   if (loader == NULL) {
4134     return name;
4135   }
4136 
4137   bool well_known_loader = SystemDictionary::is_system_class_loader(loader) ||
4138                            SystemDictionary::is_platform_class_loader(loader);
4139 
4140   stringStream ss;
4141   ss.print("%s (instance of %s", name, loader->klass()->external_name());
4142   if (!well_known_loader) {
4143     oop pl = java_lang_ClassLoader::parent(loader);
4144     ClassLoaderData *pl_cld = ClassLoaderData::class_loader_data(pl);
4145     const char* parentName = pl_cld->loader_name_and_id();
4146     if (pl != NULL) {
4147       ss.print(", child of %s %s", parentName, pl->klass()->external_name());
4148     } else {
4149       // bootstrap loader
4150       ss.print(", child of %s", parentName);
4151     }
4152   }
4153   ss.print(")");
4154 
4155   return ss.as_string();
4156 }
4157 
4158 // Support for java_lang_System
4159 //
4160 #define SYSTEM_FIELDS_DO(macro) \
4161   macro(static_in_offset,  k, "in",  input_stream_signature, true); \
4162   macro(static_out_offset, k, "out", print_stream_signature, true); \
4163   macro(static_err_offset, k, "err", print_stream_signature, true); \
4164   macro(static_security_offset, k, "security", security_manager_signature, true)
4165 
4166 void java_lang_System::compute_offsets() {
4167   InstanceKlass* k = SystemDictionary::System_klass();
4168   SYSTEM_FIELDS_DO(FIELD_COMPUTE_OFFSET);
4169 }
4170 
4171 #if INCLUDE_CDS
4172 void java_lang_System::serialize(SerializeClosure* f) {
4173    SYSTEM_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
4174 }
4175 #endif
4176 
4177 int java_lang_System::in_offset_in_bytes() { return static_in_offset; }




4107   }
4108   return false;
4109 }
4110 
4111 oop java_lang_ClassLoader::non_reflection_class_loader(oop loader) {
4112   // See whether this is one of the class loaders associated with
4113   // the generated bytecodes for reflection, and if so, "magically"
4114   // delegate to its parent to prevent class loading from occurring
4115   // in places where applications using reflection didn't expect it.
4116   if (is_reflection_class_loader(loader)) {
4117     return parent(loader);
4118   }
4119   return loader;
4120 }
4121 
4122 oop java_lang_ClassLoader::unnamedModule(oop loader) {
4123   assert(is_instance(loader), "loader must be oop");
4124   return loader->obj_field(unnamedModule_offset);
4125 }
4126 































4127 // Support for java_lang_System
4128 //
4129 #define SYSTEM_FIELDS_DO(macro) \
4130   macro(static_in_offset,  k, "in",  input_stream_signature, true); \
4131   macro(static_out_offset, k, "out", print_stream_signature, true); \
4132   macro(static_err_offset, k, "err", print_stream_signature, true); \
4133   macro(static_security_offset, k, "security", security_manager_signature, true)
4134 
4135 void java_lang_System::compute_offsets() {
4136   InstanceKlass* k = SystemDictionary::System_klass();
4137   SYSTEM_FIELDS_DO(FIELD_COMPUTE_OFFSET);
4138 }
4139 
4140 #if INCLUDE_CDS
4141 void java_lang_System::serialize(SerializeClosure* f) {
4142    SYSTEM_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
4143 }
4144 #endif
4145 
4146 int java_lang_System::in_offset_in_bytes() { return static_in_offset; }


< prev index next >