test1

Matthew Fluet fluet@cs.cornell.edu
Tue, 5 Feb 2002 22:25:49 -0500 (EST)


> Wow, what a difference in compile time.  What exactly does the FAST_INT
> thing change?  If it still produces a proper Overflow exception than I am
> really impressed.

No, I looked at the new ccodegen.h.  On overflow, it just jumps to a die.

static void MLton_overflow() {
	die("Internal overflow detected. Halt.");
}

static inline Int Int_addCheckFast(Int n1, Int n2) {
 	__asm__ __volatile__ ("addl %1, %0\n\tjo MLton_overflow"
			      : "+r" (n1) : "g" (n2) );

	return n1;
}

#define check(dst,n1,n2,l,f) dst = f(n1, n2)

#define Int_addCheck(dst, n1, n2, l)			\
	check(dst, n1, n2, l, Int_addCheckFast)

(The l in Int_addCheck is where we should go on overflow.)

It seems as though it would be possible to get the label into the jo
instruction, although it might require nasty preprocessor hacks that do
auto-string concatenation.