src/share/vm/prims/jvmtiRedefineClassesTrace.hpp

changeset 435
a61af66fc99e
child 483
d8b3ef7ee3e5
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/share/vm/prims/jvmtiRedefineClassesTrace.hpp	Sat Dec 01 00:00:00 2007 +0000
     1.3 @@ -0,0 +1,123 @@
     1.4 +/*
     1.5 + * Copyright 2003-2006 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    1.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
    1.24 + * have any questions.
    1.25 + *
    1.26 + */
    1.27 +
    1.28 +// RedefineClasses tracing support via the TraceRedefineClasses
    1.29 +// option. A bit is assigned to each group of trace messages.
    1.30 +// Groups of messages are individually selectable. We have to use
    1.31 +// decimal values on the command line since the command option
    1.32 +// parsing logic doesn't like non-decimal numerics. The HEX values
    1.33 +// are used in the actual RC_TRACE() calls for sanity. To achieve
    1.34 +// the old cumulative behavior, pick the level after the one in
    1.35 +// which you are interested and subtract one, e.g., 33554431 will
    1.36 +// print every tracing message.
    1.37 +//
    1.38 +//    0x00000000 |          0 - default; no tracing messages
    1.39 +//    0x00000001 |          1 - name each target class before loading, after
    1.40 +//                              loading and after redefinition is completed
    1.41 +//    0x00000002 |          2 - print info if parsing, linking or
    1.42 +//                              verification throws an exception
    1.43 +//    0x00000004 |          4 - print timer info for the VM operation
    1.44 +//    0x00000008 |          8 - print subclass counter updates
    1.45 +//    0x00000010 |         16 - unused
    1.46 +//    0x00000020 |         32 - unused
    1.47 +//    0x00000040 |         64 - unused
    1.48 +//    0x00000080 |        128 - unused
    1.49 +//    0x00000100 |        256 - previous class weak reference addition
    1.50 +//    0x00000200 |        512 - previous class weak reference mgmt during
    1.51 +//                              class unloading checks (GC)
    1.52 +//    0x00000400 |       1024 - previous class weak reference mgmt during
    1.53 +//                              add previous ops (GC)
    1.54 +//    0x00000800 |       2048 - previous class breakpoint mgmt
    1.55 +//    0x00001000 |       4096 - unused
    1.56 +//    0x00002000 |       8192 - unused
    1.57 +//    0x00004000 |      16384 - unused
    1.58 +//    0x00008000 |      32768 - old/new method matching/add/delete
    1.59 +//    0x00010000 |      65536 - impl details: CP size info
    1.60 +//    0x00020000 |     131072 - impl details: CP merge pass info
    1.61 +//    0x00040000 |     262144 - impl details: CP index maps
    1.62 +//    0x00080000 |     524288 - impl details: modified CP index values
    1.63 +//    0x00100000 |    1048576 - impl details: vtable updates
    1.64 +//    0x00200000 |    2097152 - impl details: itable updates
    1.65 +//    0x00400000 |    4194304 - impl details: constant pool cache updates
    1.66 +//    0x00800000 |    8388608 - impl details: methodComparator info
    1.67 +//    0x01000000 |   16777216 - impl details: nmethod evolution info
    1.68 +//    0x02000000 |   33554432 - impl details: annotation updates
    1.69 +//    0x04000000 |   67108864 - impl details: StackMapTable updates
    1.70 +//    0x08000000 |  134217728 - unused
    1.71 +//    0x10000000 |  268435456 - unused
    1.72 +//    0x20000000 |  536870912 - unused
    1.73 +//    0x40000000 | 1073741824 - unused
    1.74 +//    0x80000000 | 2147483648 - unused
    1.75 +//
    1.76 +// Note: The ResourceMark is to cleanup resource allocated args.
    1.77 +//   The "while (0)" is so we can use semi-colon at end of RC_TRACE().
    1.78 +#define RC_TRACE(level, args) \
    1.79 +  if ((TraceRedefineClasses & level) != 0) { \
    1.80 +    ResourceMark rm; \
    1.81 +    tty->print("RedefineClasses-0x%x: ", level); \
    1.82 +    tty->print_cr args; \
    1.83 +  } while (0)
    1.84 +
    1.85 +#define RC_TRACE_WITH_THREAD(level, thread, args) \
    1.86 +  if ((TraceRedefineClasses & level) != 0) { \
    1.87 +    ResourceMark rm(thread); \
    1.88 +    tty->print("RedefineClasses-0x%x: ", level); \
    1.89 +    tty->print_cr args; \
    1.90 +  } while (0)
    1.91 +
    1.92 +#define RC_TRACE_MESG(args) \
    1.93 +  { \
    1.94 +    ResourceMark rm; \
    1.95 +    tty->print("RedefineClasses: "); \
    1.96 +    tty->print_cr args; \
    1.97 +  } while (0)
    1.98 +
    1.99 +// Macro for checking if TraceRedefineClasses has a specific bit
   1.100 +// enabled. Returns true if the bit specified by level is set.
   1.101 +#define RC_TRACE_ENABLED(level) ((TraceRedefineClasses & level) != 0)
   1.102 +
   1.103 +// Macro for checking if TraceRedefineClasses has one or more bits
   1.104 +// set in a range of bit values. Returns true if one or more bits
   1.105 +// is set in the range from low..high inclusive. Assumes that low
   1.106 +// and high are single bit values.
   1.107 +//
   1.108 +// ((high << 1) - 1)
   1.109 +//     Yields a mask that removes bits greater than the high bit value.
   1.110 +//     This algorithm doesn't work with highest bit.
   1.111 +// ~(low - 1)
   1.112 +//     Yields a mask that removes bits lower than the low bit value.
   1.113 +#define RC_TRACE_IN_RANGE(low, high) \
   1.114 +(((TraceRedefineClasses & ((high << 1) - 1)) & ~(low - 1)) != 0)
   1.115 +
   1.116 +// Timer support macros. Only do timer operations if timer tracing
   1.117 +// is enabled. The "while (0)" is so we can use semi-colon at end of
   1.118 +// the macro.
   1.119 +#define RC_TIMER_START(t) \
   1.120 +  if (RC_TRACE_ENABLED(0x00000004)) { \
   1.121 +    t.start(); \
   1.122 +  } while (0)
   1.123 +#define RC_TIMER_STOP(t) \
   1.124 +  if (RC_TRACE_ENABLED(0x00000004)) { \
   1.125 +    t.stop(); \
   1.126 +  } while (0)

mercurial