Int-based lexer flag bitmask exhausted

Herbert Valerio Riedel hvriedel at gmail.com
Sat Jun 21 10:09:44 UTC 2014


Hello Simon (et al.),

While doing #9224[1] as a finger-exercise to extend the lexer to support
base-2 integer literals, I got stuck on the lexer extension map being
represented as an 'Int', which (in GHC) is only guaranteed to hold least
32bits.

-- for reasons of efficiency, flags indicating language extensions (eg,
-- -fglasgow-exts or -XParallelArrays) are represented by a bitmap
-- stored in an unboxed Int

However, as all 32bits are already taken up by language extensions, and
I'd need a 33th bit, I'm wondering how to proceed. Can we replace the
'Int' by an 'Int64' (or even better a Word64, ideally with a newtype or
at least a type-synonym around it?) which would give us a bit more
headroom while being semantically sound even for 'bitSize Int == 32'?

 [1]: https://ghc.haskell.org/trac/ghc/ticket/9224

Cheers,
   hvr


More information about the ghc-devs mailing list