Commit fb80639a authored by Simon Marlow's avatar Simon Marlow
Browse files

small performance improvement: unbox some fields

parent b80c3f61
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
ByteCodeInstrs: Bytecode instruction definitions ByteCodeInstrs: Bytecode instruction definitions
\begin{code} \begin{code}
{-# OPTIONS_GHC -funbox-strict-fields #-}
module ByteCodeInstr ( module ByteCodeInstr (
BCInstr(..), ProtoBCO(..), bciStackUse, BreakInfo (..) BCInstr(..), ProtoBCO(..), bciStackUse, BreakInfo (..)
) where ) where
...@@ -55,9 +56,9 @@ data BCInstr ...@@ -55,9 +56,9 @@ data BCInstr
= STKCHECK Int = STKCHECK Int
-- Push locals (existing bits of the stack) -- Push locals (existing bits of the stack)
| PUSH_L Int{-offset-} | PUSH_L !Int{-offset-}
| PUSH_LL Int Int{-2 offsets-} | PUSH_LL !Int !Int{-2 offsets-}
| PUSH_LLL Int Int Int{-3 offsets-} | PUSH_LLL !Int !Int !Int{-3 offsets-}
-- Push a ptr (these all map to PUSH_G really) -- Push a ptr (these all map to PUSH_G really)
| PUSH_G Name | PUSH_G Name
...@@ -95,12 +96,12 @@ data BCInstr ...@@ -95,12 +96,12 @@ data BCInstr
| SLIDE Int{-this many-} Int{-down by this much-} | SLIDE Int{-this many-} Int{-down by this much-}
-- To do with the heap -- To do with the heap
| ALLOC_AP Int -- make an AP with this many payload words | ALLOC_AP !Int -- make an AP with this many payload words
| ALLOC_PAP Int Int -- make a PAP with this arity / payload words | ALLOC_PAP !Int !Int -- make a PAP with this arity / payload words
| MKAP Int{-ptr to AP is this far down stack-} Int{-# words-} | MKAP !Int{-ptr to AP is this far down stack-} !Int{-# words-}
| MKPAP Int{-ptr to PAP is this far down stack-} Int{-# words-} | MKPAP !Int{-ptr to PAP is this far down stack-} !Int{-# words-}
| UNPACK Int -- unpack N words from t.o.s Constr | UNPACK !Int -- unpack N words from t.o.s Constr
| PACK DataCon Int | PACK DataCon !Int
-- after assembly, the DataCon is an index into the -- after assembly, the DataCon is an index into the
-- itbl array -- itbl array
-- For doing case trees -- For doing case trees
......
Markdown is supported
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