Mercurial > hg > graal-compiler
annotate src/share/vm/services/dtraceAttacher.cpp @ 1476:1f81c0d18c75
Build also release version of VM. Fix towards making SpecJVM2008 run.
author | Thomas Wuerthinger <wuerthinger@ssw.jku.at> |
---|---|
date | Fri, 26 Nov 2010 12:12:35 +0100 |
parents | e392695de029 |
children | c18cbe5936b8 |
rev | line source |
---|---|
0 | 1 /* |
2 * Copyright 2006-2007 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 # include "incls/_precompiled.incl" | |
26 # include "incls/_dtraceAttacher.cpp.incl" | |
27 | |
28 #ifdef SOLARIS | |
29 | |
30 class VM_DeoptimizeTheWorld : public VM_Operation { | |
31 public: | |
32 VMOp_Type type() const { | |
33 return VMOp_DeoptimizeTheWorld; | |
34 } | |
35 void doit() { | |
36 CodeCache::mark_all_nmethods_for_deoptimization(); | |
37 ResourceMark rm; | |
38 DeoptimizationMarker dm; | |
39 // Deoptimize all activations depending on marked methods | |
40 Deoptimization::deoptimize_dependents(); | |
41 | |
42 // Mark the dependent methods non entrant | |
43 CodeCache::make_marked_nmethods_not_entrant(); | |
44 } | |
45 }; | |
46 | |
47 static void set_bool_flag(const char* flag, bool value) { | |
48 CommandLineFlags::boolAtPut((char*)flag, strlen(flag), &value, | |
49 ATTACH_ON_DEMAND); | |
50 } | |
51 | |
52 // Enable only the "fine grained" flags. Do *not* touch | |
53 // the overall "ExtendedDTraceProbes" flag. | |
54 void DTrace::enable_dprobes(int probes) { | |
55 bool changed = false; | |
56 if (!DTraceAllocProbes && (probes & DTRACE_ALLOC_PROBES)) { | |
57 set_bool_flag("DTraceAllocProbes", true); | |
58 changed = true; | |
59 } | |
60 if (!DTraceMethodProbes && (probes & DTRACE_METHOD_PROBES)) { | |
61 set_bool_flag("DTraceMethodProbes", true); | |
62 changed = true; | |
63 } | |
64 if (!DTraceMonitorProbes && (probes & DTRACE_MONITOR_PROBES)) { | |
65 set_bool_flag("DTraceMonitorProbes", true); | |
66 changed = true; | |
67 } | |
68 | |
69 if (changed) { | |
70 // one or more flags changed, need to deoptimize | |
71 VM_DeoptimizeTheWorld op; | |
72 VMThread::execute(&op); | |
73 } | |
74 } | |
75 | |
76 // Disable only the "fine grained" flags. Do *not* touch | |
77 // the overall "ExtendedDTraceProbes" flag. | |
78 void DTrace::disable_dprobes(int probes) { | |
79 bool changed = false; | |
80 if (DTraceAllocProbes && (probes & DTRACE_ALLOC_PROBES)) { | |
81 set_bool_flag("DTraceAllocProbes", false); | |
82 changed = true; | |
83 } | |
84 if (DTraceMethodProbes && (probes & DTRACE_METHOD_PROBES)) { | |
85 set_bool_flag("DTraceMethodProbes", false); | |
86 changed = true; | |
87 } | |
88 if (DTraceMonitorProbes && (probes & DTRACE_MONITOR_PROBES)) { | |
89 set_bool_flag("DTraceMonitorProbes", false); | |
90 changed = true; | |
91 } | |
92 if (changed) { | |
93 // one or more flags changed, need to deoptimize | |
94 VM_DeoptimizeTheWorld op; | |
95 VMThread::execute(&op); | |
96 } | |
97 } | |
98 | |
99 // Do clean-up on "all door clients detached" event. | |
100 void DTrace::detach_all_clients() { | |
101 /* | |
102 * We restore the state of the fine grained flags | |
103 * to be consistent with overall ExtendedDTraceProbes. | |
104 * This way, we will honour command line setting or the | |
105 * last explicit modification of ExtendedDTraceProbes by | |
106 * a call to set_extended_dprobes. | |
107 */ | |
108 if (ExtendedDTraceProbes) { | |
109 enable_dprobes(DTRACE_ALL_PROBES); | |
110 } else { | |
111 disable_dprobes(DTRACE_ALL_PROBES); | |
112 } | |
113 } | |
114 | |
115 void DTrace::set_extended_dprobes(bool flag) { | |
116 // explicit setting of ExtendedDTraceProbes flag | |
117 set_bool_flag("ExtendedDTraceProbes", flag); | |
118 | |
119 // make sure that the fine grained flags reflect the change. | |
120 if (flag) { | |
121 enable_dprobes(DTRACE_ALL_PROBES); | |
122 } else { | |
123 /* | |
124 * FIXME: Revisit this: currently all-client-detach detection | |
125 * does not work and hence disabled. The following scheme does | |
126 * not work. So, we have to disable fine-grained flags here. | |
127 * | |
128 * disable_dprobes call has to be delayed till next "detach all "event. | |
129 * This is to be done so that concurrent DTrace clients that may | |
130 * have enabled one or more fine grained dprobes and may be running | |
131 * still. On "detach all" clients event, we would sync ExtendedDTraceProbes | |
132 * with fine grained flags which would take care of disabling fine grained flags. | |
133 */ | |
134 disable_dprobes(DTRACE_ALL_PROBES); | |
135 } | |
136 } | |
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 | 143 #endif /* SOLARIS */ |