X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;ds=sidebyside;f=ghc%2Fcompiler%2FnativeGen%2FStixInfo.lhs;h=bb264352413fe3cfb8668b35e168c906b9ff332e;hb=d9fe1d1dba2f78c10df8fd622952b4c1d057b78b;hp=17bbf98d55094ec916ee6b099d17b6ed5421693c;hpb=1db24428fa0bcf32f2e667d01bf416cc2d8035f7;p=ghc-hetmet.git diff --git a/ghc/compiler/nativeGen/StixInfo.lhs b/ghc/compiler/nativeGen/StixInfo.lhs index 17bbf98..bb26435 100644 --- a/ghc/compiler/nativeGen/StixInfo.lhs +++ b/ghc/compiler/nativeGen/StixInfo.lhs @@ -14,14 +14,14 @@ import StgSyn ( SRT(..) ) import ClosureInfo ( closurePtrsSize, closureNonHdrSize, closureSMRep, infoTableLabelFromCI, - infoTblNeedsSRT, getSRTInfo + infoTblNeedsSRT, getSRTInfo, closureSemiTag ) import PrimRep ( PrimRep(..) ) -import SMRep ( SMRep(..), getSMRepClosureTypeInt ) +import SMRep ( getSMRepClosureTypeInt ) import Stix -- all of it import UniqSupply ( returnUs, UniqSM ) -import Outputable ( int ) import BitSet ( intBS ) +import Maybes ( maybeToBool ) import Bits import Word @@ -42,10 +42,11 @@ genCodeInfoTable (CClosureInfoAndCode cl_info _ _ cl_descr) = returnUs (\xs -> StData PtrRep table : StLabel info_lbl : xs) where - info_lbl = infoTableLabelFromCI cl_info + info_lbl = infoTableLabelFromCI cl_info + needs_srt = infoTblNeedsSRT cl_info - table | infoTblNeedsSRT cl_info = srt_label : rest_of_table - | otherwise = rest_of_table + table | needs_srt = srt_label : rest_of_table + | otherwise = rest_of_table rest_of_table = [ @@ -58,22 +59,28 @@ genCodeInfoTable (CClosureInfoAndCode cl_info _ _ cl_descr) -- ToDo: do this using .byte and .word directives. type_info :: Word32 #ifdef WORDS_BIGENDIAN - type_info = (fromInt flags `shiftL` 24) .|. - (fromInt closure_type `shiftL` 16) .|. + type_info = (fromInt closure_type `shiftL` 16) .|. (fromInt srt_len) #else - type_info = (fromInt flags) .|. - (fromInt closure_type `shiftL` 8) .|. + type_info = (fromInt closure_type) .|. (fromInt srt_len `shiftL` 16) #endif srt = getSRTInfo cl_info - (srt_label,srt_len) = - case srt of - (lbl, NoSRT) -> (StInt 0, 0) + (srt_label,srt_len) + | is_constr + = (StInt 0, tag) + | needs_srt + = case srt of (lbl, SRT off len) -> (StIndex DataPtrRep (StCLbl lbl) (StInt (toInteger off)), len) + | otherwise + = (StInt 0, 0) + + maybe_tag = closureSemiTag cl_info + is_constr = maybeToBool maybe_tag + (Just tag) = maybe_tag layout_info :: Word32 #ifdef WORDS_BIGENDIAN @@ -89,7 +96,6 @@ genCodeInfoTable (CClosureInfoAndCode cl_info _ _ cl_descr) closure_type = getSMRepClosureTypeInt (closureSMRep cl_info) - flags = 0 -- for now genBitmapInfoTable @@ -121,12 +127,10 @@ genBitmapInfoTable liveness srt closure_type include_srt type_info :: Word32 #ifdef WORDS_BIGENDIAN - type_info = (fromInt flags `shiftL` 24) .|. - (fromInt closure_type `shiftL` 16) .|. + type_info = (fromInt closure_type `shiftL` 16) .|. (fromInt srt_len) #else - type_info = (fromInt flags) .|. - (fromInt closure_type `shiftL` 8) .|. + type_info = (fromInt closure_type) .|. (fromInt srt_len `shiftL` 16) #endif @@ -136,6 +140,4 @@ genBitmapInfoTable liveness srt closure_type include_srt (lbl, SRT off len) -> (StIndex DataPtrRep (StCLbl lbl) (StInt (toInteger off)), len) - - flags = 0 -- for now \end{code}