summaryrefslogtreecommitdiff
path: root/compiler/GHC
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2023-03-31 12:47:21 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2023-04-04 11:09:15 -0400
commiteed0d9307b3f48b6a2e45dbb246610cf4ab73896 (patch)
tree38751ee9aedb8c18f5bd852334a0f65f91604399 /compiler/GHC
parentcd00e321d5d7aaee3999b283a2a2f0d77f7b3e8e (diff)
downloadhaskell-eed0d9307b3f48b6a2e45dbb246610cf4ab73896.tar.gz
GHCi.RemoteTypes: fix doc and avoid unsafeCoerce (#23201)
Diffstat (limited to 'compiler/GHC')
-rw-r--r--compiler/GHC/Runtime/Interpreter.hs6
1 files changed, 2 insertions, 4 deletions
diff --git a/compiler/GHC/Runtime/Interpreter.hs b/compiler/GHC/Runtime/Interpreter.hs
index 64790ba8a4..c40e9cd1f6 100644
--- a/compiler/GHC/Runtime/Interpreter.hs
+++ b/compiler/GHC/Runtime/Interpreter.hs
@@ -690,17 +690,15 @@ principle it would probably be ok, but it seems less hairy this way.
-- 'RemoteRef' when it is no longer referenced.
mkFinalizedHValue :: Interp -> RemoteRef a -> IO (ForeignRef a)
mkFinalizedHValue interp rref = do
- let hvref = toHValueRef rref
-
free <- case interpInstance interp of
#if defined(HAVE_INTERNAL_INTERPRETER)
- InternalInterp -> return (freeRemoteRef hvref)
+ InternalInterp -> return (freeRemoteRef rref)
#endif
ExternalInterp _ (IServ i) -> return $ modifyMVar_ i $ \state ->
case state of
IServPending {} -> pure state -- already shut down
IServRunning inst -> do
- let !inst' = inst {iservPendingFrees = hvref:iservPendingFrees inst}
+ let !inst' = inst {iservPendingFrees = castRemoteRef rref : iservPendingFrees inst}
pure (IServRunning inst')
mkForeignRef rref free