Skip to content

Update for 9.6.2 - #21

Open
pillowtrucker wants to merge 6 commits into
stepcut:masterfrom
pillowtrucker:master
Open

Update for 9.6.2#21
pillowtrucker wants to merge 6 commits into
stepcut:masterfrom
pillowtrucker:master

Conversation

@pillowtrucker

Copy link
Copy Markdown

@drvink@Kleidukos this builds now and make, load and unsafeEval mostly work, even on a relatively complicated test:

main =do fn <- unsafeEval_ "(\\x -> (x,x::Int))"[] ["-O2","-v","-g","-threaded","-with-rtsopts=-N"] [][]::IO (Either [String] (Int-> (Int,Int)))
case fn ofRight fn ->putStrLn$show$ fn 8Left err ->putStrLn$"error top level"
whoop <- atomically $ newTMVar 1
whoop2 <- atomically $ newTMVar 2
whoop3 <- atomically $ newTMVar 3-- when (isJust fn) $ putStrLn $ show $ (fromRight fn) 7
danger <- unsafeEval_ "(\\w -> (atomically $ takeTMVar w) >>= putStrLn . show >> threadDelay 5000000 >> (atomically $ putTMVar w 5)) :: TMVar Int -> IO ()" ["Control.Concurrent.STM","Control.Concurrent.STM.TMVar","Control.Concurrent"] ["-O2","-v","-g","-threaded","-with-rtsopts=-N"] [][]::IO (Either [String] (TMVarInt->IO()))
case danger ofRight fn ->do
tid <- forkIO $ fn whoop
return()Left err ->mapMputStrLn err >>return()-- hmm <- atomically $ readTMVar whoop2-- putStrLn . show $ hmm
threadDelay 2000000
hmm2 <- atomically $do
hhhh <- tryTakeTMVar whoop
case hhhh ofJust ok ->return ok
Nothing-> retry
putStrLn.show$ hmm2

I'm getting a solid full terminal of warnings such as this though:

Symbol type mismatch.
Symbol stg_ap_pppppp_fast was defined by /home/wrath/.ghcup/ghc/9.6.2/lib/ghc-9.6.2/lib/../lib/x86_64-linux-ghc-9.6.2/rts-1.0.2/libHSrts-1.0.2.a to be a code symbol.
yet was defined by <builtin> to be a data symbol.

I was getting those even on very basic tests and thought maybe it's because I had ghc flags different in my main project than in the evaled code, but they're the same even when I tested:

main =do fn <- unsafeEval "(\\x -> (x,x::Int))"[]::IO (Maybe (Int-> (Int,Int)))
when (isJust fn) $putStrLn$show$ (fromJust fn) 7

@Kleidukos

Copy link
Copy Markdown

oh wow that's wonderful, thanks a lot for this work!

@arjunkathuria

Copy link
Copy Markdown

Hi! Ran into this one today.

Does this build with GHC 9.2 and is mostly safe to use?

@pillowtrucker

Copy link
Copy Markdown
Author

the other pull request might work better for 9.2 but I don't remember when the API changes were made. I don't know enough about the GHC API and to tell whether this is still safe. The code means exactly the same as it did before. Whether that still makes sense on the ABI level is another matter. I was hoping someone who knows this better would help debug it

Sign up for freeto 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.

3 participants

@pillowtrucker@Kleidukos@arjunkathuria