annotate src/share/vm/prims/jvmtiRedefineClassesTrace.hpp @ 452:00b023ae2d78

6722113: CMS: Incorrect overflow handling during precleaning of Reference lists Summary: When we encounter marking stack overflow during precleaning of Reference lists, we were using the overflow list mechanism, which can cause problems on account of mutating the mark word of the header because of conflicts with mutator accesses and updates of that field. Instead we should use the usual mechanism for overflow handling in concurrent phases, namely dirtying of the card on which the overflowed object lies. Since precleaning effectively does a form of discovered list processing, albeit with discovery enabled, we needed to adjust some code to be correct in the face of interleaved processing and discovery. Reviewed-by: apetrusenko, jcoomes
author ysr
date Thu, 20 Nov 2008 12:27:41 -0800
parents d1605aabd0a1
children 70998f2e05ef
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
196
d1605aabd0a1 6719955: Update copyright year
xdono
parents: 48
diff changeset
2 * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
a61af66fc99e Initial load
duke
parents:
diff changeset
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
a61af66fc99e Initial load
duke
parents:
diff changeset
20 * CA 95054 USA or visit www.sun.com if you need additional information or
a61af66fc99e Initial load
duke
parents:
diff changeset
21 * have any questions.
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 // RedefineClasses tracing support via the TraceRedefineClasses
a61af66fc99e Initial load
duke
parents:
diff changeset
26 // option. A bit is assigned to each group of trace messages.
a61af66fc99e Initial load
duke
parents:
diff changeset
27 // Groups of messages are individually selectable. We have to use
a61af66fc99e Initial load
duke
parents:
diff changeset
28 // decimal values on the command line since the command option
a61af66fc99e Initial load
duke
parents:
diff changeset
29 // parsing logic doesn't like non-decimal numerics. The HEX values
a61af66fc99e Initial load
duke
parents:
diff changeset
30 // are used in the actual RC_TRACE() calls for sanity. To achieve
a61af66fc99e Initial load
duke
parents:
diff changeset
31 // the old cumulative behavior, pick the level after the one in
a61af66fc99e Initial load
duke
parents:
diff changeset
32 // which you are interested and subtract one, e.g., 33554431 will
a61af66fc99e Initial load
duke
parents:
diff changeset
33 // print every tracing message.
a61af66fc99e Initial load
duke
parents:
diff changeset
34 //
a61af66fc99e Initial load
duke
parents:
diff changeset
35 // 0x00000000 | 0 - default; no tracing messages
a61af66fc99e Initial load
duke
parents:
diff changeset
36 // 0x00000001 | 1 - name each target class before loading, after
a61af66fc99e Initial load
duke
parents:
diff changeset
37 // loading and after redefinition is completed
a61af66fc99e Initial load
duke
parents:
diff changeset
38 // 0x00000002 | 2 - print info if parsing, linking or
a61af66fc99e Initial load
duke
parents:
diff changeset
39 // verification throws an exception
a61af66fc99e Initial load
duke
parents:
diff changeset
40 // 0x00000004 | 4 - print timer info for the VM operation
a61af66fc99e Initial load
duke
parents:
diff changeset
41 // 0x00000008 | 8 - print subclass counter updates
a61af66fc99e Initial load
duke
parents:
diff changeset
42 // 0x00000010 | 16 - unused
a61af66fc99e Initial load
duke
parents:
diff changeset
43 // 0x00000020 | 32 - unused
a61af66fc99e Initial load
duke
parents:
diff changeset
44 // 0x00000040 | 64 - unused
a61af66fc99e Initial load
duke
parents:
diff changeset
45 // 0x00000080 | 128 - unused
a61af66fc99e Initial load
duke
parents:
diff changeset
46 // 0x00000100 | 256 - previous class weak reference addition
a61af66fc99e Initial load
duke
parents:
diff changeset
47 // 0x00000200 | 512 - previous class weak reference mgmt during
a61af66fc99e Initial load
duke
parents:
diff changeset
48 // class unloading checks (GC)
a61af66fc99e Initial load
duke
parents:
diff changeset
49 // 0x00000400 | 1024 - previous class weak reference mgmt during
a61af66fc99e Initial load
duke
parents:
diff changeset
50 // add previous ops (GC)
a61af66fc99e Initial load
duke
parents:
diff changeset
51 // 0x00000800 | 2048 - previous class breakpoint mgmt
a61af66fc99e Initial load
duke
parents:
diff changeset
52 // 0x00001000 | 4096 - unused
a61af66fc99e Initial load
duke
parents:
diff changeset
53 // 0x00002000 | 8192 - unused
a61af66fc99e Initial load
duke
parents:
diff changeset
54 // 0x00004000 | 16384 - unused
a61af66fc99e Initial load
duke
parents:
diff changeset
55 // 0x00008000 | 32768 - old/new method matching/add/delete
a61af66fc99e Initial load
duke
parents:
diff changeset
56 // 0x00010000 | 65536 - impl details: CP size info
a61af66fc99e Initial load
duke
parents:
diff changeset
57 // 0x00020000 | 131072 - impl details: CP merge pass info
a61af66fc99e Initial load
duke
parents:
diff changeset
58 // 0x00040000 | 262144 - impl details: CP index maps
a61af66fc99e Initial load
duke
parents:
diff changeset
59 // 0x00080000 | 524288 - impl details: modified CP index values
a61af66fc99e Initial load
duke
parents:
diff changeset
60 // 0x00100000 | 1048576 - impl details: vtable updates
a61af66fc99e Initial load
duke
parents:
diff changeset
61 // 0x00200000 | 2097152 - impl details: itable updates
a61af66fc99e Initial load
duke
parents:
diff changeset
62 // 0x00400000 | 4194304 - impl details: constant pool cache updates
a61af66fc99e Initial load
duke
parents:
diff changeset
63 // 0x00800000 | 8388608 - impl details: methodComparator info
a61af66fc99e Initial load
duke
parents:
diff changeset
64 // 0x01000000 | 16777216 - impl details: nmethod evolution info
a61af66fc99e Initial load
duke
parents:
diff changeset
65 // 0x02000000 | 33554432 - impl details: annotation updates
a61af66fc99e Initial load
duke
parents:
diff changeset
66 // 0x04000000 | 67108864 - impl details: StackMapTable updates
48
d8b3ef7ee3e5 6599425: 4/3 OopMapCache::lookup() can cause later crash or assert() failure
dcubed
parents: 0
diff changeset
67 // 0x08000000 | 134217728 - impl details: OopMapCache updates
0
a61af66fc99e Initial load
duke
parents:
diff changeset
68 // 0x10000000 | 268435456 - unused
a61af66fc99e Initial load
duke
parents:
diff changeset
69 // 0x20000000 | 536870912 - unused
a61af66fc99e Initial load
duke
parents:
diff changeset
70 // 0x40000000 | 1073741824 - unused
a61af66fc99e Initial load
duke
parents:
diff changeset
71 // 0x80000000 | 2147483648 - unused
a61af66fc99e Initial load
duke
parents:
diff changeset
72 //
a61af66fc99e Initial load
duke
parents:
diff changeset
73 // Note: The ResourceMark is to cleanup resource allocated args.
a61af66fc99e Initial load
duke
parents:
diff changeset
74 // The "while (0)" is so we can use semi-colon at end of RC_TRACE().
a61af66fc99e Initial load
duke
parents:
diff changeset
75 #define RC_TRACE(level, args) \
a61af66fc99e Initial load
duke
parents:
diff changeset
76 if ((TraceRedefineClasses & level) != 0) { \
a61af66fc99e Initial load
duke
parents:
diff changeset
77 ResourceMark rm; \
a61af66fc99e Initial load
duke
parents:
diff changeset
78 tty->print("RedefineClasses-0x%x: ", level); \
a61af66fc99e Initial load
duke
parents:
diff changeset
79 tty->print_cr args; \
a61af66fc99e Initial load
duke
parents:
diff changeset
80 } while (0)
a61af66fc99e Initial load
duke
parents:
diff changeset
81
a61af66fc99e Initial load
duke
parents:
diff changeset
82 #define RC_TRACE_WITH_THREAD(level, thread, args) \
a61af66fc99e Initial load
duke
parents:
diff changeset
83 if ((TraceRedefineClasses & level) != 0) { \
a61af66fc99e Initial load
duke
parents:
diff changeset
84 ResourceMark rm(thread); \
a61af66fc99e Initial load
duke
parents:
diff changeset
85 tty->print("RedefineClasses-0x%x: ", level); \
a61af66fc99e Initial load
duke
parents:
diff changeset
86 tty->print_cr args; \
a61af66fc99e Initial load
duke
parents:
diff changeset
87 } while (0)
a61af66fc99e Initial load
duke
parents:
diff changeset
88
a61af66fc99e Initial load
duke
parents:
diff changeset
89 #define RC_TRACE_MESG(args) \
a61af66fc99e Initial load
duke
parents:
diff changeset
90 { \
a61af66fc99e Initial load
duke
parents:
diff changeset
91 ResourceMark rm; \
a61af66fc99e Initial load
duke
parents:
diff changeset
92 tty->print("RedefineClasses: "); \
a61af66fc99e Initial load
duke
parents:
diff changeset
93 tty->print_cr args; \
a61af66fc99e Initial load
duke
parents:
diff changeset
94 } while (0)
a61af66fc99e Initial load
duke
parents:
diff changeset
95
a61af66fc99e Initial load
duke
parents:
diff changeset
96 // Macro for checking if TraceRedefineClasses has a specific bit
a61af66fc99e Initial load
duke
parents:
diff changeset
97 // enabled. Returns true if the bit specified by level is set.
a61af66fc99e Initial load
duke
parents:
diff changeset
98 #define RC_TRACE_ENABLED(level) ((TraceRedefineClasses & level) != 0)
a61af66fc99e Initial load
duke
parents:
diff changeset
99
a61af66fc99e Initial load
duke
parents:
diff changeset
100 // Macro for checking if TraceRedefineClasses has one or more bits
a61af66fc99e Initial load
duke
parents:
diff changeset
101 // set in a range of bit values. Returns true if one or more bits
a61af66fc99e Initial load
duke
parents:
diff changeset
102 // is set in the range from low..high inclusive. Assumes that low
a61af66fc99e Initial load
duke
parents:
diff changeset
103 // and high are single bit values.
a61af66fc99e Initial load
duke
parents:
diff changeset
104 //
a61af66fc99e Initial load
duke
parents:
diff changeset
105 // ((high << 1) - 1)
a61af66fc99e Initial load
duke
parents:
diff changeset
106 // Yields a mask that removes bits greater than the high bit value.
a61af66fc99e Initial load
duke
parents:
diff changeset
107 // This algorithm doesn't work with highest bit.
a61af66fc99e Initial load
duke
parents:
diff changeset
108 // ~(low - 1)
a61af66fc99e Initial load
duke
parents:
diff changeset
109 // Yields a mask that removes bits lower than the low bit value.
a61af66fc99e Initial load
duke
parents:
diff changeset
110 #define RC_TRACE_IN_RANGE(low, high) \
a61af66fc99e Initial load
duke
parents:
diff changeset
111 (((TraceRedefineClasses & ((high << 1) - 1)) & ~(low - 1)) != 0)
a61af66fc99e Initial load
duke
parents:
diff changeset
112
a61af66fc99e Initial load
duke
parents:
diff changeset
113 // Timer support macros. Only do timer operations if timer tracing
a61af66fc99e Initial load
duke
parents:
diff changeset
114 // is enabled. The "while (0)" is so we can use semi-colon at end of
a61af66fc99e Initial load
duke
parents:
diff changeset
115 // the macro.
a61af66fc99e Initial load
duke
parents:
diff changeset
116 #define RC_TIMER_START(t) \
a61af66fc99e Initial load
duke
parents:
diff changeset
117 if (RC_TRACE_ENABLED(0x00000004)) { \
a61af66fc99e Initial load
duke
parents:
diff changeset
118 t.start(); \
a61af66fc99e Initial load
duke
parents:
diff changeset
119 } while (0)
a61af66fc99e Initial load
duke
parents:
diff changeset
120 #define RC_TIMER_STOP(t) \
a61af66fc99e Initial load
duke
parents:
diff changeset
121 if (RC_TRACE_ENABLED(0x00000004)) { \
a61af66fc99e Initial load
duke
parents:
diff changeset
122 t.stop(); \
a61af66fc99e Initial load
duke
parents:
diff changeset
123 } while (0)