From: Ian Lynagh Date: Wed, 27 Feb 2008 14:45:05 +0000 (+0000) Subject: Add and use seqBitmap when constructing SRTs X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=0dfab83f21817343d334314ddd25026f3f0224ab Add and use seqBitmap when constructing SRTs This roughly halves memory usage when compiling module Foo where foo :: Double -> Int foo x | x == 1 = 1 ... foo x | x == 500 = 500 without optimisation. --- diff --git a/compiler/codeGen/Bitmap.hs b/compiler/codeGen/Bitmap.hs index 7ee78a9..3b363fd 100644 --- a/compiler/codeGen/Bitmap.hs +++ b/compiler/codeGen/Bitmap.hs @@ -16,7 +16,8 @@ module Bitmap ( Bitmap, mkBitmap, intsToBitmap, intsToReverseBitmap, - mAX_SMALL_BITMAP_SIZE + mAX_SMALL_BITMAP_SIZE, + seqBitmap, ) where #include "HsVersions.h" @@ -24,6 +25,7 @@ module Bitmap ( import SMRep import Constants +import Util import Data.Bits @@ -85,3 +87,6 @@ mAX_SMALL_BITMAP_SIZE :: Int mAX_SMALL_BITMAP_SIZE | wORD_SIZE == 4 = 27 | otherwise = 58 +seqBitmap :: Bitmap -> a -> a +seqBitmap = seqList + diff --git a/compiler/simplStg/SRT.lhs b/compiler/simplStg/SRT.lhs index 57c638d..5618cb1 100644 --- a/compiler/simplStg/SRT.lhs +++ b/compiler/simplStg/SRT.lhs @@ -25,7 +25,7 @@ import Id ( Id ) import VarSet import VarEnv import Maybes ( orElse, expectJust ) -import Bitmap ( intsToBitmap ) +import Bitmap #ifdef DEBUG import Outputable @@ -157,7 +157,7 @@ srtAlt table (con,args,used,rhs) constructSRT :: IdEnv Int -> SRT -> SRT constructSRT table (SRTEntries entries) | isEmptyVarSet entries = NoSRT - | otherwise = SRT offset len bitmap + | otherwise = seqBitmap bitmap $ SRT offset len bitmap where ints = map (expectJust "constructSRT" . lookupVarEnv table) (varSetElems entries)