< prev index next >

src/share/vm/oops/instanceKlass.cpp

Print this page




1061 }
1062 
1063 Klass* InstanceKlass::array_klass_impl(bool or_null, TRAPS) {
1064   return array_klass_impl(or_null, 1, THREAD);
1065 }
1066 
1067 static int call_class_initializer_counter = 0;   // for debugging
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 




1061 }
1062 
1063 Klass* InstanceKlass::array_klass_impl(bool or_null, TRAPS) {
1064   return array_klass_impl(or_null, 1, THREAD);
1065 }
1066 
1067 static int call_class_initializer_counter = 0;   // for debugging
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 


< prev index next >