Esempio n. 1
0
        public override ArmadaRValue GetRValue(IToken tok, ResolutionContext context)
        {
            var val            = $"({context.GetRValueTopStackFrame()}).{methodName}.{name}";
            var crashAvoidance = new UndefinedBehaviorAvoidanceConstraint();

            return(new ArmadaRValue(crashAvoidance, val));
        }
Esempio n. 2
0
 public void AddUBAvoidanceConstraintAsDefinedBehaviorConjunct(UndefinedBehaviorAvoidanceConstraint constraint)
 {
     foreach (var e in constraint.AsList)
     {
         validDefinedStepBuilder.AddConjunct(e);
     }
 }
Esempio n. 3
0
        public override ArmadaLValue GetLValue(IToken tok, ResolutionContext context)
        {
            var crashAvoidance = new UndefinedBehaviorAvoidanceConstraint();
            var addr           = $"({context.GetLValueTopStackFrame()}).{methodName}.AddrOf'{name}";

            return(new AddressableArmadaLValue(tok, ty, new ArmadaRValue(crashAvoidance, addr)));
        }
Esempio n. 4
0
        public override ArmadaRValue GetRValue(IToken tok, ResolutionContext context)
        {
            var top = context.GetRValueTopStackFrame();
            var correct_frame_type = AH.MakeExprDotName(top, $"Armada_StackFrame_{methodName}?", new BoolType());
            var crashAvoidance     = new UndefinedBehaviorAvoidanceConstraint(correct_frame_type);

            var addr = AH.MakeExprDotName(top, $"{methodName}'AddrOf'{name}", new PointerType(ty));

            var h = context.GetRValueHeap();

            var valid = AH.GetInvocationOfValidPointer(h, addr, ty);

            if (valid == null)
            {
                context.Fail(tok, "Type {ty} is not supported on the heap, and thus not for addressable stack variables either");
                return(null);
            }
            crashAvoidance.Add(valid);

            var val = AH.GetInvocationOfDereferencePointer(h, addr, ty);

            if (val == null)
            {
                context.Fail(tok, "Type {ty} is not supported on the heap, and thus not for addressable stack variables either");
            }
            return(new ArmadaRValue(crashAvoidance, val));
        }
Esempio n. 5
0
        public override ArmadaLValue GetLValue(IToken tok, ResolutionContext context)
        {
            var crashAvoidance = new UndefinedBehaviorAvoidanceConstraint();
            var varsVal        = new TopStackVarsArmadaLValue(crashAvoidance, methodName);

            return(new UnaddressableFieldArmadaLValue(tok, ty, varsVal, new UndefinedBehaviorAvoidanceConstraint(), name, 0, true));
        }
Esempio n. 6
0
 public UnaddressableIndexArmadaLValue(IToken i_tok, Type i_type, UnaddressableArmadaLValue i_parent,
                                       UndefinedBehaviorAvoidanceConstraint i_crashAvoidance, Expression i_index)
     : base(i_tok, i_type, i_crashAvoidance)
 {
     parent = i_parent;
     index  = i_index;
 }
Esempio n. 7
0
 public void AddConjunct(UndefinedBehaviorAvoidanceConstraint constraint)
 {
     foreach (var e in constraint.AsList)
     {
         AddConjunct(e);
     }
 }
Esempio n. 8
0
        public override ArmadaRValue GetRValue(IToken tok, ResolutionContext context)
        {
            var s     = context.GetRValueState();
            var addrs = AH.MakeExprDotName(s, "addrs", "Armada_Addrs");
            var addr  = AH.MakeExprDotName(addrs, name, new PointerType(ty));

            var h = context.GetRValueHeap();

            var valid = AH.GetInvocationOfValidPointer(h, addr, ty);

            if (valid == null)
            {
                context.Fail(tok, "Type {ty} is currently not supported in the heap");
                return(null);
            }
            var crashAvoidance = new UndefinedBehaviorAvoidanceConstraint(valid);

            var val = AH.GetInvocationOfDereferencePointer(h, addr, ty);

            if (val == null)
            {
                context.Fail(tok, "Type {ty} is currently not supported in the heap");
            }
            return(new ArmadaRValue(crashAvoidance, val));
        }
Esempio n. 9
0
        public static UndefinedBehaviorAvoidanceConstraint operator+(UndefinedBehaviorAvoidanceConstraint c1, string c2)
        {
            var ret = new UndefinedBehaviorAvoidanceConstraint(c1);

            ret.Add(c2);
            return(ret);
        }
Esempio n. 10
0
 public UnaddressableFieldArmadaLValue(IToken i_tok, Type i_type, UnaddressableArmadaLValue i_parent,
                                       UndefinedBehaviorAvoidanceConstraint i_crashAvoidance, string i_fieldName, bool i_noTSO)
     : base(i_tok, i_type, i_crashAvoidance)
 {
     parent    = i_parent;
     fieldName = i_fieldName;
     noTSO     = i_noTSO;
 }
