From: sof Date: Fri, 28 Mar 2003 01:59:08 +0000 (+0000) Subject: [project @ 2003-03-28 01:59:05 by sof] X-Git-Tag: Approx_11550_changesets_converted~1016 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=a5687b3b04c2e404a5ed5bf56ba4e7a10f7d115a;p=ghc-hetmet.git [project @ 2003-03-28 01:59:05 by sof] Off-by-one tidyup. ALLOC_AP, ALLOC_PAP and MKAP were all being constructed with size arguments equal to (1+number of args/FVs) in ByteCodeGen.schemeE, only for Interpreter.c to subtract 1 when fishing out the payloads. This commit drops the up-and-downery. Simplification spotted by Andy Moran --- diff --git a/ghc/compiler/ghci/ByteCodeGen.lhs b/ghc/compiler/ghci/ByteCodeGen.lhs index b0234f0..d5dca0e 100644 --- a/ghc/compiler/ghci/ByteCodeGen.lhs +++ b/ghc/compiler/ghci/ByteCodeGen.lhs @@ -380,8 +380,8 @@ schemeE d s p (AnnLet binds (_,body)) fvss = map (fvsToEnv p' . fst) rhss - -- Sizes of free vars, + 1 for the fn - sizes = map (\rhs_fvs -> 1 + sum (map idSizeW rhs_fvs)) fvss + -- Sizes of free vars + sizes = map (\rhs_fvs -> sum (map idSizeW rhs_fvs)) fvss -- the arity of each rhs arities = map (length . fst . collect []) rhss @@ -397,7 +397,7 @@ schemeE d s p (AnnLet binds (_,body)) -- ToDo: don't build thunks for things with no free variables build_thunk dd [] size bco off = returnBc (PUSH_BCO bco - `consOL` unitOL (MKAP (off+size-1) size)) + `consOL` unitOL (MKAP (off+size) size)) build_thunk dd (fv:fvs) size bco off = do (push_code, pushed_szw) <- pushAtom dd p' (AnnVar fv) more_push_code <- build_thunk (dd+pushed_szw) fvs size bco off diff --git a/ghc/rts/Interpreter.c b/ghc/rts/Interpreter.c index 3fc8388..63719ad 100644 --- a/ghc/rts/Interpreter.c +++ b/ghc/rts/Interpreter.c @@ -926,7 +926,7 @@ run_BCO: case bci_ALLOC_AP: { StgAP* ap; - int n_payload = BCO_NEXT - 1; + int n_payload = BCO_NEXT; int request = PAP_sizeW(n_payload); ap = (StgAP*)allocate_UPD(request); Sp[-1] = (W_)ap; @@ -939,7 +939,7 @@ run_BCO: case bci_ALLOC_PAP: { StgPAP* pap; int arity = BCO_NEXT; - int n_payload = BCO_NEXT - 1; + int n_payload = BCO_NEXT; int request = PAP_sizeW(n_payload); pap = (StgPAP*)allocate_NONUPD(request); Sp[-1] = (W_)pap; @@ -953,7 +953,7 @@ run_BCO: case bci_MKAP: { int i; int stkoff = BCO_NEXT; - int n_payload = BCO_NEXT - 1; + int n_payload = BCO_NEXT; StgAP* ap = (StgAP*)Sp[stkoff]; ASSERT((int)ap->n_args == n_payload); ap->fun = (StgClosure*)Sp[0];