1 /* |
1 /* |
2 * Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
29 |
29 |
30 class NMethodSweeper : public AllStatic { |
30 class NMethodSweeper : public AllStatic { |
31 static long _traversals; // Stack traversal count |
31 static long _traversals; // Stack traversal count |
32 static nmethod* _current; // Current nmethod |
32 static nmethod* _current; // Current nmethod |
33 static int _seen; // Nof. nmethod we have currently processed in current pass of CodeCache |
33 static int _seen; // Nof. nmethod we have currently processed in current pass of CodeCache |
34 static int _invocations; // No. of invocations left until we are completed with this pass |
34 |
|
35 static volatile int _invocations; // No. of invocations left until we are completed with this pass |
|
36 static volatile int _sweep_started; // Flag to control conc sweeper |
35 |
37 |
36 static bool _rescan; // Indicates that we should do a full rescan of the |
38 static bool _rescan; // Indicates that we should do a full rescan of the |
37 // of the code cache looking for work to do. |
39 // of the code cache looking for work to do. |
38 static bool _do_sweep; // Flag to skip the conc sweep if no stack scan happened |
40 static bool _do_sweep; // Flag to skip the conc sweep if no stack scan happened |
39 static jint _sweep_started; // Flag to control conc sweeper |
|
40 static int _locked_seen; // Number of locked nmethods encountered during the scan |
41 static int _locked_seen; // Number of locked nmethods encountered during the scan |
41 static int _not_entrant_seen_on_stack; // Number of not entrant nmethod were are still on stack |
42 static int _not_entrant_seen_on_stack; // Number of not entrant nmethod were are still on stack |
42 |
43 |
43 static bool _was_full; // remember if we did emergency unloading |
44 static bool _was_full; // remember if we did emergency unloading |
44 static jint _advise_to_sweep; // flag to indicate code cache getting full |
45 static jint _advise_to_sweep; // flag to indicate code cache getting full |
45 static jlong _last_was_full; // timestamp of last emergency unloading |
46 static jlong _last_was_full; // timestamp of last emergency unloading |
46 static uint _highest_marked; // highest compile id dumped at last emergency unloading |
47 static uint _highest_marked; // highest compile id dumped at last emergency unloading |
47 static long _was_full_traversal; // trav number at last emergency unloading |
48 static long _was_full_traversal; // trav number at last emergency unloading |
48 |
49 |
49 static void process_nmethod(nmethod *nm); |
50 static void process_nmethod(nmethod *nm); |
|
51 |
|
52 static void log_sweep(const char* msg, const char* format = NULL, ...); |
|
53 |
50 public: |
54 public: |
51 static long traversal_count() { return _traversals; } |
55 static long traversal_count() { return _traversals; } |
52 |
56 |
53 static void scan_stacks(); // Invoked at the end of each safepoint |
57 static void scan_stacks(); // Invoked at the end of each safepoint |
54 static void sweep_code_cache(); // Concurrent part of sweep job |
58 static void sweep_code_cache(); // Concurrent part of sweep job |