author | stefank |
Tue, 23 Nov 2010 13:22:55 -0800 | |
changeset 7397 | 5b173b4ca846 |
parent 5547 | f4b087cbb361 |
child 8106 | 19106a0203fb |
permissions | -rw-r--r-- |
1 | 1 |
/* |
7397 | 2 |
* Copyright (c) 2003, 2010, 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" |
|
34 |
#include "runtime/thread.hpp" |
|
35 |
#include "runtime/vframe.hpp" |
|
36 |
#include "runtime/vframeArray.hpp" |
|
1 | 37 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
38 |
// 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
|
39 |
enum { |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
40 |
ticks_no_Java_frame = 0, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
41 |
ticks_no_class_load = -1, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
42 |
ticks_GC_active = -2, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
43 |
ticks_unknown_not_Java = -3, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
44 |
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
|
45 |
ticks_unknown_Java = -5, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
46 |
ticks_not_walkable_Java = -6, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
47 |
ticks_unknown_state = -7, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
48 |
ticks_thread_exit = -8, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
49 |
ticks_deopt = -9, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
50 |
ticks_safepoint = -10 |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
51 |
}; |
1 | 52 |
|
53 |
//------------------------------------------------------- |
|
54 |
||
55 |
// Native interfaces for use by Forte tools. |
|
56 |
||
57 |
||
58 |
#ifndef IA64 |
|
59 |
||
60 |
class vframeStreamForte : public vframeStreamCommon { |
|
61 |
public: |
|
62 |
// constructor that starts with sender of frame fr (top_frame) |
|
63 |
vframeStreamForte(JavaThread *jt, frame fr, bool stop_at_java_call_stub); |
|
64 |
void forte_next(); |
|
65 |
}; |
|
66 |
||
67 |
||
5233
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
68 |
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
|
69 |
static bool is_decipherable_interpreted_frame(JavaThread* thread, |
5233
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
70 |
frame* fr, |
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
71 |
methodOop* method_p, |
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
72 |
int* bci_p); |
1 | 73 |
|
74 |
||
75 |
||
76 |
||
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
77 |
vframeStreamForte::vframeStreamForte(JavaThread *jt, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
78 |
frame fr, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
79 |
bool stop_at_java_call_stub) : vframeStreamCommon(jt) { |
1 | 80 |
|
81 |
_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
|
82 |
_frame = fr; |
1 | 83 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
84 |
// We must always have a valid frame to start filling |
1 | 85 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
86 |
bool filled_in = fill_from_frame(); |
1 | 87 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
88 |
assert(filled_in, "invariant"); |
1 | 89 |
|
90 |
} |
|
91 |
||
92 |
||
93 |
// Solaris SPARC Compiler1 needs an additional check on the grandparent |
|
94 |
// of the top_frame when the parent of the top_frame is interpreted and |
|
95 |
// the grandparent is compiled. However, in this method we do not know |
|
96 |
// the relationship of the current _frame relative to the top_frame so |
|
97 |
// we implement a more broad sanity check. When the previous callee is |
|
98 |
// interpreted and the current sender is compiled, we verify that the |
|
99 |
// current sender is also walkable. If it is not walkable, then we mark |
|
100 |
// the current vframeStream as at the end. |
|
101 |
void vframeStreamForte::forte_next() { |
|
102 |
// handle frames with inlining |
|
103 |
if (_mode == compiled_mode && |
|
104 |
vframeStreamCommon::fill_in_compiled_inlined_sender()) { |
|
105 |
return; |
|
106 |
} |
|
107 |
||
108 |
// handle general case |
|
109 |
||
110 |
int loop_count = 0; |
|
111 |
int loop_max = MaxJavaStackTraceDepth * 2; |
|
112 |
||
113 |
||
114 |
do { |
|
115 |
||
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
116 |
loop_count++; |
1 | 117 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
118 |
// 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
|
119 |
// safe then segv'd |
1 | 120 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
121 |
if (loop_count > loop_max || !_frame.safe_for_sender(_thread)) { |
1 | 122 |
_mode = at_end_mode; |
123 |
return; |
|
124 |
} |
|
125 |
||
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
126 |
_frame = _frame.sender(&_reg_map); |
1 | 127 |
|
128 |
} while (!fill_from_frame()); |
|
129 |
} |
|
130 |
||
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
131 |
// 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
|
132 |
// 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
|
133 |
|
5233
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
134 |
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
|
135 |
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
|
136 |
|
5233
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
137 |
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
|
138 |
// 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
|
139 |
// the actual pc reported by the frame. |
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
140 |
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
|
141 |
|
5233
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
142 |
// 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
|
143 |
if (pc_desc != NULL && |
5233
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
144 |
pc_desc->scope_decode_offset() != DebugInformationRecorder::serialized_null) { |
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
145 |
return true; |
1 | 146 |
} |
147 |
} |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
148 |
|
5233
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
149 |
// 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
|
150 |
// 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
|
151 |
// 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
|
152 |
// 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
|
153 |
// instead of the beginning. |
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
154 |
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
|
155 |
|
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
156 |
// Now do we have a useful PcDesc? |
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
157 |
if (pc_desc == NULL || |
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
158 |
pc_desc->scope_decode_offset() == DebugInformationRecorder::serialized_null) { |
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
159 |
// No debug information available for this pc |
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
160 |
// 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
|
161 |
return false; |
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
162 |
} |
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
163 |
|
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
164 |
// 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
|
165 |
// 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
|
166 |
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
|
167 |
return true; |
1 | 168 |
} |
169 |
||
5233
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
170 |
|
1 | 171 |
// Determine if 'fr' is a walkable interpreted frame. Returns false |
172 |
// if it is not. *method_p, and *bci_p are not set when false is |
|
173 |
// returned. *method_p is non-NULL if frame was executing a Java |
|
174 |
// method. *bci_p is != -1 if a valid BCI in the Java method could |
|
175 |
// be found. |
|
176 |
// Note: this method returns true when a valid Java method is found |
|
177 |
// even if a valid BCI cannot be found. |
|
178 |
||
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
179 |
static bool is_decipherable_interpreted_frame(JavaThread* thread, |
5233
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
180 |
frame* fr, |
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
181 |
methodOop* method_p, |
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
182 |
int* bci_p) { |
1 | 183 |
assert(fr->is_interpreted_frame(), "just checking"); |
184 |
||
185 |
// top frame is an interpreted frame |
|
186 |
// check if it is walkable (i.e. valid methodOop and valid bci) |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
187 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
188 |
// 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
|
189 |
// 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
|
190 |
// 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
|
191 |
// 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
|
192 |
// 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
|
193 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
194 |
JavaThreadState state = thread->thread_state(); |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
195 |
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
|
196 |
state == _thread_in_vm || |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
197 |
state == _thread_blocked ); |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
198 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
199 |
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
|
200 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
201 |
// The frame code should completely validate the frame so that |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
202 |
// references to methodOop and bci are completely safe to access |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
203 |
// 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
|
204 |
// 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
|
205 |
// 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
|
206 |
// 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
|
207 |
// 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
|
208 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
209 |
methodOop method = fr->interpreter_frame_method(); |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
210 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
211 |
// 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
|
212 |
// 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
|
213 |
// 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
|
214 |
// 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
|
215 |
// 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
|
216 |
// not yet valid. |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
217 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
218 |
*method_p = method; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
219 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
220 |
// See if gc may have invalidated method since we validated frame |
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 |
if (!Universe::heap()->is_valid_method(method)) return false; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
223 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
224 |
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
|
225 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
226 |
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
|
227 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
228 |
// 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
|
229 |
*bci_p = bci; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
230 |
return true; |
1 | 231 |
} |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
232 |
|
1 | 233 |
return false; |
234 |
} |
|
235 |
||
236 |
||
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
237 |
// 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
|
238 |
// 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
|
239 |
// (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
|
240 |
// 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
|
241 |
// |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
242 |
// 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
|
243 |
// 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
|
244 |
// 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
|
245 |
// 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
|
246 |
// |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
247 |
// The initial Java frame we find (if any) is return via initial_frame_p. |
1 | 248 |
// |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
249 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
250 |
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
|
251 |
frame* fr, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
252 |
frame* initial_frame_p, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
253 |
methodOop* method_p, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
254 |
int* bci_p) { |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
255 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
256 |
// 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
|
257 |
// 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
|
258 |
// bci the frame isn't walkable but the method is usable. |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
259 |
// Therefore we init the returned methodOop to NULL so the |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
260 |
// caller can make the distinction. |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
261 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
262 |
*method_p = NULL; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
263 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
264 |
// 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
|
265 |
// 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
|
266 |
// 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
|
267 |
|
1 | 268 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
269 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
270 |
frame candidate = *fr; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
271 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
272 |
// 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
|
273 |
// 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
|
274 |
// are possible Java frames. |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
275 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
276 |
if (fr->cb() == NULL) { |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
277 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
278 |
// 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
|
279 |
int loop_count; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
280 |
int loop_max = MaxJavaStackTraceDepth * 2; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
281 |
RegisterMap map(thread, false); |
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 |
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
|
284 |
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
|
285 |
candidate = candidate.sender(&map); |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
286 |
if (candidate.cb() != NULL) break; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
287 |
} |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
288 |
if (candidate.cb() == NULL) return false; |
1 | 289 |
} |
290 |
||
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
291 |
// 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
|
292 |
// We will hopefully be able to figure out something to do with it. |
1 | 293 |
int loop_count; |
294 |
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
|
295 |
RegisterMap map(thread, false); |
1 | 296 |
|
297 |
for (loop_count = 0; loop_count < loop_max; loop_count++) { |
|
298 |
||
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
299 |
if (candidate.is_first_frame()) { |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
300 |
// 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
|
301 |
// previous anchor, there are no java frames associated with a method |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
302 |
return false; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
303 |
} |
1 | 304 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
305 |
if (candidate.is_interpreted_frame()) { |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
306 |
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
|
307 |
*initial_frame_p = candidate; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
308 |
return true; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
309 |
} |
1 | 310 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
311 |
// Hopefully we got some data |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
312 |
return false; |
1 | 313 |
} |
314 |
||
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
315 |
if (candidate.cb()->is_nmethod()) { |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
316 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
317 |
nmethod* nm = (nmethod*) candidate.cb(); |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
318 |
*method_p = nm->method(); |
1 | 319 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
320 |
// 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
|
321 |
// 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
|
322 |
// 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
|
323 |
// not be used. |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
324 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
325 |
*bci_p = -1; |
1 | 326 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
327 |
*initial_frame_p = candidate; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
328 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
329 |
// 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
|
330 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
331 |
if (nm->is_native_method()) return true; |
1 | 332 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
333 |
// 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
|
334 |
// 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
|
335 |
// a method |
1 | 336 |
|
5233
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
337 |
if (!is_decipherable_compiled_frame(thread, &candidate, nm)) { |
1 | 338 |
return false; |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
339 |
} |
1 | 340 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
341 |
// 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
|
342 |
*initial_frame_p = candidate; |
1 | 343 |
|
5233
6fd5e41e3f54
6936709: AsyncGetCallTrace doesn't handle inexact stack walking properly
never
parents:
670
diff
changeset
|
344 |
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
|
345 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
346 |
return true; |
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 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
349 |
// Must be some stub frame that we don't care about |
1 | 350 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
351 |
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
|
352 |
candidate = candidate.sender(&map); |
1 | 353 |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
354 |
// 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
|
355 |
// 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
|
356 |
// all should be there. |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
357 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
358 |
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
|
359 |
|
1 | 360 |
} |
361 |
||
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
362 |
return false; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
363 |
|
1 | 364 |
} |
365 |
||
366 |
||
367 |
// call frame copied from old .h file and renamed |
|
368 |
typedef struct { |
|
369 |
jint lineno; // line number in the source file |
|
370 |
jmethodID method_id; // method executed in this frame |
|
371 |
} ASGCT_CallFrame; |
|
372 |
||
373 |
// call trace copied from old .h file and renamed |
|
374 |
typedef struct { |
|
375 |
JNIEnv *env_id; // Env where trace was recorded |
|
376 |
jint num_frames; // number of frames in this trace |
|
377 |
ASGCT_CallFrame *frames; // frames |
|
378 |
} ASGCT_CallTrace; |
|
379 |
||
380 |
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
|
381 |
ASGCT_CallTrace* trace, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
382 |
int depth, |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
383 |
frame top_frame) { |
1 | 384 |
NoHandleMark nhm; |
385 |
||
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
386 |
frame initial_Java_frame; |
1 | 387 |
methodOop method; |
388 |
int bci; |
|
389 |
int count; |
|
390 |
||
391 |
count = 0; |
|
392 |
assert(trace->frames != NULL, "trace->frames must be non-NULL"); |
|
393 |
||
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
394 |
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
|
395 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
396 |
// The frame might not be walkable but still recovered a method |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
397 |
// (e.g. an nmethod with no scope info for the pc |
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 |
if (method == NULL) return; |
1 | 400 |
|
401 |
CollectedHeap* ch = Universe::heap(); |
|
402 |
||
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
403 |
// The method is not stored GC safe so see if GC became active |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
404 |
// after we entered AsyncGetCallTrace() and before we try to |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
405 |
// use the methodOop. |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
406 |
// Yes, there is still a window after this check and before |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
407 |
// we use methodOop below, but we can't lock out GC so that |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
408 |
// has to be an acceptable risk. |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
409 |
if (!ch->is_valid_method(method)) { |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
410 |
trace->num_frames = ticks_GC_active; // -2 |
1 | 411 |
return; |
412 |
} |
|
413 |
||
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
414 |
// 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
|
415 |
// 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
|
416 |
// 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
|
417 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
418 |
if (!fully_decipherable) { |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
419 |
// 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
|
420 |
// 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
|
421 |
// debugging information is available. |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
422 |
count++; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
423 |
trace->num_frames = count; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
424 |
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
|
425 |
if (!method->is_native()) { |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
426 |
trace->frames[0].lineno = bci; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
427 |
} else { |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
428 |
trace->frames[0].lineno = -3; |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
429 |
} |
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 |
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
|
432 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
433 |
RegisterMap map(thd, false); |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
434 |
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
|
435 |
} |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
436 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
437 |
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
|
438 |
|
1 | 439 |
for (; !st.at_end() && count < depth; st.forte_next(), count++) { |
440 |
bci = st.bci(); |
|
441 |
method = st.method(); |
|
442 |
||
443 |
// The method is not stored GC safe so see if GC became active |
|
444 |
// after we entered AsyncGetCallTrace() and before we try to |
|
445 |
// use the methodOop. |
|
446 |
// Yes, there is still a window after this check and before |
|
447 |
// we use methodOop below, but we can't lock out GC so that |
|
448 |
// has to be an acceptable risk. |
|
449 |
if (!ch->is_valid_method(method)) { |
|
450 |
// we throw away everything we've gathered in this sample since |
|
451 |
// 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
|
452 |
trace->num_frames = ticks_GC_active; // -2 |
1 | 453 |
return; |
454 |
} |
|
455 |
||
456 |
trace->frames[count].method_id = method->find_jmethod_id_or_null(); |
|
457 |
if (!method->is_native()) { |
|
458 |
trace->frames[count].lineno = bci; |
|
459 |
} else { |
|
460 |
trace->frames[count].lineno = -3; |
|
461 |
} |
|
462 |
} |
|
463 |
trace->num_frames = count; |
|
464 |
return; |
|
465 |
} |
|
466 |
||
467 |
||
468 |
// Forte Analyzer AsyncGetCallTrace() entry point. Currently supported |
|
469 |
// on Linux X86, Solaris SPARC and Solaris X86. |
|
470 |
// |
|
471 |
// Async-safe version of GetCallTrace being called from a signal handler |
|
472 |
// when a LWP gets interrupted by SIGPROF but the stack traces are filled |
|
473 |
// with different content (see below). |
|
474 |
// |
|
475 |
// This function must only be called when JVM/TI |
|
476 |
// CLASS_LOAD events have been enabled since agent startup. The enabled |
|
477 |
// event will cause the jmethodIDs to be allocated at class load time. |
|
478 |
// The jmethodIDs cannot be allocated in a signal handler because locks |
|
479 |
// cannot be grabbed in a signal handler safely. |
|
480 |
// |
|
481 |
// void (*AsyncGetCallTrace)(ASGCT_CallTrace *trace, jint depth, void* ucontext) |
|
482 |
// |
|
483 |
// Called by the profiler to obtain the current method call stack trace for |
|
484 |
// a given thread. The thread is identified by the env_id field in the |
|
485 |
// ASGCT_CallTrace structure. The profiler agent should allocate a ASGCT_CallTrace |
|
486 |
// structure with enough memory for the requested stack depth. The VM fills in |
|
487 |
// the frames buffer and the num_frames field. |
|
488 |
// |
|
489 |
// Arguments: |
|
490 |
// |
|
491 |
// trace - trace data structure to be filled by the VM. |
|
492 |
// depth - depth of the call stack trace. |
|
493 |
// ucontext - ucontext_t of the LWP |
|
494 |
// |
|
495 |
// ASGCT_CallTrace: |
|
496 |
// typedef struct { |
|
497 |
// JNIEnv *env_id; |
|
498 |
// jint num_frames; |
|
499 |
// ASGCT_CallFrame *frames; |
|
500 |
// } ASGCT_CallTrace; |
|
501 |
// |
|
502 |
// Fields: |
|
503 |
// env_id - ID of thread which executed this trace. |
|
504 |
// num_frames - number of frames in the trace. |
|
505 |
// (< 0 indicates the frame is not walkable). |
|
506 |
// frames - the ASGCT_CallFrames that make up this trace. Callee followed by callers. |
|
507 |
// |
|
508 |
// ASGCT_CallFrame: |
|
509 |
// typedef struct { |
|
510 |
// jint lineno; |
|
511 |
// jmethodID method_id; |
|
512 |
// } ASGCT_CallFrame; |
|
513 |
// |
|
514 |
// Fields: |
|
515 |
// 1) For Java frame (interpreted and compiled), |
|
516 |
// lineno - bci of the method being executed or -1 if bci is not available |
|
517 |
// method_id - jmethodID of the method being executed |
|
518 |
// 2) For native method |
|
519 |
// lineno - (-3) |
|
520 |
// method_id - jmethodID of the method being executed |
|
521 |
||
522 |
extern "C" { |
|
523 |
void AsyncGetCallTrace(ASGCT_CallTrace *trace, jint depth, void* ucontext) { |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
524 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
525 |
// This is if'd out because we no longer use thread suspension. |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
526 |
// However if someone wanted to backport this to a 5.0 jvm then this |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
527 |
// code would be important. |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
528 |
#if 0 |
1 | 529 |
if (SafepointSynchronize::is_synchronizing()) { |
530 |
// The safepoint mechanism is trying to synchronize all the threads. |
|
531 |
// Since this can involve thread suspension, it is not safe for us |
|
532 |
// to be here. We can reduce the deadlock risk window by quickly |
|
533 |
// returning to the SIGPROF handler. However, it is still possible |
|
534 |
// for VMThread to catch us here or in the SIGPROF handler. If we |
|
535 |
// are suspended while holding a resource and another thread blocks |
|
536 |
// on that resource in the SIGPROF handler, then we will have a |
|
537 |
// three-thread deadlock (VMThread, this thread, the other thread). |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
538 |
trace->num_frames = ticks_safepoint; // -10 |
1 | 539 |
return; |
540 |
} |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
541 |
#endif |
1 | 542 |
|
543 |
JavaThread* thread; |
|
544 |
||
545 |
if (trace->env_id == NULL || |
|
546 |
(thread = JavaThread::thread_from_jni_environment(trace->env_id)) == NULL || |
|
547 |
thread->is_exiting()) { |
|
548 |
||
549 |
// 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
|
550 |
trace->num_frames = ticks_thread_exit; // -8 |
1 | 551 |
return; |
552 |
} |
|
553 |
||
554 |
if (thread->in_deopt_handler()) { |
|
555 |
// 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
|
556 |
trace->num_frames = ticks_deopt; // -9 |
1 | 557 |
return; |
558 |
} |
|
559 |
||
560 |
assert(JavaThread::current() == thread, |
|
561 |
"AsyncGetCallTrace must be called by the current interrupted thread"); |
|
562 |
||
563 |
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
|
564 |
trace->num_frames = ticks_no_class_load; // -1 |
1 | 565 |
return; |
566 |
} |
|
567 |
||
568 |
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
|
569 |
trace->num_frames = ticks_GC_active; // -2 |
1 | 570 |
return; |
571 |
} |
|
572 |
||
573 |
switch (thread->thread_state()) { |
|
574 |
case _thread_new: |
|
575 |
case _thread_uninitialized: |
|
576 |
case _thread_new_trans: |
|
577 |
// We found the thread on the threads list above, but it is too |
|
578 |
// young to be useful so return that there are no Java frames. |
|
579 |
trace->num_frames = 0; |
|
580 |
break; |
|
581 |
case _thread_in_native: |
|
582 |
case _thread_in_native_trans: |
|
583 |
case _thread_blocked: |
|
584 |
case _thread_blocked_trans: |
|
585 |
case _thread_in_vm: |
|
586 |
case _thread_in_vm_trans: |
|
587 |
{ |
|
588 |
frame fr; |
|
589 |
||
590 |
// param isInJava == false - indicate we aren't in Java code |
|
591 |
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
|
592 |
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
|
593 |
} else { |
1 | 594 |
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
|
595 |
trace->num_frames = 0; // No Java frames |
1 | 596 |
} else { |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
597 |
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
|
598 |
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
|
599 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
600 |
// 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
|
601 |
// 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
|
602 |
// 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
|
603 |
// 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
|
604 |
// 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
|
605 |
// 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
|
606 |
|
1 | 607 |
} |
608 |
} |
|
609 |
} |
|
610 |
break; |
|
611 |
case _thread_in_Java: |
|
612 |
case _thread_in_Java_trans: |
|
613 |
{ |
|
614 |
frame fr; |
|
615 |
||
616 |
// param isInJava == true - indicate we are in Java code |
|
617 |
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
|
618 |
trace->num_frames = ticks_unknown_Java; // -5 unknown frame |
1 | 619 |
} else { |
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
620 |
trace->num_frames = ticks_not_walkable_Java; // -6, non walkable frame by default |
1 | 621 |
forte_fill_call_trace_given_top(thread, trace, depth, fr); |
622 |
} |
|
623 |
} |
|
624 |
break; |
|
625 |
default: |
|
626 |
// Unknown thread state |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
627 |
trace->num_frames = ticks_unknown_state; // -7 |
1 | 628 |
break; |
629 |
} |
|
630 |
} |
|
631 |
||
632 |
||
633 |
#ifndef _WINDOWS |
|
634 |
// Support for the Forte(TM) Peformance Tools collector. |
|
635 |
// |
|
636 |
// The method prototype is derived from libcollector.h. For more |
|
637 |
// information, please see the libcollect man page. |
|
638 |
||
639 |
// Method to let libcollector know about a dynamically loaded function. |
|
640 |
// Because it is weakly bound, the calls become NOP's when the library |
|
641 |
// isn't present. |
|
642 |
void collector_func_load(char* name, |
|
643 |
void* null_argument_1, |
|
644 |
void* null_argument_2, |
|
645 |
void *vaddr, |
|
646 |
int size, |
|
647 |
int zero_argument, |
|
648 |
void* null_argument_3); |
|
649 |
#pragma weak collector_func_load |
|
650 |
#define collector_func_load(x0,x1,x2,x3,x4,x5,x6) \ |
|
651 |
( collector_func_load ? collector_func_load(x0,x1,x2,x3,x4,x5,x6),0 : 0 ) |
|
652 |
#endif // !_WINDOWS |
|
653 |
||
654 |
} // end extern "C" |
|
655 |
#endif // !IA64 |
|
656 |
||
657 |
void Forte::register_stub(const char* name, address start, address end) { |
|
658 |
#if !defined(_WINDOWS) && !defined(IA64) |
|
659 |
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
|
660 |
"Code size exceeds maximum range"); |
1 | 661 |
|
662 |
collector_func_load((char*)name, NULL, NULL, start, |
|
663 |
pointer_delta(end, start, sizeof(jbyte)), 0, NULL); |
|
664 |
#endif // !_WINDOWS && !IA64 |
|
665 |
} |