Class MethodInfo

java.lang.Object
  |
  +--JavaElement
        |
        +--MethodInfo

class MethodInfo
extends JavaElement
implements JVM


Field Summary
(package private)  int access_flags
           
(package private)  AttributeTable attributes
           
(package private)  Klass cls
           
(package private)  java.util.Vector dependencies
          for native methods, the fields / methods / classes it uses / calls / instantiates.
(package private)  MethodInfo effectiveMethod
          If 'this' method is 'needed_virtually', this field can hold the effective method for virtual invocations if it is always the same method in all possible cases (this 'invokevirtual' needs no virtual function table).
(package private)  boolean effectiveMethodComputed
          flag: has effective method been computed?
(package private)  GenericMethod genericMethod
          the generic method that this method belongs to.
(package private)  int methodIndex
          the (globally unique) index of this needed method.
(package private)  java.lang.String name
           
(package private)  java.lang.Object nativeRef
          reference to a native implementation of this method.
(package private)  ConstantPool pool
           
(package private)  java.lang.String signature
           
(package private)  int vtableIndex
          This method's index in virtual function tables.
 
Fields inherited from class JavaElement
EXACT_INSTANCE_NEEDED, INSTANCE_NEEDED, NEEDED, NEEDED_INSTANCEOF, NEEDED_VIRTUALLY, neededModeAddOn, neededModeBasic, neededReasons, UNNEEDED
 
Constructor Summary
(package private) MethodInfo(Klass cls, ConstantPool pool, java.io.DataInput in)
          create a MethodInfo from a section of a class file.
 
Method Summary
(package private)  int argStackSize()
          the stack size (in 32-bit-units) needed for the method arguments.
(package private)  java.lang.String fullName()
          full name of this method (package/class.method(args)result).
(package private)  java.lang.String genericName()
          generic name of this method (method(args)result).
(package private)  MethodInfo getEffectiveMethod()
          check whether this 'neededVirtual' method has a single effective method for all possible cases.
(package private)  void makeNative(java.lang.Object nativeRef, java.util.Vector dependencies)
          add a native implementation to this method.
(package private)  void markBytecodesUsed(boolean[] bytecodesUsed)
          marks the bytecodes used in this method.
(package private)  void report()
          print to System.out a readable description of this method.
(package private)  java.lang.String returnType()
          the return-type signature.
(package private)  java.lang.String shortLabel()
          the short label of this method.
(package private)  java.lang.String shortName()
          short name of this method (package/class.method).
 java.lang.String toString()
          the full name of this method, prefixed by "Method ".
(package private)  void updateNeeded()
          update the 'needed' state of this method and related elements.
(package private)  void write(java.io.DataOutput out)
          write this method to a classfile.
 
Methods inherited from class JavaElement
isNeeded, isNeeded, markNeeded
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

cls

Klass cls

pool

ConstantPool pool

access_flags

int access_flags

attributes

AttributeTable attributes

name

java.lang.String name

signature

java.lang.String signature

nativeRef

java.lang.Object nativeRef
reference to a native implementation of this method. Details are visible only to the appropriate back-end. If 'nativeRef' is non-null, JVM bytecode for this method is ignored.

dependencies

java.util.Vector dependencies
for native methods, the fields / methods / classes it uses / calls / instantiates.

genericMethod

GenericMethod genericMethod
the generic method that this method belongs to.

effectiveMethod

MethodInfo effectiveMethod
If 'this' method is 'needed_virtually', this field can hold the effective method for virtual invocations if it is always the same method in all possible cases (this 'invokevirtual' needs no virtual function table). Otherwise, the field is 'null'. The 'effective method' is not necessarily 'this' method. If non-null, an invokevirtual call of 'this' method can be compiled to a non-virtual call of the 'effective method'.

effectiveMethodComputed

boolean effectiveMethodComputed
flag: has effective method been computed?

vtableIndex

int vtableIndex
This method's index in virtual function tables. For class methods, a pointer to the method can always be found at this index in the vtable of all classes containing this method. For interface methods, it's more complicated. For every interface / implementing class pair, we find a vtable offset in the interface data structures. Adding this offset to the method's index, we get the index into the vtable. So, the vtable layout of a class begins with the inherited vtable of the superclass, then contains extensions for its own methods, then has a section for the first interface's methods, then for the second, and so on. If there are no virtual calls to this method, the index is -1. It is no contradiction to have both, an 'effective method' and a 'vtable index'.

methodIndex

int methodIndex
the (globally unique) index of this needed method. Unneeded methods have -1.
Constructor Detail

MethodInfo

MethodInfo(Klass cls,
           ConstantPool pool,
           java.io.DataInput in)
     throws java.io.IOException
create a MethodInfo from a section of a class file. The MethodInfo is filled by reading from a stream. On entry, the stream is positioned to the beginning of the 'method_info' structure. The method leaves the stream positioned immediately after the end of this structure.
Parameters:
cls - description of the defining class
pool - the constant pool - already read from the class file
in - the stream to read exactly 1 'method_info' structure from
Method Detail

makeNative

void makeNative(java.lang.Object nativeRef,
                java.util.Vector dependencies)
add a native implementation to this method. This call also registers the native implementation's dependencies:
Parameters:
nativeRef - a reference to the implementation, to be used by the back-end.
dependencies - a vector of fields, methods and classes used in the native implementation.

write

void write(java.io.DataOutput out)
     throws java.io.IOException
write this method to a classfile.

updateNeeded

void updateNeeded()
update the 'needed' state of this method and related elements.
Overrides:
updateNeeded in class JavaElement

markBytecodesUsed

void markBytecodesUsed(boolean[] bytecodesUsed)
marks the bytecodes used in this method.

getEffectiveMethod

MethodInfo getEffectiveMethod()
check whether this 'neededVirtual' method has a single effective method for all possible cases. If so, return that method, otherwise, return null.

shortLabel

java.lang.String shortLabel()
the short label of this method.

shortName

java.lang.String shortName()
short name of this method (package/class.method).

genericName

java.lang.String genericName()
generic name of this method (method(args)result).

fullName

java.lang.String fullName()
full name of this method (package/class.method(args)result).

toString

public java.lang.String toString()
the full name of this method, prefixed by "Method ".
Overrides:
toString in class java.lang.Object

argStackSize

int argStackSize()
the stack size (in 32-bit-units) needed for the method arguments. The instance ('this' object) is not counted.

returnType

java.lang.String returnType()
the return-type signature.

report

void report()
print to System.out a readable description of this method.