Tom Bachmann <e_mc_h2@xxxxxx> wrote: > > I was wondering if it would be possible to teach gcc to maintain > multiple stacks, something like > > void foo () > { > int on_normal_stack; > int on_special_stack attribute ((stack (mystack))); > } > > where mystack is a (thread-local) global variable that is treated as > another stackpointer. Of course I know that there is no attribute like > that, but I was just wondering if I overlooked something. > > The rationale is that I am writing a system with different types of > pages, but it would be nice to still automatically allocate the space. Not trivially, at least in the form you describe. In order to maintain a second stack, you need a second stack pointer - all right, that can be a global variable, but it isn't easy to use such a thing in that context. Secondary stacks go back to at least Algol 68, and I have been trying to encourage compiler writers to readopt the technology for the past 20 years! Using them judiciously can improve the performance, and (surprisingly) the RAS. But they are almost a forgotten technique :-( However, it is possible that the answer is yes, with some constraints. Someone who knows more about gcc than I do would need to answer that. Regards, Nick Maclaren, University of Cambridge Computing Service, New Museums Site, Pembroke Street, Cambridge CB2 3QH, England. Email: nmm1@xxxxxxxxx Tel.: +44 1223 334761 Fax: +44 1223 334679