[m-dev.] Mercury and GCC split stacks

Paul Bone paul at bone.id.au
Fri Sep 5 15:38:41 AEST 2014


On Fri, Sep 05, 2014 at 02:47:05PM +1000, Julien Fischer wrote:
> On Fri, Sep 5, 2014 at 2:04 PM, Peter Wang <novalazy at gmail.com> wrote:
> 
> > On Fri, 5 Sep 2014 12:43:05 +1000, Paul Bone <paul at bone.id.au> wrote:
> > > On Fri, Sep 05, 2014 at 10:01:26AM +1000, Julien Fischer wrote:
> > > >
> > > > Hi,
> > > >
> > > > Has anyone tried Mercury (particularly the high-level C grades) with
> > > > GCC's split stacks capability?  See: <
> > https://gcc.gnu.org/wiki/SplitStacks>.
> > > >
> > >
> > > The trade offs seem interesting, not that they're trying to economise on
> > > address space usage, especially on 32bit systems.  On a 64bit system this
> > > isn't a big deal for C programs as only the parts of the stack that
> > actually
> > > get used get mapped to actual physical pages.
> >
> > Go and Rust both moved away from segmented stacks in favour of extending
> > (and moving?) the stack.  Mercury had stack-extension before stack
> > segments,
> > but it was a bit neglected.  It might be worth reviving for 64-bit systems.
> >
> 
> AFAIK, stack extension for Mercury was only supported in the low-level C
> grades.
> 

It doesn't make sense to do this at the Mercury level for high-level C
grades.  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.

I've read some of the runtime code regarding stack extension, I got the
impression that it was not used much because it wasn't portable.  But I may
be misremembering this.


-- 
Paul Bone



More information about the developers mailing list