src/share/vm/prims/jvmtiRedefineClassesTrace.hpp

changeset 0
f90c822e73f8
child 6876
710a3c8b516e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/share/vm/prims/jvmtiRedefineClassesTrace.hpp	Wed Apr 27 01:25:04 2016 +0800
     1.3 @@ -0,0 +1,138 @@
     1.4 +/*
     1.5 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.
    1.11 + *
    1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.15 + * version 2 for more details (a copy is included in the LICENSE file that
    1.16 + * accompanied this code).
    1.17 + *
    1.18 + * You should have received a copy of the GNU General Public License version
    1.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.21 + *
    1.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.23 + * or visit www.oracle.com if you need additional information or have any
    1.24 + * questions.
    1.25 + *
    1.26 + */
    1.27 +
    1.28 +#ifndef SHARE_VM_PRIMS_JVMTIREDEFINECLASSESTRACE_HPP
    1.29 +#define SHARE_VM_PRIMS_JVMTIREDEFINECLASSESTRACE_HPP
    1.30 +
    1.31 +// RedefineClasses tracing support via the TraceRedefineClasses
    1.32 +// option. A bit is assigned to each group of trace messages.
    1.33 +// Groups of messages are individually selectable. We have to use
    1.34 +// decimal values on the command line since the command option
    1.35 +// parsing logic doesn't like non-decimal numerics. The HEX values
    1.36 +// are used in the actual RC_TRACE() calls for sanity. To achieve
    1.37 +// the old cumulative behavior, pick the level after the one in
    1.38 +// which you are interested and subtract one, e.g., 33554431 will
    1.39 +// print every tracing message.
    1.40 +//
    1.41 +//    0x00000000 |          0 - default; no tracing messages
    1.42 +//    0x00000001 |          1 - name each target class before loading, after
    1.43 +//                              loading and after redefinition is completed
    1.44 +//    0x00000002 |          2 - print info if parsing, linking or
    1.45 +//                              verification throws an exception
    1.46 +//    0x00000004 |          4 - print timer info for the VM operation
    1.47 +//    0x00000008 |          8 - print subclass counter updates
    1.48 +//    0x00000010 |         16 - unused
    1.49 +//    0x00000020 |         32 - unused
    1.50 +//    0x00000040 |         64 - unused
    1.51 +//    0x00000080 |        128 - unused
    1.52 +//    0x00000100 |        256 - previous class weak reference addition
    1.53 +//    0x00000200 |        512 - previous class weak reference mgmt during
    1.54 +//                              class unloading checks (GC)
    1.55 +//    0x00000400 |       1024 - previous class weak reference mgmt during
    1.56 +//                              add previous ops (GC)
    1.57 +//    0x00000800 |       2048 - previous class breakpoint mgmt
    1.58 +//    0x00001000 |       4096 - detect calls to obsolete methods
    1.59 +//    0x00002000 |       8192 - fail a guarantee() in addition to detection
    1.60 +//    0x00004000 |      16384 - detect old/obsolete methods in metadata
    1.61 +//    0x00008000 |      32768 - old/new method matching/add/delete
    1.62 +//    0x00010000 |      65536 - impl details: CP size info
    1.63 +//    0x00020000 |     131072 - impl details: CP merge pass info
    1.64 +//    0x00040000 |     262144 - impl details: CP index maps
    1.65 +//    0x00080000 |     524288 - impl details: modified CP index values
    1.66 +//    0x00100000 |    1048576 - impl details: vtable updates
    1.67 +//    0x00200000 |    2097152 - impl details: itable updates
    1.68 +//    0x00400000 |    4194304 - impl details: constant pool cache updates
    1.69 +//    0x00800000 |    8388608 - impl details: methodComparator info
    1.70 +//    0x01000000 |   16777216 - impl details: nmethod evolution info
    1.71 +//    0x02000000 |   33554432 - impl details: annotation updates
    1.72 +//    0x04000000 |   67108864 - impl details: StackMapTable updates
    1.73 +//    0x08000000 |  134217728 - impl details: OopMapCache updates
    1.74 +//    0x10000000 |  268435456 - unused
    1.75 +//    0x20000000 |  536870912 - unused
    1.76 +//    0x40000000 | 1073741824 - unused
    1.77 +//    0x80000000 | 2147483648 - unused
    1.78 +
    1.79 +// Macro for checking if TraceRedefineClasses has a specific bit
    1.80 +// enabled. Returns true if the bit specified by level is set.
    1.81 +#define RC_TRACE_ENABLED(level) ((TraceRedefineClasses & level) != 0)
    1.82 +
    1.83 +// Macro for checking if TraceRedefineClasses has one or more bits
    1.84 +// set in a range of bit values. Returns true if one or more bits
    1.85 +// is set in the range from low..high inclusive. Assumes that low
    1.86 +// and high are single bit values.
    1.87 +//
    1.88 +// ((high << 1) - 1)
    1.89 +//     Yields a mask that removes bits greater than the high bit value.
    1.90 +//     This algorithm doesn't work with highest bit.
    1.91 +// ~(low - 1)
    1.92 +//     Yields a mask that removes bits lower than the low bit value.
    1.93 +#define RC_TRACE_IN_RANGE(low, high) \
    1.94 +(((TraceRedefineClasses & ((high << 1) - 1)) & ~(low - 1)) != 0)
    1.95 +
    1.96 +// Note: The ResourceMark is to cleanup resource allocated args.
    1.97 +// The "do {...} while (0)" is so we can use semi-colon at end of RC_TRACE().
    1.98 +#define RC_TRACE(level, args) do { \
    1.99 +  if (RC_TRACE_ENABLED(level)) { \
   1.100 +    ResourceMark rm; \
   1.101 +    tty->print("RedefineClasses-0x%x: ", level); \
   1.102 +    tty->print_cr args; \
   1.103 +  } \
   1.104 +} while (0)
   1.105 +
   1.106 +#define RC_TRACE_NO_CR(level, args) do { \
   1.107 +  if (RC_TRACE_ENABLED(level)) { \
   1.108 +    ResourceMark rm; \
   1.109 +    tty->print("RedefineClasses-0x%x: ", level); \
   1.110 +    tty->print args; \
   1.111 +  } \
   1.112 +} while (0)
   1.113 +
   1.114 +#define RC_TRACE_WITH_THREAD(level, thread, args) do { \
   1.115 +  if (RC_TRACE_ENABLED(level)) { \
   1.116 +    ResourceMark rm(thread); \
   1.117 +    tty->print("RedefineClasses-0x%x: ", level); \
   1.118 +    tty->print_cr args; \
   1.119 +  } \
   1.120 +} while (0)
   1.121 +
   1.122 +#define RC_TRACE_MESG(args) do { \
   1.123 +  ResourceMark rm; \
   1.124 +  tty->print("RedefineClasses: "); \
   1.125 +  tty->print_cr args; \
   1.126 +} while (0)
   1.127 +
   1.128 +// Timer support macros. Only do timer operations if timer tracing is enabled.
   1.129 +// The "do {...} while (0)" is so we can use semi-colon at end of the macro.
   1.130 +#define RC_TIMER_START(t) do { \
   1.131 +  if (RC_TRACE_ENABLED(0x00000004)) { \
   1.132 +    t.start(); \
   1.133 +  } \
   1.134 +} while (0)
   1.135 +#define RC_TIMER_STOP(t) do { \
   1.136 +  if (RC_TRACE_ENABLED(0x00000004)) { \
   1.137 +    t.stop(); \
   1.138 +  } \
   1.139 +} while (0)
   1.140 +
   1.141 +#endif // SHARE_VM_PRIMS_JVMTIREDEFINECLASSESTRACE_HPP

mercurial