< prev index next >

src/hotspot/share/code/codeCache.cpp


11  * version 2 for more details (a copy is included in the LICENSE file that                                                           
12  * accompanied this code).                                                                                                           
13  *                                                                                                                                   
14  * You should have received a copy of the GNU General Public License version                                                         
15  * 2 along with this work; if not, write to the Free Software Foundation,                                                            
16  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.                                                                     
17  *                                                                                                                                   
18  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA                                                           
19  * or visit www.oracle.com if you need additional information or have any                                                            
20  * questions.                                                                                                                        
21  *                                                                                                                                   
22  */                                                                                                                                  
23 
24 #include "precompiled.hpp"                                                                                                           
25 #include "aot/aotLoader.hpp"                                                                                                         
26 #include "code/codeBlob.hpp"                                                                                                         
27 #include "code/codeCache.hpp"                                                                                                        
28 #include "code/codeHeapState.hpp"                                                                                                    
29 #include "code/compiledIC.hpp"                                                                                                       
30 #include "code/dependencies.hpp"                                                                                                     
                                                                                                                                     
31 #include "code/icBuffer.hpp"                                                                                                         
32 #include "code/nmethod.hpp"                                                                                                          
33 #include "code/pcDesc.hpp"                                                                                                           
34 #include "compiler/compileBroker.hpp"                                                                                                
35 #include "jfr/jfrEvents.hpp"                                                                                                         
36 #include "logging/log.hpp"                                                                                                           
37 #include "logging/logStream.hpp"                                                                                                     
38 #include "memory/allocation.inline.hpp"                                                                                              
39 #include "memory/iterator.hpp"                                                                                                       
40 #include "memory/resourceArea.hpp"                                                                                                   
41 #include "oops/method.inline.hpp"                                                                                                    
42 #include "oops/objArrayOop.hpp"                                                                                                      
43 #include "oops/oop.inline.hpp"                                                                                                       
44 #include "oops/verifyOopClosure.hpp"                                                                                                 
45 #include "runtime/arguments.hpp"                                                                                                     
46 #include "runtime/compilationPolicy.hpp"                                                                                             
47 #include "runtime/deoptimization.hpp"                                                                                                
48 #include "runtime/handles.inline.hpp"                                                                                                
49 #include "runtime/icache.hpp"                                                                                                        

11  * version 2 for more details (a copy is included in the LICENSE file that
12  * accompanied this code).
13  *
14  * You should have received a copy of the GNU General Public License version
15  * 2 along with this work; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17  *
18  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19  * or visit www.oracle.com if you need additional information or have any
20  * questions.
21  *
22  */
23 
24 #include "precompiled.hpp"
25 #include "aot/aotLoader.hpp"
26 #include "code/codeBlob.hpp"
27 #include "code/codeCache.hpp"
28 #include "code/codeHeapState.hpp"
29 #include "code/compiledIC.hpp"
30 #include "code/dependencies.hpp"
31 #include "code/dependencyContext.hpp"
32 #include "code/icBuffer.hpp"
33 #include "code/nmethod.hpp"
34 #include "code/pcDesc.hpp"
35 #include "compiler/compileBroker.hpp"
36 #include "jfr/jfrEvents.hpp"
37 #include "logging/log.hpp"
38 #include "logging/logStream.hpp"
39 #include "memory/allocation.inline.hpp"
40 #include "memory/iterator.hpp"
41 #include "memory/resourceArea.hpp"
42 #include "oops/method.inline.hpp"
43 #include "oops/objArrayOop.hpp"
44 #include "oops/oop.inline.hpp"
45 #include "oops/verifyOopClosure.hpp"
46 #include "runtime/arguments.hpp"
47 #include "runtime/compilationPolicy.hpp"
48 #include "runtime/deoptimization.hpp"
49 #include "runtime/handles.inline.hpp"
50 #include "runtime/icache.hpp"

920     delete curr;                                                                                                                     
921     curr = next;                                                                                                                     
922   }                                                                                                                                  
923   _exception_cache_purge_list = NULL;                                                                                                
924 }                                                                                                                                    
925 
926 void CodeCache::gc_prologue() { }                                                                                                    
927 
928 void CodeCache::gc_epilogue() {                                                                                                      
929   prune_scavenge_root_nmethods();                                                                                                    
930 }                                                                                                                                    
931 
932 uint8_t CodeCache::_unloading_cycle = 1;                                                                                             
933 
934 void CodeCache::increment_unloading_cycle() {                                                                                        
935   if (_unloading_cycle == 1) {                                                                                                       
936     _unloading_cycle = 2;                                                                                                            
937   } else {                                                                                                                           
938     _unloading_cycle = 1;                                                                                                            
939   }                                                                                                                                  
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
940 }                                                                                                                                    
941 
942 void CodeCache::verify_oops() {                                                                                                      
943   MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);                                                                 
944   VerifyOopClosure voc;                                                                                                              
945   NMethodIterator iter;                                                                                                              
946   while(iter.next_alive()) {                                                                                                         
947     nmethod* nm = iter.method();                                                                                                     
948     nm->oops_do(&voc);                                                                                                               
949     nm->verify_oop_relocations();                                                                                                    
950   }                                                                                                                                  
951 }                                                                                                                                    
952 
953 int CodeCache::blob_count(int code_blob_type) {                                                                                      
954   CodeHeap* heap = get_code_heap(code_blob_type);                                                                                    
955   return (heap != NULL) ? heap->blob_count() : 0;                                                                                    
956 }                                                                                                                                    
957 
958 int CodeCache::blob_count() {                                                                                                        

921     delete curr;
922     curr = next;
923   }
924   _exception_cache_purge_list = NULL;
925 }
926 
927 void CodeCache::gc_prologue() { }
928 
929 void CodeCache::gc_epilogue() {
930   prune_scavenge_root_nmethods();
931 }
932 
933 uint8_t CodeCache::_unloading_cycle = 1;
934 
935 void CodeCache::increment_unloading_cycle() {
936   if (_unloading_cycle == 1) {
937     _unloading_cycle = 2;
938   } else {
939     _unloading_cycle = 1;
940   }
941 }
942 
943 CodeCache::UnloadingScope::UnloadingScope(BoolObjectClosure* is_alive)
944   : _is_unloading_behaviour(is_alive)
945 {
946   IsUnloadingBehaviour::set_current(&_is_unloading_behaviour);
947   increment_unloading_cycle();
948   DependencyContext::gc_prologue();
949 }
950 
951 CodeCache::UnloadingScope::~UnloadingScope() {
952   IsUnloadingBehaviour::set_current(NULL);
953   DependencyContext::gc_epilogue();
954 }
955 
956 void CodeCache::verify_oops() {
957   MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
958   VerifyOopClosure voc;
959   NMethodIterator iter;
960   while(iter.next_alive()) {
961     nmethod* nm = iter.method();
962     nm->oops_do(&voc);
963     nm->verify_oop_relocations();
964   }
965 }
966 
967 int CodeCache::blob_count(int code_blob_type) {
968   CodeHeap* heap = get_code_heap(code_blob_type);
969   return (heap != NULL) ? heap->blob_count() : 0;
970 }
971 
972 int CodeCache::blob_count() {
< prev index next >