[MLton-devel] detecting overflow with the C codegen

Stephen Weeks MLton@mlton.org
Thu, 21 Nov 2002 14:25:06 -0800


> To make the test a bit more reasonable, at least compile with
>     -fomit-frame-pointer
> (only the add* functions need this).

OK.  I recompiled with that.  Here are the new numbers.

999999999 902
1000000999 1021
1000000999 1026
1000123455 1148
1000000999 1291
1000000999 1784

Slightly different, but same ordering.
 
> I  don't understand the logic behind the add3 code.  If you know that n2 is a
> constant (so a compare of n1 against a constant does  the  job  for  overflow
> detection) then the return should be of n1 plus a constant, not plus n2.

Agreed.  Fixed.

> Note,  the  code  for  add3  is  incredibly bad. 
...

Sure, and improving it makes my point (that we should use if-tests
instead of long longs) stronger.


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
MLton-devel mailing list
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel