Mercurial > hg > graal-compiler
diff 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 |
line wrap: on
line diff
--- a/src/share/vm/runtime/vframe.cpp Fri Apr 05 18:53:57 2013 +0200 +++ b/src/share/vm/runtime/vframe.cpp Sat Apr 06 20:04:06 2013 +0200 @@ -391,40 +391,27 @@ // Step back n frames, skip any pseudo frames in between. // This function is used in Class.forName, Class.newInstance, Method.Invoke, // AccessController.doPrivileged. -// -// NOTE that in JDK 1.4 this has been exposed to Java as -// sun.reflect.Reflection.getCallerClass(), which can be inlined. -// Inlined versions must match this routine's logic. -// Native method prefixing logic does not need to match since -// the method names don't match and inlining will not occur. -// See, for example, -// Parse::inline_native_Reflection_getCallerClass in -// opto/library_call.cpp. void vframeStreamCommon::security_get_caller_frame(int depth) { - bool use_new_reflection = JDK_Version::is_gte_jdk14x_version() && UseNewReflection; + assert(depth >= 0, err_msg("invalid depth: %d", depth)); + for (int n = 0; !at_end(); security_next()) { + if (!method()->is_ignored_by_security_stack_walk()) { + if (n == depth) { + // We have reached the desired depth; return. + return; + } + n++; // this is a non-skipped frame; count it against the depth + } + } + // NOTE: At this point there were not enough frames on the stack + // to walk to depth. Callers of this method have to check for at_end. +} - while (!at_end()) { - if (Universe::reflect_invoke_cache()->is_same_method(method())) { - // This is Method.invoke() -- skip it - } else if (use_new_reflection && - method()->method_holder() - ->is_subclass_of(SystemDictionary::reflect_MethodAccessorImpl_klass())) { - // This is an auxilary frame -- skip it - } else if (method()->is_method_handle_intrinsic() || - method()->is_compiled_lambda_form()) { - // This is an internal adapter frame for method handles -- skip it - } else { - // This is non-excluded frame, we need to count it against the depth - if (depth-- <= 0) { - // we have reached the desired depth, we are done - break; - } - } - if (method()->is_prefixed_native()) { - skip_prefixed_method_and_wrappers(); - } else { - next(); - } + +void vframeStreamCommon::security_next() { + if (method()->is_prefixed_native()) { + skip_prefixed_method_and_wrappers(); // calls next() + } else { + next(); } }