jayduhon / inferno-os

Automatically exported from code.google.com/p/inferno-os
2 stars 0 forks source link

limbo compilers use too much stack for eg array data #249

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
compiling appl/lib/ida/idatab.b crashes the limbo compilers on most systems, 
due to stack growth due to recursion.  i have another limbo program that is 
compiled with a huge "array of byte", it has the same problem.

the big recursion depth seems to happen in three places (found by running the c 
compiler and looking at the backtrace when it crashes;  other limbo code might 
trigger big recursion in other places).  the attached patch fixes both the c & 
limbo versions of the compiler.  i think, but i'm not completely sure, that the 
Oseq nodes can be handled this way (i.e. their lefts & rights folded/rewritten 
independently;  the third case (in decls.[bc]) makes it tail recursive).

without this, my limbo program crashes the c limbo compiler on openbsd/386 even 
with an allowed stack of 24mb (32mb does work).  with this, 250kb stack is 
enough.  idatab.b can be compiled with this too.

Original issue reported on code.google.com by mechiel@ueber.net on 28 Feb 2011 at 7:24

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by Charles....@gmail.com on 8 Mar 2011 at 9:12