Re: very elusive ml-build issue

Dave Herman <[email protected]> Sat, 17 Feb 2007 12:10:52 -0500
Newsgroups gmane.comp.lang.sml.smlnj
Message-ID <[email protected]>
Got it! It seems to be when a large source file uses or-patterns.

I've narrowed it down to the smallest test case I could manage. Attached 
is a script that generates an SML program that uses or-patterns. If the 
program is large enough, the heap file fails to build. The following 
reproduces the problem reliably on my machine:

     % ./codegen.pl 1500 > main.sml
     % ml-build test.cm Main.main test.heap

Dave

Matthias Blume wrote:
> Hmm.  Is there some non-trivial toplevel code in parser.sml?
> Is it possible that that code somehow "dies"?
> It can't be an uncaught exception, since the runtime system
> would normally report those.  But maybe the code somehow
> ends up calling the OSes "exit" function (OS.Process.exit).
> 
> Can you show me what's in parser.sml?
> 
> Matthias
> 
> 
> On Feb 16, 2007, at 9:09 PM, Dave Herman wrote:
> 
>> It looks like it gets cut off before getting to that point. The  last 
>> lines are:
>>
>> [Loading .cm/x86-unix/pretty-rep.sml]
>> [Loading .cm/x86-unix/ast.sml]
>> [Loading .cm/x86-unix/pretty-cvt.sml]
>> [Loading .cm/x86-unix/pretty.sml]
>> [Loading .cm/x86-unix/logerr.sml]
>> [Loading .cm/x86-unix/verify.sml]
>> [Loading .cm/x86-unix/token.sml]
>> [Loading .cm/x86-unix/lexer.lex.sml]
>> [Loading .cm/x86-unix/parser.sml]
> 
>

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Smlnj-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/smlnj-list
codegen.pl (text/plain, 574 B)
#!/usr/bin/perl

codegen($ARGV[0]);
exit(0);

sub codegen {

my $N = $_[0];

print <<END;
structure Main = struct

datatype thing = Foo | Bar | Baz

END

for ($i = 0; $i < $N; $i++) {
    print <<END;
fun useOrPattern$i ts =
    case ts of
         (Foo | Bar) :: Baz :: _ => 0
       | Foo :: _ => 1
       | Bar :: _ => 2
       | _ => 100

END
}

print <<END;
fun example ts =
(
END

for ($i = 0; $i < $N; $i++) {
    print <<END;
    useOrPattern$i ts;
END
}

print <<END;
    0
)

fun main(arg0:string, args:string list) =
    example [Baz,Baz,Baz,Baz,Baz]

end
END

}
test.cm (text/plain, 93 B)
Library
        structure Main
is
        $/basis.cm
        $/smlnj-lib.cm
        main.sml