com.joanju.cg.bytecode
Class SupersInstr

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

public class SupersInstr
extends Bytecode


Field Summary
 
Fields inherited from class com.joanju.cg.bytecode.Bytecode
address, cuid, instrSet, nodeNum, xrefs
 
Constructor Summary
SupersInstr()
           
SupersInstr(int cuid, int address)
           
 
Method Summary
 void addLocalAddSuperSite(int siteAddress)
          Called by the codegenerator at every addsuper in this CU.
 void beforeWrite(boolean isNewBuild)
          Called when a build or checkval is done processing a CU, before writing the new/changed records.
 void calcValueSets()
          Calculate the value sets for the instruction.
 java.util.HashMap<java.lang.Integer,java.util.HashSet<int[]>> generateProcname2localSuperSet()
          Generate a map of procnameIDs to super procedure addresses.
 Opcode getOpcode()
           
 java.util.HashSet<java.lang.Integer> getSearchTargetValues()
          Get the SEARCH-TARGET CUIDs.
 java.util.HashSet<java.lang.Integer> getSelfAndSearchTargetSupers()
          If RUN SUPER or SUPER() is called from this procedure, then we need a set of all possible target super CUs.
 java.util.HashSet<java.lang.Integer> getSuperCUValues()
           
 boolean hasSuperCUValue(int superCuid)
          Is the input CUID already in this CU's superCUValues set?
protected  void setValuesFromByteStream(java.io.DataInputStream in)
           
 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.Bytecode
addSource, addWhereUsed, 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, toStringFromName, toStringFromSet
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SupersInstr

public SupersInstr()

SupersInstr

public SupersInstr(int cuid,
                   int address)
Method Detail

addLocalAddSuperSite

public void addLocalAddSuperSite(int siteAddress)
                          throws java.sql.SQLException,
                                 java.io.IOException
Called by the codegenerator at every addsuper in this CU.

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

beforeWrite

public void beforeWrite(boolean isNewBuild)
                 throws java.sql.SQLException,
                        java.io.IOException
Description copied from class: Bytecode
Called when a build or checkval is done processing a CU, before writing the new/changed records. This base class implementation is a no-op.

Overrides:
beforeWrite in class Bytecode
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

generateProcname2localSuperSet

public java.util.HashMap<java.lang.Integer,java.util.HashSet<int[]>> generateProcname2localSuperSet()
                                                                                             throws java.sql.SQLException,
                                                                                                    java.io.IOException
Generate a map of procnameIDs to super procedure addresses.

Returns:
A map of procnameID to procedure addresses of the form int[]{cuid,procAddress}. The return may be empty but it is never null.
Throws:
java.sql.SQLException
java.io.IOException

getOpcode

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

getSelfAndSearchTargetSupers

public java.util.HashSet<java.lang.Integer> getSelfAndSearchTargetSupers()
                                                                  throws java.sql.SQLException,
                                                                         java.io.IOException
If RUN SUPER or SUPER() is called from this procedure, then we need a set of all possible target super CUs.

The set of possible target CUs is the union of this unit's superCUValues, as well as the superCUValues of all of the CUs in this unit's searchTargetValues.

Super procedure chain searching is not recursive (supers of supers are not added to the set).

The return set is guaranteed not to include this unit's CUID.

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

getSuperCUValues

public java.util.HashSet<java.lang.Integer> getSuperCUValues()
                                                      throws java.sql.SQLException,
                                                             java.io.IOException
Throws:
java.sql.SQLException
java.io.IOException

getSearchTargetValues

public java.util.HashSet<java.lang.Integer> getSearchTargetValues()
                                                           throws java.sql.SQLException,
                                                                  java.io.IOException
Get the SEARCH-TARGET CUIDs.

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

hasSuperCUValue

public boolean hasSuperCUValue(int superCuid)
                        throws java.sql.SQLException,
                               java.io.IOException
Is the input CUID already in this CU's superCUValues set?

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

setValuesFromByteStream

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

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.