Skip to content

Commit

Permalink
brush up the plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
ulysses4ever committed Jun 12, 2024
1 parent 83f5d63 commit 19b799d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 17 deletions.
4 changes: 0 additions & 4 deletions gibbon-ghc-integration/cabal.project
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
packages: ../gibbon-compiler
plugin0
plugin1
gibbon-plugin
examples

with-compiler: ghc-9.4.3

package *
ghc-options: -fexpose-all-unfoldings
14 changes: 5 additions & 9 deletions gibbon-ghc-integration/examples/gibbon-examples.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,14 @@ build-type: Simple
library
hs-source-dirs: src
exposed-modules: BinTree
build-depends: base == 4.17.*
-- , plugin0
-- , plugin1
build-depends: base
, inline-c
, binary
, gibbon-plugin
ghc-options: -Wall -Wcompat -fdefer-typed-holes
default-language: Haskell2010
ghc-options: -Wall -Wcompat
-O2
-- -fplugin=Gibbon.Plugin0
-- -fplugin=Gibbon.Plugin1
-fplugin=Gibbon.Plugin

-- "-optl-Wl,--allow-multiple-definition"
Expand All @@ -36,8 +32,8 @@ library
-dcore-lint
-ddump-simpl -dsuppress-all -ddump-to-file

include-dirs: "/home/ckoparka/chai/tree-velocity/gibbon-rts/build"
extra-lib-dirs: "/home/ckoparka/chai/tree-velocity/gibbon-rts/build"
include-dirs: "../../gibbon-rts/build"
extra-lib-dirs: "../../gibbon-rts/build"
extra-libraries: gibbon_rts_ng


Expand All @@ -48,8 +44,8 @@ executable run-gibbon-examples
build-depends: base, gibbon-examples, binary, bytestring, deepseq, time
ghc-options: -O2
-dcore-lint
include-dirs: "/home/ckoparka/chai/tree-velocity/gibbon-rts/build"
extra-lib-dirs: "/home/ckoparka/chai/tree-velocity/gibbon-rts/build"
include-dirs: "../../gibbon-rts/build"
extra-lib-dirs: "../../gibbon-rts/build"
extra-libraries: gibbon_rts_ng
-- ghc-options: "-optl-Wl,-I/home/ckoparka/chai/tree-velocity/gibbon-rts/build"
-- "-optl-Wl,-L/home/ckoparka/chai/tree-velocity/gibbon-rts/build"
4 changes: 2 additions & 2 deletions gibbon-ghc-integration/gibbon-plugin/gibbon-plugin.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ build-type: Simple
library
exposed-modules: Gibbon.Plugin
hs-source-dirs: src
build-depends: base == 4.17.*
, ghc == 9.4.3
build-depends: base
, ghc
, gibbon
, containers
, filepath
Expand Down
5 changes: 3 additions & 2 deletions gibbon-ghc-integration/gibbon-plugin/src/Gibbon/Plugin.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module Gibbon.Plugin where

import Data.String
import qualified GHC.Types.TyThing as GHC
import qualified GHC.Unit.External as GHC
import qualified GHC.Utils.Trace as GHC
Expand Down Expand Up @@ -78,7 +79,7 @@ gibbonPlugin mod_guts = do
then do
let name = GHC.idName f
uniq <- GHC.getUniqueM
let name' = GHC.mkFCallName uniq ("c_" ++ nameToString name)
let name' = GHC.mkFCallName uniq (fromString $ "c_" ++ nameToString name)
pure (GHC.setIdName f name',rhs)
else pure (f,rhs))
closure
Expand Down Expand Up @@ -133,7 +134,7 @@ generateObjectFile l0 = do
let dflags' = Gib.gopt_set Gib.Opt_DisableGC $ Gib.gopt_set Gib.Opt_Packed (Gib.dynflags config)
let config' = config { Gib.dynflags = dflags', Gib.optc = " -O3 " }
uniq <- randomIO :: IO Word16
let fp = "/home/ckoparka/chai/gibbon-ghc-integration-files/" ++ show uniq ++ ".hs"
let fp = "/tmp/gibbon-ghc-integration-file-" ++ show uniq ++ ".hs"
Gib.compileFromL0 config' 0 fp l0
return fp

Expand Down

0 comments on commit 19b799d

Please sign in to comment.