Created
August 30, 2022 05:48
-
-
Save TerrorJack/b497b6c2e903638384a4eba0dd809895 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
import Data.List | |
import qualified Data.Map.Strict as M | |
import qualified Data.Text as T | |
main :: IO () | |
main = do | |
s <- readFile "rts/include/stg/MiscClosures.h" | |
let toks = | |
foldl' | |
(\acc (f, x) -> M.insertWith (<>) f [x] acc) | |
M.empty | |
[ (f, x) | l <- lines s, let toks = words l, not (null toks), let tok = T.pack $ head toks, "RTS_" `T.isPrefixOf` tok, let f : x : _ = T.split (`elem` ['(', ')']) tok | |
] | |
print $ | |
sort $ | |
[ "enterFunCCS", | |
"pushCostCentre", | |
"updateRemembSetPushClosure_", | |
"updateRemembSetPushThunk_", | |
"stg_copyArray_barrier" | |
] | |
<> toks M.! "RTS_FUN_DECL" | |
<> [x <> "_ret" | x <- toks M.! "RTS_RET"] | |
<> [ x <> "_entry" | |
| x <- | |
toks M.! "RTS_ENTRY" <> toks M.! "RTS_FUN" <> toks M.! "RTS_THUNK" | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment