Commit 0dfab83f authored by Ian Lynagh's avatar Ian Lynagh
Browse files

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.
parent b4696d8a
......@@ -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
......@@ -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)
......
Supports Markdown
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