Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,262
    • Issues 4,262
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 419
    • Merge Requests 419
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #17026

Closed
Open
Opened Aug 05, 2019 by Ömer Sinan Ağacan@osa1Maintainer

Remove IntRep and WordRep (and maybe AddrRep?)

(Forked from #16964)

The PrimReps IntRep and WordRep are currently 32-bit on 32-bit systems and 64-bit on 64-bit systems. The problem is IntRep is still different than Int32Rep on a 32-bit system (and Int64Rep on 64-bit), even though they're represented the same.

The idea is to remove IntRep and WordRep so that on a 64-bit system types like Int# and Word# would have Int64Rep (and Int32Rep on 32-bit).

This simplifies the PrimRep comparison logic -- e.g. we currently have bugs when checking coercion safety when coercing a Int# (which has IntRep) to a Int64# (which has Int64Rep on 64-bit) -- see #16952 (closed). Overall having less PrimReps should make dealing with them easier.

Similarly, I think we could remove AddrRep as well -- it'd be Word32Rep or Word64Rep depending on the word size.

(Doing this is one way to fix #16952 (closed) and unblock the !1381 (closed) -- which fixes release-blocking #16893 (closed))


Note that PrimRep is exposed to users via GHC.Types.RuntimeRep, so this is a user-facing change (but perhaps not in a stable part of the GHC API). E.g. this program

main = print (splitApps (typeRepKind (typeRep @Int#)))

will print differently if this proposal is implemented.


I've started working on this -- the main difficulty is we need to pass DynFlags (or word size) to top-level constants like intPrimTyCon and wordPrimTyCon, which transitively causes a lot of things to depend on DynFlags (or word size).

cc @simonpj @bgamari

Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#17026