hotspot/src/share/vm/prims/jvmtiRedefineClassesTrace.hpp
author ysr
Thu, 03 Dec 2009 15:01:57 -0800
changeset 4461 c17c526d36ef
parent 2136 c55428da3cec
child 5547 f4b087cbb361
permissions -rw-r--r--
6906727: UseCompressedOops: some card-marking fixes related to object arrays Summary: Introduced a new write_ref_array(HeapWords* start, size_t count) method that does the requisite MemRegion range calculation so (some of the) clients of the erstwhile write_ref_array(MemRegion mr) do not need to worry. This removed all external uses of array_size(), which was also simplified and made private. Asserts were added to catch other possible issues. Further, less essential, fixes stemming from this investigation are deferred to CR 6904516 (to follow shortly in hs17). Reviewed-by: kvn, coleenp, jmasa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
670
ddf3e9583f2f 6719955: Update copyright year
xdono
parents: 221
diff changeset
     2
 * Copyright 2003-2008 Sun Microsystems, Inc.  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
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    21
 * have any questions.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
489c9b5090e2 Initial load
duke
parents:
diff changeset
    25
// RedefineClasses tracing support via the TraceRedefineClasses
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
// option. A bit is assigned to each group of trace messages.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
// Groups of messages are individually selectable. We have to use
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
// decimal values on the command line since the command option
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
// parsing logic doesn't like non-decimal numerics. The HEX values
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
// are used in the actual RC_TRACE() calls for sanity. To achieve
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
// the old cumulative behavior, pick the level after the one in
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
// which you are interested and subtract one, e.g., 33554431 will
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
// print every tracing message.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
//    0x00000000 |          0 - default; no tracing messages
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
//    0x00000001 |          1 - name each target class before loading, after
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
//                              loading and after redefinition is completed
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
//    0x00000002 |          2 - print info if parsing, linking or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
//                              verification throws an exception
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
//    0x00000004 |          4 - print timer info for the VM operation
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
//    0x00000008 |          8 - print subclass counter updates
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
//    0x00000010 |         16 - unused
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
//    0x00000020 |         32 - unused
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
//    0x00000040 |         64 - unused
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
//    0x00000080 |        128 - unused
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
//    0x00000100 |        256 - previous class weak reference addition
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
//    0x00000200 |        512 - previous class weak reference mgmt during
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
//                              class unloading checks (GC)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
//    0x00000400 |       1024 - previous class weak reference mgmt during
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
//                              add previous ops (GC)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
//    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
    52
//    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
    53
//    0x00002000 |       8192 - fail a guarantee() in addition to detection
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
//    0x00004000 |      16384 - unused
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
//    0x00008000 |      32768 - old/new method matching/add/delete
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
//    0x00010000 |      65536 - impl details: CP size info
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
//    0x00020000 |     131072 - impl details: CP merge pass info
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
//    0x00040000 |     262144 - impl details: CP index maps
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
//    0x00080000 |     524288 - impl details: modified CP index values
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
//    0x00100000 |    1048576 - impl details: vtable updates
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
//    0x00200000 |    2097152 - impl details: itable updates
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
//    0x00400000 |    4194304 - impl details: constant pool cache updates
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
//    0x00800000 |    8388608 - impl details: methodComparator info
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
//    0x01000000 |   16777216 - impl details: nmethod evolution info
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
//    0x02000000 |   33554432 - impl details: annotation updates
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
//    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
    67
//    0x08000000 |  134217728 - impl details: OopMapCache updates
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
//    0x10000000 |  268435456 - unused
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
//    0x20000000 |  536870912 - unused
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
//    0x40000000 | 1073741824 - unused
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
//    0x80000000 | 2147483648 - unused
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
// Note: The ResourceMark is to cleanup resource allocated args.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
//   The "while (0)" is so we can use semi-colon at end of RC_TRACE().
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
#define RC_TRACE(level, args) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  if ((TraceRedefineClasses & level) != 0) { \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
    ResourceMark rm; \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
    tty->print("RedefineClasses-0x%x: ", level); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
    tty->print_cr args; \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  } while (0)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
#define RC_TRACE_WITH_THREAD(level, thread, args) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
  if ((TraceRedefineClasses & level) != 0) { \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
    ResourceMark rm(thread); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
    tty->print("RedefineClasses-0x%x: ", level); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
    tty->print_cr args; \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  } while (0)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
#define RC_TRACE_MESG(args) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  { \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
    ResourceMark rm; \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
    tty->print("RedefineClasses: "); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
    tty->print_cr args; \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  } while (0)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
// Macro for checking if TraceRedefineClasses has a specific bit
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
// enabled. Returns true if the bit specified by level is set.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
#define RC_TRACE_ENABLED(level) ((TraceRedefineClasses & level) != 0)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
// Macro for checking if TraceRedefineClasses has one or more bits
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
// set in a range of bit values. Returns true if one or more bits
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
// is set in the range from low..high inclusive. Assumes that low
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
// and high are single bit values.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
// ((high << 1) - 1)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
//     Yields a mask that removes bits greater than the high bit value.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
//     This algorithm doesn't work with highest bit.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
// ~(low - 1)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
//     Yields a mask that removes bits lower than the low bit value.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
#define RC_TRACE_IN_RANGE(low, high) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
(((TraceRedefineClasses & ((high << 1) - 1)) & ~(low - 1)) != 0)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
// Timer support macros. Only do timer operations if timer tracing
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
// is enabled. The "while (0)" is so we can use semi-colon at end of
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
// the macro.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
#define RC_TIMER_START(t) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
  if (RC_TRACE_ENABLED(0x00000004)) { \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
    t.start(); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
  } while (0)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
#define RC_TIMER_STOP(t) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
  if (RC_TRACE_ENABLED(0x00000004)) { \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
    t.stop(); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  } while (0)