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