OpenJdk interpreter

Tom Rodriguez Thomas.Rodriguez at Sun.COM
Thu Jul 3 11:33:08 PDT 2008


InterpreterRuntime::resolve_invoke would be a good instrumentation  
point, though you'd have to modify the code in the generated  
interpreter to always enter that code instead of only the first time a  
call site is resolved.  Start in the code for  
TemplateTable::_invokevirtual and friends and step through that code  
to see how it works.  Obviously you'd have to disable the compilers  
since your trick only works in the interpreter.

Have you considered using bytecode rewriting to capture whatever it is  
you're after?

tom

On Jul 3, 2008, at 11:11 AM, Nagy Mostafa wrote:

> Thanks, Tim.
> Yes, I know I can use JVMTI for the task, but I also wanted to  
> collect call-site and some other specific info (e.g. field access)  
> information. Can the JVM pass information about call site bytecode  
> index/pointer to JVMTI ?
>
> - nagy
>
> On Wed, Jul 2, 2008 at 3:05 PM, Tim Bell <Tim.Bell at sun.com> wrote:
> Nagy1981 wrote:
> Hi, I am trying to modify the hotspot interpreter to collect some  
> profile data.
> The main thing I want to do is build a call-tree. I want to add a  
> hook to
> the interpreter whenever an invoke_* bytecode operation is about to  
> execute
> such that my call-tree gets updated. Can you please guide me to the  
> part of
> the code where  control is passed from the interpreter to the  
> assembly code
> corresponding to a bytecode operation. All I can find is parts where  
> the
> assembly code get generated, but I can't figure out where it is  
> executed.
>
> Have you looked at the javadoc for the JVMTI_EVENT_METHOD_ENTRY event?
>
>  http://java.sun.com/javase/6/docs/platform/jvmti/jvmti.html#MethodEntry
>
> Does this supply the functionality you need?  It would be easier to  
> write a JVM TI agent [1] to collect this information than it would  
> be to modify the interpreter.
>
> If you still want to modify the JVM code, read over  
> jvmtiExport.cpp.  Look for
> void JvmtiExport::post_method_entry()
>
> If you still want to modify the JVM, look over the code base for  
> calls to post_method_entry() and that should give you an idea where  
> to start.
>
> Hope this helps - Tim Bell
>
> [1] The JVM Tool Interface (JVM TI): How VM Agents Work
>    http://java.sun.com/developer/technicalArticles/J2SE/jvm_ti/
>




More information about the hotspot-dev mailing list