< prev index next >

src/share/vm/code/codeCache.hpp

Print this page
rev 10188 : [mq]: scavenge_nmethods_auto_prune


  99   static void check_heap_sizes(size_t non_nmethod_size, size_t profiled_size, size_t non_profiled_size, size_t cache_size, bool all_set);
 100   // Creates a new heap with the given name and size, containing CodeBlobs of the given type
 101   static void add_heap(ReservedSpace rs, const char* name, int code_blob_type);
 102   static CodeHeap* get_code_heap(const CodeBlob* cb);         // Returns the CodeHeap for the given CodeBlob
 103   static CodeHeap* get_code_heap(int code_blob_type);         // Returns the CodeHeap for the given CodeBlobType
 104   // Returns the name of the VM option to set the size of the corresponding CodeHeap
 105   static const char* get_code_heap_flag_name(int code_blob_type);
 106   static size_t heap_alignment();                             // Returns the alignment of the CodeHeaps in bytes
 107   static ReservedCodeSpace reserve_heap_memory(size_t size);  // Reserves one continuous chunk of memory for the CodeHeaps
 108 
 109   // Iteration
 110   static CodeBlob* first_blob(CodeHeap* heap);                // Returns the first CodeBlob on the given CodeHeap
 111   static CodeBlob* first_blob(int code_blob_type);            // Returns the first CodeBlob of the given type
 112   static CodeBlob* next_blob(CodeHeap* heap, CodeBlob* cb);   // Returns the first alive CodeBlob on the given CodeHeap
 113   static CodeBlob* next_blob(CodeBlob* cb);                   // Returns the next CodeBlob of the given type succeeding the given CodeBlob
 114 
 115   static size_t bytes_allocated_in_freelists();
 116   static int    allocated_segments();
 117   static size_t freelists_length();
 118 




 119  public:
 120   // Initialization
 121   static void initialize();
 122 
 123   // Allocation/administration
 124   static CodeBlob* allocate(int size, int code_blob_type, bool strict = false); // allocates a new CodeBlob
 125   static void commit(CodeBlob* cb);                        // called when the allocated CodeBlob has been filled
 126   static int  alignment_unit();                            // guaranteed alignment of all CodeBlobs
 127   static int  alignment_offset();                          // guaranteed offset of first CodeBlob byte within alignment unit (i.e., allocation header)
 128   static void free(CodeBlob* cb);                          // frees a CodeBlob
 129   static bool contains(void *p);                           // returns whether p is included
 130   static void blobs_do(void f(CodeBlob* cb));              // iterates over all CodeBlobs
 131   static void blobs_do(CodeBlobClosure* f);                // iterates over all CodeBlobs
 132   static void nmethods_do(void f(nmethod* nm));            // iterates over all nmethods
 133   static void alive_nmethods_do(void f(nmethod* nm));      // iterates over all alive nmethods
 134 
 135   // Lookup
 136   static CodeBlob* find_blob(void* start);              // Returns the CodeBlob containing the given address
 137   static CodeBlob* find_blob_unsafe(void* start);       // Same as find_blob but does not fail if looking up a zombie method
 138   static nmethod*  find_nmethod(void* start);           // Returns the nmethod containing the given address
 139 
 140   static int       blob_count();                        // Returns the total number of CodeBlobs in the cache
 141   static int       blob_count(int code_blob_type);
 142   static int       adapter_count();                     // Returns the total number of Adapters in the cache
 143   static int       adapter_count(int code_blob_type);
 144   static int       nmethod_count();                     // Returns the total number of nmethods in the cache
 145   static int       nmethod_count(int code_blob_type);
 146 
 147   // GC support
 148   static void gc_epilogue();
 149   static void gc_prologue();
 150   static void verify_oops();
 151   // If "unloading_occurred" is true, then unloads (i.e., breaks root links
 152   // to) any unmarked codeBlobs in the cache.  Sets "marked_for_unloading"
 153   // to "true" iff some code got unloaded.
 154   static void do_unloading(BoolObjectClosure* is_alive, bool unloading_occurred);
 155   static void asserted_non_scavengable_nmethods_do(CodeBlobClosure* f = NULL) PRODUCT_RETURN;
 156   static void scavenge_root_nmethods_do(CodeBlobClosure* f);






 157 
 158   static nmethod* scavenge_root_nmethods()            { return _scavenge_root_nmethods; }
 159   static void set_scavenge_root_nmethods(nmethod* nm) { _scavenge_root_nmethods = nm; }
 160   static void add_scavenge_root_nmethod(nmethod* nm);
 161   static void drop_scavenge_root_nmethod(nmethod* nm);
 162   static void prune_scavenge_root_nmethods();
 163 
 164   // Printing/debugging
 165   static void print();                           // prints summary
 166   static void print_internals();
 167   static void print_memory_overhead();
 168   static void verify();                          // verifies the code cache
 169   static void print_trace(const char* event, CodeBlob* cb, int size = 0) PRODUCT_RETURN;
 170   static void print_summary(outputStream* st, bool detailed = true); // Prints a summary of the code cache usage
 171   static void log_state(outputStream* st);
 172   static const char* get_code_heap_name(int code_blob_type)  { return (heap_available(code_blob_type) ? get_code_heap(code_blob_type)->name() : "Unused"); }
 173   static void report_codemem_full(int code_blob_type, bool print);
 174 
 175   // Dcmd (Diagnostic commands)
 176   static void print_codelist(outputStream* st);
 177   static void print_layout(outputStream* st);
 178 
 179   // The full limits of the codeCache
 180   static address low_bound()                          { return _low_bound; }
 181   static address low_bound(int code_blob_type);
 182   static address high_bound()                         { return _high_bound; }




  99   static void check_heap_sizes(size_t non_nmethod_size, size_t profiled_size, size_t non_profiled_size, size_t cache_size, bool all_set);
 100   // Creates a new heap with the given name and size, containing CodeBlobs of the given type
 101   static void add_heap(ReservedSpace rs, const char* name, int code_blob_type);
 102   static CodeHeap* get_code_heap(const CodeBlob* cb);         // Returns the CodeHeap for the given CodeBlob
 103   static CodeHeap* get_code_heap(int code_blob_type);         // Returns the CodeHeap for the given CodeBlobType
 104   // Returns the name of the VM option to set the size of the corresponding CodeHeap
 105   static const char* get_code_heap_flag_name(int code_blob_type);
 106   static size_t heap_alignment();                             // Returns the alignment of the CodeHeaps in bytes
 107   static ReservedCodeSpace reserve_heap_memory(size_t size);  // Reserves one continuous chunk of memory for the CodeHeaps
 108 
 109   // Iteration
 110   static CodeBlob* first_blob(CodeHeap* heap);                // Returns the first CodeBlob on the given CodeHeap
 111   static CodeBlob* first_blob(int code_blob_type);            // Returns the first CodeBlob of the given type
 112   static CodeBlob* next_blob(CodeHeap* heap, CodeBlob* cb);   // Returns the first alive CodeBlob on the given CodeHeap
 113   static CodeBlob* next_blob(CodeBlob* cb);                   // Returns the next CodeBlob of the given type succeeding the given CodeBlob
 114 
 115   static size_t bytes_allocated_in_freelists();
 116   static int    allocated_segments();
 117   static size_t freelists_length();
 118 
 119   static void set_scavenge_root_nmethods(nmethod* nm) { _scavenge_root_nmethods = nm; }
 120   static void prune_scavenge_root_nmethods();
 121   static void unlink_scavenge_root_nmethod(nmethod* nm, nmethod* prev);
 122 
 123  public:
 124   // Initialization
 125   static void initialize();
 126 
 127   // Allocation/administration
 128   static CodeBlob* allocate(int size, int code_blob_type, bool strict = false); // allocates a new CodeBlob
 129   static void commit(CodeBlob* cb);                        // called when the allocated CodeBlob has been filled
 130   static int  alignment_unit();                            // guaranteed alignment of all CodeBlobs
 131   static int  alignment_offset();                          // guaranteed offset of first CodeBlob byte within alignment unit (i.e., allocation header)
 132   static void free(CodeBlob* cb);                          // frees a CodeBlob
 133   static bool contains(void *p);                           // returns whether p is included
 134   static void blobs_do(void f(CodeBlob* cb));              // iterates over all CodeBlobs
 135   static void blobs_do(CodeBlobClosure* f);                // iterates over all CodeBlobs
 136   static void nmethods_do(void f(nmethod* nm));            // iterates over all nmethods
 137   static void alive_nmethods_do(void f(nmethod* nm));      // iterates over all alive nmethods
 138 
 139   // Lookup
 140   static CodeBlob* find_blob(void* start);              // Returns the CodeBlob containing the given address
 141   static CodeBlob* find_blob_unsafe(void* start);       // Same as find_blob but does not fail if looking up a zombie method
 142   static nmethod*  find_nmethod(void* start);           // Returns the nmethod containing the given address
 143 
 144   static int       blob_count();                        // Returns the total number of CodeBlobs in the cache
 145   static int       blob_count(int code_blob_type);
 146   static int       adapter_count();                     // Returns the total number of Adapters in the cache
 147   static int       adapter_count(int code_blob_type);
 148   static int       nmethod_count();                     // Returns the total number of nmethods in the cache
 149   static int       nmethod_count(int code_blob_type);
 150 
 151   // GC support
 152   static void gc_epilogue();
 153   static void gc_prologue();
 154   static void verify_oops();
 155   // If "unloading_occurred" is true, then unloads (i.e., breaks root links
 156   // to) any unmarked codeBlobs in the cache.  Sets "marked_for_unloading"
 157   // to "true" iff some code got unloaded.
 158   static void do_unloading(BoolObjectClosure* is_alive, bool unloading_occurred);
 159   static void asserted_non_scavengable_nmethods_do(CodeBlobClosure* f = NULL) PRODUCT_RETURN;
 160 
 161   // Apply f to every live code blob in scavengable nmethods. Prune nmethods
 162   // from the list of scavengable nmethods if f->fix_relocations() and a nmethod
 163   // no longer has scavengable oops.  If f->fix_relocations(), then f must copy
 164   // objects to their new location immediately to avoid fixing nmethods on the
 165   // basis of the old object locations.
 166   static void scavenge_root_nmethods_do(CodeBlobToOopClosure* f);
 167 
 168   static nmethod* scavenge_root_nmethods()            { return _scavenge_root_nmethods; }

 169   static void add_scavenge_root_nmethod(nmethod* nm);
 170   static void drop_scavenge_root_nmethod(nmethod* nm);

 171 
 172   // Printing/debugging
 173   static void print();                           // prints summary
 174   static void print_internals();
 175   static void print_memory_overhead();
 176   static void verify();                          // verifies the code cache
 177   static void print_trace(const char* event, CodeBlob* cb, int size = 0) PRODUCT_RETURN;
 178   static void print_summary(outputStream* st, bool detailed = true); // Prints a summary of the code cache usage
 179   static void log_state(outputStream* st);
 180   static const char* get_code_heap_name(int code_blob_type)  { return (heap_available(code_blob_type) ? get_code_heap(code_blob_type)->name() : "Unused"); }
 181   static void report_codemem_full(int code_blob_type, bool print);
 182 
 183   // Dcmd (Diagnostic commands)
 184   static void print_codelist(outputStream* st);
 185   static void print_layout(outputStream* st);
 186 
 187   // The full limits of the codeCache
 188   static address low_bound()                          { return _low_bound; }
 189   static address low_bound(int code_blob_type);
 190   static address high_bound()                         { return _high_bound; }


< prev index next >