From 74b46a5d5f59fbeba0e35bd5a6ba685e9efd2b8e Mon Sep 17 00:00:00 2001 From: simonmar Date: Mon, 17 Mar 2003 14:47:48 +0000 Subject: [PATCH] [project @ 2003-03-17 14:47:47 by simonmar] Haskell quiz: what should this program do? main = return undefined answer: run to completion and exit successfully. GHC erroneously evaluates the returned value from main, which causes this example to fail with an uncaught exception (the evaluation is even done outside of the main exception handler!). --- ghc/rts/Main.c | 8 ++++---- ghc/rts/Schedule.h | 4 ++-- ghc/rts/Weak.c | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ghc/rts/Main.c b/ghc/rts/Main.c index 0413168..ad6924f 100644 --- a/ghc/rts/Main.c +++ b/ghc/rts/Main.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: Main.c,v 1.35 2002/07/18 06:05:30 sof Exp $ + * $Id: Main.c,v 1.36 2003/03/17 14:47:47 simonmar Exp $ * * (c) The GHC Team 1998-2000 * @@ -84,7 +84,7 @@ int main(int argc, char *argv[]) fprintf(stderr, "==== [%x] Main Thread Started ...\n", mytid)); /* ToDo: Dump event for the main thread */ - status = rts_mainEvalIO((HaskellObj)mainIO_closure, NULL); + status = rts_mainLazyIO((HaskellObj)mainIO_closure, NULL); } else { /* Just to show we're alive */ IF_PAR_DEBUG(verbose, @@ -99,12 +99,12 @@ int main(int argc, char *argv[]) # elif defined(GRAN) /* ToDo: Dump event for the main thread */ - status = rts_mainEvalIO(mainIO_closure, NULL); + status = rts_mainLazyIO(mainIO_closure, NULL); # else /* !PAR && !GRAN */ /* ToDo: want to start with a larger stack size */ - status = rts_mainEvalIO((HaskellObj)mainIO_closure, NULL); + status = rts_mainLazyIO((HaskellObj)mainIO_closure, NULL); # endif /* !PAR && !GRAN */ diff --git a/ghc/rts/Schedule.h b/ghc/rts/Schedule.h index cf49a78..b2a07e4 100644 --- a/ghc/rts/Schedule.h +++ b/ghc/rts/Schedule.h @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: Schedule.h,v 1.37 2003/01/25 15:54:50 wolfgang Exp $ + * $Id: Schedule.h,v 1.38 2003/03/17 14:47:48 simonmar Exp $ * * (c) The GHC Team 1998-1999 * @@ -151,7 +151,7 @@ extern nat rts_n_waiting_tasks; StgInt forkProcess(StgTSO *tso); -extern SchedulerStatus rts_mainEvalIO(HaskellObj p, /*out*/HaskellObj *ret); +extern SchedulerStatus rts_mainLazyIO(HaskellObj p, /*out*/HaskellObj *ret); /* Called by shutdown_handler(). */ diff --git a/ghc/rts/Weak.c b/ghc/rts/Weak.c index f216f62..bc5cb2b 100644 --- a/ghc/rts/Weak.c +++ b/ghc/rts/Weak.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: Weak.c,v 1.27 2003/01/25 15:54:50 wolfgang Exp $ + * $Id: Weak.c,v 1.28 2003/03/17 14:47:48 simonmar Exp $ * * (c) The GHC Team, 1998-1999 * @@ -48,7 +48,7 @@ finalizeWeakPointersNow(void) rts_unlock(); rts_lock(); #else - rts_mainEvalIO(w->finalizer,NULL); + rts_mainLazyIO(w->finalizer,NULL); #endif } } -- 1.7.10.4