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 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 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)); }