Visitar URL original
rts_getThreadId: fix return type on newer GHCs by amesgen · Pull Request #263 · haskell-unordered-containers/hashable · GitHub
Skip to content

rts_getThreadId: fix return type on newer GHCs - #263

Merged
phadej merged 1 commit into
haskell-unordered-containers:masterfrom
amesgen:fix-rts_getThreadId-return-type
Jan 4, 2023
Merged

phadej merged 1 commit into
haskell-unordered-containers:masterfrom
amesgen:fix-rts_getThreadId-return-type

Conversation

@amesgen

@amesgen amesgen commented Jan 4, 2023

Copy link
Copy Markdown
Contributor

Found via the GHC WASM backend: https://gitlab.haskell.org/ghc/ghc/-/issues/22617#note_470653

Also see https://hackage-search.serokell.io/?q=rts_getThreadId for other packages doing the same thing.

@@ -763,7 +769,15 @@ hashThreadId (ThreadId t) = hash (fromIntegral (getThreadId t) :: Int)

-- this cannot be capi, as GHC panics.
foreign import ccall unsafe "rts_getThreadId" getThreadId

@phadej phadej Jan 4, 2023 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is rts_getThreadId exported from some header? Could you change that to ccall to capi (with CApiFFI).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, crap. It cannot be capi as GHC panics, but does even GHC-9.4 panic still? It does :( https://gitlab.haskell.org/ghc/ghc/-/issues/22705

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I change it to capi, I get

ghc: panic! (the 'impossible' happened)
  (GHC version 9.2.4:
	toCType
  ThreadId#
  Call stack:
      CallStack (from HasCallStack):
        callStackDoc, called at compiler/GHC/Utils/Panic.hs:181:37 in ghc:GHC.Utils.Panic
        pprPanic, called at compiler/GHC/HsToCore/Foreign/Decl.hs:763:17 in ghc:GHC.HsToCore.Foreign.Decl

which seems to be consistent with the comment

-- this cannot be capi, as GHC panics.

you added in #213.

@phadej
phadej merged commit ee10c3d into haskell-unordered-containers:master Jan 4, 2023
@amesgen
amesgen deleted the fix-rts_getThreadId-return-type branch January 4, 2023 17:11
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Jan 25, 2023
Version 1.4.2.0
* Fix the foreign signature of getThreadId
  haskell-unordered-containers/hashable#263
* Drop support for GHCs prior GHC-8.2 The recent unordered-containers
  releases support only GHC-8.2+
* Add instance for OsString, PosixString, WindowsString from
  filepath-1.4.100.1
* Add Hashable ByteArray instance using data-array-byte compat package
msk pushed a commit to msk/pkgsrc that referenced this pull request May 11, 2026
Version 1.4.2.0
* Fix the foreign signature of getThreadId
  haskell-unordered-containers/hashable#263
* Drop support for GHCs prior GHC-8.2 The recent unordered-containers
  releases support only GHC-8.2+
* Add instance for OsString, PosixString, WindowsString from
  filepath-1.4.100.1
* Add Hashable ByteArray instance using data-array-byte compat package
jperkin pushed a commit to TritonDataCenter/pkgsrc that referenced this pull request May 14, 2026
Version 1.4.2.0
* Fix the foreign signature of getThreadId
  haskell-unordered-containers/hashable#263
* Drop support for GHCs prior GHC-8.2 The recent unordered-containers
  releases support only GHC-8.2+
* Add instance for OsString, PosixString, WindowsString from
  filepath-1.4.100.1
* Add Hashable ByteArray instance using data-array-byte compat package
tsutsui pushed a commit to tsutsui/pkgsrc that referenced this pull request Oct 17, 2026
Version 1.4.2.0
* Fix the foreign signature of getThreadId
  haskell-unordered-containers/hashable#263
* Drop support for GHCs prior GHC-8.2 The recent unordered-containers
  releases support only GHC-8.2+
* Add instance for OsString, PosixString, WindowsString from
  filepath-1.4.100.1
* Add Hashable ByteArray instance using data-array-byte compat package
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants