231 state == _thread_blocked );
232
233 if (known_valid || fr->is_interpreted_frame_valid(thread)) {
234
235 // The frame code should completely validate the frame so that
236 // references to Method* and bci are completely safe to access
237 // If they aren't the frame code should be fixed not this
238 // code. However since gc isn't locked out the values could be
239 // stale. This is a race we can never completely win since we can't
240 // lock out gc so do one last check after retrieving their values
241 // from the frame for additional safety
242
243 Method* method = fr->interpreter_frame_method();
244
245 // We've at least found a method.
246 // NOTE: there is something to be said for the approach that
247 // if we don't find a valid bci then the method is not likely
248 // a valid method. Then again we may have caught an interpreter
249 // frame in the middle of construction and the bci field is
250 // not yet valid.
251 if (!method->is_valid_method()) return false;
252 *method_p = method; // If the Method* found is invalid, it is
253 // ignored by forte_fill_call_trace_given_top().
254 // So set method_p only if the Method is valid.
255
256 address bcp = fr->interpreter_frame_bcp();
257 int bci = method->validate_bci_from_bcp(bcp);
258
259 // note: bci is set to -1 if not a valid bci
260 *bci_p = bci;
261 return true;
262 }
263
264 return false;
265 }
266
267
268 // Determine if a Java frame can be found starting with the frame 'fr'.
269 //
270 // Check the return value of find_initial_Java_frame and the value of
271 // 'method_p' to decide on how use the results returned by this method.
417 ASGCT_CallTrace* trace,
418 int depth,
419 frame top_frame) {
420 NoHandleMark nhm;
421
422 frame initial_Java_frame;
423 Method* method;
424 int bci = -1; // assume BCI is not available for method
425 // update with correct information if available
426 int count;
427
428 count = 0;
429 assert(trace->frames != NULL, "trace->frames must be non-NULL");
430
431 // Walk the stack starting from 'top_frame' and search for an initial Java frame.
432 find_initial_Java_frame(thd, &top_frame, &initial_Java_frame, &method, &bci);
433
434 // Check if a Java Method has been found.
435 if (method == NULL) return;
436
437 if (!method->is_valid_method()) {
438 trace->num_frames = ticks_GC_active; // -2
439 return;
440 }
441
442 vframeStreamForte st(thd, initial_Java_frame, false);
443
444 for (; !st.at_end() && count < depth; st.forte_next(), count++) {
445 bci = st.bci();
446 method = st.method();
447
448 if (!method->is_valid_method()) {
449 // we throw away everything we've gathered in this sample since
450 // none of it is safe
451 trace->num_frames = ticks_GC_active; // -2
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.
|
231 state == _thread_blocked );
232
233 if (known_valid || fr->is_interpreted_frame_valid(thread)) {
234
235 // The frame code should completely validate the frame so that
236 // references to Method* and bci are completely safe to access
237 // If they aren't the frame code should be fixed not this
238 // code. However since gc isn't locked out the values could be
239 // stale. This is a race we can never completely win since we can't
240 // lock out gc so do one last check after retrieving their values
241 // from the frame for additional safety
242
243 Method* method = fr->interpreter_frame_method();
244
245 // We've at least found a method.
246 // NOTE: there is something to be said for the approach that
247 // if we don't find a valid bci then the method is not likely
248 // a valid method. Then again we may have caught an interpreter
249 // frame in the middle of construction and the bci field is
250 // not yet valid.
251 if (!Method::is_valid_method(method)) return false;
252 *method_p = method; // If the Method* found is invalid, it is
253 // ignored by forte_fill_call_trace_given_top().
254 // So set method_p only if the Method is valid.
255
256 address bcp = fr->interpreter_frame_bcp();
257 int bci = method->validate_bci_from_bcp(bcp);
258
259 // note: bci is set to -1 if not a valid bci
260 *bci_p = bci;
261 return true;
262 }
263
264 return false;
265 }
266
267
268 // Determine if a Java frame can be found starting with the frame 'fr'.
269 //
270 // Check the return value of find_initial_Java_frame and the value of
271 // 'method_p' to decide on how use the results returned by this method.
417 ASGCT_CallTrace* trace,
418 int depth,
419 frame top_frame) {
420 NoHandleMark nhm;
421
422 frame initial_Java_frame;
423 Method* method;
424 int bci = -1; // assume BCI is not available for method
425 // update with correct information if available
426 int count;
427
428 count = 0;
429 assert(trace->frames != NULL, "trace->frames must be non-NULL");
430
431 // Walk the stack starting from 'top_frame' and search for an initial Java frame.
432 find_initial_Java_frame(thd, &top_frame, &initial_Java_frame, &method, &bci);
433
434 // Check if a Java Method has been found.
435 if (method == NULL) return;
436
437 if (!Method::is_valid_method(method)) {
438 trace->num_frames = ticks_GC_active; // -2
439 return;
440 }
441
442 vframeStreamForte st(thd, initial_Java_frame, false);
443
444 for (; !st.at_end() && count < depth; st.forte_next(), count++) {
445 bci = st.bci();
446 method = st.method();
447
448 if (!Method::is_valid_method(method)) {
449 // we throw away everything we've gathered in this sample since
450 // none of it is safe
451 trace->num_frames = ticks_GC_active; // -2
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.
|