From: David van Moolenbroek Date: Thu, 3 Sep 2015 04:17:52 +0000 (+0200) Subject: ASR pass: disable caller padding by default X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zpipe.c?a=commitdiff_plain;h=refs%2Fchanges%2F69%2F3169%2F1;p=minix.git ASR pass: disable caller padding by default The feature is fundamentally broken. See the comment in the code. Change-Id: If36b06b0732cc4d18f20240ed96d30a7959b0d21 --- diff --git a/minix/llvm/passes/asr/ASRPass.cpp b/minix/llvm/passes/asr/ASRPass.cpp index 39593ba12..22439aad3 100644 --- a/minix/llvm/passes/asr/ASRPass.cpp +++ b/minix/llvm/passes/asr/ASRPass.cpp @@ -562,6 +562,14 @@ bool ASRPass::runOnModule(Module &M) { if (Instruction *I = dyn_cast(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; } diff --git a/minix/llvm/passes/include/asr/ASRPass.h b/minix/llvm/passes/include/asr/ASRPass.h index dd4d49436..6a8f239f7 100644 --- a/minix/llvm/passes/include/asr/ASRPass.h +++ b/minix/llvm/passes/include/asr/ASRPass.h @@ -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