From 47ec5807dfabbe140b60fcb35af8a105b78ba140 Mon Sep 17 00:00:00 2001 From: Pepe Iborra Date: Thu, 15 Feb 2007 18:19:34 +0000 Subject: [PATCH] Fixed a bug in the datacon names extension in the dynamic linker My code was doing unnecessary work when trying to get hold of all the BCOs in order to sniff the datacon names. This involved calculating the transitive closure of a relation and was causing a huge performance slowdown in GHCi, as benchmarks uncovered. It turns out that this calculation was unnecessary. --- compiler/ghci/Linker.lhs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/compiler/ghci/Linker.lhs b/compiler/ghci/Linker.lhs index f59eecc..d2c7fe1 100644 --- a/compiler/ghci/Linker.lhs +++ b/compiler/ghci/Linker.lhs @@ -750,22 +750,14 @@ linkSomeBCOs toplevs_only ie ce_in de_in ul_bcos -- closure environment, which leads to trouble. ASSERT (all (not . (`elemNameEnv` ce_in)) (map fst ce_additions)) extendClosureEnv ce_in ce_additions - refs = goForRefs ul_bcos - names = nub$ concatMap (ssElts . unlinkedBCOItbls) (ul_bcos ++ refs) + names = concatMap (ssElts . unlinkedBCOItbls) ul_bcos addresses <- mapM (lookupIE ie) names let de_additions = [(address, name) | (address, name) <- zip addresses names , not(address `elemAddressEnv` de_in) ] de_out = extendAddressEnvList de_in de_additions return ( ce_out, de_out, hvals) - where - goForRefs = getRefs [] - getRefs acc [] = acc - getRefs acc new = getRefs (new++acc) - [bco | BCOPtrBCO bco <- concatMap (ssElts . unlinkedBCOPtrs) new - , notElemBy bco (new ++ acc) nameEq] - ul1 `nameEq` ul2 = unlinkedBCOName ul1 == unlinkedBCOName ul2 - (x1 `notElemBy` x2) eq = null$ intersectBy eq [x1] x2 + \end{code} -- 1.7.10.4