Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
a202c6c4
Commit
a202c6c4
authored
Jan 08, 1999
by
simonm
Browse files
[project @ 1999-01-08 16:11:23 by simonm]
Fix endianness problems in info table generation.
parent
1b0b6634
Changes
1
Hide whitespace changes
Inline
Side-by-side
ghc/compiler/nativeGen/StixInfo.lhs
View file @
a202c6c4
...
...
@@ -6,6 +6,7 @@
module StixInfo ( genCodeInfoTable, genBitmapInfoTable ) where
#include "HsVersions.h"
#include "../includes/config.h"
import AbsCSyn ( AbstractC(..), Liveness(..) )
import CLabel ( CLabel )
...
...
@@ -49,10 +50,18 @@ genCodeInfoTable (CClosureInfoAndCode cl_info _ _ srt cl_descr)
, StInt (toInteger type_info)
]
-- sigh: building up the info table is endian-dependent.
-- 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) .|.
(fromInt srt_len)
#else
type_info = (fromInt flags) .|.
(fromInt closure_type `shiftL` 8) .|.
(fromInt srt_len `shiftL` 16)
#endif
(srt_label,srt_len) =
case srt of
...
...
@@ -62,7 +71,11 @@ genCodeInfoTable (CClosureInfoAndCode cl_info _ _ srt cl_descr)
(StInt (toInteger off)), len)
layout_info :: Word32
#ifdef WORDS_BIGENDIAN
layout_info = (fromInt ptrs `shiftL` 16) .|. fromInt nptrs
#else
layout_info = (fromInt ptrs) .|. (fromInt nptrs `shiftL` 16)
#endif
ptrs = closurePtrsSize cl_info
nptrs = size - ptrs
...
...
@@ -102,10 +115,16 @@ genBitmapInfoTable liveness srt closure_type include_srt
LvLarge lbl -> StCLbl lbl
type_info :: Word32
#ifdef WORDS_BIGENDIAN
type_info = (fromInt flags `shiftL` 24) .|.
(fromInt closure_type `shiftL` 16) .|.
(fromInt srt_len)
#else
type_info = (fromInt flags) .|.
(fromInt closure_type `shiftL` 8) .|.
(fromInt srt_len `shiftL` 16)
#endif
(srt_label,srt_len) =
case srt of
(lbl, NoSRT) -> (StInt 0, 0)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment