author | kvn |
Thu, 01 Aug 2013 17:25:10 -0700 | |
changeset 22823 | 40b2c6c30123 |
parent 22819 | f88b9c394e42 |
parent 18938 | ff8f8cec9434 |
child 22872 | b6902ee5bc8d |
permissions | -rw-r--r-- |
1 | 1 |
/* |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10565
diff
changeset
|
2 |
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5402
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5402
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:
5402
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
26 |
#include "code/debugInfoRec.hpp" |
|
27 |
#include "code/pcDesc.hpp" |
|
28 |
#include "gc_interface/collectedHeap.inline.hpp" |
|
29 |
#include "memory/space.hpp" |
|
30 |
#include "memory/universe.inline.hpp" |
|
31 |
#include "oops/oop.inline.hpp" |
|
32 |
#include "oops/oop.inline2.hpp" |
|
33 |
#include "prims/forte.hpp" |
|
18938
ff8f8cec9434
8016131: nsk/sysdict/vm/stress/chain tests crash the VM in 'entry_frame_is_first()'
rbackman
parents:
18073
diff
changeset
|
34 |
#include "runtime/javaCalls.hpp" |
7397 | 35 |
#include "runtime/thread.hpp" |
36 |
#include "runtime/vframe.hpp" |
|
37 |
#include "runtime/vframeArray.hpp" |
|
1 | 38 |
|
17837
113909c12a8e
8013461: There is a symbol AsyncGetCallTrace in libjvm.symbols that does not exist in minimal/libjvm.a when DEBUG_LEVEL == release
jprovino
parents:
14579
diff
changeset
|
39 |
// call frame copied from old .h file and renamed |
113909c12a8e
8013461: There is a symbol AsyncGetCallTrace in libjvm.symbols that does not exist in minimal/libjvm.a when DEBUG_LEVEL == release
jprovino
parents:
14579
diff
changeset
|
40 |
typedef struct { |
113909c12a8e
8013461: There is a symbol AsyncGetCallTrace in libjvm.symbols that does not exist in minimal/libjvm.a when DEBUG_LEVEL == release
jprovino
parents:
14579
diff
changeset
|
41 |
jint lineno; // line number in the source file |
113909c12a8e
8013461: There is a symbol AsyncGetCallTrace in libjvm.symbols that does not exist in minimal/libjvm.a when DEBUG_LEVEL == release
jprovino
parents:
14579
diff
changeset
|
42 |
jmethodID method_id; // method executed in this frame |
113909c12a8e
8013461: There is a symbol AsyncGetCallTrace in libjvm.symbols that does not exist in minimal/libjvm.a when DEBUG_LEVEL == release
jprovino
parents:
14579
diff
changeset
|
43 |
} ASGCT_CallFrame; |
113909c12a8e
8013461: There is a symbol AsyncGetCallTrace in libjvm.symbols that does not exist in minimal/libjvm.a when DEBUG_LEVEL == release
jprovino
parents:
14579
diff
changeset
|
44 |
|
113909c12a8e
8013461: There is a symbol AsyncGetCallTrace in libjvm.symbols that does not exist in minimal/libjvm.a when DEBUG_LEVEL == release
jprovino
parents:
14579
diff
changeset
|
45 |
// call trace copied from old .h file and renamed |
113909c12a8e
8013461: There is a symbol AsyncGetCallTrace in libjvm.symbols that does not exist in minimal/libjvm.a when DEBUG_LEVEL == release
jprovino
parents:
14579
diff
changeset
|
46 |
typedef struct { |
113909c12a8e
8013461: There is a symbol AsyncGetCallTrace in libjvm.symbols that does not exist in minimal/libjvm.a when DEBUG_LEVEL == release
jprovino
parents:
14579
diff
changeset
|
47 |
JNIEnv *env_id; // Env where trace was recorded |
113909c12a8e
8013461: There is a symbol AsyncGetCallTrace in libjvm.symbols that does not exist in minimal/libjvm.a when DEBUG_LEVEL == release
jprovino
parents:
14579
diff
changeset
|
48 |
jint num_frames; // number of frames in this trace |
113909c12a8e
8013461: There is a symbol AsyncGetCallTrace in libjvm.symbols that does not exist in minimal/libjvm.a when DEBUG_LEVEL == release
jprovino
parents:
14579
diff
changeset
|
49 |
ASGCT_CallFrame *frames; // frames |
113909c12a8e
8013461: There is a symbol AsyncGetCallTrace in libjvm.symbols that does not exist in minimal/libjvm.a when DEBUG_LEVEL == release
jprovino
parents:
14579
diff
changeset
|
50 |
} ASGCT_CallTrace; |
113909c12a8e
8013461: There is a symbol AsyncGetCallTrace in libjvm.symbols that does not exist in minimal/libjvm.a when DEBUG_LEVEL == release
jprovino
parents:
14579
diff
changeset
|
51 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
52 |
// These name match the names reported by the forte quality kit |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
53 |
enum { |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
54 |
ticks_no_Java_frame = 0, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
55 |
ticks_no_class_load = -1, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
56 |
ticks_GC_active = -2, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
57 |
ticks_unknown_not_Java = -3, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
58 |
ticks_not_walkable_not_Java = -4, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
59 |
ticks_unknown_Java = -5, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
60 |
ticks_not_walkable_Java = -6, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
61 |
ticks_unknown_state = -7, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
62 |
ticks_thread_exit = -8, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
63 |
ticks_deopt = -9, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
64 |
ticks_safepoint = -10 |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
65 |
}; |
1 | 66 |
|
17837
113909c12a8e
8013461: There is a symbol AsyncGetCallTrace in libjvm.symbols that does not exist in minimal/libjvm.a when DEBUG_LEVEL == release
jprovino
parents:
14579
diff
changeset
|
67 |
#if INCLUDE_JVMTI |
113909c12a8e
8013461: There is a symbol AsyncGetCallTrace in libjvm.symbols that does not exist in minimal/libjvm.a when DEBUG_LEVEL == release
jprovino
parents:
14579
diff
changeset
|
68 |
|
1 | 69 |
//------------------------------------------------------- |
70 |
||
71 |
// Native interfaces for use by Forte tools. |
|
72 |
||
73 |
||
22819
f88b9c394e42
8019973: PPC64 (part 11): Fix IA64 preprocessor conditionals on AIX.
goetz
parents:
18073
diff
changeset
|
74 |
#if !defined(IA64) && !defined(PPC64) |
1 | 75 |
|
76 |
class vframeStreamForte : public vframeStreamCommon { |
|
77 |
public: |
|
78 |
// constructor that starts with sender of frame fr (top_frame) |
|
79 |
vframeStreamForte(JavaThread *jt, frame fr, bool stop_at_java_call_stub); |
|
80 |
void forte_next(); |
|
81 |
}; |
|
82 |
||
83 |
||
5233
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
84 |
static bool is_decipherable_compiled_frame(JavaThread* thread, frame* fr, nmethod* nm); |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
85 |
static bool is_decipherable_interpreted_frame(JavaThread* thread, |
5233
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
86 |
frame* fr, |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10565
diff
changeset
|
87 |
Method** method_p, |
5233
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
88 |
int* bci_p); |
1 | 89 |
|
90 |
||
91 |
||
92 |
||
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
93 |
vframeStreamForte::vframeStreamForte(JavaThread *jt, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
94 |
frame fr, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
95 |
bool stop_at_java_call_stub) : vframeStreamCommon(jt) { |
1 | 96 |
|
97 |
_stop_at_java_call_stub = stop_at_java_call_stub; |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
98 |
_frame = fr; |
1 | 99 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
100 |
// We must always have a valid frame to start filling |
1 | 101 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
102 |
bool filled_in = fill_from_frame(); |
1 | 103 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
104 |
assert(filled_in, "invariant"); |
1 | 105 |
|
106 |
} |
|
107 |
||
108 |
||
109 |
// Solaris SPARC Compiler1 needs an additional check on the grandparent |
|
110 |
// of the top_frame when the parent of the top_frame is interpreted and |
|
111 |
// the grandparent is compiled. However, in this method we do not know |
|
112 |
// the relationship of the current _frame relative to the top_frame so |
|
113 |
// we implement a more broad sanity check. When the previous callee is |
|
114 |
// interpreted and the current sender is compiled, we verify that the |
|
115 |
// current sender is also walkable. If it is not walkable, then we mark |
|
116 |
// the current vframeStream as at the end. |
|
117 |
void vframeStreamForte::forte_next() { |
|
118 |
// handle frames with inlining |
|
119 |
if (_mode == compiled_mode && |
|
120 |
vframeStreamCommon::fill_in_compiled_inlined_sender()) { |
|
121 |
return; |
|
122 |
} |
|
123 |
||
124 |
// handle general case |
|
125 |
||
126 |
int loop_count = 0; |
|
127 |
int loop_max = MaxJavaStackTraceDepth * 2; |
|
128 |
||
129 |
||
130 |
do { |
|
131 |
||
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
132 |
loop_count++; |
1 | 133 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
134 |
// By the time we get here we should never see unsafe but better |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
135 |
// safe then segv'd |
1 | 136 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
137 |
if (loop_count > loop_max || !_frame.safe_for_sender(_thread)) { |
1 | 138 |
_mode = at_end_mode; |
139 |
return; |
|
140 |
} |
|
141 |
||
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
142 |
_frame = _frame.sender(&_reg_map); |
1 | 143 |
|
144 |
} while (!fill_from_frame()); |
|
145 |
} |
|
146 |
||
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
147 |
// Determine if 'fr' is a decipherable compiled frame. We are already |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
148 |
// assured that fr is for a java nmethod. |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
149 |
|
5233
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
150 |
static bool is_decipherable_compiled_frame(JavaThread* thread, frame* fr, nmethod* nm) { |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
151 |
assert(nm->is_java_method(), "invariant"); |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
152 |
|
5233
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
153 |
if (thread->has_last_Java_frame() && thread->last_Java_pc() == fr->pc()) { |
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
154 |
// We're stopped at a call into the JVM so look for a PcDesc with |
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
155 |
// the actual pc reported by the frame. |
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
156 |
PcDesc* pc_desc = nm->pc_desc_at(fr->pc()); |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
157 |
|
5233
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
158 |
// Did we find a useful PcDesc? |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
159 |
if (pc_desc != NULL && |
5233
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
160 |
pc_desc->scope_decode_offset() != DebugInformationRecorder::serialized_null) { |
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
161 |
return true; |
1 | 162 |
} |
163 |
} |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
164 |
|
5233
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
165 |
// We're at some random pc in the nmethod so search for the PcDesc |
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
166 |
// whose pc is greater than the current PC. It's done this way |
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
167 |
// because the extra PcDescs that are recorded for improved debug |
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
168 |
// info record the end of the region covered by the ScopeDesc |
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
169 |
// instead of the beginning. |
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
170 |
PcDesc* pc_desc = nm->pc_desc_near(fr->pc() + 1); |
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
171 |
|
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
172 |
// Now do we have a useful PcDesc? |
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
173 |
if (pc_desc == NULL || |
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
174 |
pc_desc->scope_decode_offset() == DebugInformationRecorder::serialized_null) { |
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
175 |
// No debug information available for this pc |
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
176 |
// vframeStream would explode if we try and walk the frames. |
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
177 |
return false; |
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
178 |
} |
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
179 |
|
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
180 |
// This PcDesc is useful however we must adjust the frame's pc |
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
181 |
// so that the vframeStream lookups will use this same pc |
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
182 |
fr->set_pc(pc_desc->real_pc(nm)); |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
183 |
return true; |
1 | 184 |
} |
185 |
||
5233
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
186 |
|
1 | 187 |
// Determine if 'fr' is a walkable interpreted frame. Returns false |
188 |
// if it is not. *method_p, and *bci_p are not set when false is |
|
189 |
// returned. *method_p is non-NULL if frame was executing a Java |
|
190 |
// method. *bci_p is != -1 if a valid BCI in the Java method could |
|
191 |
// be found. |
|
192 |
// Note: this method returns true when a valid Java method is found |
|
193 |
// even if a valid BCI cannot be found. |
|
194 |
||
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
195 |
static bool is_decipherable_interpreted_frame(JavaThread* thread, |
5233
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
196 |
frame* fr, |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10565
diff
changeset
|
197 |
Method** method_p, |
5233
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
198 |
int* bci_p) { |
1 | 199 |
assert(fr->is_interpreted_frame(), "just checking"); |
200 |
||
201 |
// top frame is an interpreted frame |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10565
diff
changeset
|
202 |
// check if it is walkable (i.e. valid Method* and valid bci) |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
203 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
204 |
// Because we may be racing a gc thread the method and/or bci |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
205 |
// of a valid interpreter frame may look bad causing us to |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
206 |
// fail the is_interpreted_frame_valid test. If the thread |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
207 |
// is in any of the following states we are assured that the |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
208 |
// frame is in fact valid and we must have hit the race. |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
209 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
210 |
JavaThreadState state = thread->thread_state(); |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
211 |
bool known_valid = (state == _thread_in_native || |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
212 |
state == _thread_in_vm || |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
213 |
state == _thread_blocked ); |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
214 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
215 |
if (known_valid || fr->is_interpreted_frame_valid(thread)) { |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
216 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
217 |
// The frame code should completely validate the frame so that |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10565
diff
changeset
|
218 |
// references to Method* and bci are completely safe to access |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
219 |
// If they aren't the frame code should be fixed not this |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
220 |
// code. However since gc isn't locked out the values could be |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
221 |
// stale. This is a race we can never completely win since we can't |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
222 |
// lock out gc so do one last check after retrieving their values |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
223 |
// from the frame for additional safety |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
224 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10565
diff
changeset
|
225 |
Method* method = fr->interpreter_frame_method(); |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
226 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
227 |
// We've at least found a method. |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
228 |
// NOTE: there is something to be said for the approach that |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
229 |
// if we don't find a valid bci then the method is not likely |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
230 |
// a valid method. Then again we may have caught an interpreter |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
231 |
// frame in the middle of construction and the bci field is |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
232 |
// not yet valid. |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
233 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
234 |
*method_p = method; |
14579
7f6ce6e3dd80
8003635: NPG: AsynchGetCallTrace broken by Method* virtual call
coleenp
parents:
13728
diff
changeset
|
235 |
if (!method->is_valid_method()) return false; |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
236 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
237 |
intptr_t bcx = fr->interpreter_frame_bcx(); |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
238 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
239 |
int bci = method->validate_bci_from_bcx(bcx); |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
240 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
241 |
// note: bci is set to -1 if not a valid bci |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
242 |
*bci_p = bci; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
243 |
return true; |
1 | 244 |
} |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
245 |
|
1 | 246 |
return false; |
247 |
} |
|
248 |
||
249 |
||
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
250 |
// Determine if 'fr' can be used to find an initial Java frame. |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
251 |
// Return false if it can not find a fully decipherable Java frame |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
252 |
// (in other words a frame that isn't safe to use in a vframe stream). |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
253 |
// Obviously if it can't even find a Java frame false will also be returned. |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
254 |
// |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
255 |
// If we find a Java frame decipherable or not then by definition we have |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
256 |
// identified a method and that will be returned to the caller via method_p. |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
257 |
// If we can determine a bci that is returned also. (Hmm is it possible |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
258 |
// to return a method and bci and still return false? ) |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
259 |
// |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
260 |
// The initial Java frame we find (if any) is return via initial_frame_p. |
1 | 261 |
// |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
262 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
263 |
static bool find_initial_Java_frame(JavaThread* thread, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
264 |
frame* fr, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
265 |
frame* initial_frame_p, |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10565
diff
changeset
|
266 |
Method** method_p, |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
267 |
int* bci_p) { |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
268 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
269 |
// It is possible that for a frame containing an nmethod |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
270 |
// we can capture the method but no bci. If we get no |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
271 |
// bci the frame isn't walkable but the method is usable. |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10565
diff
changeset
|
272 |
// Therefore we init the returned Method* to NULL so the |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
273 |
// caller can make the distinction. |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
274 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
275 |
*method_p = NULL; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
276 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
277 |
// On the initial call to this method the frame we get may not be |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
278 |
// recognizable to us. This should only happen if we are in a JRT_LEAF |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
279 |
// or something called by a JRT_LEAF method. |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
280 |
|
1 | 281 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
282 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
283 |
frame candidate = *fr; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
284 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
285 |
// If the starting frame we were given has no codeBlob associated with |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
286 |
// it see if we can find such a frame because only frames with codeBlobs |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
287 |
// are possible Java frames. |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
288 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
289 |
if (fr->cb() == NULL) { |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
290 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
291 |
// See if we can find a useful frame |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
292 |
int loop_count; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
293 |
int loop_max = MaxJavaStackTraceDepth * 2; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
294 |
RegisterMap map(thread, false); |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
295 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
296 |
for (loop_count = 0; loop_count < loop_max; loop_count++) { |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
297 |
if (!candidate.safe_for_sender(thread)) return false; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
298 |
candidate = candidate.sender(&map); |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
299 |
if (candidate.cb() != NULL) break; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
300 |
} |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
301 |
if (candidate.cb() == NULL) return false; |
1 | 302 |
} |
303 |
||
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
304 |
// We have a frame known to be in the codeCache |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
305 |
// We will hopefully be able to figure out something to do with it. |
1 | 306 |
int loop_count; |
307 |
int loop_max = MaxJavaStackTraceDepth * 2; |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
308 |
RegisterMap map(thread, false); |
1 | 309 |
|
310 |
for (loop_count = 0; loop_count < loop_max; loop_count++) { |
|
311 |
||
18938
ff8f8cec9434
8016131: nsk/sysdict/vm/stress/chain tests crash the VM in 'entry_frame_is_first()'
rbackman
parents:
18073
diff
changeset
|
312 |
if (candidate.is_entry_frame()) { |
ff8f8cec9434
8016131: nsk/sysdict/vm/stress/chain tests crash the VM in 'entry_frame_is_first()'
rbackman
parents:
18073
diff
changeset
|
313 |
// jcw is NULL if the java call wrapper couldn't be found |
ff8f8cec9434
8016131: nsk/sysdict/vm/stress/chain tests crash the VM in 'entry_frame_is_first()'
rbackman
parents:
18073
diff
changeset
|
314 |
JavaCallWrapper *jcw = candidate.entry_frame_call_wrapper_if_safe(thread); |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
315 |
// If initial frame is frame from StubGenerator and there is no |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
316 |
// previous anchor, there are no java frames associated with a method |
18938
ff8f8cec9434
8016131: nsk/sysdict/vm/stress/chain tests crash the VM in 'entry_frame_is_first()'
rbackman
parents:
18073
diff
changeset
|
317 |
if (jcw == NULL || jcw->is_first_frame()) { |
ff8f8cec9434
8016131: nsk/sysdict/vm/stress/chain tests crash the VM in 'entry_frame_is_first()'
rbackman
parents:
18073
diff
changeset
|
318 |
return false; |
ff8f8cec9434
8016131: nsk/sysdict/vm/stress/chain tests crash the VM in 'entry_frame_is_first()'
rbackman
parents:
18073
diff
changeset
|
319 |
} |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
320 |
} |
1 | 321 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
322 |
if (candidate.is_interpreted_frame()) { |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
323 |
if (is_decipherable_interpreted_frame(thread, &candidate, method_p, bci_p)) { |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
324 |
*initial_frame_p = candidate; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
325 |
return true; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
326 |
} |
1 | 327 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
328 |
// Hopefully we got some data |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
329 |
return false; |
1 | 330 |
} |
331 |
||
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
332 |
if (candidate.cb()->is_nmethod()) { |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
333 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
334 |
nmethod* nm = (nmethod*) candidate.cb(); |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
335 |
*method_p = nm->method(); |
1 | 336 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
337 |
// If the frame isn't fully decipherable then the default |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
338 |
// value for the bci is a signal that we don't have a bci. |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
339 |
// If we have a decipherable frame this bci value will |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
340 |
// not be used. |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
341 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
342 |
*bci_p = -1; |
1 | 343 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
344 |
*initial_frame_p = candidate; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
345 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
346 |
// Native wrapper code is trivial to decode by vframeStream |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
347 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
348 |
if (nm->is_native_method()) return true; |
1 | 349 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
350 |
// If it isn't decipherable then we have found a pc that doesn't |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
351 |
// have a PCDesc that can get us a bci however we did find |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
352 |
// a method |
1 | 353 |
|
5233
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
354 |
if (!is_decipherable_compiled_frame(thread, &candidate, nm)) { |
1 | 355 |
return false; |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
356 |
} |
1 | 357 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
358 |
// is_decipherable_compiled_frame may modify candidate's pc |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
359 |
*initial_frame_p = candidate; |
1 | 360 |
|
5233
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
361 |
assert(nm->pc_desc_at(candidate.pc()) != NULL, "if it's decipherable then pc must be valid"); |
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
362 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
363 |
return true; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
364 |
} |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
365 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
366 |
// Must be some stub frame that we don't care about |
1 | 367 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
368 |
if (!candidate.safe_for_sender(thread)) return false; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
369 |
candidate = candidate.sender(&map); |
1 | 370 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
371 |
// If it isn't in the code cache something is wrong |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
372 |
// since once we find a frame in the code cache they |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
373 |
// all should be there. |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
374 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
375 |
if (candidate.cb() == NULL) return false; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
376 |
|
1 | 377 |
} |
378 |
||
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
379 |
return false; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
380 |
|
1 | 381 |
} |
382 |
||
383 |
static void forte_fill_call_trace_given_top(JavaThread* thd, |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
384 |
ASGCT_CallTrace* trace, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
385 |
int depth, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
386 |
frame top_frame) { |
1 | 387 |
NoHandleMark nhm; |
388 |
||
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
389 |
frame initial_Java_frame; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10565
diff
changeset
|
390 |
Method* method; |
1 | 391 |
int bci; |
392 |
int count; |
|
393 |
||
394 |
count = 0; |
|
395 |
assert(trace->frames != NULL, "trace->frames must be non-NULL"); |
|
396 |
||
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
397 |
bool fully_decipherable = find_initial_Java_frame(thd, &top_frame, &initial_Java_frame, &method, &bci); |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
398 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
399 |
// The frame might not be walkable but still recovered a method |
14579
7f6ce6e3dd80
8003635: NPG: AsynchGetCallTrace broken by Method* virtual call
coleenp
parents:
13728
diff
changeset
|
400 |
// (e.g. an nmethod with no scope info for the pc) |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
401 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
402 |
if (method == NULL) return; |
1 | 403 |
|
14579
7f6ce6e3dd80
8003635: NPG: AsynchGetCallTrace broken by Method* virtual call
coleenp
parents:
13728
diff
changeset
|
404 |
if (!method->is_valid_method()) { |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
405 |
trace->num_frames = ticks_GC_active; // -2 |
1 | 406 |
return; |
407 |
} |
|
408 |
||
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
409 |
// We got a Java frame however it isn't fully decipherable |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
410 |
// so it won't necessarily be safe to use it for the |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
411 |
// initial frame in the vframe stream. |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
412 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
413 |
if (!fully_decipherable) { |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
414 |
// Take whatever method the top-frame decoder managed to scrape up. |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
415 |
// We look further at the top frame only if non-safepoint |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
416 |
// debugging information is available. |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
417 |
count++; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
418 |
trace->num_frames = count; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
419 |
trace->frames[0].method_id = method->find_jmethod_id_or_null(); |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
420 |
if (!method->is_native()) { |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
421 |
trace->frames[0].lineno = bci; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
422 |
} else { |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
423 |
trace->frames[0].lineno = -3; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
424 |
} |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
425 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
426 |
if (!initial_Java_frame.safe_for_sender(thd)) return; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
427 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
428 |
RegisterMap map(thd, false); |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
429 |
initial_Java_frame = initial_Java_frame.sender(&map); |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
430 |
} |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
431 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
432 |
vframeStreamForte st(thd, initial_Java_frame, false); |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
433 |
|
1 | 434 |
for (; !st.at_end() && count < depth; st.forte_next(), count++) { |
435 |
bci = st.bci(); |
|
436 |
method = st.method(); |
|
437 |
||
14579
7f6ce6e3dd80
8003635: NPG: AsynchGetCallTrace broken by Method* virtual call
coleenp
parents:
13728
diff
changeset
|
438 |
if (!method->is_valid_method()) { |
1 | 439 |
// we throw away everything we've gathered in this sample since |
440 |
// none of it is safe |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
441 |
trace->num_frames = ticks_GC_active; // -2 |
1 | 442 |
return; |
443 |
} |
|
444 |
||
445 |
trace->frames[count].method_id = method->find_jmethod_id_or_null(); |
|
446 |
if (!method->is_native()) { |
|
447 |
trace->frames[count].lineno = bci; |
|
448 |
} else { |
|
449 |
trace->frames[count].lineno = -3; |
|
450 |
} |
|
451 |
} |
|
452 |
trace->num_frames = count; |
|
453 |
return; |
|
454 |
} |
|
455 |
||
456 |
||
457 |
// Forte Analyzer AsyncGetCallTrace() entry point. Currently supported |
|
458 |
// on Linux X86, Solaris SPARC and Solaris X86. |
|
459 |
// |
|
460 |
// Async-safe version of GetCallTrace being called from a signal handler |
|
461 |
// when a LWP gets interrupted by SIGPROF but the stack traces are filled |
|
462 |
// with different content (see below). |
|
463 |
// |
|
464 |
// This function must only be called when JVM/TI |
|
465 |
// CLASS_LOAD events have been enabled since agent startup. The enabled |
|
466 |
// event will cause the jmethodIDs to be allocated at class load time. |
|
467 |
// The jmethodIDs cannot be allocated in a signal handler because locks |
|
468 |
// cannot be grabbed in a signal handler safely. |
|
469 |
// |
|
470 |
// void (*AsyncGetCallTrace)(ASGCT_CallTrace *trace, jint depth, void* ucontext) |
|
471 |
// |
|
472 |
// Called by the profiler to obtain the current method call stack trace for |
|
473 |
// a given thread. The thread is identified by the env_id field in the |
|
474 |
// ASGCT_CallTrace structure. The profiler agent should allocate a ASGCT_CallTrace |
|
475 |
// structure with enough memory for the requested stack depth. The VM fills in |
|
476 |
// the frames buffer and the num_frames field. |
|
477 |
// |
|
478 |
// Arguments: |
|
479 |
// |
|
480 |
// trace - trace data structure to be filled by the VM. |
|
481 |
// depth - depth of the call stack trace. |
|
482 |
// ucontext - ucontext_t of the LWP |
|
483 |
// |
|
484 |
// ASGCT_CallTrace: |
|
485 |
// typedef struct { |
|
486 |
// JNIEnv *env_id; |
|
487 |
// jint num_frames; |
|
488 |
// ASGCT_CallFrame *frames; |
|
489 |
// } ASGCT_CallTrace; |
|
490 |
// |
|
491 |
// Fields: |
|
492 |
// env_id - ID of thread which executed this trace. |
|
493 |
// num_frames - number of frames in the trace. |
|
494 |
// (< 0 indicates the frame is not walkable). |
|
495 |
// frames - the ASGCT_CallFrames that make up this trace. Callee followed by callers. |
|
496 |
// |
|
497 |
// ASGCT_CallFrame: |
|
498 |
// typedef struct { |
|
499 |
// jint lineno; |
|
500 |
// jmethodID method_id; |
|
501 |
// } ASGCT_CallFrame; |
|
502 |
// |
|
503 |
// Fields: |
|
504 |
// 1) For Java frame (interpreted and compiled), |
|
505 |
// lineno - bci of the method being executed or -1 if bci is not available |
|
506 |
// method_id - jmethodID of the method being executed |
|
507 |
// 2) For native method |
|
508 |
// lineno - (-3) |
|
509 |
// method_id - jmethodID of the method being executed |
|
510 |
||
511 |
extern "C" { |
|
8106 | 512 |
JNIEXPORT |
1 | 513 |
void AsyncGetCallTrace(ASGCT_CallTrace *trace, jint depth, void* ucontext) { |
514 |
JavaThread* thread; |
|
515 |
||
516 |
if (trace->env_id == NULL || |
|
517 |
(thread = JavaThread::thread_from_jni_environment(trace->env_id)) == NULL || |
|
518 |
thread->is_exiting()) { |
|
519 |
||
520 |
// bad env_id, thread has exited or thread is exiting |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
521 |
trace->num_frames = ticks_thread_exit; // -8 |
1 | 522 |
return; |
523 |
} |
|
524 |
||
525 |
if (thread->in_deopt_handler()) { |
|
526 |
// thread is in the deoptimization handler so return no frames |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
527 |
trace->num_frames = ticks_deopt; // -9 |
1 | 528 |
return; |
529 |
} |
|
530 |
||
531 |
assert(JavaThread::current() == thread, |
|
532 |
"AsyncGetCallTrace must be called by the current interrupted thread"); |
|
533 |
||
534 |
if (!JvmtiExport::should_post_class_load()) { |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
535 |
trace->num_frames = ticks_no_class_load; // -1 |
1 | 536 |
return; |
537 |
} |
|
538 |
||
539 |
if (Universe::heap()->is_gc_active()) { |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
540 |
trace->num_frames = ticks_GC_active; // -2 |
1 | 541 |
return; |
542 |
} |
|
543 |
||
544 |
switch (thread->thread_state()) { |
|
545 |
case _thread_new: |
|
546 |
case _thread_uninitialized: |
|
547 |
case _thread_new_trans: |
|
548 |
// We found the thread on the threads list above, but it is too |
|
549 |
// young to be useful so return that there are no Java frames. |
|
550 |
trace->num_frames = 0; |
|
551 |
break; |
|
552 |
case _thread_in_native: |
|
553 |
case _thread_in_native_trans: |
|
554 |
case _thread_blocked: |
|
555 |
case _thread_blocked_trans: |
|
556 |
case _thread_in_vm: |
|
557 |
case _thread_in_vm_trans: |
|
558 |
{ |
|
559 |
frame fr; |
|
560 |
||
561 |
// param isInJava == false - indicate we aren't in Java code |
|
562 |
if (!thread->pd_get_top_frame_for_signal_handler(&fr, ucontext, false)) { |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
563 |
trace->num_frames = ticks_unknown_not_Java; // -3 unknown frame |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
564 |
} else { |
1 | 565 |
if (!thread->has_last_Java_frame()) { |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
566 |
trace->num_frames = 0; // No Java frames |
1 | 567 |
} else { |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
568 |
trace->num_frames = ticks_not_walkable_not_Java; // -4 non walkable frame by default |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
569 |
forte_fill_call_trace_given_top(thread, trace, depth, fr); |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
570 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
571 |
// This assert would seem to be valid but it is not. |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
572 |
// It would be valid if we weren't possibly racing a gc |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
573 |
// thread. A gc thread can make a valid interpreted frame |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
574 |
// look invalid. It's a small window but it does happen. |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
575 |
// The assert is left here commented out as a reminder. |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
576 |
// assert(trace->num_frames != ticks_not_walkable_not_Java, "should always be walkable"); |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
577 |
|
1 | 578 |
} |
579 |
} |
|
580 |
} |
|
581 |
break; |
|
582 |
case _thread_in_Java: |
|
583 |
case _thread_in_Java_trans: |
|
584 |
{ |
|
585 |
frame fr; |
|
586 |
||
587 |
// param isInJava == true - indicate we are in Java code |
|
588 |
if (!thread->pd_get_top_frame_for_signal_handler(&fr, ucontext, true)) { |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
589 |
trace->num_frames = ticks_unknown_Java; // -5 unknown frame |
1 | 590 |
} else { |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
591 |
trace->num_frames = ticks_not_walkable_Java; // -6, non walkable frame by default |
1 | 592 |
forte_fill_call_trace_given_top(thread, trace, depth, fr); |
593 |
} |
|
594 |
} |
|
595 |
break; |
|
596 |
default: |
|
597 |
// Unknown thread state |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
598 |
trace->num_frames = ticks_unknown_state; // -7 |
1 | 599 |
break; |
600 |
} |
|
601 |
} |
|
602 |
||
603 |
||
604 |
#ifndef _WINDOWS |
|
605 |
// Support for the Forte(TM) Peformance Tools collector. |
|
606 |
// |
|
607 |
// The method prototype is derived from libcollector.h. For more |
|
608 |
// information, please see the libcollect man page. |
|
609 |
||
610 |
// Method to let libcollector know about a dynamically loaded function. |
|
611 |
// Because it is weakly bound, the calls become NOP's when the library |
|
612 |
// isn't present. |
|
10565 | 613 |
#ifdef __APPLE__ |
614 |
// XXXDARWIN: Link errors occur even when __attribute__((weak_import)) |
|
615 |
// is added |
|
616 |
#define collector_func_load(x0,x1,x2,x3,x4,x5,x6) (0) |
|
617 |
#else |
|
1 | 618 |
void collector_func_load(char* name, |
619 |
void* null_argument_1, |
|
620 |
void* null_argument_2, |
|
621 |
void *vaddr, |
|
622 |
int size, |
|
623 |
int zero_argument, |
|
624 |
void* null_argument_3); |
|
625 |
#pragma weak collector_func_load |
|
626 |
#define collector_func_load(x0,x1,x2,x3,x4,x5,x6) \ |
|
18073
f02460441ddc
8014431: cleanup warnings indicated by the -Wunused-value compiler option on linux
ccheung
parents:
17837
diff
changeset
|
627 |
( collector_func_load ? collector_func_load(x0,x1,x2,x3,x4,x5,x6),(void)0 : (void)0 ) |
10565 | 628 |
#endif // __APPLE__ |
1 | 629 |
#endif // !_WINDOWS |
630 |
||
631 |
} // end extern "C" |
|
22819
f88b9c394e42
8019973: PPC64 (part 11): Fix IA64 preprocessor conditionals on AIX.
goetz
parents:
18073
diff
changeset
|
632 |
#endif // !IA64 && !PPC64 |
1 | 633 |
|
634 |
void Forte::register_stub(const char* name, address start, address end) { |
|
22819
f88b9c394e42
8019973: PPC64 (part 11): Fix IA64 preprocessor conditionals on AIX.
goetz
parents:
18073
diff
changeset
|
635 |
#if !defined(_WINDOWS) && !defined(IA64) && !defined(PPC64) |
1 | 636 |
assert(pointer_delta(end, start, sizeof(jbyte)) < INT_MAX, |
5402
c51fd0c1d005
6888953: some calls to function-like macros are missing semicolons
jcoomes
parents:
5233
diff
changeset
|
637 |
"Code size exceeds maximum range"); |
1 | 638 |
|
639 |
collector_func_load((char*)name, NULL, NULL, start, |
|
640 |
pointer_delta(end, start, sizeof(jbyte)), 0, NULL); |
|
22819
f88b9c394e42
8019973: PPC64 (part 11): Fix IA64 preprocessor conditionals on AIX.
goetz
parents:
18073
diff
changeset
|
641 |
#endif // !_WINDOWS && !IA64 && !PPC64 |
1 | 642 |
} |
17837
113909c12a8e
8013461: There is a symbol AsyncGetCallTrace in libjvm.symbols that does not exist in minimal/libjvm.a when DEBUG_LEVEL == release
jprovino
parents:
14579
diff
changeset
|
643 |
|
113909c12a8e
8013461: There is a symbol AsyncGetCallTrace in libjvm.symbols that does not exist in minimal/libjvm.a when DEBUG_LEVEL == release
jprovino
parents:
14579
diff
changeset
|
644 |
#else // INCLUDE_JVMTI |
113909c12a8e
8013461: There is a symbol AsyncGetCallTrace in libjvm.symbols that does not exist in minimal/libjvm.a when DEBUG_LEVEL == release
jprovino
parents:
14579
diff
changeset
|
645 |
extern "C" { |
113909c12a8e
8013461: There is a symbol AsyncGetCallTrace in libjvm.symbols that does not exist in minimal/libjvm.a when DEBUG_LEVEL == release
jprovino
parents:
14579
diff
changeset
|
646 |
JNIEXPORT |
113909c12a8e
8013461: There is a symbol AsyncGetCallTrace in libjvm.symbols that does not exist in minimal/libjvm.a when DEBUG_LEVEL == release
jprovino
parents:
14579
diff
changeset
|
647 |
void AsyncGetCallTrace(ASGCT_CallTrace *trace, jint depth, void* ucontext) { |
113909c12a8e
8013461: There is a symbol AsyncGetCallTrace in libjvm.symbols that does not exist in minimal/libjvm.a when DEBUG_LEVEL == release
jprovino
parents:
14579
diff
changeset
|
648 |
trace->num_frames = ticks_no_class_load; // -1 |
113909c12a8e
8013461: There is a symbol AsyncGetCallTrace in libjvm.symbols that does not exist in minimal/libjvm.a when DEBUG_LEVEL == release
jprovino
parents:
14579
diff
changeset
|
649 |
} |
113909c12a8e
8013461: There is a symbol AsyncGetCallTrace in libjvm.symbols that does not exist in minimal/libjvm.a when DEBUG_LEVEL == release
jprovino
parents:
14579
diff
changeset
|
650 |
} |
113909c12a8e
8013461: There is a symbol AsyncGetCallTrace in libjvm.symbols that does not exist in minimal/libjvm.a when DEBUG_LEVEL == release
jprovino
parents:
14579
diff
changeset
|
651 |
#endif // INCLUDE_JVMTI |