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