summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorReid Barton <rwbarton@gmail.com>2016-02-29 17:35:43 -0500
committerReid Barton <rwbarton@gmail.com>2016-02-29 17:35:43 -0500
commit0fd5db798e31912f335e4553e939e1e783284495 (patch)
tree43f1d3c8466b7e4276dfb3bb25e2a1839d7265f8 /compiler
parent49c55e68aae9841c166430ae566b0d9bdc03c99d (diff)
downloadhaskell-wip/rwbarton-tiny-tables.tar.gz
Experiment with one-byte info tableswip/rwbarton-tiny-tables
Diffstat (limited to 'compiler')
-rw-r--r--compiler/cmm/CmmInfo.hs12
-rw-r--r--compiler/nativeGen/X86/Ppr.hs5
2 files changed, 16 insertions, 1 deletions
diff --git a/compiler/cmm/CmmInfo.hs b/compiler/cmm/CmmInfo.hs
index b9981f247b..299f7bb271 100644
--- a/compiler/cmm/CmmInfo.hs
+++ b/compiler/cmm/CmmInfo.hs
@@ -194,7 +194,11 @@ mkInfoTableContents dflags
| null liveness_data = rET_SMALL -- Fits in extra_bits
| otherwise = rET_BIG -- Does not; extra_bits is
-- a label
- ; return (prof_data ++ liveness_data, (std_info, srt_label)) }
+ mb_tiny_liveness = mkTinyLivenessBits frame
+ ; case (prof_data, liveness_data, srt_label, rts_tag == rET_SMALL,
+ srt_bitmap == toStgHalfWord dflags 0, mb_tiny_liveness) of
+ ([], [], [], True, True, Just b) -> return ([], ([b], []))
+ _ -> return (prof_data ++ liveness_data, (std_info, srt_label)) }
| HeapRep _ ptrs nonptrs closure_type <- smrep
= do { let layout = packIntsCLit dflags ptrs nonptrs
@@ -317,6 +321,12 @@ makeRelativeRefTo _ _ lit = lit
-- The head of the stack layout is the top of the stack and
-- the least-significant bit.
+mkTinyLivenessBits :: Liveness -> Maybe CmmLit
+mkTinyLivenessBits liveness
+ | length liveness > 7 = Nothing
+ | otherwise = Just (CmmInt b W8)
+ where b = foldr (.|.) 0 [ 1 `shiftL` n | (True,n) <- zip (liveness ++ [True]) [0..] ]
+
mkLivenessBits :: DynFlags -> Liveness -> UniqSM (CmmLit, [RawCmmDecl])
-- ^ Returns:
-- 1. The bitmap (literal value or label)
diff --git a/compiler/nativeGen/X86/Ppr.hs b/compiler/nativeGen/X86/Ppr.hs
index 7809ae1df9..b5111a1a99 100644
--- a/compiler/nativeGen/X86/Ppr.hs
+++ b/compiler/nativeGen/X86/Ppr.hs
@@ -108,6 +108,11 @@ pprBasicBlock info_env (BasicBlock blockid instrs)
asmLbl = mkAsmTempLabel (getUnique blockid)
maybe_infotable = case mapLookup blockid info_env of
Nothing -> empty
+ Just (Statics info_lbl [b8@(CmmStaticLit (CmmInt _ W8))]) ->
+ text ".align 2" $$ -- XXX Needs to be adjusted for darwin
+ infoTableLoc $$
+ pprData b8 $$
+ pprLabel info_lbl
Just (Statics info_lbl info) ->
pprAlignForSection Text $$
infoTableLoc $$