Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 5,413
    • Issues 5,413
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 603
    • Merge requests 603
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #15698
Closed
Open
Issue created Oct 02, 2018 by Ömer Sinan Ağacan@osa1Maintainer

SingleEntry update flag for Stg bindings is not used

I was looking at code generation for bindings with different update flags. Update flag type is defined as:

data UpdateFlag = ReEntrant | Updatable | SingleEntry

I realized that we don't care about the difference between ReEntrant and SingleEntry, we only care about whether a binding is updatable or not, which is defined as

isUpdatable :: UpdateFlag -> Bool
isUpdatable ReEntrant   = False
isUpdatable SingleEntry = False
isUpdatable Updatable   = True

So we could remove SingleEntry and replace all uses of it with ReEntrant and everything would work the same.

This raises the question of whether we're missing an optimisation in the code generator. Looking at code generation differences of updatable and non-updatable bindings, it seems like for a thunk (a binding with no arguments) we generate a thunk header and push an update frame regardless of the update flag. As far as I can see, update flag is only used when generating AP and selector thunks (we don't generate AP or selector thunks if the binding is not updatable).

My question is: it seems to me that if a thunk is single entry then we should be able to give it a non-thunk type (maybe FUN?) and avoid pushing an update frame in closureCodeBody. Am I missing anything or is this possible? Is this worth trying?

Trac metadata
Trac field Value
Version 8.6.1
Type Task
TypeOfFailure OtherFailure
Priority lowest
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking