435
436 entryVFrame::entryVFrame(const frame* fr, const RegisterMap* reg_map, JavaThread* thread)
437 : externalVFrame(fr, reg_map, thread) {}
438
439 #ifdef ASSERT
440 void vframeStreamCommon::found_bad_method_frame() const {
441 // 6379830 Cut point for an assertion that occasionally fires when
442 // we are using the performance analyzer.
443 // Disable this assert when testing the analyzer with fastdebug.
444 // -XX:SuppressErrorAt=vframe.cpp:XXX (XXX=following line number)
445 fatal("invalid bci or invalid scope desc");
446 }
447 #endif
448
449 // top-frame will be skipped
450 vframeStream::vframeStream(JavaThread* thread, frame top_frame,
451 bool stop_at_java_call_stub) : vframeStreamCommon(thread) {
452 _stop_at_java_call_stub = stop_at_java_call_stub;
453
454 // skip top frame, as it may not be at safepoint
455 _frame = top_frame.sender(&_reg_map);
456 while (!fill_from_frame()) {
457 _frame = _frame.sender(&_reg_map);
458 }
459 }
460
461
462 // Step back n frames, skip any pseudo frames in between.
463 // This function is used in Class.forName, Class.newInstance, Method.Invoke,
464 // AccessController.doPrivileged.
465 void vframeStreamCommon::security_get_caller_frame(int depth) {
466 assert(depth >= 0, "invalid depth: %d", depth);
467 for (int n = 0; !at_end(); security_next()) {
468 if (!method()->is_ignored_by_security_stack_walk()) {
469 if (n == depth) {
470 // We have reached the desired depth; return.
471 return;
472 }
473 n++; // this is a non-skipped frame; count it against the depth
474 }
475 }
476 // NOTE: At this point there were not enough frames on the stack
515 if (possible_prefix_len == prefix_len &&
516 strncmp(possible_prefix, prefixed_name, prefix_len) == 0) {
517 break; // matching prefix found
518 }
519 }
520 if (prefix_index < 0) {
521 break; // didn't find the prefix, can't be a wrapper
522 }
523 prefixed_name = name;
524 prefixed_name_len = name_len;
525 }
526 }
527
528
529 void vframeStreamCommon::skip_reflection_related_frames() {
530 while (!at_end() &&
531 (method()->method_holder()->is_subclass_of(SystemDictionary::reflect_MethodAccessorImpl_klass()) ||
532 method()->method_holder()->is_subclass_of(SystemDictionary::reflect_ConstructorAccessorImpl_klass()))) {
533 next();
534 }
535 }
536
537
538 #ifndef PRODUCT
539 void vframe::print() {
540 if (WizardMode) _fr.print_value_on(tty,NULL);
541 }
542
543
544 void vframe::print_value() const {
545 ((vframe*)this)->print();
546 }
547
548
549 void entryVFrame::print_value() const {
550 ((entryVFrame*)this)->print();
551 }
552
553 void entryVFrame::print() {
554 vframe::print();
|
435
436 entryVFrame::entryVFrame(const frame* fr, const RegisterMap* reg_map, JavaThread* thread)
437 : externalVFrame(fr, reg_map, thread) {}
438
439 #ifdef ASSERT
440 void vframeStreamCommon::found_bad_method_frame() const {
441 // 6379830 Cut point for an assertion that occasionally fires when
442 // we are using the performance analyzer.
443 // Disable this assert when testing the analyzer with fastdebug.
444 // -XX:SuppressErrorAt=vframe.cpp:XXX (XXX=following line number)
445 fatal("invalid bci or invalid scope desc");
446 }
447 #endif
448
449 // top-frame will be skipped
450 vframeStream::vframeStream(JavaThread* thread, frame top_frame,
451 bool stop_at_java_call_stub) : vframeStreamCommon(thread) {
452 _stop_at_java_call_stub = stop_at_java_call_stub;
453
454 // skip top frame, as it may not be at safepoint
455 _prev_frame = top_frame;
456 _frame = top_frame.sender(&_reg_map);
457 while (!fill_from_frame()) {
458 _prev_frame = _frame;
459 _frame = _frame.sender(&_reg_map);
460 }
461 }
462
463
464 // Step back n frames, skip any pseudo frames in between.
465 // This function is used in Class.forName, Class.newInstance, Method.Invoke,
466 // AccessController.doPrivileged.
467 void vframeStreamCommon::security_get_caller_frame(int depth) {
468 assert(depth >= 0, "invalid depth: %d", depth);
469 for (int n = 0; !at_end(); security_next()) {
470 if (!method()->is_ignored_by_security_stack_walk()) {
471 if (n == depth) {
472 // We have reached the desired depth; return.
473 return;
474 }
475 n++; // this is a non-skipped frame; count it against the depth
476 }
477 }
478 // NOTE: At this point there were not enough frames on the stack
517 if (possible_prefix_len == prefix_len &&
518 strncmp(possible_prefix, prefixed_name, prefix_len) == 0) {
519 break; // matching prefix found
520 }
521 }
522 if (prefix_index < 0) {
523 break; // didn't find the prefix, can't be a wrapper
524 }
525 prefixed_name = name;
526 prefixed_name_len = name_len;
527 }
528 }
529
530
531 void vframeStreamCommon::skip_reflection_related_frames() {
532 while (!at_end() &&
533 (method()->method_holder()->is_subclass_of(SystemDictionary::reflect_MethodAccessorImpl_klass()) ||
534 method()->method_holder()->is_subclass_of(SystemDictionary::reflect_ConstructorAccessorImpl_klass()))) {
535 next();
536 }
537 }
538
539 javaVFrame* vframeStreamCommon::asJavaVFrame() {
540 javaVFrame* result = NULL;
541 if (_mode == compiled_mode) {
542 guarantee(_frame.is_compiled_frame(), "expected compiled Java frame");
543
544 // lazy update to register map
545 bool update_map = true;
546 RegisterMap map(_thread, update_map);
547 frame f = _prev_frame.sender(&map);
548
549 guarantee(f.is_compiled_frame(), "expected compiled Java frame");
550
551 compiledVFrame* cvf = compiledVFrame::cast(vframe::new_vframe(&f, &map, _thread));
552
553 guarantee(cvf->cb() == cb(), "wrong code blob");
554
555 // get the same scope as this stream
556 cvf = cvf->at_scope(_decode_offset, _vframe_id);
557
558 guarantee(cvf->scope()->decode_offset() == _decode_offset, "wrong scope");
559 guarantee(cvf->scope()->sender_decode_offset() == _sender_decode_offset, "wrong scope");
560 guarantee(cvf->vframe_id() == _vframe_id, "wrong vframe");
561
562 result = cvf;
563 } else {
564 result = javaVFrame::cast(vframe::new_vframe(&_frame, &_reg_map, _thread));
565 }
566 guarantee(result->method() == method(), "wrong method");
567 return result;
568 }
569
570
571 #ifndef PRODUCT
572 void vframe::print() {
573 if (WizardMode) _fr.print_value_on(tty,NULL);
574 }
575
576
577 void vframe::print_value() const {
578 ((vframe*)this)->print();
579 }
580
581
582 void entryVFrame::print_value() const {
583 ((entryVFrame*)this)->print();
584 }
585
586 void entryVFrame::print() {
587 vframe::print();
|