Skip to content
This repository has been archived by the owner on Nov 24, 2022. It is now read-only.

Commit

Permalink
WIP resolveSyms needs only root_syms and dep_map
Browse files Browse the repository at this point in the history
  • Loading branch information
gkaracha committed Jun 15, 2020
1 parent 4ccb740 commit 1c7ed2f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions asterius/src/Asterius/Passes/GCSections.hs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ gcSections ::
[EntitySymbol] ->
IO AsteriusModule
gcSections verbose_err module_rep root_syms export_funcs = do
let (mod_syms, err_syms) = resolveSyms verbose_err all_root_syms module_rep
let (mod_syms, err_syms) = resolveSyms verbose_err all_root_syms (dependencyMap module_rep)
buildGCModule mod_syms err_syms module_rep ffi_exports
where
ffi_exports =
Expand All @@ -61,8 +61,8 @@ gcSections verbose_err module_rep root_syms export_funcs = do
-- includes 2 categories: symbols that refer to statics and functions, and
-- symbols that refer to statics originating from barf messages (when
-- @verbose_err@ is set to @True@).
resolveSyms :: Bool -> SS.SymbolSet -> AsteriusRepModule -> (SS.SymbolSet, SS.SymbolSet)
resolveSyms verbose_err root_syms module_rep = go (root_syms, SS.empty, mempty, mempty)
resolveSyms :: Bool -> SS.SymbolSet -> DM.DependencyMap -> (SS.SymbolSet, SS.SymbolSet)
resolveSyms verbose_err root_syms dep_map = go (root_syms, SS.empty, mempty, mempty)
where
go (i_staging_syms, i_acc_syms, i_m_syms, i_err_syms)
| SS.null i_staging_syms = (i_m_syms, i_err_syms)
Expand All @@ -73,7 +73,7 @@ resolveSyms verbose_err root_syms module_rep = go (root_syms, SS.empty, mempty,
in go (o_staging_syms, o_acc_syms, o_m_syms, o_err_syms)
where
step i_staging_sym (i_child_syms_acc, o_m_acc_syms, err_syms)
| Just es <- i_staging_sym `DM.lookup` dependencyMap module_rep =
| Just es <- i_staging_sym `DM.lookup` dep_map =
(es <> i_child_syms_acc, o_m_acc_syms <> SS.singleton i_staging_sym, err_syms)
| verbose_err =
(i_child_syms_acc, o_m_acc_syms, err_syms <> SS.singleton i_staging_sym)
Expand Down

0 comments on commit 1c7ed2f

Please sign in to comment.