com.joanju.cg.bytecode
Class CompileunitInstr

java.lang.Object
  extended by com.joanju.cg.bytecode.Bytecode
      extended by com.joanju.cg.bytecode.CompileunitInstr

public class CompileunitInstr
extends Bytecode


Field Summary
 
Fields inherited from class com.joanju.cg.bytecode.Bytecode
address, cuid, instrSet, nodeNum, xrefs
 
Constructor Summary
CompileunitInstr()
           
CompileunitInstr(int cuid)
          The application should use this constructor.
CompileunitInstr(int cuid, int address)
          This gets called when extracting bytecodes from the DB.
 
Method Summary
 int addActiveNewProcID(int nameId)
           
 void calcValueSets()
          Calculate the value sets for the instruction.
 int codegenNextTriggerAddress()
           
 void copyProcIDs(java.lang.Object obj)
          Copy obj's ProcIDs into this object.
 java.util.ArrayList<java.lang.Integer> getActiveProcIds()
          Get a list of active procedure name IDs within this compile unit.
 java.util.ArrayList<int[]> getActiveProcIdsWithAddress()
          Get a list of active procedure name IDs, with their address: {procnameID, procAddress}.
 short getLayoutVersion()
           
 Opcode getOpcode()
           
 int getProcAddressOrStub(int procNameID)
          Used during cross referencing.
 long getTimeStamp()
           
 int lookupActiveProcedureAddress(int procNameID)
          Lookup the address for an active local procedure matching an input name ID.
 int lookupProcedureAddress(int procNameID)
          Lookup the address for a local procedure matching an input name ID.
 void setLayoutVersion(short layoutVersion)
           
 void setTimeStamp(long timeStamp)
           
protected  void setValuesFromByteStream(java.io.DataInputStream in)
           
protected  void writeValuesToByteStream(java.io.DataOutputStream out)
           
 
Methods inherited from class com.joanju.cg.bytecode.Bytecode
addSource, addWhereUsed, beforeWrite, calcValuesAgain, compareTo, equals, fetchBytesFromDB, fetchInCu, generateDataForDB, getAddress, getCuID, getNodeNum, getSources, getValues, getValuesCalcLocal, getWhereUsed, getXrefs, hashCode, initData, isDataModified, isFromDB, setAddress, setCuID, setDataBytesFromDB, setDataModified, setFromDB, setInstructionSet, setNodeNum, shouldLoadData, sourcesForXrefTarget, storeIfModified, toString, toStringFromComments, toStringFromData, toStringFromName, toStringFromSet
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CompileunitInstr

public CompileunitInstr()

CompileunitInstr

public CompileunitInstr(int cuid)
The application should use this constructor. The address for a compileunit instruction is set by com.joanju.cg.core.Layout.


CompileunitInstr

public CompileunitInstr(int cuid,
                        int address)
This gets called when extracting bytecodes from the DB.

Method Detail

addActiveNewProcID

public int addActiveNewProcID(int nameId)
                       throws java.sql.SQLException,
                              java.io.IOException
Returns:
The address for this newly added procedure.
Throws:
java.sql.SQLException
java.io.IOException

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

codegenNextTriggerAddress

public int codegenNextTriggerAddress()
                              throws java.sql.SQLException,
                                     java.io.IOException
Throws:
java.sql.SQLException
java.io.IOException

copyProcIDs

public void copyProcIDs(java.lang.Object obj)
                 throws java.sql.SQLException,
                        java.io.IOException
Copy obj's ProcIDs into this object. Checks for null class cast.

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

getActiveProcIds

public java.util.ArrayList<java.lang.Integer> getActiveProcIds()
                                                        throws java.sql.SQLException,
                                                               java.io.IOException
Get a list of active procedure name IDs within this compile unit.

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

getActiveProcIdsWithAddress

public java.util.ArrayList<int[]> getActiveProcIdsWithAddress()
                                                       throws java.sql.SQLException,
                                                              java.io.IOException
Get a list of active procedure name IDs, with their address: {procnameID, procAddress}.

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

getLayoutVersion

public short getLayoutVersion()
                       throws java.sql.SQLException,
                              java.io.IOException
Throws:
java.sql.SQLException
java.io.IOException

getOpcode

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

getProcAddressOrStub

public int getProcAddressOrStub(int procNameID)
                         throws java.sql.SQLException,
                                java.io.IOException
Used during cross referencing. Returns a procedure address. If there is no procedure bytecode instruction at the address, then it is considered a "stub". The "stub" is added if it is not already there.

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

getTimeStamp

public long getTimeStamp()
                  throws java.sql.SQLException,
                         java.io.IOException
Throws:
java.sql.SQLException
java.io.IOException

lookupActiveProcedureAddress

public int lookupActiveProcedureAddress(int procNameID)
                                 throws java.sql.SQLException,
                                        java.io.IOException
Lookup the address for an active local procedure matching an input name ID.

Returns:
Zero if not found or not active.
Throws:
java.sql.SQLException
java.io.IOException

lookupProcedureAddress

public int lookupProcedureAddress(int procNameID)
                           throws java.sql.SQLException,
                                  java.io.IOException
Lookup the address for a local procedure matching an input name ID. Ignores whether the procedure is active or not.

Returns:
Zero if not found.
Throws:
java.sql.SQLException
java.io.IOException

setLayoutVersion

public void setLayoutVersion(short layoutVersion)

setTimeStamp

public void setTimeStamp(long timeStamp)

setValuesFromByteStream

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

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.