497 { 498 TraceTime t3("compilation policy safepoint handler", TraceSafepointCleanupTime); 499 CompilationPolicy::policy()->do_safepoint_work(); 500 } 501 502 { 503 TraceTime t4("mark nmethods", TraceSafepointCleanupTime); 504 NMethodSweeper::mark_active_nmethods(); 505 } 506 507 if (SymbolTable::needs_rehashing()) { 508 TraceTime t5("rehashing symbol table", TraceSafepointCleanupTime); 509 SymbolTable::rehash_table(); 510 } 511 512 if (StringTable::needs_rehashing()) { 513 TraceTime t6("rehashing string table", TraceSafepointCleanupTime); 514 StringTable::rehash_table(); 515 } 516 517 // rotate log files? 518 if (UseGCLogFileRotation) { 519 gclog_or_tty->rotate_log(false); 520 } 521 522 { 523 // CMS delays purging the CLDG until the beginning of the next safepoint and to 524 // make sure concurrent sweep is done 525 TraceTime t7("purging class loader data graph", TraceSafepointCleanupTime); 526 ClassLoaderDataGraph::purge_if_needed(); 527 } 528 } 529 530 531 bool SafepointSynchronize::safepoint_safe(JavaThread *thread, JavaThreadState state) { 532 switch(state) { 533 case _thread_in_native: 534 // native threads are safe if they have no java stack or have walkable stack 535 return !thread->has_last_Java_frame() || thread->frame_anchor()->walkable(); 536 537 // blocked threads should have already have walkable stack 538 case _thread_blocked: 539 assert(!thread->has_last_Java_frame() || thread->frame_anchor()->walkable(), "blocked and not walkable"); 540 return true; 541 | 497 { 498 TraceTime t3("compilation policy safepoint handler", TraceSafepointCleanupTime); 499 CompilationPolicy::policy()->do_safepoint_work(); 500 } 501 502 { 503 TraceTime t4("mark nmethods", TraceSafepointCleanupTime); 504 NMethodSweeper::mark_active_nmethods(); 505 } 506 507 if (SymbolTable::needs_rehashing()) { 508 TraceTime t5("rehashing symbol table", TraceSafepointCleanupTime); 509 SymbolTable::rehash_table(); 510 } 511 512 if (StringTable::needs_rehashing()) { 513 TraceTime t6("rehashing string table", TraceSafepointCleanupTime); 514 StringTable::rehash_table(); 515 } 516 517 { 518 // CMS delays purging the CLDG until the beginning of the next safepoint and to 519 // make sure concurrent sweep is done 520 TraceTime t7("purging class loader data graph", TraceSafepointCleanupTime); 521 ClassLoaderDataGraph::purge_if_needed(); 522 } 523 } 524 525 526 bool SafepointSynchronize::safepoint_safe(JavaThread *thread, JavaThreadState state) { 527 switch(state) { 528 case _thread_in_native: 529 // native threads are safe if they have no java stack or have walkable stack 530 return !thread->has_last_Java_frame() || thread->frame_anchor()->walkable(); 531 532 // blocked threads should have already have walkable stack 533 case _thread_blocked: 534 assert(!thread->has_last_Java_frame() || thread->frame_anchor()->walkable(), "blocked and not walkable"); 535 return true; 536 |