[MLton] Re: [Haskell-cafe] fastest Fibonacci numbers in the West

William Lee Irwin III wli@holomorphy.com
Thu, 27 Jan 2005 11:46:33 -0800


On Thu, Jan 27, 2005 at 11:22:48AM -0800, William Lee Irwin III wrote:
>> Setting up a stack by hand for C code to run on is trivial, but
>> interoperating with glibc isn't. The thread-local storage changes have
>> made stack switching a big hassle, where formerly it was trivial. I've
>> been burned by this in handwritten C a number of times recently.

On Thu, Jan 27, 2005 at 08:38:35PM +0100, Wesley W. Terpstra wrote:
> Yes, I have had trouble with this too.
> A library I very much like (libst) doesn't work anymore due to that change.
> Your tone suggests that you know of a non-trivial way to get C stack
> switching to continue to work, could you provide a pointer?

I don't know all of the details (yet), but it involves setting up the
thread-local storage data, LDT, segment registers, and other hassles.

It used to be just adjusting some of the contents of a jmp_buf; now
there is considerably more complexity. It's also noteworthy that these
either don't expand at all or are also affected by stack rlimits. You
can set up larger stacks than the rlimit nominally having the stack
growth flag set, but these will not actually grow.


-- wli