public override ArmadaRValue GetRValue(IToken tok, ResolutionContext context) { var val = $"({context.GetRValueTopStackFrame()}).{methodName}.{name}"; var crashAvoidance = new UndefinedBehaviorAvoidanceConstraint(); return(new ArmadaRValue(crashAvoidance, val)); }
public void AddUBAvoidanceConstraintAsDefinedBehaviorConjunct(UndefinedBehaviorAvoidanceConstraint constraint) { foreach (var e in constraint.AsList) { validDefinedStepBuilder.AddConjunct(e); } }
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))); }
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)); }
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)); }
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; }
public void AddConjunct(UndefinedBehaviorAvoidanceConstraint constraint) { foreach (var e in constraint.AsList) { AddConjunct(e); } }
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)); }
public static UndefinedBehaviorAvoidanceConstraint operator+(UndefinedBehaviorAvoidanceConstraint c1, string c2) { var ret = new UndefinedBehaviorAvoidanceConstraint(c1); ret.Add(c2); return(ret); }
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; }
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)); }
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); } }
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)); }
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)); }
public void Add(UndefinedBehaviorAvoidanceConstraint other) { Add(other.AsList); }
public TopStackVarsArmadaLValue(UndefinedBehaviorAvoidanceConstraint i_crashAvoidance, string i_methodName) : base(Token.NoToken, AH.ReferToType($"Armada_StackVars_{i_methodName}"), i_crashAvoidance) { methodName = i_methodName; }
public ArmadaRValueList() { crashAvoidance = new UndefinedBehaviorAvoidanceConstraint(); vals = new List <string>(); }
public UndefinedBehaviorAvoidanceConstraint(UndefinedBehaviorAvoidanceConstraint other) { constraints = new List <string>(other.AsList); }
public ArmadaRValue(string i_val) { crashAvoidance = new UndefinedBehaviorAvoidanceConstraint(); val = i_val; }
public ArmadaRValue(UndefinedBehaviorAvoidanceConstraint i_crashAvoidance, string i_val) { Debug.Assert(i_crashAvoidance != null); crashAvoidance = i_crashAvoidance; val = i_val; }
public UndefinedBehaviorAvoidanceConstraint(UndefinedBehaviorAvoidanceConstraint other) { constraints = new List <Expression>(other.AsList); }
public UnaddressableArmadaLValue(IToken i_tok, Type i_type, UndefinedBehaviorAvoidanceConstraint i_crashAvoidance) : base(i_tok, i_type) { crashAvoidance = i_crashAvoidance; }
public TopStackFrameArmadaLValue(UndefinedBehaviorAvoidanceConstraint i_crashAvoidance) : base(Token.NoToken, AH.ReferToType("Armada_StackFrame"), i_crashAvoidance) { }