edu.ksu.cis.projects.bogor.ast.transform
Class HighToLowBIRCompiler

java.lang.Object
  extended by edu.ksu.cis.projects.bogor.ast.ASTVisitor
      extended by edu.ksu.cis.projects.bogor.ast.transform.HighToLowBIRCompiler
All Implemented Interfaces:
ISystemTransformer

public class HighToLowBIRCompiler
extends ASTVisitor
implements ISystemTransformer

System transformer which convert a high-level, automatically sequenced statement-based FSMs into a low-level, location-based FSMs.

Version:
CVS $Revision: 1.15 $ $Date: 2005/06/09 00:21:50 $
Author:
Robby , Matt Hoosier

Field Summary
protected static String ANY_THROWABLE
           
protected static String ATOMIC
           
protected static String ATOMIC_CATCH_LOC_ID
           
protected static String ATOMIC_CATCH_LOCAL_ID
           
protected static String ATOMIC_IMODULE_CLASS
           
protected static String BEGIN_ATOMIC
           
protected  ArrayList<Catch> catches
           
protected static String END_ATOMIC
           
protected  ArrayList<FileMessage> errors
           
protected  boolean extHasBeginAtomic
           
protected  boolean extHasEndAtomic
           
protected  boolean foundAtomicExtDefinitions
           
protected  boolean fsmHasAtomic
           
protected  FSMSymbolTable fsmSt
           
protected  IExpCompiler htlaec
           
protected  IExpCompiler htlnaec
           
protected  boolean isInAtomic
           
protected static String LOC
           
protected  HashSet<String> localIds
           
protected  int localNum
           
protected  ArrayList<Local> locals
           
protected  int locDesc
           
protected  ArrayList<Location> locs
           
protected  SymbolTable st
           
protected  boolean systemAltered
           
protected  boolean systemHasAtomic
           
protected static String TEMP_LOCAL
           
protected  ArrayList<FileMessage> warnings
           
 
Constructor Summary
HighToLowBIRCompiler()
           
 
Method Summary
 void addCatch(Catch c)
           
 void addLocation(Location loc)
           
protected  void adjustSuperRecords(RecordDefinition node)
           
 boolean applicationIsInvocation(Exp node, String invokedId)
           
 Exp assignExpToNewLocal(Exp exp, ExpBindingResolver ebr, ASTType type)
           
protected  Exp compileExp(Exp exp)
          Return an expression which contains the final evaluation of exp, transformed to remove inline function application and respect the atomicity context of the current statment.
 ASTType getCalledConstructType(String invokedId)
           
 String newLocal(ASTType type)
           
 int newLocDesc()
           
 int peekNextLocDesc()
           
 ITransformSystemResult transformSystem(System ast, Properties configuration, IBogorConfiguration bc, SymbolTable st, boolean dryRun)
          Destructively update the syntax tree ast.
protected  void visitActionExtension(ActionExtension node)
           
protected  void visitActionStatement(ActionStatement node)
           
protected  void visitAssertAction(AssertAction node)
           
protected  void visitAssignAction(AssignAction node)
           
protected  void visitAssumeAction(AssumeAction node)
           
protected  void visitAtomicActionStatement(AtomicActionStatement node)
           
protected  void visitAtomicStatement(AtomicStatement node)
           
protected  void visitChooseStatement(ChooseStatement node)
           
protected  void visitExpAction(ExpAction node)
           
protected  void visitExtensionDefinition(ExtensionDefinition node)
           
protected  void visitFSM(FSM node)
           
protected  void visitIfStatement(IfStatement node)
           
protected  void visitInvokeAction(InvokeAction node)
           
protected  void visitReturnStatement(ReturnStatement node)
           
protected  void visitSystem(System node)
           
protected  void visitTryCatchStatement(TryCatchStatement node)
           