Esempio n. 11
0
        public override ArmadaLValue GetLValue(IToken tok, ResolutionContext context)
        {
            var top = context.GetLValueTopStackFrame();
            var correct_frame_type = AH.MakeExprDotName(top, $"Armada_StackFrame_{methodName}?", new BoolType());
            var crashAvoidance     = new UndefinedBehaviorAvoidanceConstraint(correct_frame_type);

            return(new UnaddressableFieldArmadaLValue(tok, ty, new TopStackFrameArmadaLValue(crashAvoidance), crashAvoidance, $"{methodName}'{name}", true));
        }
Esempio n. 12
0
 public ArmadaRValue(UndefinedBehaviorAvoidanceConstraint i_crashAvoidance, Expression i_val, Type i_ty)
 {
     crashAvoidance = i_crashAvoidance;
     val            = i_val;
     if (val != null)
     {
         val = AH.SetExprType(val, i_ty);
     }
 }
Esempio n. 13
0
        public override ArmadaRValue GetRValue(IToken tok, ResolutionContext context)
        {
            var addr  = $"({context.GetRValueState()}).addrs.{name}";
            var h     = context.GetRValueHeap();
            var valid = AH.GetInvocationOfValidPointer(h, addr, ty);

            if (valid == null)
            {
                context.Fail(tok, $"Type {ty} is currently not supported in the heap");
                return(null);
            }
            var crashAvoidance = new UndefinedBehaviorAvoidanceConstraint(valid);

            var val = AH.GetInvocationOfDereferencePointer(h, addr, ty);

            if (val == null)
            {
                context.Fail(tok, $"Type {ty} is currently not supported in the heap");
            }
            return(new ArmadaRValue(crashAvoidance, val));
        }
Esempio n. 14
0
        public override ArmadaRValue GetRValue(IToken tok, ResolutionContext context)
        {
            var crashAvoidance = new UndefinedBehaviorAvoidanceConstraint();
            var addr           = $"({context.GetRValueTopStackFrame()}).{methodName}.AddrOf'{name}";
            var h = context.GetRValueHeap();

            var valid = AH.GetInvocationOfValidPointer(h, addr, ty);

            if (valid == null)
            {
                context.Fail(tok, $"Type {ty} is not supported on the heap, and thus not for addressable stack variables either");
                return(null);
            }
            crashAvoidance.Add(valid);

            var val = AH.GetInvocationOfDereferencePointer(h, addr, ty);

            if (val == null)
            {
                context.Fail(tok, $"Type {ty} is not supported on the heap, and thus not for addressable stack variables either");
            }
            return(new ArmadaRValue(crashAvoidance, val));
        }
Esempio n. 15
0
 public void Add(UndefinedBehaviorAvoidanceConstraint other)
 {
     Add(other.AsList);
 }
Esempio n. 16
0
 public TopStackVarsArmadaLValue(UndefinedBehaviorAvoidanceConstraint i_crashAvoidance, string i_methodName)
     : base(Token.NoToken, AH.ReferToType($"Armada_StackVars_{i_methodName}"), i_crashAvoidance)
 {
     methodName = i_methodName;
 }
Esempio n. 17
0
 public ArmadaRValueList()
 {
     crashAvoidance = new UndefinedBehaviorAvoidanceConstraint();
     vals           = new List <string>();
 }
Esempio n. 18
0
 public UndefinedBehaviorAvoidanceConstraint(UndefinedBehaviorAvoidanceConstraint other)
 {
     constraints = new List <string>(other.AsList);
 }
Esempio n. 19
0
 public ArmadaRValue(string i_val)
 {
     crashAvoidance = new UndefinedBehaviorAvoidanceConstraint();
     val            = i_val;
 }
Esempio n. 20
0
 public ArmadaRValue(UndefinedBehaviorAvoidanceConstraint i_crashAvoidance, string i_val)
 {
     Debug.Assert(i_crashAvoidance != null);
     crashAvoidance = i_crashAvoidance;
     val            = i_val;
 }
Esempio n. 21
0
 public UndefinedBehaviorAvoidanceConstraint(UndefinedBehaviorAvoidanceConstraint other)
 {
     constraints = new List <Expression>(other.AsList);
 }
Esempio n. 22
0
 public UnaddressableArmadaLValue(IToken i_tok, Type i_type, UndefinedBehaviorAvoidanceConstraint i_crashAvoidance) : base(i_tok, i_type)
 {
     crashAvoidance = i_crashAvoidance;
 }
Esempio n. 23
0
 public TopStackFrameArmadaLValue(UndefinedBehaviorAvoidanceConstraint i_crashAvoidance) : base(Token.NoToken, AH.ReferToType("Armada_StackFrame"), i_crashAvoidance)
 {
 }