overflow
Matthew Fluet
Matthew Fluet <fluet@CS.Cornell.EDU>
Wed, 20 Sep 2000 09:36:43 -0400 (EDT)
> I finished putting in overflow exceptions today. The main changes were to the
> CPS and Machine ILs. In both ILs primitive applications now have an additional
> PrimInfo field that looks like
>
> datatype t =
> None
> | Overflow of Label.t
>
> The label is where to jump to if the primitive overflows. In CPS it is a
> nullary continuation. In Machine, it is just a label to jump to.
Sounds good. Did you add in two types of arithmetic primitives (e.g. an
overflowing Int_add and a non-overflowing Int_add) or will every
arithmetic primitive have an overflow check?
Also, should the backend every see None for an arithmetic primitive?
I.e., is the label only for the cases when we know the handler to jump to
and the other cases use the default mechanism?
> Matthew, next time you're at a stable point, we should try to do a merge, and
> then you can add in overflow to the X86 backend. I think it will be easy.
O.k. Probably by the end of this week I should be at a stable point.
Adds, subtracts, multiplies, incs and decs all set the overflow bit, so a
jo instruction will suffice. Unfortunately, the overflow bit is only set
on 1 bit left and right shifts, so I'll have to do something different for
multiplications and divisions by powers of two.