[Git][ghc/ghc][wip/T23479] Add tracing capabilities for JS Modules

Serge S. Gulin (@gulin.serge) gitlab at gitlab.haskell.org
Fri Sep 27 16:24:19 UTC 2024



Serge S. Gulin pushed to branch wip/T23479 at Glasgow Haskell Compiler / GHC


Commits:
5f13cd11 by Serge S. Gulin at 2024-09-27T19:23:48+03:00
Add tracing capabilities for JS Modules

- - - - -


3 changed files:

- compiler/GHC/StgToJS/Linker/Linker.hs
- compiler/GHC/StgToJS/Types.hs
- compiler/GHC/Types/ForeignCall.hs


Changes:

=====================================
compiler/GHC/StgToJS/Linker/Linker.hs
=====================================
@@ -548,6 +548,16 @@ data ModuleCode = ModuleCode
   , mc_frefs    :: ![ForeignJSRef]
   }
 
+instance Outputable ModuleCode where
+  ppr m = hang (text "ModuleCode") 2 $ vcat
+            [ hcat [text "Module: ", ppr (mc_module m)]
+            , hcat [text "JS Code:", pretty True (mc_js_code m)]
+            , hcat [text "JS Exports:", pprHsBytes (mc_exports m)]
+            , hang (text "JS Closures::") 2 (vcat (fmap (text . show) (mc_closures m)))
+            , hang (text "JS Statics::") 2 (vcat (fmap (text . show) (mc_statics m)))
+            , hang (text "JS ForeignRefs::") 2 (vcat (fmap (text . show) (mc_frefs m)))
+            ]
+
 -- | ModuleCode after link with other modules.
 --
 -- It contains less information than ModuleCode because they have been commoned


=====================================
compiler/GHC/StgToJS/Types.hs
=====================================
@@ -297,6 +297,7 @@ data ForeignJSRef = ForeignJSRef
   , foreignRefArgs     :: ![FastString]
   , foreignRefResult   :: !FastString
   }
+  deriving (Show)
 
 -- | data used to generate one ObjBlock in our object file
 data LinkableUnit = LinkableUnit


=====================================
compiler/GHC/Types/ForeignCall.hs
=====================================
@@ -156,7 +156,7 @@ data CCallConv
   | StdCallConv
   | PrimCallConv
   | JavaScriptCallConv
-  deriving (Eq, Data, Enum)
+  deriving (Show, Eq, Data, Enum)
 
 instance Outputable CCallConv where
   ppr StdCallConv = text "stdcall"



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/5f13cd110033aabb88a3d7fa3a195e560c4a2aaa

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/5f13cd110033aabb88a3d7fa3a195e560c4a2aaa
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240927/efe05a89/attachment-0001.html>


More information about the ghc-commits mailing list