com.joanju.cg.bytecode
Class DefInstr

java.lang.Object
  extended by com.joanju.cg.bytecode.Bytecode
      extended by com.joanju.cg.bytecode.Assignment
          extended by com.joanju.cg.bytecode.DefInstr

public class DefInstr
extends Assignment

Record of some sort of assignment to an l-value.

Also see PopInstr for values that come out of calls. DefInstr records are used:


Field Summary
 
Fields inherited from class com.joanju.cg.bytecode.Assignment
userScriptSourceAddress
 
Fields inherited from class com.joanju.cg.bytecode.Bytecode
address, cuid, instrSet, nodeNum, xrefs
 
Constructor Summary
DefInstr()
           
DefInstr(int cuid, int address)
           
 
Method Summary
 void calcValueSets()
          Calculate the value sets for the instruction.
 int getLVal()
          Get the address of the var def.
 int getNodeNum()
          Get the node number for the Field_ref node for a DefInstr record.
 Opcode getOpcode()
           
 int getRVal()
          Get the address of the r-value source.
 java.util.HashSet<java.lang.Integer> getValues()
          Get the set of values for this instruction.
 java.util.HashSet<java.lang.Integer> getWhereUsed()
          Returns null.
 void setLVal(int addr)
          Set with the address of the var def.
 void setRVal(int val)
           
protected  void setValuesFromByteStream(java.io.DataInputStream in)
           
 java.lang.String toStringFromComments(InstructionSet instrs)
          All Bytecode instruction subclasses should override this eventually.
 java.lang.String toStringFromData()
          All Bytecode instruction subclasses should override this eventually.
protected  void writeValuesToByteStream(java.io.DataOutputStream out)
           
 
Methods inherited from class com.joanju.cg.bytecode.Assignment
getUserScriptSource, setUserScriptSource
 
Methods inherited from class com.joanju.cg.bytecode.Bytecode
addSource, addWhereUsed, beforeWrite, calcValuesAgain, compareTo, equals, fetchBytesFromDB, fetchInCu, generateDataForDB, getAddress, getCuID, getSources, getValuesCalcLocal, getXrefs, hashCode, initData, isDataModified, isFromDB, setAddress, setCuID, setDataBytesFromDB, setDataModified, setFromDB, setInstructionSet, setNodeNum, shouldLoadData, sourcesForXrefTarget, storeIfModified, toString, toStringFromName, toStringFromSet
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefInstr

public DefInstr()

DefInstr

public DefInstr(int cuid,
                int address)
Method Detail

calcValueSets

public void calcValueSets()
                   throws java.sql.SQLException,
                          java.io.IOException
Description copied from class: Bytecode
Calculate the value sets for the instruction.

Called during build, build-recalc, checkvals, and checkvals-recalc. Implementations should only build from external values once. Calculates which xref records are needed as well.

IMPORTANT: Should only ever be called for instructions belonging to an InstructionSet.

Specified by:
calcValueSets in class Bytecode
Throws:
java.sql.SQLException
java.io.IOException

getLVal

public int getLVal()
            throws java.sql.SQLException,
                   java.io.IOException
Get the address of the var def.

Throws:
java.sql.SQLException
java.io.IOException

getNodeNum

public int getNodeNum()
Get the node number for the Field_ref node for a DefInstr record. See the notes for the DefInstr class for where DefInstr records are used.

Overrides:
getNodeNum in class Bytecode

getOpcode

public Opcode getOpcode()
Specified by:
getOpcode in class Bytecode

getRVal

public int getRVal()
            throws java.sql.SQLException,
                   java.io.IOException
Get the address of the r-value source.

Throws:
java.sql.SQLException
java.io.IOException

getValues

public java.util.HashSet<java.lang.Integer> getValues()
                                               throws java.sql.SQLException,
                                                      java.io.IOException
Description copied from class: Bytecode
Get the set of values for this instruction. Should be overridden by most subclasses. This default implementation returns a set containing one Layout.UNRESOLVED_VALUE.

Overrides:
getValues in class Bytecode
Throws:
java.sql.SQLException
java.io.IOException

getWhereUsed

public java.util.HashSet<java.lang.Integer> getWhereUsed()
                                                  throws java.sql.SQLException,
                                                         java.io.IOException
Description copied from class: Bytecode
Returns null. May be overridden by subclasses.

Overrides:
getWhereUsed in class Bytecode
Throws:
java.sql.SQLException
java.io.IOException

setLVal

public void setLVal(int addr)
Set with the address of the var def.


setRVal

public void setRVal(int val)

setValuesFromByteStream

protected void setValuesFromByteStream(java.io.DataInputStream in)
                                throws java.io.IOException
Specified by:
setValuesFromByteStream in class Bytecode
Throws:
java.io.IOException

toStringFromComments

public java.lang.String toStringFromComments(InstructionSet instrs)
Description copied from class: Bytecode
All Bytecode instruction subclasses should override this eventually.

Overrides:
toStringFromComments in class Bytecode
Returns:
"" if not overridden.

toStringFromData

public java.lang.String toStringFromData()
Description copied from class: Bytecode
All Bytecode instruction subclasses should override this eventually.

Overrides:
toStringFromData in class Bytecode
Returns:
"" if not overridden.

writeValuesToByteStream

protected void writeValuesToByteStream(java.io.DataOutputStream out)
                                throws java.io.IOException
Specified by:
writeValuesToByteStream in class Bytecode
Throws:
java.io.IOException


Copyright © 2008 Joanju Software. All Rights Reserved.