From bbf0592f8d10fba986888d229ff3c22b8cbe73de Mon Sep 17 00:00:00 2001 From: simonmar Date: Thu, 30 Mar 2000 16:07:53 +0000 Subject: [PATCH] [project @ 2000-03-30 16:07:53 by simonmar] Support AP_UPDs/PAPs larger than a block in size. It turned out not to be too hard to do this. This fixes George Russell's bug ("hsc: fatal error: scavenge: stack frame"). --- ghc/rts/GC.c | 34 +++++++++++++++++++++++++++++----- ghc/rts/Schedule.c | 7 +------ 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/ghc/rts/GC.c b/ghc/rts/GC.c index 6383560..1a12852 100644 --- a/ghc/rts/GC.c +++ b/ghc/rts/GC.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: GC.c,v 1.75 2000/03/23 14:30:13 simonmar Exp $ + * $Id: GC.c,v 1.76 2000/03/30 16:07:53 simonmar Exp $ * * (c) The GHC Team 1998-1999 * @@ -1530,9 +1530,22 @@ loop: case AP_UPD: case PAP: - /* these are special - the payload is a copy of a chunk of stack, - tagging and all. */ - return copy(q,pap_sizeW((StgPAP *)q),step); + /* PAPs and AP_UPDs are special - the payload is a copy of a chunk + * of stack, tagging and all. + * + * They can be larger than a block in size. Both are only + * allocated via allocate(), so they should be chained on to the + * large_object list. + */ + { + nat size = pap_sizeW((StgPAP*)q); + if (size >= LARGE_OBJECT_THRESHOLD/sizeof(W_)) { + evacuate_large((P_)q, rtsFalse); + return q; + } else { + return copy(q,size,step); + } + } case EVACUATED: /* Already evacuated, just return the forwarding address. @@ -2956,9 +2969,20 @@ scavenge_large(step *step) case TSO: scavengeTSO((StgTSO *)p); - // HWL: old PAR code deleted here continue; + case AP_UPD: + case PAP: + { + StgPAP* pap = (StgPAP *)p; + + evac_gen = saved_evac_gen; /* not really mutable */ + pap->fun = evacuate(pap->fun); + scavenge_stack((P_)pap->payload, (P_)pap->payload + pap->n_args); + evac_gen = 0; + continue; + } + default: barf("scavenge_large: unknown/strange object"); } diff --git a/ghc/rts/Schedule.c b/ghc/rts/Schedule.c index 4ff4ef3..d6347dd 100644 --- a/ghc/rts/Schedule.c +++ b/ghc/rts/Schedule.c @@ -1,5 +1,5 @@ /* --------------------------------------------------------------------------- - * $Id: Schedule.c,v 1.58 2000/03/30 15:35:13 simonmar Exp $ + * $Id: Schedule.c,v 1.59 2000/03/30 16:07:53 simonmar Exp $ * * (c) The GHC Team, 1998-2000 * @@ -2229,11 +2229,6 @@ raiseAsync(StgTSO *tso, StgClosure *exception) */ ap = (StgAP_UPD *)allocate(AP_sizeW(words)); - /* ToDo: allocating an AP_UPD more than a block in size doesn't - * work, and will cause the GC to break later on. - */ - ASSERT(AP_sizeW(words) <= BLOCK_SIZE_W); - ASSERT(words >= 0); ap->n_args = words; -- 1.7.10.4