]> Zhao Yanbai Git Server - minix.git/commitdiff
ASR pass: disable caller padding by default 69/3169/1
authorDavid van Moolenbroek <david@minix3.org>
Thu, 3 Sep 2015 04:17:52 +0000 (06:17 +0200)
committerDavid van Moolenbroek <david@minix3.org>
Thu, 17 Sep 2015 17:14:20 +0000 (17:14 +0000)
The feature is fundamentally broken.  See the comment in the code.

Change-Id: If36b06b0732cc4d18f20240ed96d30a7959b0d21

minix/llvm/passes/asr/ASRPass.cpp
minix/llvm/passes/include/asr/ASRPass.h

index 39593ba12cbd65bf7598a765e2e28c7846a37956..22439aad336f75c2ffce4c62ee0bb58ac2d64f18 100644 (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;
                             }
index dd4d49436cc5bd6a120f6541b78e5a9e16a12747..6a8f239f70674d3319b8708819ba1e1a08b0a865 100644 (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