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 const char* name = NULL;
4116 oop nameOop = java_lang_ClassLoader::name(loader);
4117 if (nameOop != NULL) {
4118 name = java_lang_String::as_utf8_string(nameOop);
4119 }
4120
4121 stringStream ss;
4122 const char *seperator;
4123 // If we have a name set for this loader, display it. Otherwise use
4124 // the class of the loader.
4125 if (name != NULL) {
4126 ss.print("\"%s\" (instance of %s", name, loader->klass()->external_name());
4127 seperator = ", ";
4128 } else {
4129 ss.print("instance of %s", loader->klass()->external_name());
4130 seperator = " (";
4131 }
4132
4133 oop pl = java_lang_ClassLoader::parent(loader);
4134 if (pl != NULL) {
4135 ss.print("%sparent: ", seperator);
4136 oop parentNameOop = java_lang_ClassLoader::name(pl);
4137 if (parentNameOop != NULL) {
4138 const char* parentName = java_lang_String::as_utf8_string(parentNameOop);
4139 if (parentName != NULL) {
4140 ss.print("\"%s\" ", parentName);
4141 }
4142 }
4143 ss.print("%s)", pl->klass()->external_name());
4144 } else {
4145 ss.print("%sparent: <bootstrap>)", seperator);
4146 }
4147 return ss.as_string();
4148 }
4149
4150 // Support for java_lang_System
4151 //
4152 #define SYSTEM_FIELDS_DO(macro) \
4153 macro(static_in_offset, k, "in", input_stream_signature, true); \
4154 macro(static_out_offset, k, "out", print_stream_signature, true); \
4155 macro(static_err_offset, k, "err", print_stream_signature, true); \
4156 macro(static_security_offset, k, "security", security_manager_signature, true)
4157
4158 void java_lang_System::compute_offsets() {
4159 InstanceKlass* k = SystemDictionary::System_klass();
4160 SYSTEM_FIELDS_DO(FIELD_COMPUTE_OFFSET);
4161 }
4162
4163 #if INCLUDE_CDS
4164 void java_lang_System::serialize(SerializeClosure* f) {
4165 SYSTEM_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
4166 }
4167 #endif
4168
4169 int java_lang_System::in_offset_in_bytes() { return static_in_offset; }
|