Skip to content

Commit 096b6ac

Browse files
committed
brush up the plugin
1 parent 94a1842 commit 096b6ac

File tree

4 files changed

+10
-17
lines changed

4 files changed

+10
-17
lines changed
Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
packages: ../gibbon-compiler
2-
plugin0
3-
plugin1
42
gibbon-plugin
53
examples
64

7-
with-compiler: ghc-9.4.3
8-
95
package *
106
ghc-options: -fexpose-all-unfoldings

gibbon-ghc-integration/examples/gibbon-examples.cabal

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,14 @@ build-type: Simple
77
library
88
hs-source-dirs: src
99
exposed-modules: BinTree
10-
build-depends: base == 4.17.*
11-
-- , plugin0
12-
-- , plugin1
10+
build-depends: base
1311
, inline-c
1412
, binary
1513
, gibbon-plugin
1614
ghc-options: -Wall -Wcompat -fdefer-typed-holes
1715
default-language: Haskell2010
1816
ghc-options: -Wall -Wcompat
1917
-O2
20-
-- -fplugin=Gibbon.Plugin0
21-
-- -fplugin=Gibbon.Plugin1
2218
-fplugin=Gibbon.Plugin
2319

2420
-- "-optl-Wl,--allow-multiple-definition"
@@ -36,8 +32,8 @@ library
3632
-dcore-lint
3733
-ddump-simpl -dsuppress-all -ddump-to-file
3834

39-
include-dirs: "/home/ckoparka/chai/tree-velocity/gibbon-rts/build"
40-
extra-lib-dirs: "/home/ckoparka/chai/tree-velocity/gibbon-rts/build"
35+
include-dirs: "../../gibbon-rts/build"
36+
extra-lib-dirs: "../../gibbon-rts/build"
4137
extra-libraries: gibbon_rts_ng
4238

4339

@@ -48,8 +44,8 @@ executable run-gibbon-examples
4844
build-depends: base, gibbon-examples, binary, bytestring, deepseq, time
4945
ghc-options: -O2
5046
-dcore-lint
51-
include-dirs: "/home/ckoparka/chai/tree-velocity/gibbon-rts/build"
52-
extra-lib-dirs: "/home/ckoparka/chai/tree-velocity/gibbon-rts/build"
47+
include-dirs: "../../gibbon-rts/build"
48+
extra-lib-dirs: "../../gibbon-rts/build"
5349
extra-libraries: gibbon_rts_ng
5450
-- ghc-options: "-optl-Wl,-I/home/ckoparka/chai/tree-velocity/gibbon-rts/build"
5551
-- "-optl-Wl,-L/home/ckoparka/chai/tree-velocity/gibbon-rts/build"

gibbon-ghc-integration/gibbon-plugin/gibbon-plugin.cabal

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ build-type: Simple
88
library
99
exposed-modules: Gibbon.Plugin
1010
hs-source-dirs: src
11-
build-depends: base == 4.17.*
12-
, ghc == 9.4.3
11+
build-depends: base
12+
, ghc
1313
, gibbon
1414
, containers
1515
, filepath

gibbon-ghc-integration/gibbon-plugin/src/Gibbon/Plugin.hs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
module Gibbon.Plugin where
44

5+
import Data.String
56
import qualified GHC.Types.TyThing as GHC
67
import qualified GHC.Unit.External as GHC
78
import qualified GHC.Utils.Trace as GHC
@@ -78,7 +79,7 @@ gibbonPlugin mod_guts = do
7879
then do
7980
let name = GHC.idName f
8081
uniq <- GHC.getUniqueM
81-
let name' = GHC.mkFCallName uniq ("c_" ++ nameToString name)
82+
let name' = GHC.mkFCallName uniq (fromString $ "c_" ++ nameToString name)
8283
pure (GHC.setIdName f name',rhs)
8384
else pure (f,rhs))
8485
closure
@@ -133,7 +134,7 @@ generateObjectFile l0 = do
133134
let dflags' = Gib.gopt_set Gib.Opt_DisableGC $ Gib.gopt_set Gib.Opt_Packed (Gib.dynflags config)
134135
let config' = config { Gib.dynflags = dflags', Gib.optc = " -O3 " }
135136
uniq <- randomIO :: IO Word16
136-
let fp = "/home/ckoparka/chai/gibbon-ghc-integration-files/" ++ show uniq ++ ".hs"
137+
let fp = "/tmp/gibbon-ghc-integration-file-" ++ show uniq ++ ".hs"
137138
Gib.compileFromL0 config' 0 fp l0
138139
return fp
139140

0 commit comments

Comments
 (0)