| ... |
... |
@@ -20,7 +20,9 @@ module GHCi.ResolvedBCO |
|
20
|
20
|
#error Bytecode serialization works only on 32- and 64-bit platforms.
|
|
21
|
21
|
#endif
|
|
22
|
22
|
|
|
23
|
|
-#define LITTLE_ENDIAN_64_BITS (!defined(WORDS_BIGENDIAN) && SIZEOF_HSWORD == 8)
|
|
|
23
|
+#if !defined(WORDS_BIGENDIAN) && SIZEOF_HSWORD == 8
|
|
|
24
|
+#define LITTLE_ENDIAN_64_BITS
|
|
|
25
|
+#endif
|
|
24
|
26
|
|
|
25
|
27
|
import Prelude -- See note [Why do we import Prelude here?]
|
|
26
|
28
|
|
| ... |
... |
@@ -41,7 +43,7 @@ import Foreign.Storable (Storable, sizeOf) |
|
41
|
43
|
import GHC.Data.SmallArray (SmallArray)
|
|
42
|
44
|
import GHC.Generics (Generic)
|
|
43
|
45
|
|
|
44
|
|
-#if !LITTLE_ENDIAN_64_BITS
|
|
|
46
|
+#ifndef LITTLE_ENDIAN_64_BITS
|
|
45
|
47
|
import Control.Monad (replicateM)
|
|
46
|
48
|
#endif
|
|
47
|
49
|
|
| ... |
... |
@@ -100,7 +102,7 @@ data BCOByteArray a |
|
100
|
102
|
getBCOByteArray :: !ByteArray#
|
|
101
|
103
|
}
|
|
102
|
104
|
|
|
103
|
|
-#if !LITTLE_ENDIAN_64_BITS
|
|
|
105
|
+#ifndef LITTLE_ENDIAN_64_BITS
|
|
104
|
106
|
|
|
105
|
107
|
fromBCOByteArray :: Storable a => BCOByteArray a -> UArray Int a
|
|
106
|
108
|
fromBCOByteArray @a (BCOByteArray ba#) = UArray 0 (n - 1) n ba#
|
| ... |
... |
@@ -148,7 +150,7 @@ instance Binary ResolvedBCO where |
|
148
|
150
|
1 -> ResolvedStaticCon <$> get <*> get <*> get <*> get <*> get <*> get
|
|
149
|
151
|
_ -> error "Binary ResolvedBCO: invalid byte"
|
|
150
|
152
|
|
|
151
|
|
-#if !LITTLE_ENDIAN_64_BITS
|
|
|
153
|
+#ifndef LITTLE_ENDIAN_64_BITS
|
|
152
|
154
|
|
|
153
|
155
|
-- | Serialize a 'BCOByteArray', not writing the payload verbatim but
|
|
154
|
156
|
-- serializing the individual elements. This can be used with any host
|
| ... |
... |
@@ -225,7 +227,7 @@ instance Binary (BCOByteArray Word16) where |
|
225
|
227
|
-- See Note [BCOByteArray serialization].
|
|
226
|
228
|
instance Binary (BCOByteArray Word) where
|
|
227
|
229
|
|
|
228
|
|
-#if LITTLE_ENDIAN_64_BITS
|
|
|
230
|
+#ifdef LITTLE_ENDIAN_64_BITS
|
|
229
|
231
|
put = putBCOByteArrayDirectly
|
|
230
|
232
|
get = getBCOByteArrayDirectly
|
|
231
|
233
|
#else
|