protected  void visitWhileStatement(WhileStatement node)
           
 
Methods inherited from class edu.ksu.cis.projects.bogor.ast.ASTVisitor
visitApplyExp, visitArrayAccessExp, visitASTArrayType, visitASTBooleanType, visitASTDoubleType, visitASTExtType, visitASTFloatType, visitASTFunType, visitASTIntRangeType, visitASTIntType, visitASTLockType, visitASTLongRangeType, visitASTLongType, visitASTStringType, visitASTThreadIdType, visitAtomicExp, visitBinaryExp, visitBlockStatement, visitBlockTransformation, visitBooleanConstant, visitBooleanLiteral, visitCastExp, visitCatch, visitConditionalExp, visitConstantDefinition, visitDoubleConstant, visitDoubleLiteral, visitEnumDefinition, visitExitThreadAction, visitExpExtension, visitExtExp, visitField, visitFieldAccessExp, visitFloatConstant, visitFloatLiteral, visitFun, visitGlobal, visitGotoNextState, visitIdExp, visitIdPrintArg, visitIdType, visitInitialValue, visitInstanceofExp, visitIntConstant, visitIntLiteral, visitInvokeExp, visitInvokeTransformation, visitKindofExp, visitLetExp, visitLiteralExp, visitLiveSet, visitLocal, visitLocation, visitLockAction, visitLockTestExp, visitLongConstant, visitLongLiteral, visitNewArrayExp, visitNewLockExp, visitNewRecordExp, visitNullLiteral, visitParam, visitParenExp, visitPrintAction, visitRecordDefinition, visitReturnNextState, visitSkipStatement, visitStartThreadExp, visitStringConstant, visitStringLiteral, visitStringPrintArg, visitThreadTestExp, visitThrowAction, visitTypeAliasDefinition, visitTypedId, visitTypeExtension, visitUnaryExp, visitVirtualTableDefinition
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOC

protected static final String LOC
See Also:
Constant Field Values

TEMP_LOCAL

protected static final String TEMP_LOCAL
See Also:
Constant Field Values

ATOMIC

protected static final String ATOMIC
See Also:
Constant Field Values

ATOMIC_IMODULE_CLASS

protected static final String ATOMIC_IMODULE_CLASS

BEGIN_ATOMIC

protected static final String BEGIN_ATOMIC
See Also:
Constant Field Values

END_ATOMIC

protected static final String END_ATOMIC
See Also:
Constant Field Values

ANY_THROWABLE

protected static final String ANY_THROWABLE
See Also:
Constant Field Values

ATOMIC_CATCH_LOC_ID

protected static final String ATOMIC_CATCH_LOC_ID
See Also:
Constant Field Values

ATOMIC_CATCH_LOCAL_ID

protected static final String ATOMIC_CATCH_LOCAL_ID
See Also:
Constant Field Values

st

protected SymbolTable st

fsmSt

protected FSMSymbolTable fsmSt

systemAltered

protected boolean systemAltered

errors

protected ArrayList<FileMessage> errors

warnings

protected ArrayList<FileMessage> warnings

locDesc

protected int locDesc

localNum

protected int localNum

locals

protected ArrayList<Local> locals

localIds

protected HashSet<String> localIds

locs

protected ArrayList<Location> locs

catches

protected ArrayList<Catch> catches

isInAtomic

protected boolean isInAtomic

fsmHasAtomic

protected boolean fsmHasAtomic

systemHasAtomic

protected boolean systemHasAtomic

extHasBeginAtomic

protected boolean extHasBeginAtomic

extHasEndAtomic

protected boolean extHasEndAtomic

foundAtomicExtDefinitions

protected boolean foundAtomicExtDefinitions

htlaec

protected IExpCompiler htlaec

htlnaec

protected IExpCompiler htlnaec
Constructor Detail

HighToLowBIRCompiler

public HighToLowBIRCompiler()
Method Detail

addCatch

public void addCatch(Catch c)

addLocation

public void addLocation(Location loc)

applicationIsInvocation

public boolean applicationIsInvocation(Exp node,
                                       String invokedId)

assignExpToNewLocal

public Exp assignExpToNewLocal(Exp exp,
                               ExpBindingResolver ebr,
                               ASTType type)

getCalledConstructType

public ASTType getCalledConstructType(String invokedId)
Returns:
null if the identifier refers to a function or virtual virtual whose type is void

newLocal

public String newLocal(ASTType type)

newLocDesc

public int newLocDesc()

peekNextLocDesc

public int peekNextLocDesc()

transformSystem

public ITransformSystemResult transformSystem(System ast,
                                              Properties configuration,
                                              IBogorConfiguration bc,
                                              SymbolTable st,
                                              boolean dryRun)
Description copied from interface: ISystemTransformer
Destructively update the syntax tree ast. Also modify the in-memory represention of the Bogor-configuration file (configuration), to remove old config data useful for the system before this transformation, and insert new configuration directives appropriate to the post-state.

Specified by:
transformSystem in interface ISystemTransformer
Parameters:
ast - the incoming syntax tree. This should be modified in-place.
configuration - the set of Bogor configuration options. These may be used both the retrieve settings necessary for the transformation, or updated to include new data relevant after the transformation.
bc - the Bogor environment. This should only be used for queries. No destructive updates should ever be performed on it.

visitSystem

protected void visitSystem(System node)
Overrides:
visitSystem in class ASTVisitor

visitExtensionDefinition

protected void visitExtensionDefinition(ExtensionDefinition node)
Overrides:
visitExtensionDefinition in class ASTVisitor

visitActionExtension

protected void visitActionExtension(ActionExtension node)
Overrides:
visitActionExtension in class ASTVisitor

visitFSM

protected void visitFSM(FSM node)
Overrides:
visitFSM in class ASTVisitor

visitActionStatement

protected void visitActionStatement(ActionStatement node)
Overrides:
visitActionStatement in class ASTVisitor

visitAtomicActionStatement

protected void visitAtomicActionStatement(AtomicActionStatement node)
Overrides:
visitAtomicActionStatement in class ASTVisitor

visitAtomicStatement

protected void visitAtomicStatement(AtomicStatement node)
Overrides:
visitAtomicStatement in class ASTVisitor

visitChooseStatement

protected void visitChooseStatement(ChooseStatement node)
Overrides:
visitChooseStatement in class ASTVisitor

visitIfStatement

protected void visitIfStatement(IfStatement node)
Overrides:
visitIfStatement in class ASTVisitor

visitReturnStatement

protected void visitReturnStatement(ReturnStatement node)
Overrides:
visitReturnStatement in class ASTVisitor

visitTryCatchStatement

protected void visitTryCatchStatement(TryCatchStatement node)
Overrides:
visitTryCatchStatement in class ASTVisitor

visitWhileStatement

protected void visitWhileStatement(WhileStatement node)
Overrides:
visitWhileStatement in class ASTVisitor

visitAssertAction

protected void visitAssertAction(AssertAction node)
Overrides:
visitAssertAction in class ASTVisitor

visitAssumeAction

protected void visitAssumeAction(AssumeAction node)
Overrides:
visitAssumeAction in class ASTVisitor

visitAssignAction

protected void visitAssignAction(AssignAction node)
Overrides:
visitAssignAction in class ASTVisitor

visitExpAction

protected void visitExpAction(ExpAction node)
Overrides:
visitExpAction in class ASTVisitor

visitInvokeAction

protected void visitInvokeAction(InvokeAction node)
Overrides:
visitInvokeAction in class ASTVisitor

adjustSuperRecords

protected void adjustSuperRecords(RecordDefinition node)

compileExp

protected Exp compileExp(Exp exp)
Return an expression which contains the final evaluation of exp, transformed to remove inline function application and respect the atomicity context of the current statment.