Overflow exception

Matthew Fluet fluet@CS.Cornell.EDU
Wed, 13 Sep 2000 15:29:21 -0400 (EDT)


> Actually, my current thinking is to add a new Statement.t to MachineOutput.
> Something like
> 
>   datatype intCheck = Add | Sub | Mul
>   datatype Statement.t = ... | IntCheck of {oper: intCheck, 
> 					    dst: Operand.t (* option? *),
> 					    arg1: Operand.t,
> 					    arg2: Operand.t,
> 					    overflow: Label.t}
> 
> 
> The idea is an IntCheck performs the operation, and if there is an overflow,
> does a nearjump to the overflow label (which will do the appropriate local jump
> or generic raise).  That way, the backends don't need to know anything about the
> exception convention, and we can do different things at different places if we
> need.
> 
> If this looks reasonable, lemme know, and I'll start on it.

That seems like a somewhat heavyweight change.  Why not change the
definitions of Assign and SideEffect to carry the overflow label?  Or,
again looking for future expansions, make an exceptionInfo datatype (just
an {overflow: Label.t} record for now) and pass that to Assign and
SideEffect.