Re: using split stacks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Oliver Kowalke" <oliver.kowalke@xxxxxx> writes:

> I'd like to use split stacks for my coroutine implementation.
> I found a website from Ian describing how split stack could be
> implemented in gcc but not how to use it in an application.

To use it in an application, compile and link with the -fsplit-stack
option.


> I assume I have to apply the command line option -fsplit-stack and gcc
> must be compiled with --enable-gold (as described in Ians blog).

For best effect you should in general use the gold linker, but simply
configuring GCC with --enable-gold is not enough to cause that to
happen.  You should either install gold as your default linker, or you
should configure GCC using --with-ld=/PATH/TO/GOLD.


> Are some macros defined I can use in the code in order to detect that
> split stacks are available?

Not at present.  If you look in libgo/configure.ac you will see a couple
of simple autoconf tests.


> I assume I've to call a special function similiar to malloc()/calloc()
> in order to get a new split stack?!

I'm not sure exactly what you are asking.  When your program needs a new
split stack, it will get one automatically, via the libgcc routine
__generic_morestack.  You don't have to do anything to make that work.

If you are asking how to get a new split stack for a new coroutine, the
answer is to call __splitstack_makecontext.  See that function and other
helpful functions in libgcc/generic-morestack.c.

Ian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux