digitalmars.D - Stack 16
Feature request: [Stack(16)] struct MyStruct { float number; } Introduce a second stack supported by the programming language. On a 32 bit system the normal 4 byte stack and a secondary 16 byte stack is used to store parameters. void doStuff( int number, MyStruct s) //s dumped on 16 byte stack { MyStruct a; //also 16 byte aligned. } Also support compile time reflection to get the stack attribute. static if (T does it have Stack attribute, and is it 16 byte aligned) { } Any request like for Stack(8) would then be dumped on the 16 byte stack since it only has the 4 byte and 16 byte stack to choose from. Scly
Apr 14 2008
Sclytrack wrote:Feature request: [Stack(16)] struct MyStruct { float number; } Introduce a second stack supported by the programming language. On a 32 bit system the normal 4 byte stack and a secondary 16 byte stack is used to store parameters. void doStuff( int number, MyStruct s) //s dumped on 16 byte stack { MyStruct a; //also 16 byte aligned. } Also support compile time reflection to get the stack attribute. static if (T does it have Stack attribute, and is it 16 byte aligned) { } Any request like for Stack(8) would then be dumped on the 16 byte stack since it only has the 4 byte and 16 byte stack to choose from. SclyI don't understand. Are you saying that things should be dumped on different stacks based on their size for some sort of alignment improvement? Or are you saying to want to add new syntax to add secondary (and more) stacks? Either way the current CPU architecture is setup to work most efficiently on a single stack. Multiple stacks would thrash the cache and prediction. If you need a stack, why not use a stack class? Anyways could you try to re-explain. It might help get your suggestion noticed. -Joel
Apr 16 2008