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

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

public class HighToLowNonAtomicExpCompiler
extends ASTVisitor
implements IExpCompiler

Compiler to produce low-level BIR control points for evaluating expressions. The generated code permits interleavings during evaluation of subexpressions.

Another IExpCompiler (an instance of HighToLowAtomicExpCompiler) is used to generate more compact code whenever a subexpression of some AtomicExpmust be compiled.

.

Version:
CVS $Revision: 1.9 $ $Date: 2005/05/26 18:23:15 $
Author:
Matt Hoosier

Field Summary
protected  ExpBindingResolver bindingsResolver
          Installed only for duration of call to {@link #compileExp(HighToLowBIRCompiler, Exp).
protected  Wrapper<Boolean> expContainsAtomic
          Node that tells whether the presently compiled expression or a subexpression is atomic.
protected  IExpCompiler htlaec
          Persists for lifetime of object.
protected  HighToLowBIRCompiler htlbirc
          Installed for duration of call to {@link #compileExp(HighToLowBIRCompiler, Exp).
protected  Exp intermediateResult
          Node that holds result of a compiled expression.
protected  SymbolTable st
          Persists for lifetime of object.
 
Constructor Summary
HighToLowNonAtomicExpCompiler(SymbolTable st, IExpCompiler htlaec)
           
 
Method Summary
protected  Exp compileExp(Exp e, ExpBindingResolver ebr, Wrapper<Boolean> wentAtomic)
           
 Exp compileExp(HighToLowBIRCompiler htlbirc, Exp e, ExpBindingResolver ebr, Wrapper<Boolean> wentAtomic)
          Do a pre-order traversal which yields an expression containing a low-level BIR expression containing the evaluation of e.
protected  void visitApplyExp(ApplyExp node)
           
protected  void visitArrayAccessExp(ArrayAccessExp node)
           
protected  void visitAtomicExp(AtomicExp node)
           
protected  void visitBinaryExp(BinaryExp node)
           
protected  void visitCastExp(CastExp node)
           
protected  void visitConditionalExp(ConditionalExp node)
           
protected  void visitExtExp(ExtExp node)
           
protected  void visitFieldAccessExp(FieldAccessExp node)
           
protected  void visitIdExp(IdExp node)
           
protected  void visitInstanceofExp(InstanceofExp node)
           
protected  void visitInvokeExp(InvokeExp node)
           
protected  void visitKindofExp(KindofExp node)
           
protected  void visitLetExp(LetExp node)
           
protected  void visitLiteralExp(LiteralExp node)
           
protected  void visitLockTestExp(LockTestExp node)
           
protected  void visitNewArrayExp(NewArrayExp node)
           
protected  void visitNewLockExp(NewLockExp node)
           
protected  void visitNewRecordExp(NewRecordExp node)
           
protected  void visitParenExp(ParenExp node)
           
protected  void visitStartThreadExp(StartThreadExp node)
           
protected  void visitThreadTestExp(ThreadTestExp node)
           
protected  void visitUnaryExp(UnaryExp node)
           
 
Methods inherited from class edu.ksu.cis.projects.bogor.ast.ASTVisitor
visitActionExtension, visitActionStatement, visitAssertAction, visitAssignAction, visitAssumeAction, visitASTArrayType, visitASTBooleanType, visitASTDoubleType, visitASTExtType, visitASTFloatType, visitASTFunType, visitASTIntRangeType, visitASTIntType, visitASTLockType, visitASTLongRangeType, visitASTLongType, visitASTStringType, visitASTThreadIdType, visitAtomicActionStatement, visitAtomicStatement, visitBlockStatement, visitBlockTransformation, visitBooleanConstant, visitBooleanLiteral, visitCatch, visitChooseStatement, visitConstantDefinition, visitDoubleConstant, visitDoubleLiteral, visitEnumDefinition, visitExitThreadAction, visitExpAction, visitExpExtension, visitExtensionDefinition, visitField, visitFloatConstant, visitFloatLiteral, visitFSM, visitFun, visitGlobal, visitGotoNextState, visitIdPrintArg, visitIdType, visitIfStatement, visitInitialValue, visitIntConstant, visitIntLiteral, visitInvokeAction, visitInvokeTransformation, visitLiveSet, visitLocal, visitLocation, visitLockAction, visitLongConstant, visitLongLiteral, visitNullLiteral, visitParam, visitPrintAction, visitRecordDefinition, visitReturnNextState, visitReturnStatement, visitSkipStatement, visitStringConstant, visitStringLiteral, visitStringPrintArg, visitSystem, visitThrowAction, visitTryCatchStatement, visitTypeAliasDefinition, visitTypedId, visitTypeExtension, visitVirtualTableDefinition, visitWhileStatement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

st

protected SymbolTable st
Persists for lifetime of object.


htlaec

protected IExpCompiler htlaec
Persists for lifetime of object.


htlbirc

protected HighToLowBIRCompiler htlbirc
Installed for duration of call to {@link #compileExp(HighToLowBIRCompiler, Exp).


intermediateResult

protected Exp intermediateResult
Node that holds result of a compiled expression. Used to propagate results of a nested AST traversal back to calling scope.


bindingsResolver

protected ExpBindingResolver bindingsResolver
Installed only for duration of call to {@link #compileExp(HighToLowBIRCompiler, Exp).


expContainsAtomic

protected Wrapper<Boolean> expContainsAtomic
Node that tells whether the presently compiled expression or a subexpression is atomic.

Constructor Detail

HighToLowNonAtomicExpCompiler

public HighToLowNonAtomicExpCompiler(SymbolTable st,
                                     IExpCompiler htlaec)
Method Detail

compileExp

public Exp compileExp(HighToLowBIRCompiler htlbirc,
                      Exp e,
                      ExpBindingResolver ebr,
                      Wrapper<Boolean> wentAtomic)
Description copied from interface: IExpCompiler
Do a pre-order traversal which yields an expression containing a low-level BIR expression containing the evaluation of e.

Specified by:
compileExp in interface IExpCompiler
Parameters:
htlbirc - destination for new control points
e - high-level BIR expression to be translated
wentAtomic - container whose Wrapper.elementelement will be set to Boolean.TRUEif the BIR command sequence necessary to evaluate e enters an atomic block

compileExp

protected Exp compileExp(Exp e,
                         ExpBindingResolver ebr,
                         Wrapper<Boolean> wentAtomic)

visitApplyExp

protected void visitApplyExp(ApplyExp node)
Overrides:
visitApplyExp in class ASTVisitor

visitArrayAccessExp

protected void visitArrayAccessExp(ArrayAccessExp node)
Overrides:
visitArrayAccessExp in class ASTVisitor

visitAtomicExp

protected void visitAtomicExp(AtomicExp node)
Overrides:
visitAtomicExp in class ASTVisitor

visitBinaryExp

protected void visitBinaryExp(BinaryExp node)
Overrides:
visitBinaryExp in class ASTVisitor

visitCastExp

protected void visitCastExp(CastExp node)
Overrides:
visitCastExp in class ASTVisitor

visitConditionalExp

protected void visitConditionalExp(ConditionalExp node)
Overrides:
visitConditionalExp in class ASTVisitor

visitExtExp

protected void visitExtExp(ExtExp node)
Overrides:
visitExtExp in class ASTVisitor

visitFieldAccessExp

protected void visitFieldAccessExp(FieldAccessExp node)
Overrides:
visitFieldAccessExp in class ASTVisitor

visitIdExp

protected void visitIdExp(IdExp node)
Overrides:
visitIdExp in class ASTVisitor

visitInstanceofExp

protected void visitInstanceofExp(InstanceofExp node)
Overrides:
visitInstanceofExp in class ASTVisitor

visitInvokeExp

protected void visitInvokeExp(InvokeExp node)
Overrides:
visitInvokeExp in class ASTVisitor

visitKindofExp

protected void visitKindofExp(KindofExp node)
Overrides:
visitKindofExp in class ASTVisitor

visitLetExp

protected void visitLetExp(LetExp node)
Overrides:
visitLetExp in class ASTVisitor

visitLiteralExp

protected void visitLiteralExp(LiteralExp node)
Overrides:
visitLiteralExp in class ASTVisitor

visitLockTestExp

protected void visitLockTestExp(LockTestExp node)
Overrides:
visitLockTestExp in class ASTVisitor

visitNewArrayExp

protected void visitNewArrayExp(NewArrayExp node)
Overrides:
visitNewArrayExp in class ASTVisitor

visitNewLockExp

protected void visitNewLockExp(NewLockExp node)
Overrides:
visitNewLockExp in class ASTVisitor

visitNewRecordExp

protected void visitNewRecordExp(NewRecordExp node)
Overrides:
visitNewRecordExp in class ASTVisitor

visitParenExp

protected void visitParenExp(ParenExp node)
Overrides:
visitParenExp in class ASTVisitor

visitStartThreadExp

protected void visitStartThreadExp(StartThreadExp node)
Overrides:
visitStartThreadExp in class ASTVisitor

visitThreadTestExp

protected void visitThreadTestExp(ThreadTestExp node)
Overrides:
visitThreadTestExp in class ASTVisitor

visitUnaryExp

protected void visitUnaryExp(UnaryExp node)
Overrides:
visitUnaryExp in class ASTVisitor