Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
    • Locked files
  • Issues 5.6k
    • Issues 5.6k
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 667
    • Merge requests 667
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
    • Test cases
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Model experiments
  • Analytics
    • Analytics
    • 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
  • #23777

JS: bitfields and flags are inconsistent between platforms

We have some consistency issues between platforms for code generated by the JavaScript backends.

On nodejs we have some operations that return bitfields, such as the stat.st_mode field with file type information. On nodejs we can interpret the flags using the constants defined in the fs.constants object. This contains the correct bits for the platform that the nodejs instance is running on.

However, we also have some haskell code in .hsc files that interprets the bits directly. The bits/masks for the .hsc files come from the emsdk toolchain, and can be different from those of the platform that node.js is running on.

The way to solve this:

  • always convert flags/bits produced by node.js operating system specific code to the layout that is consistent with emsdk, before returning the values to Haskell code
  • always expect emsdk values for flags from Haskell code, convert them to the appropriate node.js flags just before calling the node.js API.
  • use the autoconf tooling and C preprocessor to retrieve flag/mask information from emsdk to use in the JavaScript code. Values may change between emsdk versions and we have to make sure that the .js and .hsc files are always consistent with the emsdk version that we're building with

I have a mostly working fix for this (at least for the base library), but it touches much of the same code as !10918 (merged), which should be merged first.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking