< prev index next >

src/share/vm/oops/instanceKlass.cpp

Print this page
rev 13113 : imported patch 8181917-refactor-ul-logstream


  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/jvmtiExport.hpp"
  61 #include "prims/jvmtiRedefineClasses.hpp"
  62 #include "prims/jvmtiThreadState.hpp"
  63 #include "prims/methodComparator.hpp"
  64 #include "runtime/atomic.hpp"


1067 
1068 Method* InstanceKlass::class_initializer() const {
1069   Method* clinit = find_method(
1070       vmSymbols::class_initializer_name(), vmSymbols::void_method_signature());
1071   if (clinit != NULL && clinit->has_valid_initializer_flags()) {
1072     return clinit;
1073   }
1074   return NULL;
1075 }
1076 
1077 void InstanceKlass::call_class_initializer(TRAPS) {
1078   if (ReplayCompiles &&
1079       (ReplaySuppressInitializers == 1 ||
1080        ReplaySuppressInitializers >= 2 && class_loader() != NULL)) {
1081     // Hide the existence of the initializer for the purpose of replaying the compile
1082     return;
1083   }
1084 
1085   methodHandle h_method(THREAD, class_initializer());
1086   assert(!is_initialized(), "we cannot initialize twice");
1087   if (log_is_enabled(Info, class, init)) {

1088     ResourceMark rm;
1089     outputStream* log = Log(class, init)::info_stream();
1090     log->print("%d Initializing ", call_class_initializer_counter++);
1091     name()->print_value_on(log);
1092     log->print_cr("%s (" INTPTR_FORMAT ")", h_method() == NULL ? "(no method)" : "", p2i(this));
1093   }
1094   if (h_method() != NULL) {
1095     JavaCallArguments args; // No arguments
1096     JavaValue result(T_VOID);
1097     JavaCalls::call(&result, h_method, &args, CHECK); // Static call (no args)
1098   }
1099 }
1100 
1101 
1102 void InstanceKlass::mask_for(const methodHandle& method, int bci,
1103   InterpreterOopMap* entry_for) {
1104   // Lazily create the _oop_map_cache at first request
1105   // Lock-free access requires load_ptr_acquire.
1106   OopMapCache* oop_map_cache =
1107       static_cast<OopMapCache*>(OrderAccess::load_ptr_acquire(&_oop_map_cache));
1108   if (oop_map_cache == NULL) {
1109     MutexLocker x(OopMapCacheAlloc_lock);
1110     // Check if _oop_map_cache was allocated while we were waiting for this lock
1111     if ((oop_map_cache = _oop_map_cache) == NULL) {
1112       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/jvmtiExport.hpp"
  62 #include "prims/jvmtiRedefineClasses.hpp"
  63 #include "prims/jvmtiThreadState.hpp"
  64 #include "prims/methodComparator.hpp"
  65 #include "runtime/atomic.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   LogTarget(Info, class, init) lt;
1089   if (lt.is_enabled()) {
1090     ResourceMark rm;
1091     LogStream ls(lt);
1092     ls.print("%d Initializing ", call_class_initializer_counter++);
1093     name()->print_value_on(&ls);
1094     ls.print_cr("%s (" INTPTR_FORMAT ")", h_method() == NULL ? "(no method)" : "", p2i(this));
1095   }
1096   if (h_method() != NULL) {
1097     JavaCallArguments args; // No arguments
1098     JavaValue result(T_VOID);
1099     JavaCalls::call(&result, h_method, &args, CHECK); // Static call (no args)
1100   }
1101 }
1102 
1103 
1104 void InstanceKlass::mask_for(const methodHandle& method, int bci,
1105   InterpreterOopMap* entry_for) {
1106   // Lazily create the _oop_map_cache at first request
1107   // Lock-free access requires load_ptr_acquire.
1108   OopMapCache* oop_map_cache =
1109       static_cast<OopMapCache*>(OrderAccess::load_ptr_acquire(&_oop_map_cache));
1110   if (oop_map_cache == NULL) {
1111     MutexLocker x(OopMapCacheAlloc_lock);
1112     // Check if _oop_map_cache was allocated while we were waiting for this lock
1113     if ((oop_map_cache = _oop_map_cache) == NULL) {
1114       oop_map_cache = new OopMapCache();


< prev index next >