IntInf _prims

Stephen Weeks MLton@sourcelight.com
Tue, 8 Aug 2000 18:20:42 -0700 (PDT)


One thing that Matthew and I noticed when looking through the MLton sources is
that IntInf _prims, e.g. IntInf_add, (see basis-library/misc/primitive.sml and
src/atoms/prim.fun) are thought to be SideEffecting by the compiler, since they
all take the array that was allocated and fill it in with the result.
Unfortunately, this means that (currently) they can't be uselessed away.  There
are two possible solutions I see to the problem

1. Fix cps/useless.fun so that it knows about the primitives.
2. Change the primitives so that they do the allocation themselves, and are
   hence functional.  In order to do this, they would have to be declared as
   EntersRuntime, and would have to be wrapped in a critical section so that
   no thread switch occurs during the allocation (which may cause a gc).

I am leaning towards (1).  Any comments?