< prev index next >

src/hotspot/share/prims/methodHandles.cpp


1068 
1069   oop context = java_lang_invoke_CallSite::context_no_keepalive(call_site);                                                          
1070   DependencyContext deps = java_lang_invoke_MethodHandleNatives_CallSiteContext::vmdependencies(context);                            
1071   // Try to purge stale entries on updates.                                                                                          
1072   // Since GC doesn't clean dependency contexts rooted at CallSiteContext objects,                                                   
1073   // in order to avoid memory leak, stale entries are purged whenever a dependency list                                              
1074   // is changed (both on addition and removal). Though memory reclamation is delayed,                                                
1075   // it avoids indefinite memory usage growth.                                                                                       
1076   deps.add_dependent_nmethod(nm);                                                                                                    
1077 }                                                                                                                                    
1078 
1079 void MethodHandles::remove_dependent_nmethod(oop call_site, nmethod* nm) {                                                           
1080   assert_locked_or_safepoint(CodeCache_lock);                                                                                        
1081 
1082   oop context = java_lang_invoke_CallSite::context_no_keepalive(call_site);                                                          
1083   DependencyContext deps = java_lang_invoke_MethodHandleNatives_CallSiteContext::vmdependencies(context);                            
1084   deps.remove_dependent_nmethod(nm);                                                                                                 
1085 }                                                                                                                                    
1086 
1087 void MethodHandles::clean_dependency_context(oop call_site) {                                                                        
1088   assert_locked_or_safepoint(CodeCache_lock);                                                                                        
1089                                                                                                                                      
1090   oop context = java_lang_invoke_CallSite::context_no_keepalive(call_site);                                                          
1091   DependencyContext deps = java_lang_invoke_MethodHandleNatives_CallSiteContext::vmdependencies(context);                            
1092   deps.clean_unloading_dependents();                                                                                                 
1093 }                                                                                                                                    
1094 
1095 void MethodHandles::flush_dependent_nmethods(Handle call_site, Handle target) {                                                      
1096   assert_lock_strong(Compile_lock);                                                                                                  
1097 
1098   int marked = 0;                                                                                                                    
1099   CallSiteDepChange changes(call_site, target);                                                                                      
1100   {                                                                                                                                  
1101     NoSafepointVerifier nsv;                                                                                                         
1102     MutexLockerEx mu2(CodeCache_lock, Mutex::_no_safepoint_check_flag);                                                              
1103 
1104     oop context = java_lang_invoke_CallSite::context_no_keepalive(call_site());                                                      
1105     DependencyContext deps = java_lang_invoke_MethodHandleNatives_CallSiteContext::vmdependencies(context);                          
1106     marked = deps.mark_dependent_nmethods(changes);                                                                                  
1107   }                                                                                                                                  
1108   if (marked > 0) {                                                                                                                  

1068 
1069   oop context = java_lang_invoke_CallSite::context_no_keepalive(call_site);
1070   DependencyContext deps = java_lang_invoke_MethodHandleNatives_CallSiteContext::vmdependencies(context);
1071   // Try to purge stale entries on updates.
1072   // Since GC doesn't clean dependency contexts rooted at CallSiteContext objects,
1073   // in order to avoid memory leak, stale entries are purged whenever a dependency list
1074   // is changed (both on addition and removal). Though memory reclamation is delayed,
1075   // it avoids indefinite memory usage growth.
1076   deps.add_dependent_nmethod(nm);
1077 }
1078 
1079 void MethodHandles::remove_dependent_nmethod(oop call_site, nmethod* nm) {
1080   assert_locked_or_safepoint(CodeCache_lock);
1081 
1082   oop context = java_lang_invoke_CallSite::context_no_keepalive(call_site);
1083   DependencyContext deps = java_lang_invoke_MethodHandleNatives_CallSiteContext::vmdependencies(context);
1084   deps.remove_dependent_nmethod(nm);
1085 }
1086 
1087 void MethodHandles::clean_dependency_context(oop call_site) {


1088   oop context = java_lang_invoke_CallSite::context_no_keepalive(call_site);
1089   DependencyContext deps = java_lang_invoke_MethodHandleNatives_CallSiteContext::vmdependencies(context);
1090   deps.clean_unloading_dependents();
1091 }
1092 
1093 void MethodHandles::flush_dependent_nmethods(Handle call_site, Handle target) {
1094   assert_lock_strong(Compile_lock);
1095 
1096   int marked = 0;
1097   CallSiteDepChange changes(call_site, target);
1098   {
1099     NoSafepointVerifier nsv;
1100     MutexLockerEx mu2(CodeCache_lock, Mutex::_no_safepoint_check_flag);
1101 
1102     oop context = java_lang_invoke_CallSite::context_no_keepalive(call_site());
1103     DependencyContext deps = java_lang_invoke_MethodHandleNatives_CallSiteContext::vmdependencies(context);
1104     marked = deps.mark_dependent_nmethods(changes);
1105   }
1106   if (marked > 0) {
< prev index next >