author | stefank |
Fri, 04 May 2018 11:41:35 +0200 | |
changeset 49982 | 9042ffe5b7fe |
parent 49480 | d7df2dd501ce |
child 51263 | b5aac518b097 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
48823
99c973b56994
7179701: MaxJavaStackTraceDepth of zero is not handled correctly/consistently in the VM
coleenp
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 2003, 2018, 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" |
|
30764 | 28 |
#include "gc/shared/collectedHeap.inline.hpp" |
49359
59f6547e151f
8199264: Remove universe.inline.hpp to simplify include dependencies
stefank
parents:
48823
diff
changeset
|
29 |
#include "memory/universe.hpp" |
7397 | 30 |
#include "oops/oop.inline.hpp" |
31 |
#include "prims/forte.hpp" |
|
49480
d7df2dd501ce
8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
49359
diff
changeset
|
32 |
#include "runtime/frame.inline.hpp" |
18938
ff8f8cec9434
8016131: nsk/sysdict/vm/stress/chain tests crash the VM in 'entry_frame_is_first()'
rbackman
parents:
18073
diff
changeset
|
33 |
#include "runtime/javaCalls.hpp" |
24351
61b33cc6d3cf
8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
22872
diff
changeset
|
34 |
#include "runtime/thread.inline.hpp" |
49480
d7df2dd501ce
8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
49359
diff
changeset
|
35 |
#include "runtime/vframe.inline.hpp" |
7397 | 36 |
#include "runtime/vframeArray.hpp" |
1 | 37 |
|
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
|
38 |
// 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
|
39 |
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
|
40 |
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
|
41 |
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
|
42 |
} 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
|
43 |
|
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 |
// 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
|
45 |
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
|
46 |
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
|
47 |
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
|
48 |
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
|
49 |
} 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
|
50 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
51 |
// 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
|
52 |
enum { |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
53 |
ticks_no_Java_frame = 0, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
54 |
ticks_no_class_load = -1, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
55 |
ticks_GC_active = -2, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
56 |
ticks_unknown_not_Java = -3, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
57 |
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
|
58 |
ticks_unknown_Java = -5, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
59 |
ticks_not_walkable_Java = -6, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
60 |
ticks_unknown_state = -7, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
61 |
ticks_thread_exit = -8, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
62 |
ticks_deopt = -9, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
63 |
ticks_safepoint = -10 |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
64 |
}; |
1 | 65 |
|
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
|
66 |
#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
|
67 |
|
1 | 68 |
//------------------------------------------------------- |
69 |
||
70 |
// Native interfaces for use by Forte tools. |
|
71 |
||
72 |
||
22819
f88b9c394e42
8019973: PPC64 (part 11): Fix IA64 preprocessor conditionals on AIX.
goetz
parents:
18073
diff
changeset
|
73 |
#if !defined(IA64) && !defined(PPC64) |
1 | 74 |
|
75 |
class vframeStreamForte : public vframeStreamCommon { |
|
76 |
public: |
|
77 |
// constructor that starts with sender of frame fr (top_frame) |
|
78 |
vframeStreamForte(JavaThread *jt, frame fr, bool stop_at_java_call_stub); |
|
79 |
void forte_next(); |
|
80 |
}; |
|
81 |
||
82 |
||
46694
d762fbd03dde
8184809: [AOT] AsyncGetCallTrace() code should recognize AOT code
kvn
parents:
30764
diff
changeset
|
83 |
static bool is_decipherable_compiled_frame(JavaThread* thread, frame* fr, CompiledMethod* nm); |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
84 |
static bool is_decipherable_interpreted_frame(JavaThread* thread, |
5233
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
85 |
frame* fr, |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10565
diff
changeset
|
86 |
Method** method_p, |
5233
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
87 |
int* bci_p); |
1 | 88 |
|
89 |
||
90 |
||
91 |
||
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
92 |
vframeStreamForte::vframeStreamForte(JavaThread *jt, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
93 |
frame fr, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
94 |
bool stop_at_java_call_stub) : vframeStreamCommon(jt) { |
1 | 95 |
|
96 |
_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
|
97 |
_frame = fr; |
1 | 98 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
99 |
// We must always have a valid frame to start filling |
1 | 100 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
101 |
bool filled_in = fill_from_frame(); |
1 | 102 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
103 |
assert(filled_in, "invariant"); |
1 | 104 |
|
105 |
} |
|
106 |
||
107 |
||
108 |
// Solaris SPARC Compiler1 needs an additional check on the grandparent |
|
109 |
// of the top_frame when the parent of the top_frame is interpreted and |
|
110 |
// the grandparent is compiled. However, in this method we do not know |
|
111 |
// the relationship of the current _frame relative to the top_frame so |
|
112 |
// we implement a more broad sanity check. When the previous callee is |
|
113 |
// interpreted and the current sender is compiled, we verify that the |
|
114 |
// current sender is also walkable. If it is not walkable, then we mark |
|
115 |
// the current vframeStream as at the end. |
|
116 |
void vframeStreamForte::forte_next() { |
|
117 |
// handle frames with inlining |
|
118 |
if (_mode == compiled_mode && |
|
119 |
vframeStreamCommon::fill_in_compiled_inlined_sender()) { |
|
120 |
return; |
|
121 |
} |
|
122 |
||
123 |
// handle general case |
|
124 |
||
125 |
int loop_count = 0; |
|
126 |
int loop_max = MaxJavaStackTraceDepth * 2; |
|
127 |
||
128 |
||
129 |
do { |
|
130 |
||
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
131 |
loop_count++; |
1 | 132 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
133 |
// 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
|
134 |
// safe then segv'd |
1 | 135 |
|
48823
99c973b56994
7179701: MaxJavaStackTraceDepth of zero is not handled correctly/consistently in the VM
coleenp
parents:
47216
diff
changeset
|
136 |
if ((loop_max != 0 && loop_count > loop_max) || !_frame.safe_for_sender(_thread)) { |
1 | 137 |
_mode = at_end_mode; |
138 |
return; |
|
139 |
} |
|
140 |
||
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
141 |
_frame = _frame.sender(&_reg_map); |
1 | 142 |
|
143 |
} while (!fill_from_frame()); |
|
144 |
} |
|
145 |
||
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
146 |
// Determine if 'fr' is a decipherable compiled frame. We are already |
46694
d762fbd03dde
8184809: [AOT] AsyncGetCallTrace() code should recognize AOT code
kvn
parents:
30764
diff
changeset
|
147 |
// assured that fr is for a java compiled method. |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
148 |
|
46694
d762fbd03dde
8184809: [AOT] AsyncGetCallTrace() code should recognize AOT code
kvn
parents:
30764
diff
changeset
|
149 |
static bool is_decipherable_compiled_frame(JavaThread* thread, frame* fr, CompiledMethod* nm) { |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
150 |
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
|
151 |
|
5233
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
152 |
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
|
153 |
// 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
|
154 |
// the actual pc reported by the frame. |
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
155 |
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
|
156 |
|
5233
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
157 |
// 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
|
158 |
if (pc_desc != NULL && |
5233
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
159 |
pc_desc->scope_decode_offset() != DebugInformationRecorder::serialized_null) { |
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
160 |
return true; |
1 | 161 |
} |
162 |
} |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
163 |
|
46694
d762fbd03dde
8184809: [AOT] AsyncGetCallTrace() code should recognize AOT code
kvn
parents:
30764
diff
changeset
|
164 |
// We're at some random pc in the compiled method so search for the PcDesc |
5233
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
165 |
// 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
|
166 |
// 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
|
167 |
// 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
|
168 |
// instead of the beginning. |
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
169 |
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
|
170 |
|
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
171 |
// Now do we have a useful PcDesc? |
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
172 |
if (pc_desc == NULL || |
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
173 |
pc_desc->scope_decode_offset() == DebugInformationRecorder::serialized_null) { |
30305
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
174 |
// No debug information is available for this PC. |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
175 |
// |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
176 |
// vframeStreamCommon::fill_from_frame() will decode the frame depending |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
177 |
// on the state of the thread. |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
178 |
// |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
179 |
// Case #1: If the thread is in Java (state == _thread_in_Java), then |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
180 |
// the vframeStreamCommon object will be filled as if the frame were a native |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
181 |
// compiled frame. Therefore, no debug information is needed. |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
182 |
// |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
183 |
// Case #2: If the thread is in any other state, then two steps will be performed: |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
184 |
// - if asserts are enabled, found_bad_method_frame() will be called and |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
185 |
// the assert in found_bad_method_frame() will be triggered; |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
186 |
// - if asserts are disabled, the vframeStreamCommon object will be filled |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
187 |
// as if it were a native compiled frame. |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
188 |
// |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
189 |
// Case (2) is similar to the way interpreter frames are processed in |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
190 |
// vframeStreamCommon::fill_from_interpreter_frame in case no valid BCI |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
191 |
// was found for an interpreted frame. If asserts are enabled, the assert |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
192 |
// in found_bad_method_frame() will be triggered. If asserts are disabled, |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
193 |
// the vframeStreamCommon object will be filled afterwards as if the |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
194 |
// interpreter were at the point of entering into the method. |
5233
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
195 |
return false; |
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
196 |
} |
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
197 |
|
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
198 |
// 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
|
199 |
// 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
|
200 |
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
|
201 |
return true; |
1 | 202 |
} |
203 |
||
5233
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
204 |
|
1 | 205 |
// Determine if 'fr' is a walkable interpreted frame. Returns false |
206 |
// if it is not. *method_p, and *bci_p are not set when false is |
|
207 |
// returned. *method_p is non-NULL if frame was executing a Java |
|
208 |
// method. *bci_p is != -1 if a valid BCI in the Java method could |
|
209 |
// be found. |
|
210 |
// Note: this method returns true when a valid Java method is found |
|
211 |
// even if a valid BCI cannot be found. |
|
212 |
||
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
213 |
static bool is_decipherable_interpreted_frame(JavaThread* thread, |
5233
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
214 |
frame* fr, |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10565
diff
changeset
|
215 |
Method** method_p, |
5233
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
216 |
int* bci_p) { |
1 | 217 |
assert(fr->is_interpreted_frame(), "just checking"); |
218 |
||
219 |
// top frame is an interpreted frame |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10565
diff
changeset
|
220 |
// 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
|
221 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
222 |
// 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
|
223 |
// 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
|
224 |
// 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
|
225 |
// 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
|
226 |
// 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
|
227 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
228 |
JavaThreadState state = thread->thread_state(); |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
229 |
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
|
230 |
state == _thread_in_vm || |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
231 |
state == _thread_blocked ); |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
232 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
233 |
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
|
234 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
235 |
// 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
|
236 |
// 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
|
237 |
// 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
|
238 |
// 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
|
239 |
// 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
|
240 |
// 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
|
241 |
// 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
|
242 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10565
diff
changeset
|
243 |
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
|
244 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
245 |
// 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
|
246 |
// 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
|
247 |
// 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
|
248 |
// 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
|
249 |
// 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
|
250 |
// not yet valid. |
14579
7f6ce6e3dd80
8003635: NPG: AsynchGetCallTrace broken by Method* virtual call
coleenp
parents:
13728
diff
changeset
|
251 |
if (!method->is_valid_method()) return false; |
30305
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
252 |
*method_p = method; // If the Method* found is invalid, it is |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
253 |
// ignored by forte_fill_call_trace_given_top(). |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
254 |
// So set method_p only if the Method is valid. |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
255 |
|
25714
87fa6860b5ae
8004128: NPG: remove stackwalking in Threads::gc_prologue and gc_epilogue code
coleenp
parents:
24351
diff
changeset
|
256 |
address bcp = fr->interpreter_frame_bcp(); |
87fa6860b5ae
8004128: NPG: remove stackwalking in Threads::gc_prologue and gc_epilogue code
coleenp
parents:
24351
diff
changeset
|
257 |
int bci = method->validate_bci_from_bcp(bcp); |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
258 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
259 |
// 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
|
260 |
*bci_p = bci; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
261 |
return true; |
1 | 262 |
} |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
263 |
|
1 | 264 |
return false; |
265 |
} |
|
266 |
||
267 |
||
30305
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
268 |
// Determine if a Java frame can be found starting with the frame 'fr'. |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
269 |
// |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
270 |
// Check the return value of find_initial_Java_frame and the value of |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
271 |
// 'method_p' to decide on how use the results returned by this method. |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
272 |
// |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
273 |
// If 'method_p' is not NULL, an initial Java frame has been found and |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
274 |
// the stack can be walked starting from that initial frame. In this case, |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
275 |
// 'method_p' points to the Method that the initial frame belongs to and |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
276 |
// the initial Java frame is returned in initial_frame_p. |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
277 |
// |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
278 |
// find_initial_Java_frame() returns true if a Method has been found (i.e., |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
279 |
// 'method_p' is not NULL) and the initial frame that belongs to that Method |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
280 |
// is decipherable. |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
281 |
// |
30305
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
282 |
// A frame is considered to be decipherable: |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
283 |
// |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
284 |
// - if the frame is a compiled frame and a PCDesc is available; |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
285 |
// |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
286 |
// - if the frame is an interpreter frame that is valid or the thread is |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
287 |
// state (_thread_in_native || state == _thread_in_vm || state == _thread_blocked). |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
288 |
// |
30305
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
289 |
// Note that find_initial_Java_frame() can return false even if an initial |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
290 |
// Java method was found (e.g., there is no PCDesc available for the method). |
1 | 291 |
// |
30305
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
292 |
// If 'method_p' is NULL, it was not possible to find a Java frame when |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
293 |
// walking the stack starting from 'fr'. In this case find_initial_Java_frame |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
294 |
// returns false. |
354
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 |
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
|
297 |
frame* fr, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
298 |
frame* initial_frame_p, |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10565
diff
changeset
|
299 |
Method** method_p, |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
300 |
int* bci_p) { |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
301 |
|
46694
d762fbd03dde
8184809: [AOT] AsyncGetCallTrace() code should recognize AOT code
kvn
parents:
30764
diff
changeset
|
302 |
// It is possible that for a frame containing a compiled method |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
303 |
// 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
|
304 |
// 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
|
305 |
// 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
|
306 |
// caller can make the distinction. |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
307 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
308 |
*method_p = NULL; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
309 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
310 |
// 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
|
311 |
// 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
|
312 |
// 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
|
313 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
314 |
frame candidate = *fr; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
315 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
316 |
// 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
|
317 |
// 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
|
318 |
// are possible Java frames. |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
319 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
320 |
if (fr->cb() == NULL) { |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
321 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
322 |
// 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
|
323 |
int loop_count; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
324 |
int loop_max = MaxJavaStackTraceDepth * 2; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
325 |
RegisterMap map(thread, false); |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
326 |
|
48823
99c973b56994
7179701: MaxJavaStackTraceDepth of zero is not handled correctly/consistently in the VM
coleenp
parents:
47216
diff
changeset
|
327 |
for (loop_count = 0; loop_max == 0 || loop_count < loop_max; loop_count++) { |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
328 |
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
|
329 |
candidate = candidate.sender(&map); |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
330 |
if (candidate.cb() != NULL) break; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
331 |
} |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
332 |
if (candidate.cb() == NULL) return false; |
1 | 333 |
} |
334 |
||
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
335 |
// 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
|
336 |
// We will hopefully be able to figure out something to do with it. |
1 | 337 |
int loop_count; |
338 |
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
|
339 |
RegisterMap map(thread, false); |
1 | 340 |
|
48823
99c973b56994
7179701: MaxJavaStackTraceDepth of zero is not handled correctly/consistently in the VM
coleenp
parents:
47216
diff
changeset
|
341 |
for (loop_count = 0; loop_max == 0 || loop_count < loop_max; loop_count++) { |
1 | 342 |
|
18938
ff8f8cec9434
8016131: nsk/sysdict/vm/stress/chain tests crash the VM in 'entry_frame_is_first()'
rbackman
parents:
18073
diff
changeset
|
343 |
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
|
344 |
// 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
|
345 |
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
|
346 |
// 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
|
347 |
// 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
|
348 |
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
|
349 |
return false; |
ff8f8cec9434
8016131: nsk/sysdict/vm/stress/chain tests crash the VM in 'entry_frame_is_first()'
rbackman
parents:
18073
diff
changeset
|
350 |
} |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
351 |
} |
1 | 352 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
353 |
if (candidate.is_interpreted_frame()) { |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
354 |
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
|
355 |
*initial_frame_p = candidate; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
356 |
return true; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
357 |
} |
1 | 358 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
359 |
// Hopefully we got some data |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
360 |
return false; |
1 | 361 |
} |
362 |
||
46694
d762fbd03dde
8184809: [AOT] AsyncGetCallTrace() code should recognize AOT code
kvn
parents:
30764
diff
changeset
|
363 |
if (candidate.cb()->is_compiled()) { |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
364 |
|
46694
d762fbd03dde
8184809: [AOT] AsyncGetCallTrace() code should recognize AOT code
kvn
parents:
30764
diff
changeset
|
365 |
CompiledMethod* nm = candidate.cb()->as_compiled_method(); |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
366 |
*method_p = nm->method(); |
1 | 367 |
|
30305
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
368 |
// If the frame is not decipherable, then the value of -1 |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
369 |
// for the BCI is used to signal that no BCI is available. |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
370 |
// Furthermore, the method returns false in this case. |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
371 |
// |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
372 |
// If a decipherable frame is available, the BCI value will |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
373 |
// not be used. |
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 |
*bci_p = -1; |
1 | 376 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
377 |
*initial_frame_p = candidate; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
378 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
379 |
// 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
|
380 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
381 |
if (nm->is_native_method()) return true; |
1 | 382 |
|
30305
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
383 |
// If the frame is not decipherable, then a PC was found |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
384 |
// that does not have a PCDesc from which a BCI can be obtained. |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
385 |
// Nevertheless, a Method was found. |
1 | 386 |
|
5233
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
387 |
if (!is_decipherable_compiled_frame(thread, &candidate, nm)) { |
1 | 388 |
return false; |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
389 |
} |
1 | 390 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
391 |
// 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
|
392 |
*initial_frame_p = candidate; |
1 | 393 |
|
30305
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
394 |
assert(nm->pc_desc_at(candidate.pc()) != NULL, "debug information must be available if the frame is decipherable"); |
5233
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
395 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
396 |
return true; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
397 |
} |
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 |
// Must be some stub frame that we don't care about |
1 | 400 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
401 |
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
|
402 |
candidate = candidate.sender(&map); |
1 | 403 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
404 |
// 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
|
405 |
// 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
|
406 |
// all should be there. |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
407 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
408 |
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
|
409 |
|
1 | 410 |
} |
411 |
||
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
412 |
return false; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
413 |
|
1 | 414 |
} |
415 |
||
416 |
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
|
417 |
ASGCT_CallTrace* trace, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
418 |
int depth, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
419 |
frame top_frame) { |
1 | 420 |
NoHandleMark nhm; |
421 |
||
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
422 |
frame initial_Java_frame; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10565
diff
changeset
|
423 |
Method* method; |
30305
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
424 |
int bci = -1; // assume BCI is not available for method |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
425 |
// update with correct information if available |
1 | 426 |
int count; |
427 |
||
428 |
count = 0; |
|
429 |
assert(trace->frames != NULL, "trace->frames must be non-NULL"); |
|
430 |
||
30305
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
431 |
// Walk the stack starting from 'top_frame' and search for an initial Java frame. |
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
432 |
find_initial_Java_frame(thd, &top_frame, &initial_Java_frame, &method, &bci); |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
433 |
|
30305
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29081
diff
changeset
|
434 |
// Check if a Java Method has been found. |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
435 |
if (method == NULL) return; |
1 | 436 |
|
14579
7f6ce6e3dd80
8003635: NPG: AsynchGetCallTrace broken by Method* virtual call
coleenp
parents:
13728
diff
changeset
|
437 |
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
|
438 |
trace->num_frames = ticks_GC_active; // -2 |
1 | 439 |
return; |
440 |
} |
|
441 |
||
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
442 |
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
|
443 |
|
1 | 444 |
for (; !st.at_end() && count < depth; st.forte_next(), count++) { |
445 |
bci = st.bci(); |
|
446 |
method = st.method(); |
|
447 |
||
14579
7f6ce6e3dd80
8003635: NPG: AsynchGetCallTrace broken by Method* virtual call
coleenp
parents:
13728
diff
changeset
|
448 |
if (!method->is_valid_method()) { |
1 | 449 |
// we throw away everything we've gathered in this sample since |
450 |
// 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
|
451 |
trace->num_frames = ticks_GC_active; // -2 |
1 | 452 |
return; |
453 |
} |
|
454 |
||
455 |
trace->frames[count].method_id = method->find_jmethod_id_or_null(); |
|
456 |
if (!method->is_native()) { |
|
457 |
trace->frames[count].lineno = bci; |
|
458 |
} else { |
|
459 |
trace->frames[count].lineno = -3; |
|
460 |
} |
|
461 |
} |
|
462 |
trace->num_frames = count; |
|
463 |
return; |
|
464 |
} |
|
465 |
||
466 |
||
467 |
// Forte Analyzer AsyncGetCallTrace() entry point. Currently supported |
|
468 |
// on Linux X86, Solaris SPARC and Solaris X86. |
|
469 |
// |
|
470 |
// Async-safe version of GetCallTrace being called from a signal handler |
|
471 |
// when a LWP gets interrupted by SIGPROF but the stack traces are filled |
|
472 |
// with different content (see below). |
|
473 |
// |
|
474 |
// This function must only be called when JVM/TI |
|
475 |
// CLASS_LOAD events have been enabled since agent startup. The enabled |
|
476 |
// event will cause the jmethodIDs to be allocated at class load time. |
|
477 |
// The jmethodIDs cannot be allocated in a signal handler because locks |
|
478 |
// cannot be grabbed in a signal handler safely. |
|
479 |
// |
|
480 |
// void (*AsyncGetCallTrace)(ASGCT_CallTrace *trace, jint depth, void* ucontext) |
|
481 |
// |
|
482 |
// Called by the profiler to obtain the current method call stack trace for |
|
483 |
// a given thread. The thread is identified by the env_id field in the |
|
484 |
// ASGCT_CallTrace structure. The profiler agent should allocate a ASGCT_CallTrace |
|
485 |
// structure with enough memory for the requested stack depth. The VM fills in |
|
486 |
// the frames buffer and the num_frames field. |
|
487 |
// |
|
488 |
// Arguments: |
|
489 |
// |
|
490 |
// trace - trace data structure to be filled by the VM. |
|
491 |
// depth - depth of the call stack trace. |
|
492 |
// ucontext - ucontext_t of the LWP |
|
493 |
// |
|
494 |
// ASGCT_CallTrace: |
|
495 |
// typedef struct { |
|
496 |
// JNIEnv *env_id; |
|
497 |
// jint num_frames; |
|
498 |
// ASGCT_CallFrame *frames; |
|
499 |
// } ASGCT_CallTrace; |
|
500 |
// |
|
501 |
// Fields: |
|
502 |
// env_id - ID of thread which executed this trace. |
|
503 |
// num_frames - number of frames in the trace. |
|
504 |
// (< 0 indicates the frame is not walkable). |
|
505 |
// frames - the ASGCT_CallFrames that make up this trace. Callee followed by callers. |
|
506 |
// |
|
507 |
// ASGCT_CallFrame: |
|
508 |
// typedef struct { |
|
509 |
// jint lineno; |
|
510 |
// jmethodID method_id; |
|
511 |
// } ASGCT_CallFrame; |
|
512 |
// |
|
513 |
// Fields: |
|
514 |
// 1) For Java frame (interpreted and compiled), |
|
515 |
// lineno - bci of the method being executed or -1 if bci is not available |
|
516 |
// method_id - jmethodID of the method being executed |
|
517 |
// 2) For native method |
|
518 |
// lineno - (-3) |
|
519 |
// method_id - jmethodID of the method being executed |
|
520 |
||
521 |
extern "C" { |
|
8106 | 522 |
JNIEXPORT |
1 | 523 |
void AsyncGetCallTrace(ASGCT_CallTrace *trace, jint depth, void* ucontext) { |
524 |
JavaThread* thread; |
|
525 |
||
526 |
if (trace->env_id == NULL || |
|
527 |
(thread = JavaThread::thread_from_jni_environment(trace->env_id)) == NULL || |
|
528 |
thread->is_exiting()) { |
|
529 |
||
530 |
// 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
|
531 |
trace->num_frames = ticks_thread_exit; // -8 |
1 | 532 |
return; |
533 |
} |
|
534 |
||
535 |
if (thread->in_deopt_handler()) { |
|
536 |
// 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
|
537 |
trace->num_frames = ticks_deopt; // -9 |
1 | 538 |
return; |
539 |
} |
|
540 |
||
541 |
assert(JavaThread::current() == thread, |
|
542 |
"AsyncGetCallTrace must be called by the current interrupted thread"); |
|
543 |
||
544 |
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
|
545 |
trace->num_frames = ticks_no_class_load; // -1 |
1 | 546 |
return; |
547 |
} |
|
548 |
||
549 |
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
|
550 |
trace->num_frames = ticks_GC_active; // -2 |
1 | 551 |
return; |
552 |
} |
|
553 |
||
554 |
switch (thread->thread_state()) { |
|
555 |
case _thread_new: |
|
556 |
case _thread_uninitialized: |
|
557 |
case _thread_new_trans: |
|
558 |
// We found the thread on the threads list above, but it is too |
|
559 |
// young to be useful so return that there are no Java frames. |
|
560 |
trace->num_frames = 0; |
|
561 |
break; |
|
562 |
case _thread_in_native: |
|
563 |
case _thread_in_native_trans: |
|
564 |
case _thread_blocked: |
|
565 |
case _thread_blocked_trans: |
|
566 |
case _thread_in_vm: |
|
567 |
case _thread_in_vm_trans: |
|
568 |
{ |
|
569 |
frame fr; |
|
570 |
||
571 |
// param isInJava == false - indicate we aren't in Java code |
|
572 |
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
|
573 |
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
|
574 |
} else { |
1 | 575 |
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
|
576 |
trace->num_frames = 0; // No Java frames |
1 | 577 |
} else { |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
578 |
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
|
579 |
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
|
580 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
581 |
// 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
|
582 |
// 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
|
583 |
// 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
|
584 |
// 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
|
585 |
// 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
|
586 |
// 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
|
587 |
|
1 | 588 |
} |
589 |
} |
|
590 |
} |
|
591 |
break; |
|
592 |
case _thread_in_Java: |
|
593 |
case _thread_in_Java_trans: |
|
594 |
{ |
|
595 |
frame fr; |
|
596 |
||
597 |
// param isInJava == true - indicate we are in Java code |
|
598 |
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
|
599 |
trace->num_frames = ticks_unknown_Java; // -5 unknown frame |
1 | 600 |
} else { |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
601 |
trace->num_frames = ticks_not_walkable_Java; // -6, non walkable frame by default |
1 | 602 |
forte_fill_call_trace_given_top(thread, trace, depth, fr); |
603 |
} |
|
604 |
} |
|
605 |
break; |
|
606 |
default: |
|
607 |
// Unknown thread state |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
608 |
trace->num_frames = ticks_unknown_state; // -7 |
1 | 609 |
break; |
610 |
} |
|
611 |
} |
|
612 |
||
613 |
||
614 |
#ifndef _WINDOWS |
|
615 |
// Support for the Forte(TM) Peformance Tools collector. |
|
616 |
// |
|
617 |
// The method prototype is derived from libcollector.h. For more |
|
618 |
// information, please see the libcollect man page. |
|
619 |
||
620 |
// Method to let libcollector know about a dynamically loaded function. |
|
621 |
// Because it is weakly bound, the calls become NOP's when the library |
|
622 |
// isn't present. |
|
10565 | 623 |
#ifdef __APPLE__ |
624 |
// XXXDARWIN: Link errors occur even when __attribute__((weak_import)) |
|
625 |
// is added |
|
22240
ec02eda6b9b6
8022263: use same Clang warnings on BSD as on Linux
twisti
parents:
22234
diff
changeset
|
626 |
#define collector_func_load(x0,x1,x2,x3,x4,x5,x6) ((void) 0) |
10565 | 627 |
#else |
1 | 628 |
void collector_func_load(char* name, |
629 |
void* null_argument_1, |
|
630 |
void* null_argument_2, |
|
631 |
void *vaddr, |
|
632 |
int size, |
|
633 |
int zero_argument, |
|
634 |
void* null_argument_3); |
|
635 |
#pragma weak collector_func_load |
|
636 |
#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
|
637 |
( collector_func_load ? collector_func_load(x0,x1,x2,x3,x4,x5,x6),(void)0 : (void)0 ) |
10565 | 638 |
#endif // __APPLE__ |
1 | 639 |
#endif // !_WINDOWS |
640 |
||
641 |
} // end extern "C" |
|
22819
f88b9c394e42
8019973: PPC64 (part 11): Fix IA64 preprocessor conditionals on AIX.
goetz
parents:
18073
diff
changeset
|
642 |
#endif // !IA64 && !PPC64 |
1 | 643 |
|
644 |
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
|
645 |
#if !defined(_WINDOWS) && !defined(IA64) && !defined(PPC64) |
1 | 646 |
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
|
647 |
"Code size exceeds maximum range"); |
1 | 648 |
|
649 |
collector_func_load((char*)name, NULL, NULL, start, |
|
650 |
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
|
651 |
#endif // !_WINDOWS && !IA64 && !PPC64 |
1 | 652 |
} |
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
|
653 |
|
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
|
654 |
#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
|
655 |
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
|
656 |
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
|
657 |
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
|
658 |
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
|
659 |
} |
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
|
660 |
} |
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
|
661 |
#endif // INCLUDE_JVMTI |