1247 } |
1247 } |
1248 vm_exit(0); |
1248 vm_exit(0); |
1249 } |
1249 } |
1250 |
1250 |
1251 int ClassLoader::_compile_the_world_counter = 0; |
1251 int ClassLoader::_compile_the_world_counter = 0; |
|
1252 static int _codecache_sweep_counter = 0; |
1252 |
1253 |
1253 void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) { |
1254 void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) { |
1254 int len = (int)strlen(name); |
1255 int len = (int)strlen(name); |
1255 if (len > 6 && strcmp(".class", name + len - 6) == 0) { |
1256 if (len > 6 && strcmp(".class", name + len - 6) == 0) { |
1256 // We have a .class file |
1257 // We have a .class file |
1291 // Preload all classes to get around uncommon traps |
1292 // Preload all classes to get around uncommon traps |
1292 // Iterate over all methods in class |
1293 // Iterate over all methods in class |
1293 for (int n = 0; n < k->methods()->length(); n++) { |
1294 for (int n = 0; n < k->methods()->length(); n++) { |
1294 methodHandle m (THREAD, methodOop(k->methods()->obj_at(n))); |
1295 methodHandle m (THREAD, methodOop(k->methods()->obj_at(n))); |
1295 if (CompilationPolicy::canBeCompiled(m)) { |
1296 if (CompilationPolicy::canBeCompiled(m)) { |
|
1297 |
|
1298 if (++_codecache_sweep_counter == CompileTheWorldSafepointInterval) { |
|
1299 // Give sweeper a chance to keep up with CTW |
|
1300 VM_ForceSafepoint op; |
|
1301 VMThread::execute(&op); |
|
1302 _codecache_sweep_counter = 0; |
|
1303 } |
1296 // Force compilation |
1304 // Force compilation |
1297 CompileBroker::compile_method(m, InvocationEntryBci, |
1305 CompileBroker::compile_method(m, InvocationEntryBci, |
1298 methodHandle(), 0, "CTW", THREAD); |
1306 methodHandle(), 0, "CTW", THREAD); |
1299 if (HAS_PENDING_EXCEPTION) { |
1307 if (HAS_PENDING_EXCEPTION) { |
1300 CLEAR_PENDING_EXCEPTION; |
1308 CLEAR_PENDING_EXCEPTION; |