Review Request: JDK-8157464: StackWalker.getCallerClass() is not
Daniel Fuchs
daniel.fuchs at oracle.com
Wed Sep 14 08:55:19 UTC 2016
Hi Mandy,
webrev.03 looks good to me!
best regards,
-- daniel
On 14/09/16 01:04, Mandy Chung wrote:
> Yes that’s one option.
>
> JVM_STACKWALK_FILL_CLASS_REFS_ONLY is not necessarily used to get caller class. For example, AccessControlContext is interested in protection domains. We could build a specialized impl class to walk the stack fetching Class<?> only whereas getCallerClass will stop walking after a few top frames. So a different bit will enable future experiment. Having said that, the assert should be reverted and minor adjustment:
>
> @@ -140,6 +143,13 @@
> fill_stackframe(stackFrame, method, bci);
> } else {
> assert (use_frames_array(mode) == false, "Bad mode for get caller class");
> + if (get_caller_class(mode) && index == start_index && method->caller_sensitive()) {
> + ResourceMark rm(THREAD);
> + THROW_MSG_0(vmSymbols::java_lang_UnsupportedOperationException(),
> + err_msg("StackWalker::getCallerClass called from @CallerSensitive %s method",
> + method->name_and_sig_as_C_string()));
> + }
> +
>
> http://cr.openjdk.java.net/~mchung/jdk9/webrevs/8157464/webrev.03/
>
> Mandy
More information about the core-libs-dev
mailing list