Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • 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 4,843
    • Issues 4,843
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 457
    • Merge requests 457
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #5931

Closed
Open
Created Mar 12, 2012 by Joachim Breitner@nomeataDeveloper

Allow 'Any' to be passed to a foreign prim function.

Real primops can take boxed arguments, and the Cmm code will receive the pointer to the object on the Haskell heap, e.g. for unpackClosure#. To be able to implement such a function in a "foreign prim" call, this needs to be allowed there as well, and the attached patch does that.

By only allowing Any here (instead of arbitrary types), it is clearer that the function will not receive the value in any marshalled form, but just the raw pointer. Haskell code using such functions are likely to use unsafeCoerce# to turn a Haskell value into a value of type Any.

I am working on code that helps investigating the heap, similar to vacuum, and unwrapClosure was not sufficient. With this patch in GHC I do not have to modify the compiler further to create an improved version.

If applied, the documentation at wiki:Commentary/PrimOps#Foreignout-of-linePrimOps needs to be updated. I did not find any documentation in the GHC tree to updated accordingly.

Trac metadata
Trac field Value
Version 7.4.1
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (FFI)
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