101 static CodeHeap* get_code_heap(CodeBlob* cb); // Returns the CodeHeap for the given CodeBlob
102 static CodeHeap* get_code_heap(int code_blob_type); // Returns the CodeHeap for the given CodeBlobType
103 static bool heap_available(int code_blob_type); // Returns true if an own CodeHeap for the given CodeBlobType is available
104 static ReservedCodeSpace reserve_heap_memory(size_t size); // Reserves one continuous chunk of memory for the CodeHeaps
105
106 // Iteration
107 static CodeBlob* first_blob(CodeHeap* heap); // Returns the first CodeBlob on the given CodeHeap
108 static CodeBlob* first_blob(int code_blob_type); // Returns the first CodeBlob of the given type
109 static CodeBlob* next_blob(CodeHeap* heap, CodeBlob* cb); // Returns the first alive CodeBlob on the given CodeHeap
110 static CodeBlob* next_blob(CodeBlob* cb); // Returns the next CodeBlob of the given type succeeding the given CodeBlob
111
112 static size_t bytes_allocated_in_freelists();
113 static int allocated_segments();
114 static size_t freelists_length();
115
116 public:
117 // Initialization
118 static void initialize();
119
120 // Allocation/administration
121 static CodeBlob* allocate(int size, int code_blob_type, bool is_critical = false); // allocates a new CodeBlob
122 static void commit(CodeBlob* cb); // called when the allocated CodeBlob has been filled
123 static int alignment_unit(); // guaranteed alignment of all CodeBlobs
124 static int alignment_offset(); // guaranteed offset of first CodeBlob byte within alignment unit (i.e., allocation header)
125 static void free(CodeBlob* cb); // frees a CodeBlob
126 static bool contains(void *p); // returns whether p is included
127 static void blobs_do(void f(CodeBlob* cb)); // iterates over all CodeBlobs
128 static void blobs_do(CodeBlobClosure* f); // iterates over all CodeBlobs
129 static void nmethods_do(void f(nmethod* nm)); // iterates over all nmethods
130 static void alive_nmethods_do(void f(nmethod* nm)); // iterates over all alive nmethods
131
132 // Lookup
133 static CodeBlob* find_blob(void* start); // Returns the CodeBlob containing the given address
134 static CodeBlob* find_blob_unsafe(void* start); // Same as find_blob but does not fail if looking up a zombie method
135 static nmethod* find_nmethod(void* start); // Returns the nmethod containing the given address
136
137 static int nof_blobs() { return _number_of_blobs; } // Returns the total number of CodeBlobs in the cache
138 static int nof_adapters() { return _number_of_adapters; } // Returns the total number of Adapters in the cache
139 static int nof_nmethods() { return _number_of_nmethods; } // Returns the total number of nmethods in the cache
140
141 // GC support
163 static void print_trace(const char* event, CodeBlob* cb, int size = 0) PRODUCT_RETURN;
164 static void print_summary(outputStream* st, bool detailed = true); // Prints a summary of the code cache usage
165 static void log_state(outputStream* st);
166 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"); }
167 static void report_codemem_full(int code_blob_type, bool print);
168
169 // Dcmd (Diagnostic commands)
170 static void print_codelist(outputStream* st);
171 static void print_layout(outputStream* st);
172
173 // The full limits of the codeCache
174 static address low_bound() { return _low_bound; }
175 static address high_bound() { return _high_bound; }
176
177 // Profiling
178 static size_t capacity();
179 static size_t unallocated_capacity(int code_blob_type);
180 static size_t unallocated_capacity();
181 static size_t max_capacity();
182
183 static bool is_full(int* code_blob_type);
184 static double reverse_free_ratio(int code_blob_type);
185
186 static bool needs_cache_clean() { return _needs_cache_clean; }
187 static void set_needs_cache_clean(bool v) { _needs_cache_clean = v; }
188 static void clear_inline_caches(); // clear all inline caches
189
190 // Returns the CodeBlobType for nmethods of the given compilation level
191 static int get_code_blob_type(int comp_level) {
192 if (comp_level == CompLevel_none ||
193 comp_level == CompLevel_simple ||
194 comp_level == CompLevel_full_optimization) {
195 // Non profiled methods
196 return CodeBlobType::MethodNonProfiled;
197 } else if (comp_level == CompLevel_limited_profile ||
198 comp_level == CompLevel_full_profile) {
199 // Profiled methods
200 return CodeBlobType::MethodProfiled;
201 }
202 ShouldNotReachHere();
203 return 0;
|
101 static CodeHeap* get_code_heap(CodeBlob* cb); // Returns the CodeHeap for the given CodeBlob
102 static CodeHeap* get_code_heap(int code_blob_type); // Returns the CodeHeap for the given CodeBlobType
103 static bool heap_available(int code_blob_type); // Returns true if an own CodeHeap for the given CodeBlobType is available
104 static ReservedCodeSpace reserve_heap_memory(size_t size); // Reserves one continuous chunk of memory for the CodeHeaps
105
106 // Iteration
107 static CodeBlob* first_blob(CodeHeap* heap); // Returns the first CodeBlob on the given CodeHeap
108 static CodeBlob* first_blob(int code_blob_type); // Returns the first CodeBlob of the given type
109 static CodeBlob* next_blob(CodeHeap* heap, CodeBlob* cb); // Returns the first alive CodeBlob on the given CodeHeap
110 static CodeBlob* next_blob(CodeBlob* cb); // Returns the next CodeBlob of the given type succeeding the given CodeBlob
111
112 static size_t bytes_allocated_in_freelists();
113 static int allocated_segments();
114 static size_t freelists_length();
115
116 public:
117 // Initialization
118 static void initialize();
119
120 // Allocation/administration
121 static CodeBlob* allocate(int size, int code_blob_type); // allocates a new CodeBlob
122 static void commit(CodeBlob* cb); // called when the allocated CodeBlob has been filled
123 static int alignment_unit(); // guaranteed alignment of all CodeBlobs
124 static int alignment_offset(); // guaranteed offset of first CodeBlob byte within alignment unit (i.e., allocation header)
125 static void free(CodeBlob* cb); // frees a CodeBlob
126 static bool contains(void *p); // returns whether p is included
127 static void blobs_do(void f(CodeBlob* cb)); // iterates over all CodeBlobs
128 static void blobs_do(CodeBlobClosure* f); // iterates over all CodeBlobs
129 static void nmethods_do(void f(nmethod* nm)); // iterates over all nmethods
130 static void alive_nmethods_do(void f(nmethod* nm)); // iterates over all alive nmethods
131
132 // Lookup
133 static CodeBlob* find_blob(void* start); // Returns the CodeBlob containing the given address
134 static CodeBlob* find_blob_unsafe(void* start); // Same as find_blob but does not fail if looking up a zombie method
135 static nmethod* find_nmethod(void* start); // Returns the nmethod containing the given address
136
137 static int nof_blobs() { return _number_of_blobs; } // Returns the total number of CodeBlobs in the cache
138 static int nof_adapters() { return _number_of_adapters; } // Returns the total number of Adapters in the cache
139 static int nof_nmethods() { return _number_of_nmethods; } // Returns the total number of nmethods in the cache
140
141 // GC support
163 static void print_trace(const char* event, CodeBlob* cb, int size = 0) PRODUCT_RETURN;
164 static void print_summary(outputStream* st, bool detailed = true); // Prints a summary of the code cache usage
165 static void log_state(outputStream* st);
166 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"); }
167 static void report_codemem_full(int code_blob_type, bool print);
168
169 // Dcmd (Diagnostic commands)
170 static void print_codelist(outputStream* st);
171 static void print_layout(outputStream* st);
172
173 // The full limits of the codeCache
174 static address low_bound() { return _low_bound; }
175 static address high_bound() { return _high_bound; }
176
177 // Profiling
178 static size_t capacity();
179 static size_t unallocated_capacity(int code_blob_type);
180 static size_t unallocated_capacity();
181 static size_t max_capacity();
182
183 static double reverse_free_ratio(int code_blob_type);
184
185 static bool needs_cache_clean() { return _needs_cache_clean; }
186 static void set_needs_cache_clean(bool v) { _needs_cache_clean = v; }
187 static void clear_inline_caches(); // clear all inline caches
188
189 // Returns the CodeBlobType for nmethods of the given compilation level
190 static int get_code_blob_type(int comp_level) {
191 if (comp_level == CompLevel_none ||
192 comp_level == CompLevel_simple ||
193 comp_level == CompLevel_full_optimization) {
194 // Non profiled methods
195 return CodeBlobType::MethodNonProfiled;
196 } else if (comp_level == CompLevel_limited_profile ||
197 comp_level == CompLevel_full_profile) {
198 // Profiled methods
199 return CodeBlobType::MethodProfiled;
200 }
201 ShouldNotReachHere();
202 return 0;
|