diff options
author | Simon Marlow <marlowsd@gmail.com> | 2012-10-09 08:49:25 +0100 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2012-11-19 13:01:58 +0000 |
commit | 7da13762664c1bec8e2a1ee5c7106cca3b32a98f (patch) | |
tree | 119fdbbde299fbdf83375d006b48ed7ab0317d58 /compiler/codeGen/StgCmmClosure.hs | |
parent | 5874a66b4baff3ff8dba38f629d71cbfdf7f67fc (diff) | |
download | haskell-7da13762664c1bec8e2a1ee5c7106cca3b32a98f.tar.gz |
Code-size optimisation for top-level indirections (#7308)
Top-level indirections are often generated when there is a cast, e.g.
foo :: T
foo = bar `cast` (some coercion)
For these we were generating a full-blown CAF, which is a fair chunk
of code.
This patch makes these indirections generate a single IND_STATIC
closure (4 words) instead. This is exactly what the CAF would
evaluate to eventually anyway, we're just shortcutting the whole
process.
Diffstat (limited to 'compiler/codeGen/StgCmmClosure.hs')
-rw-r--r-- | compiler/codeGen/StgCmmClosure.hs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/codeGen/StgCmmClosure.hs b/compiler/codeGen/StgCmmClosure.hs index e4c42d203d..7f44f67ff7 100644 --- a/compiler/codeGen/StgCmmClosure.hs +++ b/compiler/codeGen/StgCmmClosure.hs @@ -63,6 +63,7 @@ module StgCmmClosure ( -- * InfoTables mkDataConInfoTable, cafBlackHoleInfoTable, + indStaticInfoTable, staticClosureNeedsLink, ) where @@ -915,6 +916,13 @@ cafBlackHoleInfoTable , cit_prof = NoProfilingInfo , cit_srt = NoC_SRT } +indStaticInfoTable :: CmmInfoTable +indStaticInfoTable + = CmmInfoTable { cit_lbl = mkIndStaticInfoLabel + , cit_rep = indStaticRep + , cit_prof = NoProfilingInfo + , cit_srt = NoC_SRT } + staticClosureNeedsLink :: Bool -> CmmInfoTable -> Bool -- A static closure needs a link field to aid the GC when traversing -- the static closure graph. But it only needs such a field if either |