hotspot/src/share/vm/prims/jvmtiRedefineClassesTrace.hpp
changeset 1 489c9b5090e2
child 221 ec745a0fe922
equal deleted inserted replaced
0:fd16c54261b3 1:489c9b5090e2
       
     1 /*
       
     2  * Copyright 2003-2006 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
       
    20  * CA 95054 USA or visit www.sun.com if you need additional information or
       
    21  * have any questions.
       
    22  *
       
    23  */
       
    24 
       
    25 // RedefineClasses tracing support via the TraceRedefineClasses
       
    26 // option. A bit is assigned to each group of trace messages.
       
    27 // Groups of messages are individually selectable. We have to use
       
    28 // decimal values on the command line since the command option
       
    29 // parsing logic doesn't like non-decimal numerics. The HEX values
       
    30 // are used in the actual RC_TRACE() calls for sanity. To achieve
       
    31 // the old cumulative behavior, pick the level after the one in
       
    32 // which you are interested and subtract one, e.g., 33554431 will
       
    33 // print every tracing message.
       
    34 //
       
    35 //    0x00000000 |          0 - default; no tracing messages
       
    36 //    0x00000001 |          1 - name each target class before loading, after
       
    37 //                              loading and after redefinition is completed
       
    38 //    0x00000002 |          2 - print info if parsing, linking or
       
    39 //                              verification throws an exception
       
    40 //    0x00000004 |          4 - print timer info for the VM operation
       
    41 //    0x00000008 |          8 - print subclass counter updates
       
    42 //    0x00000010 |         16 - unused
       
    43 //    0x00000020 |         32 - unused
       
    44 //    0x00000040 |         64 - unused
       
    45 //    0x00000080 |        128 - unused
       
    46 //    0x00000100 |        256 - previous class weak reference addition
       
    47 //    0x00000200 |        512 - previous class weak reference mgmt during
       
    48 //                              class unloading checks (GC)
       
    49 //    0x00000400 |       1024 - previous class weak reference mgmt during
       
    50 //                              add previous ops (GC)
       
    51 //    0x00000800 |       2048 - previous class breakpoint mgmt
       
    52 //    0x00001000 |       4096 - unused
       
    53 //    0x00002000 |       8192 - unused
       
    54 //    0x00004000 |      16384 - unused
       
    55 //    0x00008000 |      32768 - old/new method matching/add/delete
       
    56 //    0x00010000 |      65536 - impl details: CP size info
       
    57 //    0x00020000 |     131072 - impl details: CP merge pass info
       
    58 //    0x00040000 |     262144 - impl details: CP index maps
       
    59 //    0x00080000 |     524288 - impl details: modified CP index values
       
    60 //    0x00100000 |    1048576 - impl details: vtable updates
       
    61 //    0x00200000 |    2097152 - impl details: itable updates
       
    62 //    0x00400000 |    4194304 - impl details: constant pool cache updates
       
    63 //    0x00800000 |    8388608 - impl details: methodComparator info
       
    64 //    0x01000000 |   16777216 - impl details: nmethod evolution info
       
    65 //    0x02000000 |   33554432 - impl details: annotation updates
       
    66 //    0x04000000 |   67108864 - impl details: StackMapTable updates
       
    67 //    0x08000000 |  134217728 - unused
       
    68 //    0x10000000 |  268435456 - unused
       
    69 //    0x20000000 |  536870912 - unused
       
    70 //    0x40000000 | 1073741824 - unused
       
    71 //    0x80000000 | 2147483648 - unused
       
    72 //
       
    73 // Note: The ResourceMark is to cleanup resource allocated args.
       
    74 //   The "while (0)" is so we can use semi-colon at end of RC_TRACE().
       
    75 #define RC_TRACE(level, args) \
       
    76   if ((TraceRedefineClasses & level) != 0) { \
       
    77     ResourceMark rm; \
       
    78     tty->print("RedefineClasses-0x%x: ", level); \
       
    79     tty->print_cr args; \
       
    80   } while (0)
       
    81 
       
    82 #define RC_TRACE_WITH_THREAD(level, thread, args) \
       
    83   if ((TraceRedefineClasses & level) != 0) { \
       
    84     ResourceMark rm(thread); \
       
    85     tty->print("RedefineClasses-0x%x: ", level); \
       
    86     tty->print_cr args; \
       
    87   } while (0)
       
    88 
       
    89 #define RC_TRACE_MESG(args) \
       
    90   { \
       
    91     ResourceMark rm; \
       
    92     tty->print("RedefineClasses: "); \
       
    93     tty->print_cr args; \
       
    94   } while (0)
       
    95 
       
    96 // Macro for checking if TraceRedefineClasses has a specific bit
       
    97 // enabled. Returns true if the bit specified by level is set.
       
    98 #define RC_TRACE_ENABLED(level) ((TraceRedefineClasses & level) != 0)
       
    99 
       
   100 // Macro for checking if TraceRedefineClasses has one or more bits
       
   101 // set in a range of bit values. Returns true if one or more bits
       
   102 // is set in the range from low..high inclusive. Assumes that low
       
   103 // and high are single bit values.
       
   104 //
       
   105 // ((high << 1) - 1)
       
   106 //     Yields a mask that removes bits greater than the high bit value.
       
   107 //     This algorithm doesn't work with highest bit.
       
   108 // ~(low - 1)
       
   109 //     Yields a mask that removes bits lower than the low bit value.
       
   110 #define RC_TRACE_IN_RANGE(low, high) \
       
   111 (((TraceRedefineClasses & ((high << 1) - 1)) & ~(low - 1)) != 0)
       
   112 
       
   113 // Timer support macros. Only do timer operations if timer tracing
       
   114 // is enabled. The "while (0)" is so we can use semi-colon at end of
       
   115 // the macro.
       
   116 #define RC_TIMER_START(t) \
       
   117   if (RC_TRACE_ENABLED(0x00000004)) { \
       
   118     t.start(); \
       
   119   } while (0)
       
   120 #define RC_TIMER_STOP(t) \
       
   121   if (RC_TRACE_ENABLED(0x00000004)) { \
       
   122     t.stop(); \
       
   123   } while (0)