byucc.jhdl.synth.classparse
Class AttributeCode

java.lang.Object
  extended bybyucc.jhdl.synth.classparse.ClassFileParser
      extended bybyucc.jhdl.synth.classparse.AttributeInfo
          extended bybyucc.jhdl.synth.classparse.AttributeCode

public class AttributeCode
extends AttributeInfo


Field Summary
 
Fields inherited from class byucc.jhdl.synth.classparse.AttributeInfo
attribute_name
 
Fields inherited from class byucc.jhdl.synth.classparse.ClassFileParser
CONSTANT_Class, CONSTANT_Double, CONSTANT_Fieldref, CONSTANT_Float, CONSTANT_Integer, CONSTANT_InterfaceMethodref, CONSTANT_Long, CONSTANT_Methodref, CONSTANT_NameAndType, CONSTANT_String, CONSTANT_Utf8
 
Constructor Summary
AttributeCode(MethodInfo parent, int name_index)
           
 
Method Summary
 void execute(VirtualMachine vm)
           
 BasicBlock[] findBasicBlocks(VirtualMachine vm)
           
 OpCode[] getCode()
           
 OpCode getInstructionAtIndex(int index)
           
 OpCode getInstructionByPC(int pc)
           
 int getInstructionIndexByPC(int pc)
          Get the index of the instruction that has the given PC value.
 java.lang.String getLocalVariableName(int pc, int index)
           
 AttributeLocalVariableTable getLocalVariables()
           
 java.lang.String getLocalVariableType(int index)
           
 int length()
           
 void resolveTargets()
           
 void toClass(ClassFileWriter output)
          Spit out the contents of this AttributeCode to the given ClassFileWriter.
 java.lang.StringBuffer toJasmin(java.lang.StringBuffer result)
           
 java.lang.String toString()
           
 
Methods inherited from class byucc.jhdl.synth.classparse.ClassFileParser
getClassFile, getConstantPool, parseAttributeInfo, parseAttributes, parseConstantPool, parseCPInfo, parseDouble, parseFieldInfo, parseFields, parseFloat, parseLong, parseMethodInfo, parseMethods, parseOpCode, parseSuccess, parseUTF, s2, toJasmin, u1, u2, u4
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AttributeCode

public AttributeCode(MethodInfo parent,
                     int name_index)
Method Detail

toClass

public void toClass(ClassFileWriter output)
Spit out the contents of this AttributeCode to the given ClassFileWriter. This method is basically the opposite of the constructor. The constructor reads in a AttributeCode from a DataInputStream and this method spits the AttributeCode out to a DataOutputStream, (which is in the ClassFileWriter).

Overrides:
toClass in class AttributeInfo
Parameters:
output - a ClassFileWriter constructed with a DataOutputStram to contain the output class file.

length

public int length()
Overrides:
length in class ClassFileParser

resolveTargets

public void resolveTargets()

getInstructionByPC

public OpCode getInstructionByPC(int pc)

getInstructionIndexByPC

public int getInstructionIndexByPC(int pc)
Get the index of the instruction that has the given PC value. If the given PC value is beyond the end of the code in this method, then return the index of the last valid OPCode within this method. The reason we do this is that the values of the indices from the LocalVariableTable sometimes extend beyond the last PC in the method. Here's the relevant section of the documentation of the LocalVariableTable: start_pc, length The given local variable must have a value at indices into the code array in the interval [start_pc, start_pc+length], that is, between start_pc and start_pc+length inclusive. The value of start_pc must be a valid index into the code array of this Code attribute and must be the index of the opcode of an instruction. Either the value of start_pc+length must be a valid index into the code array of this Code attribute and be the index of the opcode of an instruction, or it must be the first index beyond the end of that code array. (Java Language Specification)


getInstructionAtIndex

public OpCode getInstructionAtIndex(int index)

toString

public java.lang.String toString()

toJasmin

public java.lang.StringBuffer toJasmin(java.lang.StringBuffer result)
Overrides:
toJasmin in class AttributeInfo

execute

public void execute(VirtualMachine vm)

findBasicBlocks

public BasicBlock[] findBasicBlocks(VirtualMachine vm)

getLocalVariables

public AttributeLocalVariableTable getLocalVariables()

getLocalVariableName

public java.lang.String getLocalVariableName(int pc,
                                             int index)

getCode

public OpCode[] getCode()

getLocalVariableType

public java.lang.String getLocalVariableType(int index)


Copyright ? 2006 Brigham Young University, Configurable Computing Laboratory. All Rights Reserved.