1 /*
2 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
279 static void mark_all_nmethods_for_deoptimization();
280 static int mark_for_deoptimization(Method* dependee);
281 static void make_marked_nmethods_not_entrant();
282
283 // Flushing and deoptimization
284 static void flush_dependents_on(InstanceKlass* dependee);
285 #ifdef HOTSWAP
286 // Flushing and deoptimization in case of evolution
287 static void flush_evol_dependents_on(InstanceKlass* dependee);
288 #endif // HOTSWAP
289 // Support for fullspeed debugging
290 static void flush_dependents_on_method(const methodHandle& dependee);
291
292 // tells how many nmethods have dependencies
293 static int number_of_nmethods_with_dependencies();
294
295 static int get_codemem_full_count(int code_blob_type) {
296 CodeHeap* heap = get_code_heap(code_blob_type);
297 return (heap != NULL) ? heap->full_count() : 0;
298 }
299 };
300
301
302 // Iterator to iterate over nmethods in the CodeCache.
303 template <class T, class Filter> class CodeBlobIterator : public StackObj {
304 private:
305 CodeBlob* _code_blob; // Current CodeBlob
306 GrowableArrayIterator<CodeHeap*> _heap;
307 GrowableArrayIterator<CodeHeap*> _end;
308
309 public:
310 CodeBlobIterator(T* nm = NULL) {
311 if (Filter::heaps() == NULL) {
312 return;
313 }
314 _heap = Filter::heaps()->begin();
315 _end = Filter::heaps()->end();
316 // If set to NULL, initialized by first call to next()
317 _code_blob = (CodeBlob*)nm;
318 if (nm != NULL) {
|
1 /*
2 * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
279 static void mark_all_nmethods_for_deoptimization();
280 static int mark_for_deoptimization(Method* dependee);
281 static void make_marked_nmethods_not_entrant();
282
283 // Flushing and deoptimization
284 static void flush_dependents_on(InstanceKlass* dependee);
285 #ifdef HOTSWAP
286 // Flushing and deoptimization in case of evolution
287 static void flush_evol_dependents_on(InstanceKlass* dependee);
288 #endif // HOTSWAP
289 // Support for fullspeed debugging
290 static void flush_dependents_on_method(const methodHandle& dependee);
291
292 // tells how many nmethods have dependencies
293 static int number_of_nmethods_with_dependencies();
294
295 static int get_codemem_full_count(int code_blob_type) {
296 CodeHeap* heap = get_code_heap(code_blob_type);
297 return (heap != NULL) ? heap->full_count() : 0;
298 }
299
300 // CodeHeap State Analytics.
301 // interface methods for CodeHeap printing, called by CompileBroker
302 static void aggregate(outputStream *out, const char* granularity);
303 static void discard(outputStream *out);
304 static void print_usedSpace(outputStream *out);
305 static void print_freeSpace(outputStream *out);
306 static void print_count(outputStream *out);
307 static void print_space(outputStream *out);
308 static void print_age(outputStream *out);
309 static void print_names(outputStream *out);
310 };
311
312
313 // Iterator to iterate over nmethods in the CodeCache.
314 template <class T, class Filter> class CodeBlobIterator : public StackObj {
315 private:
316 CodeBlob* _code_blob; // Current CodeBlob
317 GrowableArrayIterator<CodeHeap*> _heap;
318 GrowableArrayIterator<CodeHeap*> _end;
319
320 public:
321 CodeBlobIterator(T* nm = NULL) {
322 if (Filter::heaps() == NULL) {
323 return;
324 }
325 _heap = Filter::heaps()->begin();
326 _end = Filter::heaps()->end();
327 // If set to NULL, initialized by first call to next()
328 _code_blob = (CodeBlob*)nm;
329 if (nm != NULL) {
|