ASR pass: disable caller padding by default

The feature is fundamentally broken.  See the comment in the code.

Change-Id: If36b06b0732cc4d18f20240ed96d30a7959b0d21
This commit is contained in:
David van Moolenbroek 2015-09-03 06:17:52 +02:00
parent 0b98e8aad8
commit 139ae0da30
2 changed files with 9 additions and 1 deletions

View file

@ -562,6 +562,14 @@ bool ASRPass::runOnModule(Module &M) {
if (Instruction *I = dyn_cast<Instruction>(U)) {
Function *parent = I->getParent()->getParent();
/* XXX Skipping MAGIC_ENTRY_POINT shouldn't be necessary. Check why. */
/* ..the reason is that main() typically contains the message loop, which loops
* forever making calls. These calls are getting padded, and AllocaInst causes a
* stack pointer adjustment every time a call is made. This stack memory is never
* released, since the function never returns. The result is that we eventually
* run out of stack. Since MINIX3 also uses user-level threads these days, the
* problem is not limited to main(), and for this reason I have disabled caller
* padding by default. -dcvmoole
*/
if(MAGIC_IS_MAGIC_FUNC(M, parent) || parent->getName().equals(MAGIC_ENTRY_POINT)) {
continue;
}

View file

@ -23,7 +23,7 @@
#define STACKFRAME_DEFAULT_MAX_PADDING 5000
#define STACKFRAME_DEFAULT_DO_PERMUTATE 1
#define STACKFRAME_DEFAULT_STATIC_PADDING 1
#define STACKFRAME_DEFAULT_CALLER_PADDING 1
#define STACKFRAME_DEFAULT_CALLER_PADDING 0 // broken, disabled (see note in code)
#define HEAP_MAP_DEFAULT_DO_PERMUTATE 1