public override Expression UpdateTotalStateLocationDirectly(ResolutionContext context, IConstraintCollector constraintCollector, Expression val_new) { var s = context.GetLValueState(); var mem = AH.MakeExprDotName(s, "mem", "Armada_SharedMemory"); var h = AH.MakeExprDotName(mem, "heap", "Armada_Heap"); var valid = AH.GetInvocationOfValidPointer(h, address.Val, type); if (valid == null) { constraintCollector.Fail(tok, $"Type {type} is currently not supported in the heap"); } else { constraintCollector.AddUndefinedBehaviorAvoidanceConstraint(valid); } var h_new = AH.GetInvocationOfUpdatePointer(h, address.Val, val_new); if (h_new == null) { constraintCollector.Fail(tok, $"Type {type} is currently not supported in the heap"); } var mem_new = AH.MakeDatatypeUpdateExpr(mem, "heap", h_new); return(AH.MakeDatatypeUpdateExpr(s, "mem", mem_new)); }
public override string UpdateTotalStateLocationDirectly(ResolutionContext context, IConstraintCollector constraintCollector, string val_new) { var s = context.GetLValueState(); var h = $"({s}).mem.heap"; var valid = AH.GetInvocationOfValidPointer(h, address.Val, type); if (valid == null) { constraintCollector.Fail(tok, $"Type {type} is currently not supported in the heap"); } else { constraintCollector.AddUndefinedBehaviorAvoidanceConstraint(valid); } var h_new = AH.GetInvocationOfUpdatePointer(h, address.Val, val_new, type); if (h_new == null) { constraintCollector.Fail(tok, $"Type {type} is currently not supported in the heap"); } return($"{s}.(mem := {s}.mem.(heap := {h_new}))"); }