annotate src/share/vm/services/dtraceAttacher.cpp @ 1721:413ad0331a0c

6977924: Changes for 6975078 produce build error with certain gcc versions Summary: The changes introduced for 6975078 assign badHeapOopVal to the _allocation field in the ResourceObj class. In 32 bit linux builds with certain versions of gcc this assignment will be flagged as an error while compiling allocation.cpp. In 32 bit builds the constant value badHeapOopVal (which is cast to an intptr_t) is negative. The _allocation field is typed as an unsigned intptr_t and gcc catches this as an error. Reviewed-by: jcoomes, ysr, phh
author johnc
date Wed, 18 Aug 2010 10:59:06 -0700
parents c18cbe5936b8
children f95d63e2154a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1324
diff changeset
2 * Copyright (c) 2006, 2007, Oracle and/or its affiliates. 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 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1324
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1324
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1324
diff changeset
21 * questions.
0
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 # include "incls/_precompiled.incl"
a61af66fc99e Initial load
duke
parents:
diff changeset
26 # include "incls/_dtraceAttacher.cpp.incl"
a61af66fc99e Initial load
duke
parents:
diff changeset
27
a61af66fc99e Initial load
duke
parents:
diff changeset
28 #ifdef SOLARIS
a61af66fc99e Initial load
duke
parents:
diff changeset
29
a61af66fc99e Initial load
duke
parents:
diff changeset
30 class VM_DeoptimizeTheWorld : public VM_Operation {
a61af66fc99e Initial load
duke
parents:
diff changeset
31 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
32 VMOp_Type type() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
33 return VMOp_DeoptimizeTheWorld;
a61af66fc99e Initial load
duke
parents:
diff changeset
34 }
a61af66fc99e Initial load
duke
parents:
diff changeset
35 void doit() {
a61af66fc99e Initial load
duke
parents:
diff changeset
36 CodeCache::mark_all_nmethods_for_deoptimization();
a61af66fc99e Initial load
duke
parents:
diff changeset
37 ResourceMark rm;
a61af66fc99e Initial load
duke
parents:
diff changeset
38 DeoptimizationMarker dm;
a61af66fc99e Initial load
duke
parents:
diff changeset
39 // Deoptimize all activations depending on marked methods
a61af66fc99e Initial load
duke
parents:
diff changeset
40 Deoptimization::deoptimize_dependents();
a61af66fc99e Initial load
duke
parents:
diff changeset
41
a61af66fc99e Initial load
duke
parents:
diff changeset
42 // Mark the dependent methods non entrant
a61af66fc99e Initial load
duke
parents:
diff changeset
43 CodeCache::make_marked_nmethods_not_entrant();
a61af66fc99e Initial load
duke
parents:
diff changeset
44 }
a61af66fc99e Initial load
duke
parents:
diff changeset
45 };
a61af66fc99e Initial load
duke
parents:
diff changeset
46
a61af66fc99e Initial load
duke
parents:
diff changeset
47 static void set_bool_flag(const char* flag, bool value) {
a61af66fc99e Initial load
duke
parents:
diff changeset
48 CommandLineFlags::boolAtPut((char*)flag, strlen(flag), &value,
a61af66fc99e Initial load
duke
parents:
diff changeset
49 ATTACH_ON_DEMAND);
a61af66fc99e Initial load
duke
parents:
diff changeset
50 }
a61af66fc99e Initial load
duke
parents:
diff changeset
51
a61af66fc99e Initial load
duke
parents:
diff changeset
52 // Enable only the "fine grained" flags. Do *not* touch
a61af66fc99e Initial load
duke
parents:
diff changeset
53 // the overall "ExtendedDTraceProbes" flag.
a61af66fc99e Initial load
duke
parents:
diff changeset
54 void DTrace::enable_dprobes(int probes) {
a61af66fc99e Initial load
duke
parents:
diff changeset
55 bool changed = false;
a61af66fc99e Initial load
duke
parents:
diff changeset
56 if (!DTraceAllocProbes && (probes & DTRACE_ALLOC_PROBES)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
57 set_bool_flag("DTraceAllocProbes", true);
a61af66fc99e Initial load
duke
parents:
diff changeset
58 changed = true;
a61af66fc99e Initial load
duke
parents:
diff changeset
59 }
a61af66fc99e Initial load
duke
parents:
diff changeset
60 if (!DTraceMethodProbes && (probes & DTRACE_METHOD_PROBES)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
61 set_bool_flag("DTraceMethodProbes", true);
a61af66fc99e Initial load
duke
parents:
diff changeset
62 changed = true;
a61af66fc99e Initial load
duke
parents:
diff changeset
63 }
a61af66fc99e Initial load
duke
parents:
diff changeset
64 if (!DTraceMonitorProbes && (probes & DTRACE_MONITOR_PROBES)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
65 set_bool_flag("DTraceMonitorProbes", true);
a61af66fc99e Initial load
duke
parents:
diff changeset
66 changed = true;
a61af66fc99e Initial load
duke
parents:
diff changeset
67 }
a61af66fc99e Initial load
duke
parents:
diff changeset
68
a61af66fc99e Initial load
duke
parents:
diff changeset
69 if (changed) {
a61af66fc99e Initial load
duke
parents:
diff changeset
70 // one or more flags changed, need to deoptimize
a61af66fc99e Initial load
duke
parents:
diff changeset
71 VM_DeoptimizeTheWorld op;
a61af66fc99e Initial load
duke
parents:
diff changeset
72 VMThread::execute(&op);
a61af66fc99e Initial load
duke
parents:
diff changeset
73 }
a61af66fc99e Initial load
duke
parents:
diff changeset
74 }
a61af66fc99e Initial load
duke
parents:
diff changeset
75
a61af66fc99e Initial load
duke
parents:
diff changeset
76 // Disable only the "fine grained" flags. Do *not* touch
a61af66fc99e Initial load
duke
parents:
diff changeset
77 // the overall "ExtendedDTraceProbes" flag.
a61af66fc99e Initial load
duke
parents:
diff changeset
78 void DTrace::disable_dprobes(int probes) {
a61af66fc99e Initial load
duke
parents:
diff changeset
79 bool changed = false;
a61af66fc99e Initial load
duke
parents:
diff changeset
80 if (DTraceAllocProbes && (probes & DTRACE_ALLOC_PROBES)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
81 set_bool_flag("DTraceAllocProbes", false);
a61af66fc99e Initial load
duke
parents:
diff changeset
82 changed = true;
a61af66fc99e Initial load
duke
parents:
diff changeset
83 }
a61af66fc99e Initial load
duke
parents:
diff changeset
84 if (DTraceMethodProbes && (probes & DTRACE_METHOD_PROBES)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
85 set_bool_flag("DTraceMethodProbes", false);
a61af66fc99e Initial load
duke
parents:
diff changeset
86 changed = true;
a61af66fc99e Initial load
duke
parents:
diff changeset
87 }
a61af66fc99e Initial load
duke
parents:
diff changeset
88 if (DTraceMonitorProbes && (probes & DTRACE_MONITOR_PROBES)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
89 set_bool_flag("DTraceMonitorProbes", false);
a61af66fc99e Initial load
duke
parents:
diff changeset
90 changed = true;
a61af66fc99e Initial load
duke
parents:
diff changeset
91 }
a61af66fc99e Initial load
duke
parents:
diff changeset
92 if (changed) {
a61af66fc99e Initial load
duke
parents:
diff changeset
93 // one or more flags changed, need to deoptimize
a61af66fc99e Initial load
duke
parents:
diff changeset
94 VM_DeoptimizeTheWorld op;
a61af66fc99e Initial load
duke
parents:
diff changeset
95 VMThread::execute(&op);
a61af66fc99e Initial load
duke
parents:
diff changeset
96 }
a61af66fc99e Initial load
duke
parents:
diff changeset
97 }
a61af66fc99e Initial load
duke
parents:
diff changeset
98
a61af66fc99e Initial load
duke
parents:
diff changeset
99 // Do clean-up on "all door clients detached" event.
a61af66fc99e Initial load
duke
parents:
diff changeset
100 void DTrace::detach_all_clients() {
a61af66fc99e Initial load
duke
parents:
diff changeset
101 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
102 * We restore the state of the fine grained flags
a61af66fc99e Initial load
duke
parents:
diff changeset
103 * to be consistent with overall ExtendedDTraceProbes.
a61af66fc99e Initial load
duke
parents:
diff changeset
104 * This way, we will honour command line setting or the
a61af66fc99e Initial load
duke
parents:
diff changeset
105 * last explicit modification of ExtendedDTraceProbes by
a61af66fc99e Initial load
duke
parents:
diff changeset
106 * a call to set_extended_dprobes.
a61af66fc99e Initial load
duke
parents:
diff changeset
107 */
a61af66fc99e Initial load
duke
parents:
diff changeset
108 if (ExtendedDTraceProbes) {
a61af66fc99e Initial load
duke
parents:
diff changeset
109 enable_dprobes(DTRACE_ALL_PROBES);
a61af66fc99e Initial load
duke
parents:
diff changeset
110 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
111 disable_dprobes(DTRACE_ALL_PROBES);
a61af66fc99e Initial load
duke
parents:
diff changeset
112 }
a61af66fc99e Initial load
duke
parents:
diff changeset
113 }
a61af66fc99e Initial load
duke
parents:
diff changeset
114
a61af66fc99e Initial load
duke
parents:
diff changeset
115 void DTrace::set_extended_dprobes(bool flag) {
a61af66fc99e Initial load
duke
parents:
diff changeset
116 // explicit setting of ExtendedDTraceProbes flag
a61af66fc99e Initial load
duke
parents:
diff changeset
117 set_bool_flag("ExtendedDTraceProbes", flag);
a61af66fc99e Initial load
duke
parents:
diff changeset
118
a61af66fc99e Initial load
duke
parents:
diff changeset
119 // make sure that the fine grained flags reflect the change.
a61af66fc99e Initial load
duke
parents:
diff changeset
120 if (flag) {
a61af66fc99e Initial load
duke
parents:
diff changeset
121 enable_dprobes(DTRACE_ALL_PROBES);
a61af66fc99e Initial load
duke
parents:
diff changeset
122 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
123 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
124 * FIXME: Revisit this: currently all-client-detach detection
a61af66fc99e Initial load
duke
parents:
diff changeset
125 * does not work and hence disabled. The following scheme does
a61af66fc99e Initial load
duke
parents:
diff changeset
126 * not work. So, we have to disable fine-grained flags here.
a61af66fc99e Initial load
duke
parents:
diff changeset
127 *
a61af66fc99e Initial load
duke
parents:
diff changeset
128 * disable_dprobes call has to be delayed till next "detach all "event.
a61af66fc99e Initial load
duke
parents:
diff changeset
129 * This is to be done so that concurrent DTrace clients that may
a61af66fc99e Initial load
duke
parents:
diff changeset
130 * have enabled one or more fine grained dprobes and may be running
a61af66fc99e Initial load
duke
parents:
diff changeset
131 * still. On "detach all" clients event, we would sync ExtendedDTraceProbes
a61af66fc99e Initial load
duke
parents:
diff changeset
132 * with fine grained flags which would take care of disabling fine grained flags.
a61af66fc99e Initial load
duke
parents:
diff changeset
133 */
a61af66fc99e Initial load
duke
parents:
diff changeset
134 disable_dprobes(DTRACE_ALL_PROBES);
a61af66fc99e Initial load
duke
parents:
diff changeset
135 }
a61af66fc99e Initial load
duke
parents:
diff changeset
136 }
a61af66fc99e Initial load
duke
parents:
diff changeset
137
1324
e392695de029 6935224: Adding new DTrace probes to work with Palantir
fparain
parents: 0
diff changeset
138 void DTrace::set_monitor_dprobes(bool flag) {
e392695de029 6935224: Adding new DTrace probes to work with Palantir
fparain
parents: 0
diff changeset
139 // explicit setting of DTraceMonitorProbes flag
e392695de029 6935224: Adding new DTrace probes to work with Palantir
fparain
parents: 0
diff changeset
140 set_bool_flag("DTraceMonitorProbes", flag);
e392695de029 6935224: Adding new DTrace probes to work with Palantir
fparain
parents: 0
diff changeset
141 }
e392695de029 6935224: Adding new DTrace probes to work with Palantir
fparain
parents: 0
diff changeset
142
0
a61af66fc99e Initial load
duke
parents:
diff changeset
143 #endif /* SOLARIS */