comparison src/share/vm/c1/c1_Runtime1.cpp @ 12080:5888334c9c24

7145569: G1: optimize nmethods scanning Summary: Add a list of nmethods to the RSet for a region that contain references into the region. Skip scanning the code cache during root scanning and scan the nmethod lists during RSet scanning instead. Reviewed-by: tschatzl, brutisso, mgerdin, twisti, kvn
author johnc
date Thu, 15 Aug 2013 10:52:18 +0200
parents b800986664f4
children f98f5d48f511
comparison
equal deleted inserted replaced
12033:bd902affe102 12080:5888334c9c24
913 Deoptimization::deoptimize_frame(thread, caller_frame.id()); 913 Deoptimization::deoptimize_frame(thread, caller_frame.id());
914 914
915 // Return to the now deoptimized frame. 915 // Return to the now deoptimized frame.
916 } 916 }
917 917
918 // If we are patching in a non-perm oop, make sure the nmethod
919 // is on the right list.
920 if (ScavengeRootsInCode && mirror.not_null() && mirror()->is_scavengable()) {
921 MutexLockerEx ml_code (CodeCache_lock, Mutex::_no_safepoint_check_flag);
922 nmethod* nm = CodeCache::find_nmethod(caller_frame.pc());
923 guarantee(nm != NULL, "only nmethods can contain non-perm oops");
924 if (!nm->on_scavenge_root_list())
925 CodeCache::add_scavenge_root_nmethod(nm);
926 }
927
928 // Now copy code back 918 // Now copy code back
929 919
930 { 920 {
931 MutexLockerEx ml_patch (Patching_lock, Mutex::_no_safepoint_check_flag); 921 MutexLockerEx ml_patch (Patching_lock, Mutex::_no_safepoint_check_flag);
932 // 922 //
1123 NativeGeneralJump::insert_unconditional(instr_pc, being_initialized_entry); 1113 NativeGeneralJump::insert_unconditional(instr_pc, being_initialized_entry);
1124 } 1114 }
1125 } 1115 }
1126 } 1116 }
1127 } 1117 }
1118
1119 // If we are patching in a non-perm oop, make sure the nmethod
1120 // is on the right list.
1121 if (ScavengeRootsInCode && mirror.not_null() && mirror()->is_scavengable()) {
1122 MutexLockerEx ml_code (CodeCache_lock, Mutex::_no_safepoint_check_flag);
1123 nmethod* nm = CodeCache::find_nmethod(caller_frame.pc());
1124 guarantee(nm != NULL, "only nmethods can contain non-perm oops");
1125 if (!nm->on_scavenge_root_list()) {
1126 CodeCache::add_scavenge_root_nmethod(nm);
1127 }
1128
1129 // Since we've patched some oops in the nmethod,
1130 // (re)register it with the heap.
1131 Universe::heap()->register_nmethod(nm);
1132 }
1128 JRT_END 1133 JRT_END
1129 1134
1130 // 1135 //
1131 // Entry point for compiled code. We want to patch a nmethod. 1136 // Entry point for compiled code. We want to patch a nmethod.
1132 // We don't do a normal VM transition here because we want to 1137 // We don't do a normal VM transition here because we want to