FFI, safe vs unsafe

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Thu Mar 30 09:50:32 EST 2006

"Simon Marlow" <simonmar at microsoft.com> wrote:

> > I thought yhc supported unboxed values, so a loop like
> > 
> > count 0 = 0
> > count n = count (n - 1)
> > 
> > count 100000
> > 
> > could block the runtime (assuming it was properly unboxed by the
> > compiler) since it never calls back into it and is just a straight
> > up countdown loop?
> are we talking about the same compiler?  YHC is fully interpreted, has
> no unboxed types, and AFAIK it is impossible to write any code that
> doesn't get preempted after a while.

Indeed.  But unboxing is not the issue - the main reason is that yhc
cannot currently compile that code into a loop - jumps only go forwards
in the bytecode, never backwards.  The only possible bytecode
representation of a loop is as a recursive call, which immediately
presents an opportunity to insert a yield.


More information about the Haskell-prime mailing list