Microsoft SDK for Java

IJavaEventMonitorIDInfo::
MethodInformation

The MethodInformation method of the IJavaEventMonitorIDInfo interface is called by a profiler to retrieve information on a method. The profiler passes in the MethodID of a method to be profiled.

Syntax

HRESULT MethodInformation(MethodID method_id, LPSTR *ppmethod_name, ClassID *pclass_id, JAVA_EXECUTION_MODEL *pexec, int *psource_line_info_length, SourceLineInfo **ppsource_line_info);

Return Value

The name of the method, the ClassID of the class that contains the method, the default execution model (interpreted, JIT-compiled, native, and so on) that is used for the method, and source line information.

Parameters

[in] method_id The MethodID of the method to be profiled.
[out] *ppmethod_name The UTF-8 string name of the method. This consists of the class name with forward slashes (java/lang/Object, for example) followed by a dot and the method name followed by the method signature. This item is taken directly from the constant pool of the Class file, unmodified.
[out] *pclass_id This ClassID of the class that contains this method.
[out] *pexec The default Java execution model (interpreted, JIT-compiled, native, and so on) that is used for this method. This parameter is one of the JAVA_EXECUTION_MODEL enumeration constants that describe how the Microsoft VM goes about executing this method.
[out] *psource_line_info_length The length of the source line information returned. This represents the number of elements in the array.
[out] **ppsource_line_info A pointer to an array of SourceLineInfo structures containing source line information for the method.

Remarks

MethodInformation returns a value indicating the execution model of a Java method, which describes how the Microsoft VM executes this method. The possible execution models can be one of the types defined in the JAVA_EXECUTION_MODEL enumeration.

JAVA_EXECUTION_MODEL

Constant Value Description
JVM_EXECUTION_INVALID -1 The execution model for this method is invalid.
JVM_EXECUTION_JIT_COMPILED 0 The method is JIT-compiled.
JVM_EXECUTION_NATIVE 1 The method is a native Win32 method.
JVM_EXECUTION_INTERPRETED 2 The method is interpreted.
JVM_EXECUTION_FAST_INTERPRETED 3 The method is fast-interpreted.
JVM_EXECUTION_COM 4 The method is a native COM method.

The following structure is used for returning source line information for a method.

typedef struct tagSourceLineInfo {
    DWORD code_offset;
    DWORD line_number;
} SourceLineInfo;

If a Java method is interpreted, the profiler can call the InterpretedMethodInformation method to retrieve a pointer to an array of the Java bytecodes that implement the interpreted method. This method can be called anytime before the given Java method has been JIT-compiled. Depending on the mode of the Microsoft VM, interpreted bytecode information may not be available after the given method has been JIT-compiled.

If a Java method is JIT-compiled, the profiler can call JITCompiledMethodInformation to retrieve a pointer to an array of JIT-compiled instructions that implement the JIT-compiled method. This method should only be called after the profiler has received notification that the method has been JIT-compiled.

If this method is called by a profiler application before JIT compilation, the code_offset member of the SourceLineInfo structure returns the code offset for the interpreted bytecodes.

If this method is called by a profiler after JIT-compilation is finished when the profiler receives a call to its NotifyEvent method (the JVM_EVENT_TYPE_ JIT_COMPILE_FINISHED event), the code_offset member of the SourceLineInfo structure returns the code offset for the JIT-compiled code. Note that the profiler must call MethodInformation during the NotifyEvent method call, indicating that JIT-compilation for this method is finished and before the profiler returns from this NotifyEvent method call.

© 1999 Microsoft Corporation. All rights reserved. Terms of use.