Request for reviews (M): 6580131: Exposing Method Inlining InformationTo JVMTI Agents

Venkatachalam, Vasanth Vasanth.Venkatachalam at
Mon Aug 17 17:26:31 PDT 2009

Hi Tom,

Thank you again for your detailed and insightful review. We have revised
our implementation based on your suggestions and submitted new diffs for
bugid 100085 with the changes described below. We have attached these
diffs and new sample JVMTI agents to the bug report at: 



1. Overall Structure

We have added one new header file to the Hotspot JVM, jvmticmlr.h.  This
header defines a struct JvmtiCompiledMethodLoadRecordHeader that
represents arbitrary information passed through the void pointer. The
struct has a type field to indicate the type of information being
passed, and a next pointer. The type field can also be used to capture
versioning information. 


We also defined another struct, JvmtiCompiledMethodLoadInlineRecord,
which contains the previous struct as the first member but in addition
has extra fields for storing inlining information. One can similarly
define additional structs to pass other kinds of information. As an
example, we've defined a struct JvmtiCompiledMethodLoadDummyRecord,
which contains a string "I am a dummy record." When the sample JVMTI
agents that we have provided encounter a record of this type, they print
the string contained in the dummy record. 


This new header file jvmticmlr.h lives in the Hotspot src/share/vm/code
directory. However, we envision that the JDK installer would copy it to
the JDK include/ directory to make this file available to external JVMTI
agents, in the same way that it makes jni.h available.  

When a CompiledMethodLoad event is generated for an nmethod, the void
pointer will contain a list of JvmtiCompiledMethodLoadInlineRecords.
Each record has a pc address which actually represents a range of pc
addresses between that JvmtiCompiledMethodLoadInlineRecord and the pc
address of the next one in the list.


When the sample JVMTI agents we have provided detect a
CompiledMethodLoad event, they first cast the void pointer,of the
CompiledMethodLoad callback  to a JvmtiCompiledMethodLoadRecordHeader *
list, and iterate over each of the records in the list, checking its
type and then casting the record to the appropriate subtype (e.g.,
JvmtiCompiledMethodLoadInlineRecords) before deciding how to process it.

2. Code Changes


The main code changes are to the jvmtiExport.cpp file, located in
src/share/vm/prims. We have defined a new global method,
create_inline_records which returns a list of records containing inline
information for a given nmethod. The post_compiled_method_load method of
JvmtiExport calls this method to retrieve the inlining information and
pass it rhrough the void pointer. 


In addition to these changes, we have made the following miscellaneous
changes that were requested:


-We changed the date of the copyright notices in the new header files to
-We have changed all function names to use lowercase with underscores.
-We replaced null checks of impossible conditions with assertions as
-We removed the unused type and offset fields from the data structure
that was previously called InlineInfoRecord and is now called
JVMTICompiledMethodLoadInlineRecord. We renamed the jmethodID[] array to
methods and bytecodeindexes to bcis.
-We removed the PCDescriptorList class since it was redundant.

-We modified our code to use resource allocation rather than C heap
allocations. Please see the create_inline_records method in
-We modified jvmtiExport.cpp to set the _compile_info void pointer
inside the JvmtiCompiledMethodLoadEventMark constructor, rather than
setting this pointer in a separate method call.


3. Sample Agents

The sample agents now use the jvmticmlr.h header file. For ease of
testing, we have copied this header file from the JVM 

src/share/vm/code directory into the c and cpp directories containing
the agents. However, as noted before, the JDK installer would ideally
copy this header file to the JDK /include directory, so that it can be
made available in the same way that jni.h is available.

Again, we thank you for your detailed feedback. Please let us know if
you have additional comments or questions







From: Venkatachalam, Vasanth 
Sent: Tuesday, August 04, 2009 10:47 AM
To: 'hotspot-dev at'
Cc: 'Thomas.Rodriguez at'; Joshi, Shrinivas; Pollan, Ben
Subject: RE: Request for reviews (M): 6580131: Exposing Method Inlining
InformationTo JVMTI Agents


Hi Tom,


Thank you for your detailed and insightful feedback on my JVMTI method
inlining submission. Sorry for the delay in responding to your comments.
We are scoping out the changes that you have recommended. Some of these
changes could take longer, but we hope to be able to respond in a few
days with some changes or at least a timeline on when we can get them








Vasanth Venkatachalam

AMD Java Labs



-------------- next part --------------
An HTML attachment was scrubbed...

More information about the hotspot-dev mailing list