Zubin pushed to branch wip/inline-fs at Glasgow Haskell Compiler / GHC
Commits:
-
5fb45025
by Zubin Duggal at 2025-11-05T12:58:44+05:30
1 changed file:
Changes:
| ... | ... | @@ -214,6 +214,11 @@ data FastStringPayload = FastString { |
| 214 | 214 | |
| 215 | 215 | data FastString = FastStringId {-# UNPACK #-} !Word64
|
| 216 | 216 | |
| 217 | +-- first 5 bits set: inlined faststring
|
|
| 218 | +-- next 3 bits: length
|
|
| 219 | +-- next 7 bytes: unpacked BS
|
|
| 220 | +--
|
|
| 221 | + |
|
| 217 | 222 | fs_sbs :: FastString -> ShortByteString
|
| 218 | 223 | fs_sbs (FastStringId w)
|
| 219 | 224 | | w .&. 0xf8000000_00000000 == 0xf8000000_00000000
|
| ... | ... | @@ -230,7 +235,8 @@ fs_sbs (FastStringId w) |
| 230 | 235 | 5 -> SBS.pack [ w8_64 (w `uncheckedShiftRL64#` 32#), w8_64 (w `uncheckedShiftRL64#` 24#), w8_64 (w `uncheckedShiftRL64#` 16#), w8_64 (w `uncheckedShiftRL64#` 8#), w8_64 w)]
|
| 231 | 236 | 6 -> SBS.pack [ w8_64 (w `uncheckedShiftRL64#` 40#), w8_64 (w `uncheckedShiftRL64#` 32#), w8_64 (w `uncheckedShiftRL64#` 24#), w8_64 (w `uncheckedShiftRL64#` 16#), w8_64 (w `uncheckedShiftRL64#` 8#), w8_64 w)]
|
| 232 | 237 | 7 -> SBS.pack [ w8_64 (w `uncheckedShiftRL64#` 48#), w8_64 (w `uncheckedShiftRL64#` 40#), w8_64 (w `uncheckedShiftRL64#` 32#), w8_64 (w `uncheckedShiftRL64#` 24#), w8_64 (w `uncheckedShiftRL64#` 16#), w8_64 (w `uncheckedShiftRL64#` 8#), w8_64 w)]
|
| 233 | - | otherwise
|
|
| 238 | + | otherwise =
|
|
| 239 | + |
|
| 234 | 240 | n_chars :: FastString -> Int
|
| 235 | 241 | uniq :: FastString -> Int
|
| 236 | 242 |