comparison src/share/vm/runtime/vframe.cpp @ 8883:b9a918201d47

Merge with hsx25
author Gilles Duboscq <duboscq@ssw.jku.at>
date Sat, 06 Apr 2013 20:04:06 +0200
parents b8f261ba79c6 16885e702c88
children 63724649e19e
comparison
equal deleted inserted replaced
8660:d47b52b0ff68 8883:b9a918201d47
389 389
390 390
391 // Step back n frames, skip any pseudo frames in between. 391 // Step back n frames, skip any pseudo frames in between.
392 // This function is used in Class.forName, Class.newInstance, Method.Invoke, 392 // This function is used in Class.forName, Class.newInstance, Method.Invoke,
393 // AccessController.doPrivileged. 393 // AccessController.doPrivileged.
394 //
395 // NOTE that in JDK 1.4 this has been exposed to Java as
396 // sun.reflect.Reflection.getCallerClass(), which can be inlined.
397 // Inlined versions must match this routine's logic.
398 // Native method prefixing logic does not need to match since
399 // the method names don't match and inlining will not occur.
400 // See, for example,
401 // Parse::inline_native_Reflection_getCallerClass in
402 // opto/library_call.cpp.
403 void vframeStreamCommon::security_get_caller_frame(int depth) { 394 void vframeStreamCommon::security_get_caller_frame(int depth) {
404 bool use_new_reflection = JDK_Version::is_gte_jdk14x_version() && UseNewReflection; 395 assert(depth >= 0, err_msg("invalid depth: %d", depth));
405 396 for (int n = 0; !at_end(); security_next()) {
406 while (!at_end()) { 397 if (!method()->is_ignored_by_security_stack_walk()) {
407 if (Universe::reflect_invoke_cache()->is_same_method(method())) { 398 if (n == depth) {
408 // This is Method.invoke() -- skip it 399 // We have reached the desired depth; return.
409 } else if (use_new_reflection && 400 return;
410 method()->method_holder()
411 ->is_subclass_of(SystemDictionary::reflect_MethodAccessorImpl_klass())) {
412 // This is an auxilary frame -- skip it
413 } else if (method()->is_method_handle_intrinsic() ||
414 method()->is_compiled_lambda_form()) {
415 // This is an internal adapter frame for method handles -- skip it
416 } else {
417 // This is non-excluded frame, we need to count it against the depth
418 if (depth-- <= 0) {
419 // we have reached the desired depth, we are done
420 break;
421 } 401 }
422 } 402 n++; // this is a non-skipped frame; count it against the depth
423 if (method()->is_prefixed_native()) { 403 }
424 skip_prefixed_method_and_wrappers(); 404 }
425 } else { 405 // NOTE: At this point there were not enough frames on the stack
426 next(); 406 // to walk to depth. Callers of this method have to check for at_end.
427 } 407 }
408
409
410 void vframeStreamCommon::security_next() {
411 if (method()->is_prefixed_native()) {
412 skip_prefixed_method_and_wrappers(); // calls next()
413 } else {
414 next();
428 } 415 }
429 } 416 }
430 417
431 418
432 void vframeStreamCommon::skip_prefixed_method_and_wrappers() { 419 void vframeStreamCommon::skip_prefixed_method_and_wrappers() {