5404 |
5404 |
5405 ClassFileParser::ClassFileParser(ClassFileStream* stream, |
5405 ClassFileParser::ClassFileParser(ClassFileStream* stream, |
5406 Symbol* name, |
5406 Symbol* name, |
5407 ClassLoaderData* loader_data, |
5407 ClassLoaderData* loader_data, |
5408 Handle protection_domain, |
5408 Handle protection_domain, |
5409 TempNewSymbol* parsed_name, |
|
5410 const Klass* host_klass, |
5409 const Klass* host_klass, |
5411 GrowableArray<Handle>* cp_patches, |
5410 GrowableArray<Handle>* cp_patches, |
5412 Publicity pub_level, |
5411 Publicity pub_level, |
5413 TRAPS) : |
5412 TRAPS) : |
5414 _stream(stream), |
5413 _stream(stream), |
5415 _requested_name(name), |
5414 _requested_name(name), |
5416 _loader_data(loader_data), |
5415 _loader_data(loader_data), |
5417 _host_klass(host_klass), |
5416 _host_klass(host_klass), |
5418 _cp_patches(cp_patches), |
5417 _cp_patches(cp_patches), |
5419 _parsed_name(parsed_name), |
|
5420 _super_klass(), |
5418 _super_klass(), |
5421 _cp(NULL), |
5419 _cp(NULL), |
5422 _fields(NULL), |
5420 _fields(NULL), |
5423 _methods(NULL), |
5421 _methods(NULL), |
5424 _inner_classes(NULL), |
5422 _inner_classes(NULL), |
5655 _this_class_index, CHECK); |
5653 _this_class_index, CHECK); |
5656 |
5654 |
5657 Symbol* const class_name_in_cp = cp->klass_name_at(_this_class_index); |
5655 Symbol* const class_name_in_cp = cp->klass_name_at(_this_class_index); |
5658 assert(class_name_in_cp != NULL, "class_name can't be null"); |
5656 assert(class_name_in_cp != NULL, "class_name can't be null"); |
5659 |
5657 |
5660 if (_parsed_name != NULL) { |
|
5661 // It's important to set parsed_name *before* resolving the super class. |
|
5662 // (it's used for cleanup by the caller if parsing fails) |
|
5663 *_parsed_name = class_name_in_cp; |
|
5664 // parsed_name is returned and can be used if there's an error, so add to |
|
5665 // its reference count. Caller will decrement the refcount. |
|
5666 (*_parsed_name)->increment_refcount(); |
|
5667 } |
|
5668 |
|
5669 // Update _class_name which could be null previously |
5658 // Update _class_name which could be null previously |
5670 // to reflect the name in the constant pool |
5659 // to reflect the name in the constant pool |
5671 _class_name = class_name_in_cp; |
5660 _class_name = class_name_in_cp; |
5672 |
5661 |
5673 // Don't need to check whether this class name is legal or not. |
5662 // Don't need to check whether this class name is legal or not. |
5690 _requested_name != NULL ? _requested_name->as_C_string() : "NoName" |
5679 _requested_name != NULL ? _requested_name->as_C_string() : "NoName" |
5691 ); |
5680 ); |
5692 return; |
5681 return; |
5693 } |
5682 } |
5694 |
5683 |
|
5684 // Verification prevents us from creating names with dots in them, this |
|
5685 // asserts that that's the case. |
|
5686 assert(is_internal_format(_class_name), "external class name format used internally"); |
|
5687 |
5695 if (!is_internal()) { |
5688 if (!is_internal()) { |
5696 if (log_is_enabled(Debug, class, preorder)){ |
5689 if (log_is_enabled(Debug, class, preorder)){ |
5697 ResourceMark rm(THREAD); |
5690 ResourceMark rm(THREAD); |
5698 outputStream* log = Log(class, preorder)::debug_stream(); |
5691 outputStream* log = Log(class, preorder)::debug_stream(); |
5699 log->print("%s", _class_name->as_klass_external_name()); |
5692 log->print("%s", _class_name->as_klass_external_name()); |
5898 const ClassFileStream* ClassFileParser::clone_stream() const { |
5891 const ClassFileStream* ClassFileParser::clone_stream() const { |
5899 assert(_stream != NULL, "invariant"); |
5892 assert(_stream != NULL, "invariant"); |
5900 |
5893 |
5901 return _stream->clone(); |
5894 return _stream->clone(); |
5902 } |
5895 } |
|
5896 // ---------------------------------------------------------------------------- |
|
5897 // debugging |
|
5898 |
|
5899 #ifdef ASSERT |
|
5900 |
|
5901 // return true if class_name contains no '.' (internal format is '/') |
|
5902 bool ClassFileParser::is_internal_format(Symbol* class_name) { |
|
5903 if (class_name != NULL) { |
|
5904 ResourceMark rm; |
|
5905 char* name = class_name->as_C_string(); |
|
5906 return strchr(name, '.') == NULL; |
|
5907 } else { |
|
5908 return true; |
|
5909 } |
|
5910 } |
|
5911 |
|
5912 #endif |