com.joanju.cg.bytecode
Class DefglobalInstr

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

public class DefglobalInstr
extends Bytecode

Record of a global variable.

These are not a record of a DEFINE statement in a compile unit, instead, these are a record of a shared variable in the application, and all its possible values. See DefsharedInstr for records of DEFINE...SHARED instructions.

All DefglobalInstr records have cuid==Layout.CUID_GLOBALS. The address is the string ID for the global variable's name.


Field Summary
 
Fields inherited from class com.joanju.cg.bytecode.Bytecode
address, cuid, instrSet, nodeNum, xrefs
 
Constructor Summary
DefglobalInstr()
           
DefglobalInstr(int cuid, int address)
           
 
Method Summary
 void addValue(int value)
           
 void addValues(java.util.Collection<java.lang.Integer> addedVals)
           
 void calcValueSets()
          Calculate the value sets for the instruction.
static DefglobalInstr fetchOrCreate(int nameID)
           
 Opcode getOpcode()
           
 java.util.HashSet<java.lang.Integer> getValues()
          Get the set of values for this instruction.
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.
 java.lang.String toStringFromName(InstructionSet instrs)
          Some subclasses should override this to return the string literal, var name, procedure name, etc.
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, getValuesCalcLocal, getWhereUsed, getXrefs, hashCode, initData, isDataModified, isFromDB, setAddress, setCuID, setDataBytesFromDB, setDataModified, setFromDB, setInstructionSet, setNodeNum, shouldLoadData, sourcesForXrefTarget, storeIfModified, toString, toStringFromSet
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefglobalInstr

public DefglobalInstr()

DefglobalInstr

public DefglobalInstr(int cuid,
                      int address)
Method Detail

addValue

public void addValue(int value)
              throws java.sql.SQLException,
                     java.io.IOException
Throws:
java.sql.SQLException
java.io.IOException

addValues

public void addValues(java.util.Collection<java.lang.Integer> addedVals)
               throws java.sql.SQLException,
                      java.io.IOException
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

fetchOrCreate

public static DefglobalInstr fetchOrCreate(int nameID)
                                    throws java.sql.SQLException,
                                           java.io.IOException
Throws:
java.sql.SQLException
java.io.IOException

getOpcode

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

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

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.

toStringFromName

public java.lang.String toStringFromName(InstructionSet instrs)
Description copied from class: Bytecode
Some subclasses should override this to return the string literal, var name, procedure name, etc.

Overrides:
toStringFromName 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.