Commit 47ec5807 authored by mnislaih's avatar mnislaih

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.
parent 60ade746
......@@ -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}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment