src/share/vm/classfile/classFileParser.cpp

changeset 9931
fd44df5e3bc3
parent 9572
624a0741915c
parent 9859
7d05a422d710
child 10015
eb7ce841ccec
equal deleted inserted replaced
9855:274a1ea904c8 9931:fd44df5e3bc3
3882 } 3882 }
3883 verify_legal_class_modifiers(flags, CHECK_(nullHandle)); 3883 verify_legal_class_modifiers(flags, CHECK_(nullHandle));
3884 access_flags.set_flags(flags); 3884 access_flags.set_flags(flags);
3885 3885
3886 // This class and superclass 3886 // This class and superclass
3887 u2 this_class_index = cfs->get_u2_fast(); 3887 _this_class_index = cfs->get_u2_fast();
3888 check_property( 3888 check_property(
3889 valid_cp_range(this_class_index, cp_size) && 3889 valid_cp_range(_this_class_index, cp_size) &&
3890 cp->tag_at(this_class_index).is_unresolved_klass(), 3890 cp->tag_at(_this_class_index).is_unresolved_klass(),
3891 "Invalid this class index %u in constant pool in class file %s", 3891 "Invalid this class index %u in constant pool in class file %s",
3892 this_class_index, CHECK_(nullHandle)); 3892 _this_class_index, CHECK_(nullHandle));
3893 3893
3894 Symbol* class_name = cp->unresolved_klass_at(this_class_index); 3894 Symbol* class_name = cp->unresolved_klass_at(_this_class_index);
3895 assert(class_name != NULL, "class_name can't be null"); 3895 assert(class_name != NULL, "class_name can't be null");
3896 3896
3897 // It's important to set parsed_name *before* resolving the super class. 3897 // It's important to set parsed_name *before* resolving the super class.
3898 // (it's used for cleanup by the caller if parsing fails) 3898 // (it's used for cleanup by the caller if parsing fails)
3899 parsed_name = class_name; 3899 parsed_name = class_name;
4120 // is managed on the assumption that the initial cache 4120 // is managed on the assumption that the initial cache
4121 // size is equal to the number of methods in the class. If 4121 // size is equal to the number of methods in the class. If
4122 // that changes, then InstanceKlass::idnum_can_increment() 4122 // that changes, then InstanceKlass::idnum_can_increment()
4123 // has to be changed accordingly. 4123 // has to be changed accordingly.
4124 this_klass->set_initial_method_idnum(methods->length()); 4124 this_klass->set_initial_method_idnum(methods->length());
4125 this_klass->set_name(cp->klass_name_at(this_class_index)); 4125 this_klass->set_name(cp->klass_name_at(_this_class_index));
4126 if (is_anonymous()) // I am well known to myself 4126 if (is_anonymous()) // I am well known to myself
4127 cp->klass_at_put(this_class_index, this_klass()); // eagerly resolve 4127 cp->klass_at_put(_this_class_index, this_klass()); // eagerly resolve
4128 4128
4129 this_klass->set_minor_version(minor_version); 4129 this_klass->set_minor_version(minor_version);
4130 this_klass->set_major_version(major_version); 4130 this_klass->set_major_version(major_version);
4131 this_klass->set_has_default_methods(has_default_methods); 4131 this_klass->set_has_default_methods(has_default_methods);
4132 this_klass->set_declares_default_methods(declares_default_methods); 4132 this_klass->set_declares_default_methods(declares_default_methods);
4259 } 4259 }
4260 4260
4261 // preserve result across HandleMark 4261 // preserve result across HandleMark
4262 preserve_this_klass = this_klass(); 4262 preserve_this_klass = this_klass();
4263 } 4263 }
4264
4265 JFR_ONLY(INIT_ID(preserve_this_klass);)
4264 4266
4265 // Create new handle outside HandleMark (might be needed for 4267 // Create new handle outside HandleMark (might be needed for
4266 // Extended Class Redefinition) 4268 // Extended Class Redefinition)
4267 instanceKlassHandle this_klass (THREAD, preserve_this_klass); 4269 instanceKlassHandle this_klass (THREAD, preserve_this_klass);
4268 debug_only(this_klass->verify();) 4270 debug_only(this_klass->verify();)
5271 return NULL; 5273 return NULL;
5272 } 5274 }
5273 } 5275 }
5274 return NULL; 5276 return NULL;
5275 } 5277 }
5278
5279 #if INCLUDE_JFR
5280
5281 // Caller responsible for ResourceMark
5282 // clone stream with rewound position
5283 ClassFileStream* ClassFileParser::clone_stream() const {
5284 assert(_stream != NULL, "invariant");
5285
5286 return _stream->clone();
5287 }
5288
5289 void ClassFileParser::set_klass_to_deallocate(InstanceKlass* klass) {
5290 #ifdef ASSERT
5291 if (klass != NULL) {
5292 assert(NULL == _klass, "leaking?");
5293 }
5294 #endif
5295
5296 _klass = klass;
5297 }
5298
5299 #endif // INCLUDE_JFR

mercurial