25 #include "precompiled.hpp"
26 #include "aot/aotLoader.hpp"
27 #include "classfile/classFileParser.hpp"
28 #include "classfile/classFileStream.hpp"
29 #include "classfile/classLoader.hpp"
30 #include "classfile/javaClasses.hpp"
31 #include "classfile/moduleEntry.hpp"
32 #include "classfile/systemDictionary.hpp"
33 #include "classfile/systemDictionaryShared.hpp"
34 #include "classfile/verifier.hpp"
35 #include "classfile/vmSymbols.hpp"
36 #include "code/dependencyContext.hpp"
37 #include "compiler/compileBroker.hpp"
38 #include "gc/shared/collectedHeap.inline.hpp"
39 #include "gc/shared/specialized_oop_closures.hpp"
40 #include "interpreter/oopMapCache.hpp"
41 #include "interpreter/rewriter.hpp"
42 #include "jvmtifiles/jvmti.h"
43 #include "logging/log.hpp"
44 #include "logging/logMessage.hpp"
45 #include "memory/heapInspection.hpp"
46 #include "memory/iterator.inline.hpp"
47 #include "memory/metadataFactory.hpp"
48 #include "memory/metaspaceShared.hpp"
49 #include "memory/oopFactory.hpp"
50 #include "memory/resourceArea.hpp"
51 #include "oops/fieldStreams.hpp"
52 #include "oops/instanceClassLoaderKlass.hpp"
53 #include "oops/instanceKlass.inline.hpp"
54 #include "oops/instanceMirrorKlass.hpp"
55 #include "oops/instanceOop.hpp"
56 #include "oops/klass.inline.hpp"
57 #include "oops/method.hpp"
58 #include "oops/oop.inline.hpp"
59 #include "oops/symbol.hpp"
60 #include "prims/jvm.h"
61 #include "prims/jvmtiExport.hpp"
62 #include "prims/jvmtiRedefineClasses.hpp"
63 #include "prims/jvmtiThreadState.hpp"
64 #include "prims/methodComparator.hpp"
1068
1069 Method* InstanceKlass::class_initializer() const {
1070 Method* clinit = find_method(
1071 vmSymbols::class_initializer_name(), vmSymbols::void_method_signature());
1072 if (clinit != NULL && clinit->has_valid_initializer_flags()) {
1073 return clinit;
1074 }
1075 return NULL;
1076 }
1077
1078 void InstanceKlass::call_class_initializer(TRAPS) {
1079 if (ReplayCompiles &&
1080 (ReplaySuppressInitializers == 1 ||
1081 ReplaySuppressInitializers >= 2 && class_loader() != NULL)) {
1082 // Hide the existence of the initializer for the purpose of replaying the compile
1083 return;
1084 }
1085
1086 methodHandle h_method(THREAD, class_initializer());
1087 assert(!is_initialized(), "we cannot initialize twice");
1088 if (log_is_enabled(Info, class, init)) {
1089 ResourceMark rm;
1090 outputStream* log = Log(class, init)::info_stream();
1091 log->print("%d Initializing ", call_class_initializer_counter++);
1092 name()->print_value_on(log);
1093 log->print_cr("%s (" INTPTR_FORMAT ")", h_method() == NULL ? "(no method)" : "", p2i(this));
1094 }
1095 if (h_method() != NULL) {
1096 JavaCallArguments args; // No arguments
1097 JavaValue result(T_VOID);
1098 JavaCalls::call(&result, h_method, &args, CHECK); // Static call (no args)
1099 }
1100 }
1101
1102
1103 void InstanceKlass::mask_for(const methodHandle& method, int bci,
1104 InterpreterOopMap* entry_for) {
1105 // Lazily create the _oop_map_cache at first request
1106 // Lock-free access requires load_ptr_acquire.
1107 OopMapCache* oop_map_cache =
1108 static_cast<OopMapCache*>(OrderAccess::load_ptr_acquire(&_oop_map_cache));
1109 if (oop_map_cache == NULL) {
1110 MutexLocker x(OopMapCacheAlloc_lock);
1111 // Check if _oop_map_cache was allocated while we were waiting for this lock
1112 if ((oop_map_cache = _oop_map_cache) == NULL) {
1113 oop_map_cache = new OopMapCache();
|
25 #include "precompiled.hpp"
26 #include "aot/aotLoader.hpp"
27 #include "classfile/classFileParser.hpp"
28 #include "classfile/classFileStream.hpp"
29 #include "classfile/classLoader.hpp"
30 #include "classfile/javaClasses.hpp"
31 #include "classfile/moduleEntry.hpp"
32 #include "classfile/systemDictionary.hpp"
33 #include "classfile/systemDictionaryShared.hpp"
34 #include "classfile/verifier.hpp"
35 #include "classfile/vmSymbols.hpp"
36 #include "code/dependencyContext.hpp"
37 #include "compiler/compileBroker.hpp"
38 #include "gc/shared/collectedHeap.inline.hpp"
39 #include "gc/shared/specialized_oop_closures.hpp"
40 #include "interpreter/oopMapCache.hpp"
41 #include "interpreter/rewriter.hpp"
42 #include "jvmtifiles/jvmti.h"
43 #include "logging/log.hpp"
44 #include "logging/logMessage.hpp"
45 #include "logging/logStream.hpp"
46 #include "memory/heapInspection.hpp"
47 #include "memory/iterator.inline.hpp"
48 #include "memory/metadataFactory.hpp"
49 #include "memory/metaspaceShared.hpp"
50 #include "memory/oopFactory.hpp"
51 #include "memory/resourceArea.hpp"
52 #include "oops/fieldStreams.hpp"
53 #include "oops/instanceClassLoaderKlass.hpp"
54 #include "oops/instanceKlass.inline.hpp"
55 #include "oops/instanceMirrorKlass.hpp"
56 #include "oops/instanceOop.hpp"
57 #include "oops/klass.inline.hpp"
58 #include "oops/method.hpp"
59 #include "oops/oop.inline.hpp"
60 #include "oops/symbol.hpp"
61 #include "prims/jvm.h"
62 #include "prims/jvmtiExport.hpp"
63 #include "prims/jvmtiRedefineClasses.hpp"
64 #include "prims/jvmtiThreadState.hpp"
65 #include "prims/methodComparator.hpp"
1069
1070 Method* InstanceKlass::class_initializer() const {
1071 Method* clinit = find_method(
1072 vmSymbols::class_initializer_name(), vmSymbols::void_method_signature());
1073 if (clinit != NULL && clinit->has_valid_initializer_flags()) {
1074 return clinit;
1075 }
1076 return NULL;
1077 }
1078
1079 void InstanceKlass::call_class_initializer(TRAPS) {
1080 if (ReplayCompiles &&
1081 (ReplaySuppressInitializers == 1 ||
1082 ReplaySuppressInitializers >= 2 && class_loader() != NULL)) {
1083 // Hide the existence of the initializer for the purpose of replaying the compile
1084 return;
1085 }
1086
1087 methodHandle h_method(THREAD, class_initializer());
1088 assert(!is_initialized(), "we cannot initialize twice");
1089 LogTarget(Info, class, init) lt;
1090 if (lt.is_enabled()) {
1091 ResourceMark rm;
1092 LogStream ls(lt);
1093 ls.print("%d Initializing ", call_class_initializer_counter++);
1094 name()->print_value_on(&ls);
1095 ls.print_cr("%s (" INTPTR_FORMAT ")", h_method() == NULL ? "(no method)" : "", p2i(this));
1096 }
1097 if (h_method() != NULL) {
1098 JavaCallArguments args; // No arguments
1099 JavaValue result(T_VOID);
1100 JavaCalls::call(&result, h_method, &args, CHECK); // Static call (no args)
1101 }
1102 }
1103
1104
1105 void InstanceKlass::mask_for(const methodHandle& method, int bci,
1106 InterpreterOopMap* entry_for) {
1107 // Lazily create the _oop_map_cache at first request
1108 // Lock-free access requires load_ptr_acquire.
1109 OopMapCache* oop_map_cache =
1110 static_cast<OopMapCache*>(OrderAccess::load_ptr_acquire(&_oop_map_cache));
1111 if (oop_map_cache == NULL) {
1112 MutexLocker x(OopMapCacheAlloc_lock);
1113 // Check if _oop_map_cache was allocated while we were waiting for this lock
1114 if ((oop_map_cache = _oop_map_cache) == NULL) {
1115 oop_map_cache = new OopMapCache();
|