136 }
137
138 if (SystemDictionary::ClassLoader_klass_loaded()) {
139 const Klass* const super_klass = parser.super_klass();
140 if (super_klass != NULL) {
141 if (super_klass->is_subtype_of(SystemDictionary::ClassLoader_klass())) {
142 return true;
143 }
144 }
145 }
146 return false;
147 }
148
149 InstanceKlass* InstanceKlass::allocate_instance_klass(const ClassFileParser& parser, TRAPS) {
150 const int size = InstanceKlass::size(parser.vtable_size(),
151 parser.itable_size(),
152 nonstatic_oop_map_size(parser.total_oop_map_count()),
153 parser.is_interface(),
154 parser.is_anonymous(),
155 should_store_fingerprint(parser.is_anonymous()),
156 parser.has_value_fields() ? parser.java_fields_count() : 0,
157 parser.is_value_type());
158
159 const Symbol* const class_name = parser.class_name();
160 assert(class_name != NULL, "invariant");
161 ClassLoaderData* loader_data = parser.loader_data();
162 assert(loader_data != NULL, "invariant");
163
164 InstanceKlass* ik;
165
166 // Allocation
167 if (REF_NONE == parser.reference_type()) {
168 if (class_name == vmSymbols::java_lang_Class()) {
169 // mirror
170 ik = new (loader_data, size, THREAD) InstanceMirrorKlass(parser);
171 } else if (is_class_loader(class_name, parser)) {
172 // class loader
173 ik = new (loader_data, size, THREAD) InstanceClassLoaderKlass(parser);
174 } else if (parser.is_value_type()) {
175 // value type
176 ik = new (loader_data, size, THREAD) ValueKlass(parser);
241 _method_ordering->at_put(i, m->at(i));
242 }
243 } else {
244 _method_ordering = Universe::the_empty_int_array();
245 }
246 }
247
248 // create a new array of vtable_indices for default methods
249 Array<int>* InstanceKlass::create_new_default_vtable_indices(int len, TRAPS) {
250 Array<int>* vtable_indices = MetadataFactory::new_array<int>(class_loader_data(), len, CHECK_NULL);
251 assert(default_vtable_indices() == NULL, "only create once");
252 set_default_vtable_indices(vtable_indices);
253 return vtable_indices;
254 }
255
256 InstanceKlass::InstanceKlass(const ClassFileParser& parser, unsigned kind) :
257 _static_field_size(parser.static_field_size()),
258 _nonstatic_oop_map_size(nonstatic_oop_map_size(parser.total_oop_map_count())),
259 _itable_len(parser.itable_size()),
260 _reference_type(parser.reference_type()),
261 _extra_flags(0) {
262 set_vtable_length(parser.vtable_size());
263 set_kind(kind);
264 set_access_flags(parser.access_flags());
265 set_is_anonymous(parser.is_anonymous());
266 set_layout_helper(Klass::instance_layout_helper(parser.layout_size(),
267 false));
268 if (parser.has_value_fields()) {
269 set_has_value_fields();
270 }
271 _java_fields_count = parser.java_fields_count();
272
273 assert(NULL == _methods, "underlying memory not zeroed?");
274 assert(is_instance_klass(), "is layout incorrect?");
275 assert(size_helper() == parser.layout_size(), "incorrect size_helper?");
276 }
277
278 void InstanceKlass::deallocate_methods(ClassLoaderData* loader_data,
279 Array<Method*>* methods) {
280 if (methods != NULL && methods != Universe::the_empty_method_array() &&
281 !methods->is_shared()) {
282 for (int i = 0; i < methods->length(); i++) {
283 Method* method = methods->at(i);
284 if (method == NULL) continue; // maybe null if error processing
285 // Only want to delete methods that are not executing for RedefineClasses.
286 // The previous version will point to them so they're not totally dangling
287 assert (!method->on_stack(), "shouldn't be called with methods on stack");
288 MetadataFactory::free_metadata(loader_data, method);
610 }
611
612 // If a value type is referenced by a class (either as a field type or a
613 // method argument or return type) this value type must be loaded during
614 // the linking of this class because size and properties of the value type
615 // must be known in order to be able to perform value type optimizations
616
617 // Note: circular dependencies between value types are not handled yet
618
619 // Note: one case is not handled yet: arrays of value types => FixMe
620
621 // Note: the current implementation is not optimized because the search for
622 // value types is performed on all classes. It would be more efficient to
623 // detect value types during verification and 'tag' the classes for which
624 // value type loading is required. However, this optimization won't be
625 // applicable to classes that are not verified
626
627 // First step: fields
628 for (JavaFieldStream fs(this); !fs.done(); fs.next()) {
629 ResourceMark rm(THREAD);
630 if (fs.field_descriptor().field_type() == T_VALUETYPE) {
631 Symbol* signature = fs.field_descriptor().signature();
632 // Get current loader and protection domain first.
633 oop loader = class_loader();
634 oop prot_domain = protection_domain();
635 Klass* klass = SystemDictionary::resolve_or_fail(signature,
636 Handle(THREAD, loader), Handle(THREAD, prot_domain), true,
637 THREAD);
638 if (klass == NULL) {
639 THROW_(vmSymbols::java_lang_LinkageError(), false);
640 }
641 }
642 }
643
644 // Second step: methods arguments and return types
645 // for (int i = 0; i < this_k->constants()->length(); i++) {
646 // if (this_k->constants()->tag_at(i).is_method()) {
647 // Symbol* signature = this_k->constants()->signature_ref_at(i);
648 // ResourceMark rm(THREAD);
649 // for (SignatureStream ss(signature); !ss.is_done(); ss.next()) {
650 // if (ss.type() == T_VALUETYPE) {
672 // trace only the link time for this klass that includes
673 // the verification time
674 PerfClassTraceTime vmtimer(ClassLoader::perf_class_link_time(),
675 ClassLoader::perf_class_link_selftime(),
676 ClassLoader::perf_classes_linked(),
677 jt->get_thread_stat()->perf_recursion_counts_addr(),
678 jt->get_thread_stat()->perf_timers_addr(),
679 PerfClassTraceTime::CLASS_LINK);
680
681 // verification & rewriting
682 {
683 HandleMark hm(THREAD);
684 Handle h_init_lock(THREAD, init_lock());
685 ObjectLocker ol(h_init_lock, THREAD, h_init_lock() != NULL);
686 // rewritten will have been set if loader constraint error found
687 // on an earlier link attempt
688 // don't verify or rewrite if already rewritten
689 //
690
691 if (!is_linked()) {
692 // The VCC must be linked before the DVT
693 if (get_vcc_klass() != NULL) {
694 InstanceKlass::cast(get_vcc_klass())->link_class(CHECK_false);
695 }
696
697 if (!is_rewritten()) {
698 {
699 bool verify_ok = verify_code(throw_verifyerror, THREAD);
700 if (!verify_ok) {
701 return false;
702 }
703 }
704
705 // Just in case a side-effect of verify linked this class already
706 // (which can sometimes happen since the verifier loads classes
707 // using custom class loaders, which are free to initialize things)
708 if (is_linked()) {
709 return true;
710 }
711
712 // also sets rewritten
713 rewrite_class(CHECK_false);
714 } else if (is_shared()) {
715 SystemDictionaryShared::check_verification_constraints(this, CHECK_false);
716 }
785 Klass* iface = local_interfaces()->at(i);
786 InstanceKlass* ik = InstanceKlass::cast(iface);
787
788 // Initialization is depth first search ie. we start with top of the inheritance tree
789 // has_nonstatic_concrete_methods drives searching superinterfaces since it
790 // means has_nonstatic_concrete_methods in its superinterface hierarchy
791 if (ik->has_nonstatic_concrete_methods()) {
792 ik->initialize_super_interfaces(CHECK);
793 }
794
795 // Only initialize() interfaces that "declare" concrete methods.
796 if (ik->should_be_initialized() && ik->declares_nonstatic_concrete_methods()) {
797 ik->initialize(CHECK);
798 }
799 }
800 }
801
802 void InstanceKlass::initialize_impl(TRAPS) {
803 HandleMark hm(THREAD);
804
805 // ensure outer VCC is initialized, possible some crafty code referred to VT 1st
806 if (get_vcc_klass() != NULL) {
807 get_vcc_klass()->initialize(CHECK);
808 }
809
810 // Make sure klass is linked (verified) before initialization
811 // A class could already be verified, since it has been reflected upon.
812 link_class(CHECK);
813
814 DTRACE_CLASSINIT_PROBE(required, -1);
815
816 bool wait = false;
817
818 // refer to the JVM book page 47 for description of steps
819 // Step 1
820 {
821 Handle h_init_lock(THREAD, init_lock());
822 ObjectLocker ol(h_init_lock, THREAD, h_init_lock() != NULL);
823
824 Thread *self = THREAD; // it's passed the current thread
825
826 // Step 2
827 // If we were to use wait() instead of waitInterruptibly() then
828 // we might end up throwing IE from link/symbol resolution sites
829 // that aren't expected to throw. This would wreak havoc. See 6320309.
2376
2377 const char* InstanceKlass::signature_name() const {
2378 int hash_len = 0;
2379 char hash_buf[40];
2380
2381 // If this is an anonymous class, append a hash to make the name unique
2382 if (is_anonymous()) {
2383 intptr_t hash = (java_mirror() != NULL) ? java_mirror()->identity_hash() : 0;
2384 jio_snprintf(hash_buf, sizeof(hash_buf), "/" UINTX_FORMAT, (uintx)hash);
2385 hash_len = (int)strlen(hash_buf);
2386 }
2387
2388 // Get the internal name as a c string
2389 const char* src = (const char*) (name()->as_C_string());
2390 const int src_length = (int)strlen(src);
2391
2392 char* dest = NEW_RESOURCE_ARRAY(char, src_length + hash_len + 3);
2393
2394 // Add L as type indicator
2395 int dest_index = 0;
2396 dest[dest_index++] = is_value_type_klass() ? 'Q' : 'L';
2397
2398 // Add the actual class name
2399 for (int src_index = 0; src_index < src_length; ) {
2400 dest[dest_index++] = src[src_index++];
2401 }
2402
2403 // If we have a hash, append it
2404 for (int hash_index = 0; hash_index < hash_len; ) {
2405 dest[dest_index++] = hash_buf[hash_index++];
2406 }
2407
2408 // Add the semicolon and the NULL
2409 dest[dest_index++] = ';';
2410 dest[dest_index] = '\0';
2411 return dest;
2412 }
2413
2414 // Used to obtain the package name from a fully qualified class name.
2415 Symbol* InstanceKlass::package_from_name(const Symbol* name, TRAPS) {
2416 if (name == NULL) {
3879 #if INCLUDE_CDS
3880 JvmtiCachedClassFileData* InstanceKlass::get_archived_class_data() {
3881 if (DumpSharedSpaces) {
3882 return _cached_class_file;
3883 } else {
3884 assert(this->is_shared(), "class should be shared");
3885 if (MetaspaceShared::is_in_shared_metaspace(_cached_class_file)) {
3886 return _cached_class_file;
3887 } else {
3888 return NULL;
3889 }
3890 }
3891 }
3892 #endif
3893 #endif
3894
3895 #define THROW_DVT_ERROR(s) \
3896 Exceptions::fthrow(THREAD_AND_LOCATION, vmSymbols::java_lang_IncompatibleClassChangeError(), \
3897 "ValueCapableClass class '%s' %s", external_name(),(s)); \
3898 return
3899
3900 void InstanceKlass::create_value_capable_class(Handle class_loader, Handle protection_domain, TRAPS) {
3901 ResourceMark rm(THREAD);
3902 HandleMark hm(THREAD);
3903
3904 if (!EnableMVT) {
3905 return; // Silent fail
3906 }
3907 // Validate VCC...
3908 if (!has_nonstatic_fields()) {
3909 THROW_DVT_ERROR("has no instance fields");
3910 }
3911 if (is_value()) {
3912 THROW_DVT_ERROR("is already a value type");
3913 }
3914 if (!access_flags().is_final()) {
3915 THROW_DVT_ERROR("is not a final class");
3916 }
3917 if (super() != SystemDictionary::Object_klass()) {
3918 THROW_DVT_ERROR("does not derive from Object only");
3919 }
3920
3921 // All non-static are final
3922 GrowableArray<Handle>* fields = new GrowableArray<Handle>(THREAD, java_fields_count()*2);
3923 GrowableArray<jint>* fields_access = new GrowableArray<jint>(THREAD, java_fields_count()*2);
3924 for (JavaFieldStream fs(this); !fs.done(); fs.next()) {
3925 AccessFlags access_flags = fs.access_flags();
3926 if (access_flags.is_static()) {
3927 continue;
3928 }
3929 if (!access_flags.is_final()) {
3930 THROW_DVT_ERROR("contains non-final instance field");
3931 }
3932 jint flags = access_flags.get_flags();
3933 // Remember the field name, signature, access modifiers
3934 Handle h = java_lang_String::create_from_symbol(fs.name(), CHECK);
3935 fields->append(h);
3936 h = java_lang_String::create_from_symbol(fs.signature(), CHECK);
3937 fields->append(h);
3938 fields_access->append(access_flags.get_flags());
3939 }
3940
3941 // Generate DVT...
3942 log_debug(load)("Cooking DVT for VCC %s", external_name());
3943 const char* this_name = name()->as_C_string();
3944
3945 // Assemble the Java args...field descriptor array
3946 objArrayOop fdarr_oop = oopFactory::new_objectArray(fields->length(), CHECK);
3947 objArrayHandle fdarr(THREAD, fdarr_oop);
3948 for (int i = 0; i < fields->length(); i++) {
3949 fdarr->obj_at_put(i, fields->at(i)());
3950 }
3951 //...field access modifiers array
3952 typeArrayOop faarr_oop = oopFactory::new_intArray(fields_access->length(), CHECK);
3953 typeArrayHandle faarr(THREAD, faarr_oop);
3954 for (int i = 0; i < fields_access->length(); i++) {
3955 faarr->int_at_put(i, fields_access->at(i));
3956 }
3957
3958 Handle vcc_name_h = java_lang_String::create_from_symbol(name(), CHECK);
3959 // Upcall to our Java helper...
3960 JavaValue result(T_OBJECT);
3961 JavaCallArguments args(5);
3962 args.push_oop(vcc_name_h);
3963 args.push_oop(class_loader);
3964 args.push_oop(protection_domain);
3965 args.push_oop(fdarr);
3966 args.push_oop(faarr);
3967 JavaCalls::call_static(&result,
3968 SystemDictionary::Valhalla_MVT1_0_klass(),
3969 vmSymbols::valhalla_shady_MVT1_0_createDerivedValueType(),
3970 vmSymbols::valhalla_shady_MVT1_0_createDerivedValueType_signature(),
3971 &args,
3972 CHECK);
3973 Handle returned(THREAD, (oop) result.get_jobject());
3974 if (returned.is_null()) {
3975 THROW_DVT_ERROR("unknown error deriving value type");
3976 }
3977 TempNewSymbol dvt_name_sym = java_lang_String::as_symbol(returned(), CHECK);
3978
3979 Klass* dvt_klass = SystemDictionary::resolve_or_null(dvt_name_sym,
3980 class_loader,
3981 protection_domain,
3982 CHECK);
3983 if (!dvt_klass->is_value()) {
3984 THROW_DVT_ERROR("failed to resolve derived value type");
3985 }
3986 /**
3987 * Found it, let's point to each other to denote "is_derive_vt()"...
3988 */
3989 ValueKlass* vt_klass = ValueKlass::cast(dvt_klass);
3990 assert(vt_klass->class_loader() == class_loader(), "DVT Not the same class loader as VCC");
3991 vt_klass->set_vcc_klass(this);
3992 log_debug(load)("Cooked DVT %s for VCC %s", vt_klass->external_name(), external_name());
3993 }
3994
|
136 }
137
138 if (SystemDictionary::ClassLoader_klass_loaded()) {
139 const Klass* const super_klass = parser.super_klass();
140 if (super_klass != NULL) {
141 if (super_klass->is_subtype_of(SystemDictionary::ClassLoader_klass())) {
142 return true;
143 }
144 }
145 }
146 return false;
147 }
148
149 InstanceKlass* InstanceKlass::allocate_instance_klass(const ClassFileParser& parser, TRAPS) {
150 const int size = InstanceKlass::size(parser.vtable_size(),
151 parser.itable_size(),
152 nonstatic_oop_map_size(parser.total_oop_map_count()),
153 parser.is_interface(),
154 parser.is_anonymous(),
155 should_store_fingerprint(parser.is_anonymous()),
156 parser.has_flattenable_fields() ? parser.java_fields_count() : 0,
157 parser.is_value_type());
158
159 const Symbol* const class_name = parser.class_name();
160 assert(class_name != NULL, "invariant");
161 ClassLoaderData* loader_data = parser.loader_data();
162 assert(loader_data != NULL, "invariant");
163
164 InstanceKlass* ik;
165
166 // Allocation
167 if (REF_NONE == parser.reference_type()) {
168 if (class_name == vmSymbols::java_lang_Class()) {
169 // mirror
170 ik = new (loader_data, size, THREAD) InstanceMirrorKlass(parser);
171 } else if (is_class_loader(class_name, parser)) {
172 // class loader
173 ik = new (loader_data, size, THREAD) InstanceClassLoaderKlass(parser);
174 } else if (parser.is_value_type()) {
175 // value type
176 ik = new (loader_data, size, THREAD) ValueKlass(parser);
241 _method_ordering->at_put(i, m->at(i));
242 }
243 } else {
244 _method_ordering = Universe::the_empty_int_array();
245 }
246 }
247
248 // create a new array of vtable_indices for default methods
249 Array<int>* InstanceKlass::create_new_default_vtable_indices(int len, TRAPS) {
250 Array<int>* vtable_indices = MetadataFactory::new_array<int>(class_loader_data(), len, CHECK_NULL);
251 assert(default_vtable_indices() == NULL, "only create once");
252 set_default_vtable_indices(vtable_indices);
253 return vtable_indices;
254 }
255
256 InstanceKlass::InstanceKlass(const ClassFileParser& parser, unsigned kind) :
257 _static_field_size(parser.static_field_size()),
258 _nonstatic_oop_map_size(nonstatic_oop_map_size(parser.total_oop_map_count())),
259 _itable_len(parser.itable_size()),
260 _reference_type(parser.reference_type()),
261 _extra_flags(0),
262 _adr_valueklass_fixed_block(NULL) {
263 set_vtable_length(parser.vtable_size());
264 set_kind(kind);
265 set_access_flags(parser.access_flags());
266 set_is_anonymous(parser.is_anonymous());
267 set_layout_helper(Klass::instance_layout_helper(parser.layout_size(),
268 false));
269 if (parser.has_flattenable_fields()) {
270 set_has_value_fields();
271 }
272 _java_fields_count = parser.java_fields_count();
273
274 assert(NULL == _methods, "underlying memory not zeroed?");
275 assert(is_instance_klass(), "is layout incorrect?");
276 assert(size_helper() == parser.layout_size(), "incorrect size_helper?");
277 }
278
279 void InstanceKlass::deallocate_methods(ClassLoaderData* loader_data,
280 Array<Method*>* methods) {
281 if (methods != NULL && methods != Universe::the_empty_method_array() &&
282 !methods->is_shared()) {
283 for (int i = 0; i < methods->length(); i++) {
284 Method* method = methods->at(i);
285 if (method == NULL) continue; // maybe null if error processing
286 // Only want to delete methods that are not executing for RedefineClasses.
287 // The previous version will point to them so they're not totally dangling
288 assert (!method->on_stack(), "shouldn't be called with methods on stack");
289 MetadataFactory::free_metadata(loader_data, method);
611 }
612
613 // If a value type is referenced by a class (either as a field type or a
614 // method argument or return type) this value type must be loaded during
615 // the linking of this class because size and properties of the value type
616 // must be known in order to be able to perform value type optimizations
617
618 // Note: circular dependencies between value types are not handled yet
619
620 // Note: one case is not handled yet: arrays of value types => FixMe
621
622 // Note: the current implementation is not optimized because the search for
623 // value types is performed on all classes. It would be more efficient to
624 // detect value types during verification and 'tag' the classes for which
625 // value type loading is required. However, this optimization won't be
626 // applicable to classes that are not verified
627
628 // First step: fields
629 for (JavaFieldStream fs(this); !fs.done(); fs.next()) {
630 ResourceMark rm(THREAD);
631 if (fs.field_descriptor().access_flags().is_flattenable()) {
632 Symbol* signature = fs.field_descriptor().signature();
633 // Get current loader and protection domain first.
634 oop loader = class_loader();
635 oop prot_domain = protection_domain();
636 Klass* klass = SystemDictionary::resolve_or_fail(signature,
637 Handle(THREAD, loader), Handle(THREAD, prot_domain), true,
638 THREAD);
639 if (klass == NULL) {
640 THROW_(vmSymbols::java_lang_LinkageError(), false);
641 }
642 }
643 }
644
645 // Second step: methods arguments and return types
646 // for (int i = 0; i < this_k->constants()->length(); i++) {
647 // if (this_k->constants()->tag_at(i).is_method()) {
648 // Symbol* signature = this_k->constants()->signature_ref_at(i);
649 // ResourceMark rm(THREAD);
650 // for (SignatureStream ss(signature); !ss.is_done(); ss.next()) {
651 // if (ss.type() == T_VALUETYPE) {
673 // trace only the link time for this klass that includes
674 // the verification time
675 PerfClassTraceTime vmtimer(ClassLoader::perf_class_link_time(),
676 ClassLoader::perf_class_link_selftime(),
677 ClassLoader::perf_classes_linked(),
678 jt->get_thread_stat()->perf_recursion_counts_addr(),
679 jt->get_thread_stat()->perf_timers_addr(),
680 PerfClassTraceTime::CLASS_LINK);
681
682 // verification & rewriting
683 {
684 HandleMark hm(THREAD);
685 Handle h_init_lock(THREAD, init_lock());
686 ObjectLocker ol(h_init_lock, THREAD, h_init_lock() != NULL);
687 // rewritten will have been set if loader constraint error found
688 // on an earlier link attempt
689 // don't verify or rewrite if already rewritten
690 //
691
692 if (!is_linked()) {
693 if (!is_rewritten()) {
694 {
695 bool verify_ok = verify_code(throw_verifyerror, THREAD);
696 if (!verify_ok) {
697 return false;
698 }
699 }
700
701 // Just in case a side-effect of verify linked this class already
702 // (which can sometimes happen since the verifier loads classes
703 // using custom class loaders, which are free to initialize things)
704 if (is_linked()) {
705 return true;
706 }
707
708 // also sets rewritten
709 rewrite_class(CHECK_false);
710 } else if (is_shared()) {
711 SystemDictionaryShared::check_verification_constraints(this, CHECK_false);
712 }
781 Klass* iface = local_interfaces()->at(i);
782 InstanceKlass* ik = InstanceKlass::cast(iface);
783
784 // Initialization is depth first search ie. we start with top of the inheritance tree
785 // has_nonstatic_concrete_methods drives searching superinterfaces since it
786 // means has_nonstatic_concrete_methods in its superinterface hierarchy
787 if (ik->has_nonstatic_concrete_methods()) {
788 ik->initialize_super_interfaces(CHECK);
789 }
790
791 // Only initialize() interfaces that "declare" concrete methods.
792 if (ik->should_be_initialized() && ik->declares_nonstatic_concrete_methods()) {
793 ik->initialize(CHECK);
794 }
795 }
796 }
797
798 void InstanceKlass::initialize_impl(TRAPS) {
799 HandleMark hm(THREAD);
800
801 // Make sure klass is linked (verified) before initialization
802 // A class could already be verified, since it has been reflected upon.
803 link_class(CHECK);
804
805 DTRACE_CLASSINIT_PROBE(required, -1);
806
807 bool wait = false;
808
809 // refer to the JVM book page 47 for description of steps
810 // Step 1
811 {
812 Handle h_init_lock(THREAD, init_lock());
813 ObjectLocker ol(h_init_lock, THREAD, h_init_lock() != NULL);
814
815 Thread *self = THREAD; // it's passed the current thread
816
817 // Step 2
818 // If we were to use wait() instead of waitInterruptibly() then
819 // we might end up throwing IE from link/symbol resolution sites
820 // that aren't expected to throw. This would wreak havoc. See 6320309.
2367
2368 const char* InstanceKlass::signature_name() const {
2369 int hash_len = 0;
2370 char hash_buf[40];
2371
2372 // If this is an anonymous class, append a hash to make the name unique
2373 if (is_anonymous()) {
2374 intptr_t hash = (java_mirror() != NULL) ? java_mirror()->identity_hash() : 0;
2375 jio_snprintf(hash_buf, sizeof(hash_buf), "/" UINTX_FORMAT, (uintx)hash);
2376 hash_len = (int)strlen(hash_buf);
2377 }
2378
2379 // Get the internal name as a c string
2380 const char* src = (const char*) (name()->as_C_string());
2381 const int src_length = (int)strlen(src);
2382
2383 char* dest = NEW_RESOURCE_ARRAY(char, src_length + hash_len + 3);
2384
2385 // Add L as type indicator
2386 int dest_index = 0;
2387 dest[dest_index++] = 'L';
2388
2389 // Add the actual class name
2390 for (int src_index = 0; src_index < src_length; ) {
2391 dest[dest_index++] = src[src_index++];
2392 }
2393
2394 // If we have a hash, append it
2395 for (int hash_index = 0; hash_index < hash_len; ) {
2396 dest[dest_index++] = hash_buf[hash_index++];
2397 }
2398
2399 // Add the semicolon and the NULL
2400 dest[dest_index++] = ';';
2401 dest[dest_index] = '\0';
2402 return dest;
2403 }
2404
2405 // Used to obtain the package name from a fully qualified class name.
2406 Symbol* InstanceKlass::package_from_name(const Symbol* name, TRAPS) {
2407 if (name == NULL) {
3870 #if INCLUDE_CDS
3871 JvmtiCachedClassFileData* InstanceKlass::get_archived_class_data() {
3872 if (DumpSharedSpaces) {
3873 return _cached_class_file;
3874 } else {
3875 assert(this->is_shared(), "class should be shared");
3876 if (MetaspaceShared::is_in_shared_metaspace(_cached_class_file)) {
3877 return _cached_class_file;
3878 } else {
3879 return NULL;
3880 }
3881 }
3882 }
3883 #endif
3884 #endif
3885
3886 #define THROW_DVT_ERROR(s) \
3887 Exceptions::fthrow(THREAD_AND_LOCATION, vmSymbols::java_lang_IncompatibleClassChangeError(), \
3888 "ValueCapableClass class '%s' %s", external_name(),(s)); \
3889 return
|