How to compare thecaller thread object and callee's holder?
David Holmes
David.Holmes at oracle.com
Wed Apr 21 18:11:51 PDT 2010
Tony,
Tony Guan said the following on 04/22/10 00:06:
> a quick question: given a caller thread object( JavaThread* thread)
> and the method to be called by the thread (methodOopDesc* method), how
> do I know that the holder of the "method" is from the same caller
> object or not?
I don't understand what you mean here by "holder"?
> The reason why I am asking is:
> in
> JRT_LEAF(int, SharedRuntime::dtrace_method_entry( JavaThread*
> thread, methodOopDesc* method)) in shareRuntime.cpp
>
> I want to check if the method called will start another thread or not,
> so I need to compare the holders of the caller and callee.
Again I don't know what the "holder" is here. If a method starts a
thread then that new thread doesn't necessarily have any connection back
to the method from which it was started.
> So one more question: is there any other way to achieve this?
I think you would have to add code in the thread start routine (of the
JVM) and have the before/after method hooks to do this eg:
before-method: set flag showing current thread is interested in
thread start
start-thread: check if current thread interested in thread start and
if so bump a counter
after-method: check counter and clear flag
David Holmes
More information about the hotspot-runtime-dev
mailing list