Tue, 17 Oct 2017 12:58:25 +0800
merge
aoqi@0 | 1 | /* |
aoqi@0 | 2 | * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. |
aoqi@0 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
aoqi@0 | 4 | * |
aoqi@0 | 5 | * This code is free software; you can redistribute it and/or modify it |
aoqi@0 | 6 | * under the terms of the GNU General Public License version 2 only, as |
aoqi@0 | 7 | * published by the Free Software Foundation. |
aoqi@0 | 8 | * |
aoqi@0 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
aoqi@0 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
aoqi@0 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
aoqi@0 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
aoqi@0 | 13 | * accompanied this code). |
aoqi@0 | 14 | * |
aoqi@0 | 15 | * You should have received a copy of the GNU General Public License version |
aoqi@0 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
aoqi@0 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
aoqi@0 | 18 | * |
aoqi@0 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
aoqi@0 | 20 | * or visit www.oracle.com if you need additional information or have any |
aoqi@0 | 21 | * questions. |
aoqi@0 | 22 | * |
aoqi@0 | 23 | */ |
aoqi@0 | 24 | |
aoqi@0 | 25 | #ifndef SHARE_VM_PRIMS_JVMTIREDEFINECLASSESTRACE_HPP |
aoqi@0 | 26 | #define SHARE_VM_PRIMS_JVMTIREDEFINECLASSESTRACE_HPP |
aoqi@0 | 27 | |
aoqi@0 | 28 | // RedefineClasses tracing support via the TraceRedefineClasses |
aoqi@0 | 29 | // option. A bit is assigned to each group of trace messages. |
aoqi@0 | 30 | // Groups of messages are individually selectable. We have to use |
aoqi@0 | 31 | // decimal values on the command line since the command option |
aoqi@0 | 32 | // parsing logic doesn't like non-decimal numerics. The HEX values |
aoqi@0 | 33 | // are used in the actual RC_TRACE() calls for sanity. To achieve |
aoqi@0 | 34 | // the old cumulative behavior, pick the level after the one in |
aoqi@0 | 35 | // which you are interested and subtract one, e.g., 33554431 will |
aoqi@0 | 36 | // print every tracing message. |
aoqi@0 | 37 | // |
aoqi@0 | 38 | // 0x00000000 | 0 - default; no tracing messages |
aoqi@0 | 39 | // 0x00000001 | 1 - name each target class before loading, after |
aoqi@0 | 40 | // loading and after redefinition is completed |
aoqi@0 | 41 | // 0x00000002 | 2 - print info if parsing, linking or |
aoqi@0 | 42 | // verification throws an exception |
aoqi@0 | 43 | // 0x00000004 | 4 - print timer info for the VM operation |
aoqi@0 | 44 | // 0x00000008 | 8 - print subclass counter updates |
aoqi@0 | 45 | // 0x00000010 | 16 - unused |
aoqi@0 | 46 | // 0x00000020 | 32 - unused |
aoqi@0 | 47 | // 0x00000040 | 64 - unused |
aoqi@0 | 48 | // 0x00000080 | 128 - unused |
aoqi@0 | 49 | // 0x00000100 | 256 - previous class weak reference addition |
aoqi@0 | 50 | // 0x00000200 | 512 - previous class weak reference mgmt during |
aoqi@0 | 51 | // class unloading checks (GC) |
aoqi@0 | 52 | // 0x00000400 | 1024 - previous class weak reference mgmt during |
aoqi@0 | 53 | // add previous ops (GC) |
aoqi@0 | 54 | // 0x00000800 | 2048 - previous class breakpoint mgmt |
aoqi@0 | 55 | // 0x00001000 | 4096 - detect calls to obsolete methods |
aoqi@0 | 56 | // 0x00002000 | 8192 - fail a guarantee() in addition to detection |
aoqi@0 | 57 | // 0x00004000 | 16384 - detect old/obsolete methods in metadata |
aoqi@0 | 58 | // 0x00008000 | 32768 - old/new method matching/add/delete |
aoqi@0 | 59 | // 0x00010000 | 65536 - impl details: CP size info |
aoqi@0 | 60 | // 0x00020000 | 131072 - impl details: CP merge pass info |
aoqi@0 | 61 | // 0x00040000 | 262144 - impl details: CP index maps |
aoqi@0 | 62 | // 0x00080000 | 524288 - impl details: modified CP index values |
aoqi@0 | 63 | // 0x00100000 | 1048576 - impl details: vtable updates |
aoqi@0 | 64 | // 0x00200000 | 2097152 - impl details: itable updates |
aoqi@0 | 65 | // 0x00400000 | 4194304 - impl details: constant pool cache updates |
aoqi@0 | 66 | // 0x00800000 | 8388608 - impl details: methodComparator info |
aoqi@0 | 67 | // 0x01000000 | 16777216 - impl details: nmethod evolution info |
aoqi@0 | 68 | // 0x02000000 | 33554432 - impl details: annotation updates |
aoqi@0 | 69 | // 0x04000000 | 67108864 - impl details: StackMapTable updates |
aoqi@0 | 70 | // 0x08000000 | 134217728 - impl details: OopMapCache updates |
aoqi@0 | 71 | // 0x10000000 | 268435456 - unused |
aoqi@0 | 72 | // 0x20000000 | 536870912 - unused |
aoqi@0 | 73 | // 0x40000000 | 1073741824 - unused |
aoqi@0 | 74 | // 0x80000000 | 2147483648 - unused |
aoqi@0 | 75 | |
aoqi@0 | 76 | // Macro for checking if TraceRedefineClasses has a specific bit |
aoqi@0 | 77 | // enabled. Returns true if the bit specified by level is set. |
aoqi@0 | 78 | #define RC_TRACE_ENABLED(level) ((TraceRedefineClasses & level) != 0) |
aoqi@0 | 79 | |
aoqi@0 | 80 | // Macro for checking if TraceRedefineClasses has one or more bits |
aoqi@0 | 81 | // set in a range of bit values. Returns true if one or more bits |
aoqi@0 | 82 | // is set in the range from low..high inclusive. Assumes that low |
aoqi@0 | 83 | // and high are single bit values. |
aoqi@0 | 84 | // |
aoqi@0 | 85 | // ((high << 1) - 1) |
aoqi@0 | 86 | // Yields a mask that removes bits greater than the high bit value. |
aoqi@0 | 87 | // This algorithm doesn't work with highest bit. |
aoqi@0 | 88 | // ~(low - 1) |
aoqi@0 | 89 | // Yields a mask that removes bits lower than the low bit value. |
aoqi@0 | 90 | #define RC_TRACE_IN_RANGE(low, high) \ |
aoqi@0 | 91 | (((TraceRedefineClasses & ((high << 1) - 1)) & ~(low - 1)) != 0) |
aoqi@0 | 92 | |
aoqi@0 | 93 | // Note: The ResourceMark is to cleanup resource allocated args. |
aoqi@0 | 94 | // The "do {...} while (0)" is so we can use semi-colon at end of RC_TRACE(). |
aoqi@0 | 95 | #define RC_TRACE(level, args) do { \ |
aoqi@0 | 96 | if (RC_TRACE_ENABLED(level)) { \ |
aoqi@0 | 97 | ResourceMark rm; \ |
aoqi@0 | 98 | tty->print("RedefineClasses-0x%x: ", level); \ |
aoqi@0 | 99 | tty->print_cr args; \ |
aoqi@0 | 100 | } \ |
aoqi@0 | 101 | } while (0) |
aoqi@0 | 102 | |
aoqi@0 | 103 | #define RC_TRACE_NO_CR(level, args) do { \ |
aoqi@0 | 104 | if (RC_TRACE_ENABLED(level)) { \ |
aoqi@0 | 105 | ResourceMark rm; \ |
aoqi@0 | 106 | tty->print("RedefineClasses-0x%x: ", level); \ |
aoqi@0 | 107 | tty->print args; \ |
aoqi@0 | 108 | } \ |
aoqi@0 | 109 | } while (0) |
aoqi@0 | 110 | |
aoqi@0 | 111 | #define RC_TRACE_WITH_THREAD(level, thread, args) do { \ |
aoqi@0 | 112 | if (RC_TRACE_ENABLED(level)) { \ |
aoqi@0 | 113 | ResourceMark rm(thread); \ |
aoqi@0 | 114 | tty->print("RedefineClasses-0x%x: ", level); \ |
aoqi@0 | 115 | tty->print_cr args; \ |
aoqi@0 | 116 | } \ |
aoqi@0 | 117 | } while (0) |
aoqi@0 | 118 | |
aoqi@0 | 119 | #define RC_TRACE_MESG(args) do { \ |
aoqi@0 | 120 | ResourceMark rm; \ |
aoqi@0 | 121 | tty->print("RedefineClasses: "); \ |
aoqi@0 | 122 | tty->print_cr args; \ |
aoqi@0 | 123 | } while (0) |
aoqi@0 | 124 | |
aoqi@0 | 125 | // Timer support macros. Only do timer operations if timer tracing is enabled. |
aoqi@0 | 126 | // The "do {...} while (0)" is so we can use semi-colon at end of the macro. |
aoqi@0 | 127 | #define RC_TIMER_START(t) do { \ |
aoqi@0 | 128 | if (RC_TRACE_ENABLED(0x00000004)) { \ |
aoqi@0 | 129 | t.start(); \ |
aoqi@0 | 130 | } \ |
aoqi@0 | 131 | } while (0) |
aoqi@0 | 132 | #define RC_TIMER_STOP(t) do { \ |
aoqi@0 | 133 | if (RC_TRACE_ENABLED(0x00000004)) { \ |
aoqi@0 | 134 | t.stop(); \ |
aoqi@0 | 135 | } \ |
aoqi@0 | 136 | } while (0) |
aoqi@0 | 137 | |
aoqi@0 | 138 | #endif // SHARE_VM_PRIMS_JVMTIREDEFINECLASSESTRACE_HPP |