1084 Universe::_loader_addClass_cache->init(
1085 SystemDictionary::ClassLoader_klass(), m);
1086
1087 // Setup method for checking protection domain
1088 InstanceKlass::cast(SystemDictionary::ProtectionDomain_klass())->link_class(CHECK_false);
1089 m = InstanceKlass::cast(SystemDictionary::ProtectionDomain_klass())->
1090 find_method(vmSymbols::impliesCreateAccessControlContext_name(),
1091 vmSymbols::void_boolean_signature());
1092 // Allow NULL which should only happen with bootstrapping.
1093 if (m != NULL) {
1094 if (m->is_static()) {
1095 // NoSuchMethodException doesn't actually work because it tries to run the
1096 // <init> function before java_lang_Class is linked. Print error and exit.
1097 tty->print_cr("ProtectionDomain.impliesCreateAccessControlContext() has the wrong linkage");
1098 return false; // initialization failed
1099 }
1100 Universe::_pd_implies_cache->init(
1101 SystemDictionary::ProtectionDomain_klass(), m);;
1102 }
1103
1104 // The folowing is initializing converter functions for serialization in
1105 // JVM.cpp. If we clean up the StrictMath code above we may want to find
1106 // a better solution for this as well.
1107 initialize_converter_functions();
1108
1109 // This needs to be done before the first scavenge/gc, since
1110 // it's an input to soft ref clearing policy.
1111 {
1112 MutexLocker x(Heap_lock);
1113 Universe::update_heap_info_at_gc();
1114 }
1115
1116 // ("weak") refs processing infrastructure initialization
1117 Universe::heap()->post_initialize();
1118
1119 // Initialize performance counters for metaspaces
1120 MetaspaceCounters::initialize_performance_counters();
1121 CompressedClassSpaceCounters::initialize_performance_counters();
1122
1123 MemoryService::add_metaspace_memory_pools();
1124
1126
1127 MemoryService::set_universe_heap(Universe::_collectedHeap);
1128 return true;
1129 }
1130
1131
1132 void Universe::compute_base_vtable_size() {
1133 _base_vtable_size = ClassLoader::compute_Object_vtable();
1134 }
1135
1136
1137 // %%% The Universe::flush_foo methods belong in CodeCache.
1138
1139 // Flushes compiled methods dependent on dependee.
1140 void Universe::flush_dependents_on(instanceKlassHandle dependee) {
1141 assert_lock_strong(Compile_lock);
1142
1143 if (CodeCache::number_of_nmethods_with_dependencies() == 0) return;
1144
1145 // CodeCache can only be updated by a thread_in_VM and they will all be
1146 // stopped dring the safepoint so CodeCache will be safe to update without
1147 // holding the CodeCache_lock.
1148
1149 KlassDepChange changes(dependee);
1150
1151 // Compute the dependent nmethods
1152 if (CodeCache::mark_for_deoptimization(changes) > 0) {
1153 // At least one nmethod has been marked for deoptimization
1154 VM_Deoptimize op;
1155 VMThread::execute(&op);
1156 }
1157 }
1158
1159 // Flushes compiled methods dependent on a particular CallSite
1160 // instance when its target is different than the given MethodHandle.
1161 void Universe::flush_dependents_on(Handle call_site, Handle method_handle) {
1162 assert_lock_strong(Compile_lock);
1163
1164 if (CodeCache::number_of_nmethods_with_dependencies() == 0) return;
1165
1166 // CodeCache can only be updated by a thread_in_VM and they will all be
1167 // stopped dring the safepoint so CodeCache will be safe to update without
1168 // holding the CodeCache_lock.
1169
1170 CallSiteDepChange changes(call_site(), method_handle());
1171
1172 // Compute the dependent nmethods that have a reference to a
1173 // CallSite object. We use InstanceKlass::mark_dependent_nmethod
1174 // directly instead of CodeCache::mark_for_deoptimization because we
1175 // want dependents on the call site class only not all classes in
1176 // the ContextStream.
1177 int marked = 0;
1178 {
1179 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
1180 InstanceKlass* call_site_klass = InstanceKlass::cast(call_site->klass());
1181 marked = call_site_klass->mark_dependent_nmethods(changes);
1182 }
1183 if (marked > 0) {
1184 // At least one nmethod has been marked for deoptimization
1185 VM_Deoptimize op;
1186 VMThread::execute(&op);
1187 }
|
1084 Universe::_loader_addClass_cache->init(
1085 SystemDictionary::ClassLoader_klass(), m);
1086
1087 // Setup method for checking protection domain
1088 InstanceKlass::cast(SystemDictionary::ProtectionDomain_klass())->link_class(CHECK_false);
1089 m = InstanceKlass::cast(SystemDictionary::ProtectionDomain_klass())->
1090 find_method(vmSymbols::impliesCreateAccessControlContext_name(),
1091 vmSymbols::void_boolean_signature());
1092 // Allow NULL which should only happen with bootstrapping.
1093 if (m != NULL) {
1094 if (m->is_static()) {
1095 // NoSuchMethodException doesn't actually work because it tries to run the
1096 // <init> function before java_lang_Class is linked. Print error and exit.
1097 tty->print_cr("ProtectionDomain.impliesCreateAccessControlContext() has the wrong linkage");
1098 return false; // initialization failed
1099 }
1100 Universe::_pd_implies_cache->init(
1101 SystemDictionary::ProtectionDomain_klass(), m);;
1102 }
1103
1104 // The following is initializing converter functions for serialization in
1105 // JVM.cpp. If we clean up the StrictMath code above we may want to find
1106 // a better solution for this as well.
1107 initialize_converter_functions();
1108
1109 // This needs to be done before the first scavenge/gc, since
1110 // it's an input to soft ref clearing policy.
1111 {
1112 MutexLocker x(Heap_lock);
1113 Universe::update_heap_info_at_gc();
1114 }
1115
1116 // ("weak") refs processing infrastructure initialization
1117 Universe::heap()->post_initialize();
1118
1119 // Initialize performance counters for metaspaces
1120 MetaspaceCounters::initialize_performance_counters();
1121 CompressedClassSpaceCounters::initialize_performance_counters();
1122
1123 MemoryService::add_metaspace_memory_pools();
1124
1126
1127 MemoryService::set_universe_heap(Universe::_collectedHeap);
1128 return true;
1129 }
1130
1131
1132 void Universe::compute_base_vtable_size() {
1133 _base_vtable_size = ClassLoader::compute_Object_vtable();
1134 }
1135
1136
1137 // %%% The Universe::flush_foo methods belong in CodeCache.
1138
1139 // Flushes compiled methods dependent on dependee.
1140 void Universe::flush_dependents_on(instanceKlassHandle dependee) {
1141 assert_lock_strong(Compile_lock);
1142
1143 if (CodeCache::number_of_nmethods_with_dependencies() == 0) return;
1144
1145 // CodeCache can only be updated by a thread_in_VM and they will all be
1146 // stopped during the safepoint so CodeCache will be safe to update without
1147 // holding the CodeCache_lock.
1148
1149 KlassDepChange changes(dependee);
1150
1151 // Compute the dependent nmethods
1152 if (CodeCache::mark_for_deoptimization(changes) > 0) {
1153 // At least one nmethod has been marked for deoptimization
1154 VM_Deoptimize op;
1155 VMThread::execute(&op);
1156 }
1157 }
1158
1159 // Flushes compiled methods dependent on a particular CallSite
1160 // instance when its target is different than the given MethodHandle.
1161 void Universe::flush_dependents_on(Handle call_site, Handle method_handle) {
1162 assert_lock_strong(Compile_lock);
1163
1164 if (CodeCache::number_of_nmethods_with_dependencies() == 0) return;
1165
1166 // CodeCache can only be updated by a thread_in_VM and they will all be
1167 // stopped during the safepoint so CodeCache will be safe to update without
1168 // holding the CodeCache_lock.
1169
1170 CallSiteDepChange changes(call_site(), method_handle());
1171
1172 // Compute the dependent nmethods that have a reference to a
1173 // CallSite object. We use InstanceKlass::mark_dependent_nmethod
1174 // directly instead of CodeCache::mark_for_deoptimization because we
1175 // want dependents on the call site class only not all classes in
1176 // the ContextStream.
1177 int marked = 0;
1178 {
1179 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
1180 InstanceKlass* call_site_klass = InstanceKlass::cast(call_site->klass());
1181 marked = call_site_klass->mark_dependent_nmethods(changes);
1182 }
1183 if (marked > 0) {
1184 // At least one nmethod has been marked for deoptimization
1185 VM_Deoptimize op;
1186 VMThread::execute(&op);
1187 }
|