[m-dev.] Mercury and GCC split stacks

Zoltan Somogyi zoltan.somogyi at runbox.com
Fri Sep 5 22:01:37 AEST 2014



On Fri, 5 Sep 2014 15:38:41 +1000, Paul Bone <paul at bone.id.au> wrote:
 Also I like the idea of using something like mprotect to implement
> stack extension for low level C grades.  I'd prefer this kind of "trap" to
> detect when stack extension is required rather than a test for each stack
> frame.

The tradeoff is that an mmap trap requires, for each stack, a buffer
that is the size of a page, since the VM hardware on typical machines
cannot set permissions on any smaller unit of memory than that.
If you want to have tens or hundreds of thousands of stacks
(because you have that many threads), like Erlang was designed for,
this per-stack overhead (in address space, if not in memory) becomes
excessive.

Zoltan.



More information about the developers mailing list