28 #include "cds/cdsEnumKlass.hpp"
29 #include "cds/classListWriter.hpp"
30 #include "cds/heapShared.hpp"
31 #include "cds/metaspaceShared.hpp"
32 #include "classfile/classFileParser.hpp"
33 #include "classfile/classFileStream.hpp"
34 #include "classfile/classLoader.hpp"
35 #include "classfile/classLoaderData.inline.hpp"
36 #include "classfile/javaClasses.hpp"
37 #include "classfile/moduleEntry.hpp"
38 #include "classfile/systemDictionary.hpp"
39 #include "classfile/systemDictionaryShared.hpp"
40 #include "classfile/verifier.hpp"
41 #include "classfile/vmClasses.hpp"
42 #include "classfile/vmSymbols.hpp"
43 #include "code/codeCache.hpp"
44 #include "code/dependencyContext.hpp"
45 #include "compiler/compilationPolicy.hpp"
46 #include "compiler/compileBroker.hpp"
47 #include "gc/shared/collectedHeap.inline.hpp"
48 #include "interpreter/bytecodeStream.hpp"
49 #include "interpreter/oopMapCache.hpp"
50 #include "interpreter/rewriter.hpp"
51 #include "jvm.h"
52 #include "jvmtifiles/jvmti.h"
53 #include "logging/log.hpp"
54 #include "klass.inline.hpp"
55 #include "logging/logMessage.hpp"
56 #include "logging/logStream.hpp"
57 #include "memory/allocation.inline.hpp"
58 #include "memory/iterator.inline.hpp"
59 #include "memory/metadataFactory.hpp"
60 #include "memory/metaspaceClosure.hpp"
61 #include "memory/oopFactory.hpp"
62 #include "memory/resourceArea.hpp"
63 #include "memory/universe.hpp"
64 #include "oops/fieldStreams.inline.hpp"
65 #include "oops/constantPool.hpp"
66 #include "oops/instanceClassLoaderKlass.hpp"
67 #include "oops/instanceKlass.inline.hpp"
71 #include "oops/klass.inline.hpp"
72 #include "oops/method.hpp"
73 #include "oops/oop.inline.hpp"
74 #include "oops/recordComponent.hpp"
75 #include "oops/symbol.hpp"
76 #include "prims/jvmtiExport.hpp"
77 #include "prims/jvmtiRedefineClasses.hpp"
78 #include "prims/jvmtiThreadState.hpp"
79 #include "prims/methodComparator.hpp"
80 #include "runtime/arguments.hpp"
81 #include "runtime/deoptimization.hpp"
82 #include "runtime/atomic.hpp"
83 #include "runtime/fieldDescriptor.inline.hpp"
84 #include "runtime/handles.inline.hpp"
85 #include "runtime/javaCalls.hpp"
86 #include "runtime/javaThread.inline.hpp"
87 #include "runtime/mutexLocker.hpp"
88 #include "runtime/orderAccess.hpp"
89 #include "runtime/os.inline.hpp"
90 #include "runtime/reflection.hpp"
91 #include "runtime/synchronizer.hpp"
92 #include "runtime/threads.hpp"
93 #include "services/classLoadingService.hpp"
94 #include "services/finalizerService.hpp"
95 #include "services/threadService.hpp"
96 #include "utilities/dtrace.hpp"
97 #include "utilities/events.hpp"
98 #include "utilities/macros.hpp"
99 #include "utilities/nativeStackPrinter.hpp"
100 #include "utilities/stringUtils.hpp"
101 #ifdef COMPILER1
102 #include "c1/c1_Compiler.hpp"
103 #endif
104 #if INCLUDE_JFR
105 #include "jfr/jfrEvents.hpp"
106 #endif
107
108 #ifdef DTRACE_ENABLED
109
110
1063 return true;
1064 }
1065
1066 // Rewrite the byte codes of all of the methods of a class.
1067 // The rewriter must be called exactly once. Rewriting must happen after
1068 // verification but before the first method of the class is executed.
1069 void InstanceKlass::rewrite_class(TRAPS) {
1070 assert(is_loaded(), "must be loaded");
1071 if (is_rewritten()) {
1072 assert(is_shared(), "rewriting an unshared class?");
1073 return;
1074 }
1075 Rewriter::rewrite(this, CHECK);
1076 set_rewritten();
1077 }
1078
1079 // Now relocate and link method entry points after class is rewritten.
1080 // This is outside is_rewritten flag. In case of an exception, it can be
1081 // executed more than once.
1082 void InstanceKlass::link_methods(TRAPS) {
1083 PerfTraceTime timer(ClassLoader::perf_ik_link_methods_time());
1084
1085 int len = methods()->length();
1086 for (int i = len-1; i >= 0; i--) {
1087 methodHandle m(THREAD, methods()->at(i));
1088
1089 // Set up method entry points for compiler and interpreter .
1090 m->link_method(m, CHECK);
1091 }
1092 }
1093
1094 // Eagerly initialize superinterfaces that declare default methods (concrete instance: any access)
1095 void InstanceKlass::initialize_super_interfaces(TRAPS) {
1096 assert (has_nonstatic_concrete_methods(), "caller should have checked this");
1097 for (int i = 0; i < local_interfaces()->length(); ++i) {
1098 InstanceKlass* ik = local_interfaces()->at(i);
1099
1100 // Initialization is depth first search ie. we start with top of the inheritance tree
1101 // has_nonstatic_concrete_methods drives searching superinterfaces since it
1102 // means has_nonstatic_concrete_methods in its superinterface hierarchy
1103 if (ik->has_nonstatic_concrete_methods()) {
1104 ik->initialize_super_interfaces(CHECK);
1105 }
1106
1107 // Only initialize() interfaces that "declare" concrete methods.
1172 assert_locked_or_safepoint(ClassInitError_lock);
1173 InitErrorTableCleaner cleaner;
1174 if (_initialization_error_table != nullptr) {
1175 _initialization_error_table->unlink(&cleaner);
1176 }
1177 }
1178
1179 void InstanceKlass::initialize_impl(TRAPS) {
1180 HandleMark hm(THREAD);
1181
1182 // Make sure klass is linked (verified) before initialization
1183 // A class could already be verified, since it has been reflected upon.
1184 link_class(CHECK);
1185
1186 DTRACE_CLASSINIT_PROBE(required, -1);
1187
1188 bool wait = false;
1189
1190 JavaThread* jt = THREAD;
1191
1192 bool debug_logging_enabled = log_is_enabled(Debug, class, init);
1193
1194 // refer to the JVM book page 47 for description of steps
1195 // Step 1
1196 {
1197 Handle h_init_lock(THREAD, init_lock());
1198 ObjectLocker ol(h_init_lock, jt);
1199
1200 // Step 2
1201 // If we were to use wait() instead of waitInterruptibly() then
1202 // we might end up throwing IE from link/symbol resolution sites
1203 // that aren't expected to throw. This would wreak havoc. See 6320309.
1204 while (is_being_initialized() && !is_reentrant_initialization(jt)) {
1205 if (debug_logging_enabled) {
1206 ResourceMark rm(jt);
1207 log_debug(class, init)("Thread \"%s\" waiting for initialization of %s by thread \"%s\"",
1208 jt->name(), external_name(), init_thread_name());
1209 }
1210 wait = true;
1211 jt->set_class_to_be_initialized(this);
1341 add_initialization_error(THREAD, e);
1342 set_initialization_state_and_notify(initialization_error, THREAD);
1343 CLEAR_PENDING_EXCEPTION; // ignore any exception thrown, class initialization error is thrown below
1344 // JVMTI has already reported the pending exception
1345 // JVMTI internal flag reset is needed in order to report ExceptionInInitializerError
1346 JvmtiExport::clear_detected_exception(jt);
1347 }
1348 DTRACE_CLASSINIT_PROBE_WAIT(error, -1, wait);
1349 if (e->is_a(vmClasses::Error_klass())) {
1350 THROW_OOP(e());
1351 } else {
1352 JavaCallArguments args(e);
1353 THROW_ARG(vmSymbols::java_lang_ExceptionInInitializerError(),
1354 vmSymbols::throwable_void_signature(),
1355 &args);
1356 }
1357 }
1358 DTRACE_CLASSINIT_PROBE_WAIT(end, -1, wait);
1359 }
1360
1361
1362 void InstanceKlass::set_initialization_state_and_notify(ClassState state, TRAPS) {
1363 Handle h_init_lock(THREAD, init_lock());
1364 if (h_init_lock() != nullptr) {
1365 ObjectLocker ol(h_init_lock, THREAD);
1366 set_init_thread(nullptr); // reset _init_thread before changing _init_state
1367 set_init_state(state);
1368 fence_and_clear_init_lock();
1369 ol.notify_all(CHECK);
1370 } else {
1371 assert(h_init_lock() != nullptr, "The initialization state should never be set twice");
1372 set_init_thread(nullptr); // reset _init_thread before changing _init_state
1373 set_init_state(state);
1374 }
1375 }
1376
1377 // Update hierarchy. This is done before the new klass has been added to the SystemDictionary. The Compile_lock
1378 // is grabbed, to ensure that the compiler is not using the class hierarchy.
1379 void InstanceKlass::add_to_hierarchy(JavaThread* current) {
1380 assert(!SafepointSynchronize::is_at_safepoint(), "must NOT be at safepoint");
1381
1571 tty->print("Registered ");
1572 i->print_value_on(tty);
1573 tty->print_cr(" (" PTR_FORMAT ") as finalizable", p2i(i));
1574 }
1575 instanceHandle h_i(THREAD, i);
1576 // Pass the handle as argument, JavaCalls::call expects oop as jobjects
1577 JavaValue result(T_VOID);
1578 JavaCallArguments args(h_i);
1579 methodHandle mh(THREAD, Universe::finalizer_register_method());
1580 JavaCalls::call(&result, mh, &args, CHECK_NULL);
1581 MANAGEMENT_ONLY(FinalizerService::on_register(h_i(), THREAD);)
1582 return h_i();
1583 }
1584
1585 instanceOop InstanceKlass::allocate_instance(TRAPS) {
1586 assert(!is_abstract() && !is_interface(), "Should not create this object");
1587 size_t size = size_helper(); // Query before forming handle.
1588 return (instanceOop)Universe::heap()->obj_allocate(this, size, CHECK_NULL);
1589 }
1590
1591 instanceOop InstanceKlass::allocate_instance(oop java_class, TRAPS) {
1592 Klass* k = java_lang_Class::as_Klass(java_class);
1593 if (k == nullptr) {
1594 ResourceMark rm(THREAD);
1595 THROW_(vmSymbols::java_lang_InstantiationException(), nullptr);
1596 }
1597 InstanceKlass* ik = cast(k);
1598 ik->check_valid_for_instantiation(false, CHECK_NULL);
1599 ik->initialize(CHECK_NULL);
1600 return ik->allocate_instance(THREAD);
1601 }
1602
1603 instanceHandle InstanceKlass::allocate_instance_handle(TRAPS) {
1604 return instanceHandle(THREAD, allocate_instance(THREAD));
1605 }
1606
1607 void InstanceKlass::check_valid_for_instantiation(bool throwError, TRAPS) {
1608 if (is_interface() || is_abstract()) {
1609 ResourceMark rm(THREAD);
1610 THROW_MSG(throwError ? vmSymbols::java_lang_InstantiationError()
1611 : vmSymbols::java_lang_InstantiationException(), external_name());
1674 // Hide the existence of the initializer for the purpose of replaying the compile
1675 return;
1676 }
1677
1678 #if INCLUDE_CDS
1679 // This is needed to ensure the consistency of the archived heap objects.
1680 if (has_aot_initialized_mirror() && CDSConfig::is_loading_heap()) {
1681 AOTClassInitializer::call_runtime_setup(THREAD, this);
1682 return;
1683 } else if (has_archived_enum_objs()) {
1684 assert(is_shared(), "must be");
1685 bool initialized = CDSEnumKlass::initialize_enum_klass(this, CHECK);
1686 if (initialized) {
1687 return;
1688 }
1689 }
1690 #endif
1691
1692 methodHandle h_method(THREAD, class_initializer());
1693 assert(!is_initialized(), "we cannot initialize twice");
1694 LogTarget(Info, class, init) lt;
1695 if (lt.is_enabled()) {
1696 ResourceMark rm(THREAD);
1697 LogStream ls(lt);
1698 ls.print("%d Initializing ", call_class_initializer_counter++);
1699 name()->print_value_on(&ls);
1700 ls.print_cr("%s (" PTR_FORMAT ") by thread \"%s\"",
1701 h_method() == nullptr ? "(no method)" : "", p2i(this),
1702 THREAD->name());
1703 }
1704 if (h_method() != nullptr) {
1705 ThreadInClassInitializer ticl(THREAD, this); // Track class being initialized
1706 JavaCallArguments args; // No arguments
1707 JavaValue result(T_VOID);
1708 JavaCalls::call(&result, h_method, &args, CHECK); // Static call (no args)
1709 }
1710 }
1711
1712 // If a class that implements this interface is initialized, is the JVM required
1713 // to first execute a <clinit> method declared in this interface,
1714 // or (if also_check_supers==true) any of the super types of this interface?
1715 //
1716 // JVMS 5.5. Initialization, step 7: Next, if C is a class rather than
1717 // an interface, then let SC be its superclass and let SI1, ..., SIn
1718 // be all superinterfaces of C (whether direct or indirect) that
1719 // declare at least one non-abstract, non-static method.
1720 //
1721 // So when an interface is initialized, it does not look at its
1722 // supers. But a proper class will ensure that all of its supers have
1723 // run their <clinit> methods, except that it disregards interfaces
1724 // that lack a non-static concrete method (i.e., a default method).
1725 // Therefore, you should probably call this method only when the
1726 // current class is a super of some proper class, not an interface.
1727 bool InstanceKlass::interface_needs_clinit_execution_as_super(bool also_check_supers) const {
1728 assert(is_interface(), "must be");
1729
2486 }
2487 }
2488 if (new_jmeths != 0) {
2489 Method::ensure_jmethod_ids(class_loader_data(), new_jmeths);
2490 }
2491 }
2492
2493 // Lookup a jmethodID, null if not found. Do no blocking, no allocations, no handles
2494 jmethodID InstanceKlass::jmethod_id_or_null(Method* method) {
2495 int idnum = method->method_idnum();
2496 jmethodID* jmeths = methods_jmethod_ids_acquire();
2497 return (jmeths != nullptr) ? jmeths[idnum + 1] : nullptr;
2498 }
2499
2500 inline DependencyContext InstanceKlass::dependencies() {
2501 DependencyContext dep_context(&_dep_context, &_dep_context_last_cleaned);
2502 return dep_context;
2503 }
2504
2505 void InstanceKlass::mark_dependent_nmethods(DeoptimizationScope* deopt_scope, KlassDepChange& changes) {
2506 dependencies().mark_dependent_nmethods(deopt_scope, changes);
2507 }
2508
2509 void InstanceKlass::add_dependent_nmethod(nmethod* nm) {
2510 assert_lock_strong(CodeCache_lock);
2511 dependencies().add_dependent_nmethod(nm);
2512 }
2513
2514 void InstanceKlass::clean_dependency_context() {
2515 dependencies().clean_unloading_dependents();
2516 }
2517
2518 #ifndef PRODUCT
2519 void InstanceKlass::print_dependent_nmethods(bool verbose) {
2520 dependencies().print_dependent_nmethods(verbose);
2521 }
2522
2523 bool InstanceKlass::is_dependent_nmethod(nmethod* nm) {
2524 return dependencies().is_dependent_nmethod(nm);
2525 }
2526 #endif //PRODUCT
2624 for (int i = 0; i < nof_interfaces; i ++, ioe ++) {
2625 if (ioe->interface_klass() != nullptr) {
2626 it->push(ioe->interface_klass_addr());
2627 itableMethodEntry* ime = ioe->first_method_entry(this);
2628 int n = klassItable::method_count_for_interface(ioe->interface_klass());
2629 for (int index = 0; index < n; index ++) {
2630 it->push(ime[index].method_addr());
2631 }
2632 }
2633 }
2634 }
2635
2636 it->push(&_nest_host);
2637 it->push(&_nest_members);
2638 it->push(&_permitted_subclasses);
2639 it->push(&_record_components);
2640 }
2641
2642 #if INCLUDE_CDS
2643 void InstanceKlass::remove_unshareable_info() {
2644
2645 if (is_linked()) {
2646 assert(can_be_verified_at_dumptime(), "must be");
2647 // Remember this so we can avoid walking the hierarchy at runtime.
2648 set_verified_at_dump_time();
2649 }
2650
2651 _misc_flags.set_has_init_deps_processed(false);
2652
2653 Klass::remove_unshareable_info();
2654
2655 if (SystemDictionaryShared::has_class_failed_verification(this)) {
2656 // Classes are attempted to link during dumping and may fail,
2657 // but these classes are still in the dictionary and class list in CLD.
2658 // If the class has failed verification, there is nothing else to remove.
2659 return;
2660 }
2661
2662 // Reset to the 'allocated' state to prevent any premature accessing to
2663 // a shared class at runtime while the class is still being loaded and
2664 // restored. A class' init_state is set to 'loaded' at runtime when it's
2665 // being added to class hierarchy (see InstanceKlass:::add_to_hierarchy()).
2666 _init_state = allocated;
2667
2668 { // Otherwise this needs to take out the Compile_lock.
2669 assert(SafepointSynchronize::is_at_safepoint(), "only called at safepoint");
2801
2802 // restore constant pool resolved references
2803 constants()->restore_unshareable_info(CHECK);
2804
2805 if (array_klasses() != nullptr) {
2806 // To get a consistent list of classes we need MultiArray_lock to ensure
2807 // array classes aren't observed while they are being restored.
2808 RecursiveLocker rl(MultiArray_lock, THREAD);
2809 assert(this == array_klasses()->bottom_klass(), "sanity");
2810 // Array classes have null protection domain.
2811 // --> see ArrayKlass::complete_create_array_klass()
2812 array_klasses()->restore_unshareable_info(class_loader_data(), Handle(), CHECK);
2813 }
2814
2815 // Initialize @ValueBased class annotation if not already set in the archived klass.
2816 if (DiagnoseSyncOnValueBasedClasses && has_value_based_class_annotation() && !is_value_based()) {
2817 set_is_value_based();
2818 }
2819 }
2820
2821 // Check if a class or any of its supertypes has a version older than 50.
2822 // CDS will not perform verification of old classes during dump time because
2823 // without changing the old verifier, the verification constraint cannot be
2824 // retrieved during dump time.
2825 // Verification of archived old classes will be performed during run time.
2826 bool InstanceKlass::can_be_verified_at_dumptime() const {
2827 if (MetaspaceShared::is_in_shared_metaspace(this)) {
2828 // This is a class that was dumped into the base archive, so we know
2829 // it was verified at dump time.
2830 return true;
2831 }
2832 if (major_version() < 50 /*JAVA_6_VERSION*/) {
2833 return false;
2834 }
2835 if (java_super() != nullptr && !java_super()->can_be_verified_at_dumptime()) {
2836 return false;
2837 }
2838 Array<InstanceKlass*>* interfaces = local_interfaces();
2839 int len = interfaces->length();
2840 for (int i = 0; i < len; i++) {
2841 if (!interfaces->at(i)->can_be_verified_at_dumptime()) {
2842 return false;
2843 }
2844 }
2845 return true;
2846 }
2847
2848 #endif // INCLUDE_CDS
2849
2850 #if INCLUDE_JVMTI
2851 static void clear_all_breakpoints(Method* m) {
3606 static void print_vtable(intptr_t* start, int len, outputStream* st) {
3607 for (int i = 0; i < len; i++) {
3608 intptr_t e = start[i];
3609 st->print("%d : " INTPTR_FORMAT, i, e);
3610 if (MetaspaceObj::is_valid((Metadata*)e)) {
3611 st->print(" ");
3612 ((Metadata*)e)->print_value_on(st);
3613 }
3614 st->cr();
3615 }
3616 }
3617
3618 static void print_vtable(vtableEntry* start, int len, outputStream* st) {
3619 return print_vtable(reinterpret_cast<intptr_t*>(start), len, st);
3620 }
3621
3622 const char* InstanceKlass::init_state_name() const {
3623 return state_names[init_state()];
3624 }
3625
3626 void InstanceKlass::print_on(outputStream* st) const {
3627 assert(is_klass(), "must be klass");
3628 Klass::print_on(st);
3629
3630 st->print(BULLET"instance size: %d", size_helper()); st->cr();
3631 st->print(BULLET"klass size: %d", size()); st->cr();
3632 st->print(BULLET"access: "); access_flags().print_on(st); st->cr();
3633 st->print(BULLET"flags: "); _misc_flags.print_on(st); st->cr();
3634 st->print(BULLET"state: "); st->print_cr("%s", init_state_name());
3635 st->print(BULLET"name: "); name()->print_value_on(st); st->cr();
3636 st->print(BULLET"super: "); Metadata::print_value_on_maybe_null(st, super()); st->cr();
3637 st->print(BULLET"sub: ");
3638 Klass* sub = subklass();
3639 int n;
3640 for (n = 0; sub != nullptr; n++, sub = sub->next_sibling()) {
3641 if (n < MaxSubklassPrintSize) {
3642 sub->print_value_on(st);
3643 st->print(" ");
3644 }
3645 }
3935 nullptr;
3936 // caller can be null, for example, during a JVMTI VM_Init hook
3937 if (caller != nullptr) {
3938 info_stream.print(" source: instance of %s", caller->external_name());
3939 } else {
3940 // source is unknown
3941 }
3942 } else {
3943 oop class_loader = loader_data->class_loader();
3944 info_stream.print(" source: %s", class_loader->klass()->external_name());
3945 }
3946 } else {
3947 assert(this->is_shared(), "must be");
3948 if (MetaspaceShared::is_shared_dynamic((void*)this)) {
3949 info_stream.print(" source: shared objects file (top)");
3950 } else {
3951 info_stream.print(" source: shared objects file");
3952 }
3953 }
3954
3955 msg.info("%s", info_stream.as_string());
3956
3957 if (log_is_enabled(Debug, class, load)) {
3958 stringStream debug_stream;
3959
3960 // Class hierarchy info
3961 debug_stream.print(" klass: " PTR_FORMAT " super: " PTR_FORMAT,
3962 p2i(this), p2i(superklass()));
3963
3964 // Interfaces
3965 if (local_interfaces() != nullptr && local_interfaces()->length() > 0) {
3966 debug_stream.print(" interfaces:");
3967 int length = local_interfaces()->length();
3968 for (int i = 0; i < length; i++) {
3969 debug_stream.print(" " PTR_FORMAT,
3970 p2i(InstanceKlass::cast(local_interfaces()->at(i))));
3971 }
3972 }
3973
3974 // Class loader
|
28 #include "cds/cdsEnumKlass.hpp"
29 #include "cds/classListWriter.hpp"
30 #include "cds/heapShared.hpp"
31 #include "cds/metaspaceShared.hpp"
32 #include "classfile/classFileParser.hpp"
33 #include "classfile/classFileStream.hpp"
34 #include "classfile/classLoader.hpp"
35 #include "classfile/classLoaderData.inline.hpp"
36 #include "classfile/javaClasses.hpp"
37 #include "classfile/moduleEntry.hpp"
38 #include "classfile/systemDictionary.hpp"
39 #include "classfile/systemDictionaryShared.hpp"
40 #include "classfile/verifier.hpp"
41 #include "classfile/vmClasses.hpp"
42 #include "classfile/vmSymbols.hpp"
43 #include "code/codeCache.hpp"
44 #include "code/dependencyContext.hpp"
45 #include "compiler/compilationPolicy.hpp"
46 #include "compiler/compileBroker.hpp"
47 #include "gc/shared/collectedHeap.inline.hpp"
48 #include "interpreter/bytecodeHistogram.hpp"
49 #include "interpreter/bytecodeStream.hpp"
50 #include "interpreter/oopMapCache.hpp"
51 #include "interpreter/rewriter.hpp"
52 #include "jvm.h"
53 #include "jvmtifiles/jvmti.h"
54 #include "logging/log.hpp"
55 #include "klass.inline.hpp"
56 #include "logging/logMessage.hpp"
57 #include "logging/logStream.hpp"
58 #include "memory/allocation.inline.hpp"
59 #include "memory/iterator.inline.hpp"
60 #include "memory/metadataFactory.hpp"
61 #include "memory/metaspaceClosure.hpp"
62 #include "memory/oopFactory.hpp"
63 #include "memory/resourceArea.hpp"
64 #include "memory/universe.hpp"
65 #include "oops/fieldStreams.inline.hpp"
66 #include "oops/constantPool.hpp"
67 #include "oops/instanceClassLoaderKlass.hpp"
68 #include "oops/instanceKlass.inline.hpp"
72 #include "oops/klass.inline.hpp"
73 #include "oops/method.hpp"
74 #include "oops/oop.inline.hpp"
75 #include "oops/recordComponent.hpp"
76 #include "oops/symbol.hpp"
77 #include "prims/jvmtiExport.hpp"
78 #include "prims/jvmtiRedefineClasses.hpp"
79 #include "prims/jvmtiThreadState.hpp"
80 #include "prims/methodComparator.hpp"
81 #include "runtime/arguments.hpp"
82 #include "runtime/deoptimization.hpp"
83 #include "runtime/atomic.hpp"
84 #include "runtime/fieldDescriptor.inline.hpp"
85 #include "runtime/handles.inline.hpp"
86 #include "runtime/javaCalls.hpp"
87 #include "runtime/javaThread.inline.hpp"
88 #include "runtime/mutexLocker.hpp"
89 #include "runtime/orderAccess.hpp"
90 #include "runtime/os.inline.hpp"
91 #include "runtime/reflection.hpp"
92 #include "runtime/runtimeUpcalls.hpp"
93 #include "runtime/synchronizer.hpp"
94 #include "runtime/threads.hpp"
95 #include "services/classLoadingService.hpp"
96 #include "services/finalizerService.hpp"
97 #include "services/threadService.hpp"
98 #include "utilities/dtrace.hpp"
99 #include "utilities/events.hpp"
100 #include "utilities/macros.hpp"
101 #include "utilities/nativeStackPrinter.hpp"
102 #include "utilities/stringUtils.hpp"
103 #ifdef COMPILER1
104 #include "c1/c1_Compiler.hpp"
105 #endif
106 #if INCLUDE_JFR
107 #include "jfr/jfrEvents.hpp"
108 #endif
109
110 #ifdef DTRACE_ENABLED
111
112
1065 return true;
1066 }
1067
1068 // Rewrite the byte codes of all of the methods of a class.
1069 // The rewriter must be called exactly once. Rewriting must happen after
1070 // verification but before the first method of the class is executed.
1071 void InstanceKlass::rewrite_class(TRAPS) {
1072 assert(is_loaded(), "must be loaded");
1073 if (is_rewritten()) {
1074 assert(is_shared(), "rewriting an unshared class?");
1075 return;
1076 }
1077 Rewriter::rewrite(this, CHECK);
1078 set_rewritten();
1079 }
1080
1081 // Now relocate and link method entry points after class is rewritten.
1082 // This is outside is_rewritten flag. In case of an exception, it can be
1083 // executed more than once.
1084 void InstanceKlass::link_methods(TRAPS) {
1085 PerfTraceElapsedTime timer(ClassLoader::perf_ik_link_methods_time());
1086
1087 int len = methods()->length();
1088 for (int i = len-1; i >= 0; i--) {
1089 methodHandle m(THREAD, methods()->at(i));
1090 RuntimeUpcalls::install_upcalls(m);
1091
1092 // Set up method entry points for compiler and interpreter .
1093 m->link_method(m, CHECK);
1094 }
1095 }
1096
1097 // Eagerly initialize superinterfaces that declare default methods (concrete instance: any access)
1098 void InstanceKlass::initialize_super_interfaces(TRAPS) {
1099 assert (has_nonstatic_concrete_methods(), "caller should have checked this");
1100 for (int i = 0; i < local_interfaces()->length(); ++i) {
1101 InstanceKlass* ik = local_interfaces()->at(i);
1102
1103 // Initialization is depth first search ie. we start with top of the inheritance tree
1104 // has_nonstatic_concrete_methods drives searching superinterfaces since it
1105 // means has_nonstatic_concrete_methods in its superinterface hierarchy
1106 if (ik->has_nonstatic_concrete_methods()) {
1107 ik->initialize_super_interfaces(CHECK);
1108 }
1109
1110 // Only initialize() interfaces that "declare" concrete methods.
1175 assert_locked_or_safepoint(ClassInitError_lock);
1176 InitErrorTableCleaner cleaner;
1177 if (_initialization_error_table != nullptr) {
1178 _initialization_error_table->unlink(&cleaner);
1179 }
1180 }
1181
1182 void InstanceKlass::initialize_impl(TRAPS) {
1183 HandleMark hm(THREAD);
1184
1185 // Make sure klass is linked (verified) before initialization
1186 // A class could already be verified, since it has been reflected upon.
1187 link_class(CHECK);
1188
1189 DTRACE_CLASSINIT_PROBE(required, -1);
1190
1191 bool wait = false;
1192
1193 JavaThread* jt = THREAD;
1194
1195 if (ForceProfiling) {
1196 // Preallocate MDOs.
1197 for (int i = 0; i < methods()->length(); i++) {
1198 assert(!HAS_PENDING_EXCEPTION, "");
1199 methodHandle m(THREAD, methods()->at(i));
1200 Method::build_profiling_method_data(m, THREAD);
1201 if (HAS_PENDING_EXCEPTION) {
1202 ResourceMark rm;
1203 log_warning(cds)("MDO preallocation failed for %s", external_name());
1204 CLEAR_PENDING_EXCEPTION;
1205 break;
1206 }
1207 }
1208 }
1209
1210 bool debug_logging_enabled = log_is_enabled(Debug, class, init);
1211
1212 // refer to the JVM book page 47 for description of steps
1213 // Step 1
1214 {
1215 Handle h_init_lock(THREAD, init_lock());
1216 ObjectLocker ol(h_init_lock, jt);
1217
1218 // Step 2
1219 // If we were to use wait() instead of waitInterruptibly() then
1220 // we might end up throwing IE from link/symbol resolution sites
1221 // that aren't expected to throw. This would wreak havoc. See 6320309.
1222 while (is_being_initialized() && !is_reentrant_initialization(jt)) {
1223 if (debug_logging_enabled) {
1224 ResourceMark rm(jt);
1225 log_debug(class, init)("Thread \"%s\" waiting for initialization of %s by thread \"%s\"",
1226 jt->name(), external_name(), init_thread_name());
1227 }
1228 wait = true;
1229 jt->set_class_to_be_initialized(this);
1359 add_initialization_error(THREAD, e);
1360 set_initialization_state_and_notify(initialization_error, THREAD);
1361 CLEAR_PENDING_EXCEPTION; // ignore any exception thrown, class initialization error is thrown below
1362 // JVMTI has already reported the pending exception
1363 // JVMTI internal flag reset is needed in order to report ExceptionInInitializerError
1364 JvmtiExport::clear_detected_exception(jt);
1365 }
1366 DTRACE_CLASSINIT_PROBE_WAIT(error, -1, wait);
1367 if (e->is_a(vmClasses::Error_klass())) {
1368 THROW_OOP(e());
1369 } else {
1370 JavaCallArguments args(e);
1371 THROW_ARG(vmSymbols::java_lang_ExceptionInInitializerError(),
1372 vmSymbols::throwable_void_signature(),
1373 &args);
1374 }
1375 }
1376 DTRACE_CLASSINIT_PROBE_WAIT(end, -1, wait);
1377 }
1378
1379 void InstanceKlass::set_initialization_state_and_notify(ClassState state, TRAPS) {
1380 Handle h_init_lock(THREAD, init_lock());
1381 if (h_init_lock() != nullptr) {
1382 ObjectLocker ol(h_init_lock, THREAD);
1383 set_init_thread(nullptr); // reset _init_thread before changing _init_state
1384 set_init_state(state);
1385 fence_and_clear_init_lock();
1386 ol.notify_all(CHECK);
1387 } else {
1388 assert(h_init_lock() != nullptr, "The initialization state should never be set twice");
1389 set_init_thread(nullptr); // reset _init_thread before changing _init_state
1390 set_init_state(state);
1391 }
1392 }
1393
1394 // Update hierarchy. This is done before the new klass has been added to the SystemDictionary. The Compile_lock
1395 // is grabbed, to ensure that the compiler is not using the class hierarchy.
1396 void InstanceKlass::add_to_hierarchy(JavaThread* current) {
1397 assert(!SafepointSynchronize::is_at_safepoint(), "must NOT be at safepoint");
1398
1588 tty->print("Registered ");
1589 i->print_value_on(tty);
1590 tty->print_cr(" (" PTR_FORMAT ") as finalizable", p2i(i));
1591 }
1592 instanceHandle h_i(THREAD, i);
1593 // Pass the handle as argument, JavaCalls::call expects oop as jobjects
1594 JavaValue result(T_VOID);
1595 JavaCallArguments args(h_i);
1596 methodHandle mh(THREAD, Universe::finalizer_register_method());
1597 JavaCalls::call(&result, mh, &args, CHECK_NULL);
1598 MANAGEMENT_ONLY(FinalizerService::on_register(h_i(), THREAD);)
1599 return h_i();
1600 }
1601
1602 instanceOop InstanceKlass::allocate_instance(TRAPS) {
1603 assert(!is_abstract() && !is_interface(), "Should not create this object");
1604 size_t size = size_helper(); // Query before forming handle.
1605 return (instanceOop)Universe::heap()->obj_allocate(this, size, CHECK_NULL);
1606 }
1607
1608 instanceOop InstanceKlass::allocate_instance(oop java_class,
1609 const char* who,
1610 TRAPS) {
1611 Klass* k = java_lang_Class::as_Klass(java_class);
1612 if (k == nullptr) {
1613 ResourceMark rm(THREAD);
1614 THROW_(vmSymbols::java_lang_InstantiationException(), nullptr);
1615 }
1616 InstanceKlass* ik = cast(k);
1617 ik->check_valid_for_instantiation(false, CHECK_NULL);
1618 ik->initialize(CHECK_NULL);
1619 return ik->allocate_instance(THREAD);
1620 }
1621
1622 instanceHandle InstanceKlass::allocate_instance_handle(TRAPS) {
1623 return instanceHandle(THREAD, allocate_instance(THREAD));
1624 }
1625
1626 void InstanceKlass::check_valid_for_instantiation(bool throwError, TRAPS) {
1627 if (is_interface() || is_abstract()) {
1628 ResourceMark rm(THREAD);
1629 THROW_MSG(throwError ? vmSymbols::java_lang_InstantiationError()
1630 : vmSymbols::java_lang_InstantiationException(), external_name());
1693 // Hide the existence of the initializer for the purpose of replaying the compile
1694 return;
1695 }
1696
1697 #if INCLUDE_CDS
1698 // This is needed to ensure the consistency of the archived heap objects.
1699 if (has_aot_initialized_mirror() && CDSConfig::is_loading_heap()) {
1700 AOTClassInitializer::call_runtime_setup(THREAD, this);
1701 return;
1702 } else if (has_archived_enum_objs()) {
1703 assert(is_shared(), "must be");
1704 bool initialized = CDSEnumKlass::initialize_enum_klass(this, CHECK);
1705 if (initialized) {
1706 return;
1707 }
1708 }
1709 #endif
1710
1711 methodHandle h_method(THREAD, class_initializer());
1712 assert(!is_initialized(), "we cannot initialize twice");
1713
1714 #if 0
1715 // FIXME -- revive this code added to leyden/premain for <clinit> profiling
1716 int init_id = log_class_init(THREAD, this);
1717 if (h_method() != nullptr) {
1718 JavaCallArguments args; // No arguments
1719 JavaValue result(T_VOID);
1720 InstanceKlass* outer = THREAD->set_class_being_initialized(this);
1721 jlong bc_start = (CountBytecodesPerThread ? THREAD->bc_counter_value() : BytecodeCounter::counter_value());
1722
1723 elapsedTimer timer;
1724 {
1725 PerfPauseTimer pt(THREAD->current_rt_call_timer(), THREAD->profile_rt_calls());
1726 PauseRuntimeCallProfiling prcp(THREAD, THREAD->profile_rt_calls());
1727
1728 timer.start();
1729 JavaCalls::call(&result, h_method, &args, THREAD); // Static call (no args)
1730 timer.stop();
1731 }
1732
1733 jlong bc_end = (CountBytecodesPerThread ? THREAD->bc_counter_value() : BytecodeCounter::counter_value());
1734
1735 jlong bc_executed = (bc_end - bc_start);
1736 if (UsePerfData && outer == nullptr) { // outermost clinit
1737 THREAD->inc_clinit_bc_counter_value(bc_executed);
1738 ClassLoader::perf_class_init_bytecodes_count()->inc(bc_executed);
1739 }
1740
1741 THREAD->set_class_being_initialized(outer);
1742
1743 LogStreamHandle(Debug, init) log;
1744 if (log.is_enabled()) {
1745 ResourceMark rm(THREAD);
1746 log.print("%d Initialized in %.3fms (total: " JLONG_FORMAT "ms); ",
1747 init_id, timer.seconds() * 1000.0, ClassLoader::class_init_time_ms());
1748 if (CountBytecodes || CountBytecodesPerThread) {
1749 log.print("executed " JLONG_FORMAT " bytecodes; ", bc_executed);
1750 }
1751 name()->print_value_on(&log);
1752 log.print_cr(" by thread " PTR_FORMAT " \"%s\" (" PTR_FORMAT ")",
1753 p2i(THREAD), THREAD->name(), p2i(this));
1754 }
1755 }
1756 LogTarget(Info, class, init) lt;
1757 if (lt.is_enabled()) {
1758 ResourceMark rm(THREAD);
1759 LogStream ls(lt);
1760 ls.print("%d Initialized ", init_id);
1761 name()->print_value_on(&ls);
1762 ls.print_cr("%s (" PTR_FORMAT ") by thread \"%s\"",
1763 h_method() == nullptr ? "(no method)" : "", p2i(this),
1764 THREAD->name());
1765 }
1766 #else
1767 LogTarget(Info, class, init) lt;
1768 if (lt.is_enabled()) {
1769 ResourceMark rm(THREAD);
1770 LogStream ls(lt);
1771 ls.print("%d Initializing ", call_class_initializer_counter++);
1772 name()->print_value_on(&ls);
1773 ls.print_cr("%s (" PTR_FORMAT ") by thread \"%s\"",
1774 h_method() == nullptr ? "(no method)" : "", p2i(this),
1775 THREAD->name());
1776 }
1777 if (h_method() != nullptr) {
1778 ThreadInClassInitializer ticl(THREAD, this); // Track class being initialized
1779 JavaCallArguments args; // No arguments
1780 JavaValue result(T_VOID);
1781 JavaCalls::call(&result, h_method, &args, CHECK); // Static call (no args)
1782 }
1783 #endif
1784 }
1785
1786 // If a class that implements this interface is initialized, is the JVM required
1787 // to first execute a <clinit> method declared in this interface,
1788 // or (if also_check_supers==true) any of the super types of this interface?
1789 //
1790 // JVMS 5.5. Initialization, step 7: Next, if C is a class rather than
1791 // an interface, then let SC be its superclass and let SI1, ..., SIn
1792 // be all superinterfaces of C (whether direct or indirect) that
1793 // declare at least one non-abstract, non-static method.
1794 //
1795 // So when an interface is initialized, it does not look at its
1796 // supers. But a proper class will ensure that all of its supers have
1797 // run their <clinit> methods, except that it disregards interfaces
1798 // that lack a non-static concrete method (i.e., a default method).
1799 // Therefore, you should probably call this method only when the
1800 // current class is a super of some proper class, not an interface.
1801 bool InstanceKlass::interface_needs_clinit_execution_as_super(bool also_check_supers) const {
1802 assert(is_interface(), "must be");
1803
2560 }
2561 }
2562 if (new_jmeths != 0) {
2563 Method::ensure_jmethod_ids(class_loader_data(), new_jmeths);
2564 }
2565 }
2566
2567 // Lookup a jmethodID, null if not found. Do no blocking, no allocations, no handles
2568 jmethodID InstanceKlass::jmethod_id_or_null(Method* method) {
2569 int idnum = method->method_idnum();
2570 jmethodID* jmeths = methods_jmethod_ids_acquire();
2571 return (jmeths != nullptr) ? jmeths[idnum + 1] : nullptr;
2572 }
2573
2574 inline DependencyContext InstanceKlass::dependencies() {
2575 DependencyContext dep_context(&_dep_context, &_dep_context_last_cleaned);
2576 return dep_context;
2577 }
2578
2579 void InstanceKlass::mark_dependent_nmethods(DeoptimizationScope* deopt_scope, KlassDepChange& changes) {
2580 dependencies().mark_dependent_nmethods(deopt_scope, changes, this);
2581 }
2582
2583 void InstanceKlass::add_dependent_nmethod(nmethod* nm) {
2584 assert_lock_strong(CodeCache_lock);
2585 dependencies().add_dependent_nmethod(nm);
2586 }
2587
2588 void InstanceKlass::clean_dependency_context() {
2589 dependencies().clean_unloading_dependents();
2590 }
2591
2592 #ifndef PRODUCT
2593 void InstanceKlass::print_dependent_nmethods(bool verbose) {
2594 dependencies().print_dependent_nmethods(verbose);
2595 }
2596
2597 bool InstanceKlass::is_dependent_nmethod(nmethod* nm) {
2598 return dependencies().is_dependent_nmethod(nm);
2599 }
2600 #endif //PRODUCT
2698 for (int i = 0; i < nof_interfaces; i ++, ioe ++) {
2699 if (ioe->interface_klass() != nullptr) {
2700 it->push(ioe->interface_klass_addr());
2701 itableMethodEntry* ime = ioe->first_method_entry(this);
2702 int n = klassItable::method_count_for_interface(ioe->interface_klass());
2703 for (int index = 0; index < n; index ++) {
2704 it->push(ime[index].method_addr());
2705 }
2706 }
2707 }
2708 }
2709
2710 it->push(&_nest_host);
2711 it->push(&_nest_members);
2712 it->push(&_permitted_subclasses);
2713 it->push(&_record_components);
2714 }
2715
2716 #if INCLUDE_CDS
2717 void InstanceKlass::remove_unshareable_info() {
2718 if (is_linked()) {
2719 assert(can_be_verified_at_dumptime(), "must be");
2720 // Remember this so we can avoid walking the hierarchy at runtime.
2721 set_verified_at_dump_time();
2722 }
2723 _misc_flags.set_has_init_deps_processed(false);
2724
2725 _misc_flags.set_has_init_deps_processed(false);
2726
2727 Klass::remove_unshareable_info();
2728
2729 if (SystemDictionaryShared::has_class_failed_verification(this)) {
2730 // Classes are attempted to link during dumping and may fail,
2731 // but these classes are still in the dictionary and class list in CLD.
2732 // If the class has failed verification, there is nothing else to remove.
2733 return;
2734 }
2735
2736 // Reset to the 'allocated' state to prevent any premature accessing to
2737 // a shared class at runtime while the class is still being loaded and
2738 // restored. A class' init_state is set to 'loaded' at runtime when it's
2739 // being added to class hierarchy (see InstanceKlass:::add_to_hierarchy()).
2740 _init_state = allocated;
2741
2742 { // Otherwise this needs to take out the Compile_lock.
2743 assert(SafepointSynchronize::is_at_safepoint(), "only called at safepoint");
2875
2876 // restore constant pool resolved references
2877 constants()->restore_unshareable_info(CHECK);
2878
2879 if (array_klasses() != nullptr) {
2880 // To get a consistent list of classes we need MultiArray_lock to ensure
2881 // array classes aren't observed while they are being restored.
2882 RecursiveLocker rl(MultiArray_lock, THREAD);
2883 assert(this == array_klasses()->bottom_klass(), "sanity");
2884 // Array classes have null protection domain.
2885 // --> see ArrayKlass::complete_create_array_klass()
2886 array_klasses()->restore_unshareable_info(class_loader_data(), Handle(), CHECK);
2887 }
2888
2889 // Initialize @ValueBased class annotation if not already set in the archived klass.
2890 if (DiagnoseSyncOnValueBasedClasses && has_value_based_class_annotation() && !is_value_based()) {
2891 set_is_value_based();
2892 }
2893 }
2894
2895 bool InstanceKlass::can_be_verified_at_dumptime() const {
2896 if (CDSConfig::preserve_all_dumptime_verification_states(this)) {
2897 return true;
2898 }
2899
2900 if (MetaspaceShared::is_in_shared_metaspace(this)) {
2901 // This is a class that was dumped into the base archive, so we know
2902 // it was verified at dump time.
2903 return true;
2904 }
2905
2906 // Check if a class or any of its supertypes has a version older than 50.
2907 // CDS will not perform verification of old classes during dump time because
2908 // without changing the old verifier, the verification constraint cannot be
2909 // retrieved during dump time.
2910 // Verification of archived old classes will be performed during run time.
2911 if (major_version() < 50 /*JAVA_6_VERSION*/) {
2912 return false;
2913 }
2914 if (java_super() != nullptr && !java_super()->can_be_verified_at_dumptime()) {
2915 return false;
2916 }
2917 Array<InstanceKlass*>* interfaces = local_interfaces();
2918 int len = interfaces->length();
2919 for (int i = 0; i < len; i++) {
2920 if (!interfaces->at(i)->can_be_verified_at_dumptime()) {
2921 return false;
2922 }
2923 }
2924 return true;
2925 }
2926
2927 #endif // INCLUDE_CDS
2928
2929 #if INCLUDE_JVMTI
2930 static void clear_all_breakpoints(Method* m) {
3685 static void print_vtable(intptr_t* start, int len, outputStream* st) {
3686 for (int i = 0; i < len; i++) {
3687 intptr_t e = start[i];
3688 st->print("%d : " INTPTR_FORMAT, i, e);
3689 if (MetaspaceObj::is_valid((Metadata*)e)) {
3690 st->print(" ");
3691 ((Metadata*)e)->print_value_on(st);
3692 }
3693 st->cr();
3694 }
3695 }
3696
3697 static void print_vtable(vtableEntry* start, int len, outputStream* st) {
3698 return print_vtable(reinterpret_cast<intptr_t*>(start), len, st);
3699 }
3700
3701 const char* InstanceKlass::init_state_name() const {
3702 return state_names[init_state()];
3703 }
3704
3705 const char* InstanceKlass::state2name(ClassState s) {
3706 return state_names[s];
3707 }
3708
3709 void InstanceKlass::print_on(outputStream* st) const {
3710 assert(is_klass(), "must be klass");
3711 Klass::print_on(st);
3712
3713 st->print(BULLET"instance size: %d", size_helper()); st->cr();
3714 st->print(BULLET"klass size: %d", size()); st->cr();
3715 st->print(BULLET"access: "); access_flags().print_on(st); st->cr();
3716 st->print(BULLET"flags: "); _misc_flags.print_on(st); st->cr();
3717 st->print(BULLET"state: "); st->print_cr("%s", init_state_name());
3718 st->print(BULLET"name: "); name()->print_value_on(st); st->cr();
3719 st->print(BULLET"super: "); Metadata::print_value_on_maybe_null(st, super()); st->cr();
3720 st->print(BULLET"sub: ");
3721 Klass* sub = subklass();
3722 int n;
3723 for (n = 0; sub != nullptr; n++, sub = sub->next_sibling()) {
3724 if (n < MaxSubklassPrintSize) {
3725 sub->print_value_on(st);
3726 st->print(" ");
3727 }
3728 }
4018 nullptr;
4019 // caller can be null, for example, during a JVMTI VM_Init hook
4020 if (caller != nullptr) {
4021 info_stream.print(" source: instance of %s", caller->external_name());
4022 } else {
4023 // source is unknown
4024 }
4025 } else {
4026 oop class_loader = loader_data->class_loader();
4027 info_stream.print(" source: %s", class_loader->klass()->external_name());
4028 }
4029 } else {
4030 assert(this->is_shared(), "must be");
4031 if (MetaspaceShared::is_shared_dynamic((void*)this)) {
4032 info_stream.print(" source: shared objects file (top)");
4033 } else {
4034 info_stream.print(" source: shared objects file");
4035 }
4036 }
4037
4038 info_stream.print(" loader:");
4039 if (is_shared()) {
4040 info_stream.print(" %s", SystemDictionaryShared::loader_type_for_shared_class((Klass*)this));
4041 } else if (loader_data == ClassLoaderData::the_null_class_loader_data()) {
4042 info_stream.print(" boot_loader");
4043 } else {
4044 oop class_loader = loader_data->class_loader();
4045 if (class_loader != nullptr) {
4046 info_stream.print(" %s", class_loader->klass()->external_name());
4047 oop cl_name_and_id = java_lang_ClassLoader::nameAndId(class_loader);
4048 if (cl_name_and_id != nullptr) {
4049 info_stream.print(" %s", java_lang_String::as_utf8_string(cl_name_and_id));
4050 }
4051 } else {
4052 info_stream.print(" null");
4053 }
4054 }
4055 msg.info("%s", info_stream.as_string());
4056
4057 if (log_is_enabled(Debug, class, load)) {
4058 stringStream debug_stream;
4059
4060 // Class hierarchy info
4061 debug_stream.print(" klass: " PTR_FORMAT " super: " PTR_FORMAT,
4062 p2i(this), p2i(superklass()));
4063
4064 // Interfaces
4065 if (local_interfaces() != nullptr && local_interfaces()->length() > 0) {
4066 debug_stream.print(" interfaces:");
4067 int length = local_interfaces()->length();
4068 for (int i = 0; i < length; i++) {
4069 debug_stream.print(" " PTR_FORMAT,
4070 p2i(InstanceKlass::cast(local_interfaces()->at(i))));
4071 }
4072 }
4073
4074 // Class loader
|