Rodrigo Mesquita pushed to branch wip/spj-reinstallable-base2 at Glasgow Haskell Compiler / GHC
Commits:
-
64ed2f41
by Rodrigo Mesquita at 2026-05-06T13:25:50+01:00
4 changed files:
- compiler/GHC/Builtin/KnownKeys.hs
- compiler/GHC/HsToCore/Foreign/C.hs
- libraries/base/src/GHC/Essentials.hs
- libraries/ghc-internal/src/GHC/Internal/Foreign/C/ConstPtr.hs
Changes:
| ... | ... | @@ -200,6 +200,9 @@ knownKeyTable |
| 200 | 200 | , (mkVarOcc "toRational", toRationalClassOpKey)
|
| 201 | 201 | , (mkVarOcc "realToFrac", realToFracIdKey)
|
| 202 | 202 | |
| 203 | + -- FFI things
|
|
| 204 | + , (mkTcOcc "ConstPtr", constPtrTyConKey)
|
|
| 205 | + |
|
| 203 | 206 | -- Class Monad, MonadFix, MonadZip
|
| 204 | 207 | , (mkTcOcc "Monad", monadClassKey)
|
| 205 | 208 | , (thenMClassOpOcc, thenMClassOpKey)
|
| ... | ... | @@ -365,7 +368,7 @@ basicKnownKeyNames |
| 365 | 368 | starArrStarArrStarKindRepName,
|
| 366 | 369 | constraintKindRepName,
|
| 367 | 370 | -- FFI primitive types that are not wired-in.
|
| 368 | - ptrTyConName, funPtrTyConName, constPtrConName,
|
|
| 371 | + ptrTyConName, funPtrTyConName,
|
|
| 369 | 372 | word8TyConName,
|
| 370 | 373 | |
| 371 | 374 | -- Plugins
|
| ... | ... | @@ -459,11 +462,6 @@ pluginTyConName = tcQual pLUGINS (fsLit "Plugin") pluginTyConKey |
| 459 | 462 | frontendPluginTyConName :: Name
|
| 460 | 463 | frontendPluginTyConName = tcQual pLUGINS (fsLit "FrontendPlugin") frontendPluginTyConKey
|
| 461 | 464 | |
| 462 | -constPtrConName :: Name
|
|
| 463 | -constPtrConName =
|
|
| 464 | - tcQual gHC_INTERNAL_FOREIGN_C_CONSTPTR (fsLit "ConstPtr") constPtrTyConKey
|
|
| 465 | - |
|
| 466 | - |
|
| 467 | 465 | {-
|
| 468 | 466 | ************************************************************************
|
| 469 | 467 | * *
|
| ... | ... | @@ -241,7 +241,7 @@ dsFCall fn_id co fcall mDeclHeader = do |
| 241 | 241 | | (_, res_ty1) <- tcSplitFunTys ty1
|
| 242 | 242 | , newty <- maybe res_ty1 snd (tcSplitIOType_maybe res_ty1)
|
| 243 | 243 | , Just (ptr, _) <- splitTyConApp_maybe newty
|
| 244 | - , tyConName ptr == constPtrConName
|
|
| 244 | + , tyConName ptr `hasKnownKey` constPtrTyConKey
|
|
| 245 | 245 | = text "const"
|
| 246 | 246 | | otherwise = empty
|
| 247 | 247 |
| ... | ... | @@ -75,6 +75,9 @@ module GHC.Essentials |
| 75 | 75 | , Either(..)
|
| 76 | 76 | , Void
|
| 77 | 77 | |
| 78 | + -- FFI
|
|
| 79 | + , ConstPtr
|
|
| 80 | + |
|
| 78 | 81 | -- Show internals
|
| 79 | 82 | , showsPrec, shows, showString, showSpace, showCommaSpace, showParen
|
| 80 | 83 | |
| ... | ... | @@ -299,6 +302,7 @@ import GHC.Internal.GHCi |
| 299 | 302 | import GHC.Internal.Desugar (toAnnotationWrapper)
|
| 300 | 303 | import GHC.Internal.Stack.Types
|
| 301 | 304 | import GHC.Internal.Exception.Context
|
| 305 | +import GHC.Internal.Foreign.C.ConstPtr
|
|
| 302 | 306 | #if defined(javascript_HOST_ARCH)
|
| 303 | 307 | import GHC.Internal.JS.Prim (unsafeUnpackJSStringUtf8##)
|
| 304 | 308 | #endif |
| ... | ... | @@ -3,6 +3,7 @@ |
| 3 | 3 | {-# LANGUAGE StandaloneKindSignatures #-}
|
| 4 | 4 | {-# LANGUAGE Trustworthy #-}
|
| 5 | 5 | |
| 6 | +{-# OPTIONS_GHC -fdefines-known-key-names #-}
|
|
| 6 | 7 | -----------------------------------------------------------------------------
|
| 7 | 8 | -- |
|
| 8 | 9 | -- Module : GHC.Internal.Foreign.C.ConstPtr
|