/**
* Function returns method name.
*
* @param method - method handle
*
* @return Method name bytes.
*
* @note Assertion is raised if method is equal to null.
*/
const char * methodGetName(MethodHandle method);
/**
* Function returns method descriptor.
*
* @param method - method handle
*
* @return Method descriptor bytes.
*
* @note Assertion is raised if method is equal to null.
*/
const char * methodGetDescriptor(MethodHandle method);
/**
* Function returns a signature that can be used to iterate over method's arguments
* and query the type of the method result.
*
* @param method - method handle
*
* @return Return a method signature.
*
* @note Assertion is raised if method is equal to null.
*/
MethodSignatureHandle methodGetSignature(MethodHandle method);
/**
* Function returns a class in which the method is declared.
*
* @param method - method handle
*
* @return Return a class in which the method is declared.
*
* @note Assertion is raised if method is equal to null.
*/
ClassHandle methodGetClass(MethodHandle method);
/**
* Function returns a returned java type for the method.
*
* @param method - method handle
*
* @return Return a returned java type.
*
* @note Assertion is raised if method is equal to null.
*/
JavaType methodGetReturnType(MethodHandle method);
/**
* Function returns access flags for a given method.
*
* @param method - method handle
*
* @return Return access flags.
*
* @note Assertion is raised if method is equal to null.
*/
unsigned short methodGetFlags(MethodHandle method);
/**
* Function checks if a given method is private.
*
* @param method - method handle
*
* @return Return TRUE
if a given method is private.
*
* @note Assertion is raised if method is equal to null.
*/
Boolean methodIsPrivate(MethodHandle method);
/**
* Function checks if a given method is public.
*
* @param method - method handle
*
* @return Return TRUE
if a given method is public.
*
* @note Assertion is raised if method is equal to null.
*/
Boolean methodIsPublic(MethodHandle method);
/**
* Function checks if a given method is static.
*
* @param method - method handle
*
* @return Return TRUE
if a given method is static.
*
* @note Assertion is raised if method is equal to null.
*/
Boolean methodIsStatic(MethodHandle method);
/**
* Function checks if a given method is native.
*
* @param method - method handle
*
* @return Return TRUE
if a given method is native.
*
* @note Assertion is raised if method is equal to null.
*/
Boolean methodIsNative(MethodHandle method);
/**
* Function checks if a given method is synchronized.
*
* @param method - method handle
*
* @return Return TRUE
if a given method is synchronized.
*
* @note Assertion is raised if method is equal to null.
*/
Boolean methodIsSynchronized(MethodHandle method);
/**
* Function checks if a given method is final.
*
* @param method - method handle
*
* @return Return TRUE
if a given method is final.
*
* @note Assertion is raised if method is equal to null.
*/
Boolean methodIsFinal(MethodHandle method);
/**
* Function checks if a given method is abstract.
*
* @param method - method handle
*
* @return Return TRUE
if a given method is abstract.
*
* @note Assertion is raised if method is equal to null.
*/
Boolean methodIsAbstract(MethodHandle method);
/**
* Function checks if a given method is strict.
* Java methods may have a flag set to indicate that floating point operations
* must be performed in the strict mode.
*
* @param method - method handle
*
* @return Return TRUE
the ACC_STRICT
flag is set for
* a Java method and FALSE
otherwise.
*
* @note Assertion is raised if method is equal to null.
*/
Boolean methodIsStrict(MethodHandle method);
/**
* Function checks if a given method is a fake method.
*
* @param method - method handle
*
* @return Return TRUE
if a given method is a fake method.
*
* @note Assertion is raised if method is equal to null.
*/
Boolean methodIsFake(MethodHandle method);
/**
* Function checks if a given method is overridden.
*
* @param method - method handle
*
* @return Return TRUE
if the method has been overriden in
* a subclass and FALSE
otherwise.
*
* @note Assertion is raised if method is equal to null.
* @note If methodIsOverridden returns FALSE
, loading
* of a subclass later in the execution of the program may change invalidate
* this condition. If a JIT uses methodIsOverridden to implement
* unconditional inlining, it must be prepared to patch the code later
* (see vmRegisterJitOverriddenMethodCallback).
*/
Boolean methodIsOverridden(MethodHandle method);
/**
* Function returns TRUE if the method should not be inlined.
* There may also be other reasons why a method shouldn't be inlined,
* e.g., native methods can't be inlined and in Java you can't inlined
* methods that are loaded by a different class loader than the caller.
*
* @param method - method handle
*
* @return Return TRUE
if the method should not be inlined.
*
* @note Assertion is raised if method is equal to null.
* @note Always FALSE
for Java.
*/
Boolean methodIsNoInlining(Method_Handle method);
/**
* Function sets the number of exception handlers in the code generated by the JIT
* jit for a given method.
*
* @param method - method handle
* @param jit - jit handle
* @param num_handlers - the number of exception handlers
*
* @note The JIT must then call methodSetTargetHandlerInfo function
* for each of the numHandlers exception handlers.
*/
void methodSetNumTargetHandlers(MethodHandle method, JitHandle jit,
unsigned short numHandlers);
/**
* Function checks if the local variable is pinned.
*
* @param method - method handle
* @param index - the local variable index
*
* @return Return TRUE if the local variable is pinned.
*/
Boolean methodVarsIsPinned(MethodHandle method, unsigned short index);
/**
* Function returns a unique id associated with a method handle.
*
* @param method - method handle
*
* @return Return a unique id associated with a method handle.
*/
uint32 methodGetId(MethodHandle method);
/**
* The function returns a method handle for an accessible method overriding
* method in klass or in its closest superclass that overrides method.
*
* @param klass - class handle
* @param method - method handle
*
* @return Return a method handle for an accessible method overriding method.
*/
MethodHandle methodFindOverriddenMethod(ClassHandle klass, MethodHandle method);
/**
* Function returns the type info of the local variable.
*
* @param method - method handle
* @param index - the local variable number
*
* @return Return the type info of the local variable.
*
* @note Since local variables are not typed in Java, this function
* always returns NULL for Java methods.
*/
TypeInfoHandle methodVarsGetTypeInfo(MethodHandle method, unsigned short index);
/**
* Function returns the number of arguments defined for the method.
* This number automatically includes the this pointer (if present).
*
* @param methodSignature - method signature handle
*
* @return Return the number of arguments defined for the method.
*/
unsigned char methodArgsGetNumber(MethodSignatureHandle methodSignature);
/**
* Function initializes the ChaMethodIterator iterator, to iterate over all
* methods that match the method signature and descend from klass
* (including klass itself).
*
* @param iterator - class iterator
* @param method - method handle
* @param klass - class handle
*
* @return Return TRUE
if iteration is supported over klass,
* FALSE
if not.
*
* @note Reference to internal type ChaMethodIterator.
*/
Boolean methodIteratorInitialize(ChaMethodIterator *iterator, MethodHandle method,
ClassHandle klass);
/**
* Function advances the iterator.
*
* @param iterator - class iterator
*
* @note Reference to internal type ChaMethodIterator.
*/
void methodIteratorAdvance(ChaMethodIterator *iterator);
/**
* Function returns the current method of the iterator.
* NULL is returned if there are no more methods.
*
* @param iterator - class iterator
*
* @return Return the current method of the iterator.
*
* @note Reference to internal type ChaMethodIterator.
*/
MethodHandle methodIteratorGetCurrent(ChaMethodIterator *iterator);
/**
* Function returns the number of exceptions a given method can throw.
*
* @param method - method handle
*
* @return Return the number of exceptions.
*
* @note Replaces methodNumberThrows function.
*/
unsigned short methodGetNumThrows(MethodHandle method);
/**
* Function returns the exception class a given method can throw.
*
* @param method - method handle
* @param index - the exception number
*
* @return Return the exception class a given method can throw.
*/
ClassHandle methodGetThrows(MethodHandle method, unsigned short index);
/**
* Function returns number of method exception handlers.
*
* @param method - method handle
*
* @return Number of method exception handlers.
*
* @note Assertion is raised if method is equal to null.
* @note Replaces methodGetExcHandlerNumber function.
*/
unsigned short methodGetExcHandlerNumber(MethodHandle method);
/**
* Function obtains method exception handle info.
*
* @param method - method handle
* @param index - exception handle index number
* @param startPc - resulting pointer to exception handle start program count
* @param endPc - resulting pointer to exception handle end program count
* @param handlerPc - resulting pointer to exception handle program count
* @param catchType - resulting pointer to constant pool entry index
*
* @note Assertion is raised if method is equal to null or
* exception handle index is out of range or
* any pointer is equal to null.
* @note Replaces methodGetExcHandlerInfo function.
*/
void methodGetHandlerInfo(MethodHandler method, unsigned short index,
unsigned short *startPc, unsigned short *endPc,
unsigned short *handlerPc, unsigned short *catchType );
/**
* Function returns the type info for return value.
*
* @param methodSignature - method signature handle
*
* @return Return the type info for return value.
*/
TypeInfoHandle methodRetTypeGetTypeInfo(MethodSignatureHandle methodSignature);
/**
* Function returns the type info for argument.
*
* @param methodSignature - method signature handle
* @param index - argument index
*
* @return Return the type info for argument.
*/
TypeInfoHandle methodArgsGetTypeInfo(MethodSignatureHandle methodSignature, unsigned index);
/**
* Function returns the method argument list.
*
* @param method - method handle
*
* @return Return the method argument list.
*/
ArgListIterator methodGetArgumentList(MethodHandle method);
/**
* Function moves the iterator to the next argument in the list.
*
* @param iterator - argument list iterator
*
* @return Return the moved iterator.
*
* @note Replaces advanceArgIterator function.
*/
ArgListIterator methodAdvanceArgIterator(ArgListIterator iterator);
/**
* Function returns Java type of the argument pointed by the iterator.
*
* @param iterator - argument list iterator
*
* @return Return Java type of the argument.
*
* @note Replaces currArg function.
*/
JavaType methodCurrentArg(ArgListIterator iterator);
/**
* Function returns the method bytecode size.
*
* @param method - method handle
*
* @return Return the method bytecode size.
*
* @note Replaces methodGetCodeLength function.
*/
size_t methodGetBytecodeSize(MethodHandle method);
/*
* Function returns the method bytecode array.
*
* @param method - method handle
*
* @return Return the method bytecode array.
*
* @note Assertion is raised if method is equal to null.
* @note Reference to type Byte.
* @note Replaces methodGetBytecode function.
*/
const Byte * methodGetBytecodeAddr(MethodHandle method);
/**
* Function returns maximal local variables number of a given method.
*
* @param method - method handle
*
* @return Maximal local variables number of method.
*
* @note Assertion is raised if method is equal to null.
* @note Replaces methodGetMaxLocal and methodVarsGetNumber functions.
*/
unsigned short methodGetMaxLocals(MethodHandle method);
/**
* Function returns maximal stack deep of method.
*
* @param method - method handler
*
* @return Maximal stack deep of method.
*
* @note Assertion is raised if method is equal to null.
*/
unsigned short methodGetMaxStack(MethodHandle method);
/**
* Function returns the offset in bytes from the start of
* the vtable to the entry for a given method.
*
* @param method - method handler
*
* @return Return the offset in bytes from the start of the vtable
* to the entry for a given method.
*/
unsigned methodGetOffset(MethodHandle method);
/**
* Function return the address where the code pointer for a given method is.
* A simple JIT that doesn't support recompilation (see e.g.
* vmRegisterJitRecompiledMethodCallback) can only generate
* code with indirect branches through the address provided by
* methodGetIndirectAddress function.
*
* @param method - method handler
*
* @return Return the address where the code pointer for a given method is.
*/
void * methodGetIndirectAddress(MethodHandle method);
/**
* This function allows allocation of multiple chunks of code with different
* heat values. The JIT is responsible for specifying ids that are unique
* within the same method.
* The first instruction of the chunk with id=0 is the entry point of the method.
* If the CAAAllocate argument is specified, memory is allocated and a pointer
* to it is returned. If the CAASimulate argument is specified, no memory is
* actually allocated and the VM returns an address that would have been
* allocated if CAAAllocate was specified and all the other arguments were
* the same. The VM may return NULL when CAASimulate is specified. This may
* for instance happen if multiple heat values were mapped to the same code
* pool or if the specified size would require a new code pool.
*
* @param method - method handle
* @param jit - jit handle
* @param size - allocated code block size
* @param alignment - memory block aligment
* @param heat - ?
* @param id - ?
* @param action - result return action
*
* @return Pointer to allocated code block.
*
* @note Reference to type Byte.
*/
Byte * methodAllocateCodeBlock(Method_Handle method, JitHandle jit, size_t size,
size_t alignment, unsigned heat, int id,
CodeAllocationAction action);
/**
* Function allocates the "read-write" data block for this method.
* This memory block cannot be retrieved later. The intention is to
* use the data block for data that may be needed during the program
* execution (e.g. tables for switch statements).
*
* Separation of data allocated by methodAllocateDataBlock and
* methodAllocateInfoBlock may help improve locality of references
* to data accessed during execution of compiled code and data accessed during
* stack unwinding.
*
* @param method - method handle
* @param jit - jit handle
* @param size - allocated code block size
* @param alignment - memory block aligment
*
* @return Pointer to allocated data block.
*
* @note Reference to type Byte.
*
* @see methodAllocateInfoBlock
*/
Byte * methodAllocateDataBlock(MethodHandle method, JitHandle jit, size_t size,
size_t alignment);
/**
* Function allocates an info block for this method.
* An info block can be later retrieved by the JIT. The JIT may
* for instance store GC maps for root set enumeration and stack
* unwinding in the info block.
*
* @param method - method handle
* @param jit - jit handle
* @param size - allocated code block size
*
* @return Pointer to allocated info block.
*
* @note Reference to type Byte.
*
* @see methodAllocateDataBlock
*/
Byte * methodAllocateInfoBlock(MethodHandle method, JitHandle jit, size_t size);
/**
* Function retrieves the memory block allocated earlier by
* methodAllocateDataBlock function.
* A pair uniquely identifies a JIT info block.
*
* @param method - method handle
* @param jit - jit handle
*
* @return Pointer to allocated data block.
*
* @note Reference to type Byte.
*/
Byte * methodGetDataBlockJit(MethodHandle method, JitHandle jit);
/**
* Function retrieves the memory block allocated earlier by
* methodAllocateInfoBlock function.
* A pair uniquely identifies a JIT info block.
*
* @param method - method handle
* @param jit - jit handle
*
* @return Pointer to allocated info block.
*
* @note Reference to type Byte.
*/
Byte * methodGetInfoBlockJit(MethodHandle method, JitHandle jit);