476 assert(false, "invalid bci or invalid scope desc");
477 }
478
479 // top-frame will be skipped
480 vframeStream::vframeStream(JavaThread* thread, frame top_frame,
481 bool stop_at_java_call_stub) : vframeStreamCommon(thread) {
482 _stop_at_java_call_stub = stop_at_java_call_stub;
483
484 // skip top frame, as it may not be at safepoint
485 _frame = top_frame.sender(&_reg_map);
486 while (!fill_from_frame()) {
487 _frame = _frame.sender(&_reg_map);
488 }
489 }
490
491
492 // Step back n frames, skip any pseudo frames in between.
493 // This function is used in Class.forName, Class.newInstance, Method.Invoke,
494 // AccessController.doPrivileged.
495 void vframeStreamCommon::security_get_caller_frame(int depth) {
496 assert(depth >= 0, err_msg("invalid depth: %d", depth));
497 for (int n = 0; !at_end(); security_next()) {
498 if (!method()->is_ignored_by_security_stack_walk()) {
499 if (n == depth) {
500 // We have reached the desired depth; return.
501 return;
502 }
503 n++; // this is a non-skipped frame; count it against the depth
504 }
505 }
506 // NOTE: At this point there were not enough frames on the stack
507 // to walk to depth. Callers of this method have to check for at_end.
508 }
509
510
511 void vframeStreamCommon::security_next() {
512 if (method()->is_prefixed_native()) {
513 skip_prefixed_method_and_wrappers(); // calls next()
514 } else {
515 next();
516 }
|
476 assert(false, "invalid bci or invalid scope desc");
477 }
478
479 // top-frame will be skipped
480 vframeStream::vframeStream(JavaThread* thread, frame top_frame,
481 bool stop_at_java_call_stub) : vframeStreamCommon(thread) {
482 _stop_at_java_call_stub = stop_at_java_call_stub;
483
484 // skip top frame, as it may not be at safepoint
485 _frame = top_frame.sender(&_reg_map);
486 while (!fill_from_frame()) {
487 _frame = _frame.sender(&_reg_map);
488 }
489 }
490
491
492 // Step back n frames, skip any pseudo frames in between.
493 // This function is used in Class.forName, Class.newInstance, Method.Invoke,
494 // AccessController.doPrivileged.
495 void vframeStreamCommon::security_get_caller_frame(int depth) {
496 assert(depth >= 0, "invalid depth: %d", depth);
497 for (int n = 0; !at_end(); security_next()) {
498 if (!method()->is_ignored_by_security_stack_walk()) {
499 if (n == depth) {
500 // We have reached the desired depth; return.
501 return;
502 }
503 n++; // this is a non-skipped frame; count it against the depth
504 }
505 }
506 // NOTE: At this point there were not enough frames on the stack
507 // to walk to depth. Callers of this method have to check for at_end.
508 }
509
510
511 void vframeStreamCommon::security_next() {
512 if (method()->is_prefixed_native()) {
513 skip_prefixed_method_and_wrappers(); // calls next()
514 } else {
515 next();
516 }
|