示例#1
0
        public NextRoutineConstructor(Program i_prog, ArmadaSymbolTable i_symbols, NextType i_nextType, MethodInfo i_methodInfo,
                                      ArmadaStatement i_armadaStatement, Statement i_stmt, ArmadaPC i_startPC, ArmadaPC i_endPC)
        {
            prog     = i_prog;
            symbols  = i_symbols;
            nextType = i_nextType;
            validDefinedStepBuilder   = new PredicateBuilder(i_prog, true);
            validUndefinedStepBuilder = new PredicateBuilder(i_prog, false);
            getNextStateBuilder       = new ExpressionBuilder(i_prog);
            methodInfo      = i_methodInfo;
            method          = methodInfo == null ? null : methodInfo.method;
            armadaStatement = i_armadaStatement;
            stmt            = i_stmt;
            startPC         = i_startPC;
            endPC           = i_endPC;
            formals         = new List <NextFormal>();
            valid           = true;
            hasUndefinedBehaviorAvoidanceConstraint = false;
            definedBehaviorNextRoutine   = null;
            undefinedBehaviorNextRoutine = null;

            s     = ReserveVariableName("s");
            entry = ReserveVariableName("entry");
            tid   = ReserveVariableName("tid");
            t     = ReserveVariableName("t");
            locv  = ReserveVariableName("locv");

            if (startPC != null)
            {
                AddConjunct($"{t}.pc.{startPC}?");
                AddConjunct($"{t}.top.Armada_StackFrame_{startPC.methodName}?");

                if (methodInfo != null)
                {
                    var constraints = methodInfo.GetEnablingConstraintCollector(startPC);
                    if (constraints != null && !constraints.Empty)
                    {
                        AddConjunct($"Armada_EnablingConditions_{startPC}(s, tid)");
                    }
                }

                AddConjunct("Armada_UniversalStepConstraint(s, tid)");
            }
        }
示例#2
0
 public NextRoutine(Program i_prog, ArmadaSymbolTable i_symbols, NextType i_nextType, MethodInfo i_methodInfo,
                    ArmadaStatement i_armadaStatement, Statement i_stmt, ArmadaPC i_startPC, ArmadaPC i_endPC,
                    List <NextFormal> i_formals, string i_nameSuffix, bool i_undefinedBehavior, bool i_stopping)
 {
     prog              = i_prog;
     symbols           = i_symbols;
     nextType          = i_nextType;
     methodInfo        = i_methodInfo;
     armadaStatement   = i_armadaStatement;
     stmt              = i_stmt;
     startPC           = i_startPC;
     endPC             = i_endPC;
     formals           = new List <NextFormal>(i_formals);
     nameSuffix        = i_nameSuffix;
     undefinedBehavior = i_undefinedBehavior;
     stopping          = i_stopping;
 }