Skip to content
Permalink
Browse files

Importing Cubix code

  • Loading branch information...
jkoppel committed Sep 5, 2018
1 parent ed052d0 commit 993860e3a72adb578b8aaec4ee511c61d5c0f921
Showing with 37,951 additions and 0 deletions.
  1. +7 −0 .gitignore
  2. +18 −0 README.md
  3. +2 −0 Setup.hs
  4. +253 −0 benchmarks/Benchmarks.hs
  5. +4,380 −0 benchmarks/reports/092117.html
  6. +1,248 −0 benchmarks/reports/092217_lua_O2.html
  7. +3 −0 benchmarks/reports/build_log.txt
  8. BIN commons-lang3-3.2-SNAPSHOT.jar
  9. +13 −0 compdata/.gitignore
  10. +29 −0 compdata/.travis.yml
  11. +30 −0 compdata/LICENSE
  12. +79 −0 compdata/README.md
  13. +2 −0 compdata/Setup.hs
  14. +72 −0 compdata/cubix-compdata.cabal
  15. +39 −0 compdata/examples/Examples/Multi/Common.hs
  16. +54 −0 compdata/examples/Examples/Multi/Eval.hs
  17. +48 −0 compdata/examples/Examples/Multi/EvalI.hs
  18. +60 −0 compdata/examples/Examples/Multi/EvalM.hs
  19. +275 −0 compdata/src/Data/Comp/Derive/Utils.hs
  20. +435 −0 compdata/src/Data/Comp/Multi.hs
  21. +452 −0 compdata/src/Data/Comp/Multi/Algebra.hs
  22. +102 −0 compdata/src/Data/Comp/Multi/Annotation.hs
  23. +58 −0 compdata/src/Data/Comp/Multi/Derive.hs
  24. +61 −0 compdata/src/Data/Comp/Multi/Derive/Equality.hs
  25. +118 −0 compdata/src/Data/Comp/Multi/Derive/HFoldable.hs
  26. +63 −0 compdata/src/Data/Comp/Multi/Derive/HFunctor.hs
  27. +79 −0 compdata/src/Data/Comp/Multi/Derive/HTraversable.hs
  28. +40 −0 compdata/src/Data/Comp/Multi/Derive/LiftSum.hs
  29. +75 −0 compdata/src/Data/Comp/Multi/Derive/Ordering.hs
  30. +70 −0 compdata/src/Data/Comp/Multi/Derive/Show.hs
  31. +69 −0 compdata/src/Data/Comp/Multi/Derive/SmartConstructors.hs
  32. +79 −0 compdata/src/Data/Comp/Multi/Equality.hs
  33. +91 −0 compdata/src/Data/Comp/Multi/Generic.hs
  34. +73 −0 compdata/src/Data/Comp/Multi/HFoldable.hs
  35. +118 −0 compdata/src/Data/Comp/Multi/HFunctor.hs
  36. +45 −0 compdata/src/Data/Comp/Multi/HTraversable.hs
  37. +93 −0 compdata/src/Data/Comp/Multi/Mapping.hs
  38. +90 −0 compdata/src/Data/Comp/Multi/Mutable.hs
  39. +204 −0 compdata/src/Data/Comp/Multi/Ops.hs
  40. +64 −0 compdata/src/Data/Comp/Multi/Ordering.hs
  41. +75 −0 compdata/src/Data/Comp/Multi/Projection.hs
  42. +51 −0 compdata/src/Data/Comp/Multi/Show.hs
  43. +134 −0 compdata/src/Data/Comp/Multi/Sum.hs
  44. +126 −0 compdata/src/Data/Comp/Multi/Term.hs
  45. +233 −0 compdata/src/Data/Comp/Multi/Variables.hs
  46. +183 −0 compdata/src/Data/Comp/Ops.hs
  47. +168 −0 compdata/src/Data/Comp/SubsumeCommon.hs
  48. +49 −0 compdata/stack.yaml
  49. +38 −0 compdata/testsuite/tests/Data/Comp/Examples/Multi.hs
  50. +117 −0 compdata/testsuite/tests/Data/Comp/Multi/Variables_Test.hs
  51. +20 −0 compdata/testsuite/tests/Data/Comp/Multi_Test.hs
  52. +55 −0 compdata/testsuite/tests/Data/Comp/Subsume_Test.hs
  53. +22 −0 compdata/testsuite/tests/Data/Comp_Test.hs
  54. +18 −0 compdata/testsuite/tests/Data_Test.hs
  55. +41 −0 compdata/testsuite/tests/Test/Utils.hs
  56. +17 −0 compdata/upload-doc
  57. +8 −0 compilation_notes.txt
  58. +2 −0 compstrat/.gitignore
  59. +314 −0 compstrat/Data/Comp/Multi/Strategic.hs
  60. +104 −0 compstrat/Data/Comp/Multi/Strategy/Classification.hs
  61. +96 −0 compstrat/Data/Comp/Multi/Strategy/Derive.hs
  62. +30 −0 compstrat/LICENSE
  63. +2 −0 compstrat/README.md
  64. +2 −0 compstrat/Setup.hs
  65. +60 −0 compstrat/compstrat.cabal
  66. +4 −0 compstrat/examples/.gitignore
  67. +23 −0 compstrat/examples/Examples/Multi/Main.hs
  68. +49 −0 compstrat/examples/Examples/Multi/Strat.hs
  69. +48 −0 compstrat/examples/Examples/Multi/Syntax.hs
  70. +36 −0 compstrat/stack.yaml
  71. +1 −0 comptrans/.gitignore
  72. +196 −0 comptrans/Data/Comp/Derive/Generic.hs
  73. +149 −0 comptrans/Data/Comp/Trans.hs
  74. +78 −0 comptrans/Data/Comp/Trans/Collect.hs
  75. +93 −0 comptrans/Data/Comp/Trans/DeriveMulti.hs
  76. +151 −0 comptrans/Data/Comp/Trans/DeriveTrans.hs
  77. +191 −0 comptrans/Data/Comp/Trans/DeriveUntrans.hs
  78. +237 −0 comptrans/Data/Comp/Trans/Util.hs
  79. +30 −0 comptrans/LICENSE
  80. +2 −0 comptrans/Setup.hs
  81. +63 −0 comptrans/comptrans.cabal
  82. +60 −0 comptrans/examples/generics/GenericExample.hs
  83. +3 −0 comptrans/examples/java/README
  84. +54 −0 comptrans/package.yaml
  85. +36 −0 comptrans/stack.yaml
  86. +25 −0 examples/basic/Examples/Multi/Main.hs
  87. +48 −0 examples/basic/Examples/Multi/Strat.hs
  88. +44 −0 examples/basic/Examples/Multi/Syntax.hs
  89. +50 −0 examples/c/Main.hs
  90. +143 −0 examples/java/Main.hs
  91. +41 −0 examples/javascript/Main.hs
  92. +117 −0 examples/lua/Main.hs
  93. +299 −0 examples/multi/Main.hs
  94. +62 −0 examples/python/Main.hs
  95. +3 −0 input-files/c/Bar.c
  96. +24 −0 input-files/c/Foo.c
  97. +23 −0 input-files/c/baz.c
  98. +4 −0 input-files/c/ipt/File1.c
  99. +5 −0 input-files/c/ipt/File2.c
  100. +4 −0 input-files/c/ipt/File3.c
  101. +12 −0 input-files/c/thud.c
  102. +3 −0 input-files/c/variadic.c
  103. +8 −0 input-files/java/Bar.java
  104. +15 −0 input-files/java/Foo.java
  105. +7 −0 input-files/java/ipt/Class1.java
  106. +7 −0 input-files/java/ipt/Class2.java
  107. +7 −0 input-files/java/ipt/Class3.java
  108. +1 −0 input-files/javascript/Bar.js
  109. +34 −0 input-files/javascript/Foo.js
  110. +3 −0 input-files/javascript/ipt/file1.js
  111. +3 −0 input-files/javascript/ipt/file2.js
  112. +3 −0 input-files/javascript/ipt/file3.js
  113. +1 −0 input-files/lua/Bar.lua
  114. +57 −0 input-files/lua/Foo.lua
  115. +5 −0 input-files/lua/ipt/file1.lua
  116. +5 −0 input-files/lua/ipt/file2.lua
  117. +5 −0 input-files/lua/ipt/file3.lua
  118. +2 −0 input-files/python/Bar.py
  119. +3 −0 input-files/python/Baz.py
  120. +27 −0 input-files/python/Foo.py
  121. +2 −0 input-files/python/ipt/File1.py
  122. +3 −0 input-files/python/ipt/File2.py
  123. +6 −0 input-files/python/ipt/File3.py
  124. BIN javaparser-1.0.8.jar
  125. BIN javaparser-to-hs.jar
  126. +15 −0 languages.iml
  127. +207 −0 package.yaml
  128. +77 −0 scripts/test_c.rb
  129. +119 −0 scripts/test_java.rb
  130. +108 −0 scripts/test_js.rb
  131. +40 −0 scripts/test_lua.rb
  132. +174 −0 scripts/test_py.rb
  133. +107 −0 src/Cubix/Analysis/Call/Trivial.hs
  134. +22 −0 src/Cubix/Language/C/Parametric/Common.hs
  135. +115 −0 src/Cubix/Language/C/Parametric/Common/Cfg.hs
  136. +54 −0 src/Cubix/Language/C/Parametric/Common/Semantics.hs
  137. +275 −0 src/Cubix/Language/C/Parametric/Common/Trans.hs
  138. +343 −0 src/Cubix/Language/C/Parametric/Common/Types.hs
  139. +14 −0 src/Cubix/Language/C/Parametric/Full.hs
  140. +41 −0 src/Cubix/Language/C/Parametric/Full/Names.hs
  141. +125 −0 src/Cubix/Language/C/Parametric/Full/Trans.hs
  142. +36 −0 src/Cubix/Language/C/Parametric/Full/Types.hs
  143. +27 −0 src/Cubix/Language/C/Parse.hs
  144. +250 −0 src/Cubix/Language/Info.hs
  145. +21 −0 src/Cubix/Language/Java/Parametric/Common.hs
  146. +161 −0 src/Cubix/Language/Java/Parametric/Common/Cfg.hs
  147. +56 −0 src/Cubix/Language/Java/Parametric/Common/Semantics.hs
  148. +312 −0 src/Cubix/Language/Java/Parametric/Common/Trans.hs
  149. +249 −0 src/Cubix/Language/Java/Parametric/Common/Types.hs
  150. +20 −0 src/Cubix/Language/Java/Parametric/Full.hs
  151. +27 −0 src/Cubix/Language/Java/Parametric/Full/Names.hs
  152. +74 −0 src/Cubix/Language/Java/Parametric/Full/Trans.hs
  153. +44 −0 src/Cubix/Language/Java/Parametric/Full/Types.hs
  154. +36 −0 src/Cubix/Language/Java/Parse.hs
  155. +26 −0 src/Cubix/Language/JavaScript/Parametric/Common.hs
  156. +161 −0 src/Cubix/Language/JavaScript/Parametric/Common/Cfg.hs
  157. +82 −0 src/Cubix/Language/JavaScript/Parametric/Common/Semantics.hs
  158. +280 −0 src/Cubix/Language/JavaScript/Parametric/Common/Trans.hs
  159. +208 −0 src/Cubix/Language/JavaScript/Parametric/Common/Types.hs
  160. +15 −0 src/Cubix/Language/JavaScript/Parametric/Full.hs
  161. +28 −0 src/Cubix/Language/JavaScript/Parametric/Full/Exclusions.hs
  162. +27 −0 src/Cubix/Language/JavaScript/Parametric/Full/Names.hs
  163. +81 −0 src/Cubix/Language/JavaScript/Parametric/Full/Trans.hs
  164. +114 −0 src/Cubix/Language/JavaScript/Parametric/Full/Types.hs
  165. +28 −0 src/Cubix/Language/Lua/Parametric/Common.hs
  166. +115 −0 src/Cubix/Language/Lua/Parametric/Common/Cfg.hs
  167. +40 −0 src/Cubix/Language/Lua/Parametric/Common/Semantics.hs
  168. +241 −0 src/Cubix/Language/Lua/Parametric/Common/Trans.hs
  169. +248 −0 src/Cubix/Language/Lua/Parametric/Common/Types.hs
  170. +8 −0 src/Cubix/Language/Lua/Parametric/Full.hs
  171. +23 −0 src/Cubix/Language/Lua/Parametric/Full/Exclusions.hs
  172. +58 −0 src/Cubix/Language/Lua/Parametric/Full/Names.hs
  173. +97 −0 src/Cubix/Language/Lua/Parametric/Full/Trans.hs
  174. +56 −0 src/Cubix/Language/Lua/Parametric/Full/Types.hs
  175. +171 −0 src/Cubix/Language/Parametric/Derive.hs
  176. +127 −0 src/Cubix/Language/Parametric/InjF.hs
  177. +120 −0 src/Cubix/Language/Parametric/Path.hs
  178. +49 −0 src/Cubix/Language/Parametric/ProgInfo.hs
  179. +14 −0 src/Cubix/Language/Parametric/Semantics/Cfg.hs
  180. +267 −0 src/Cubix/Language/Parametric/Semantics/Cfg/CfgConstruction.hs
  181. +70 −0 src/Cubix/Language/Parametric/Semantics/Cfg/CfgDot.hs
  182. +377 −0 src/Cubix/Language/Parametric/Semantics/Cfg/CommonNodes.hs
  183. +339 −0 src/Cubix/Language/Parametric/Semantics/Cfg/Graph.hs
  184. +221 −0 src/Cubix/Language/Parametric/Semantics/CfgInserter.hs
  185. +140 −0 src/Cubix/Language/Parametric/Semantics/SemanticProperties.hs
  186. +11 −0 src/Cubix/Language/Parametric/Syntax.hs
  187. +89 −0 src/Cubix/Language/Parametric/Syntax/Base.hs
  188. +294 −0 src/Cubix/Language/Parametric/Syntax/Function.hs
  189. +571 −0 src/Cubix/Language/Parametric/Syntax/Functor.hs
  190. +336 −0 src/Cubix/Language/Parametric/Syntax/VarDecl.hs
  191. +39 −0 src/Cubix/Language/Python/Parametric/Common.hs
  192. +159 −0 src/Cubix/Language/Python/Parametric/Common/Cfg.hs
  193. +112 −0 src/Cubix/Language/Python/Parametric/Common/Semantics.hs
  194. +280 −0 src/Cubix/Language/Python/Parametric/Common/Trans.hs
  195. +280 −0 src/Cubix/Language/Python/Parametric/Common/Types.hs
  196. +15 −0 src/Cubix/Language/Python/Parametric/Full.hs
  197. +39 −0 src/Cubix/Language/Python/Parametric/Full/Names.hs
  198. +88 −0 src/Cubix/Language/Python/Parametric/Full/Trans.hs
  199. +37 −0 src/Cubix/Language/Python/Parametric/Full/Types.hs
  200. +175 −0 src/Cubix/ParsePretty.hs
  201. +67 −0 src/Cubix/Sin/Compdata/Annotation.hs
  202. +108 −0 src/Cubix/Sin/Compdata/Derive.hs
  203. +24 −0 src/Cubix/Sin/Compdata/Instances.hs
  204. +12 −0 src/Cubix/Sin/NFData.hs
  205. +8 −0 src/Cubix/Transformations/Hoist.hs
  206. +316 −0 src/Cubix/Transformations/Hoist/Custom.hs
  207. +54 −0 src/Cubix/Transformations/Hoist/Elementary.hs
  208. +190 −0 src/Cubix/Transformations/Hoist/Hoisting.hs
  209. +341 −0 src/Cubix/Transformations/Plumbing/IPT.hs
  210. +6 −0 src/Cubix/Transformations/TAC.hs
  211. +327 −0 src/Cubix/Transformations/TAC/Custom.hs
  212. +89 −0 src/Cubix/Transformations/TAC/Gensym.hs
  213. +79 −0 src/Cubix/Transformations/TAC/Sorts.hs
  214. +115 −0 src/Cubix/Transformations/TAC/State.hs
  215. +334 −0 src/Cubix/Transformations/TAC/ToTAC.hs
  216. +254 −0 src/Cubix/Transformations/TestCoverage.hs
  217. +120 −0 src/Cubix/Transformations/Variation.hs
  218. +262 −0 src/Language/JavaScript/Pretty/Printer/Extended.hs
  219. +48 −0 stack.yaml
  220. +2 −0 test/Spec.hs
  221. +279 −0 test/lua/lua-5.3.3-tests/all.lua
  222. +1,171 −0 test/lua/lua-5.3.3-tests/api.lua
  223. +469 −0 test/lua/lua-5.3.3-tests/attrib.lua
  224. +81 −0 test/lua/lua-5.3.3-tests/big.lua
  225. +327 −0 test/lua/lua-5.3.3-tests/bitwise.lua
  226. +400 −0 test/lua/lua-5.3.3-tests/calls.lua
  227. +246 −0 test/lua/lua-5.3.3-tests/closure.lua
  228. +230 −0 test/lua/lua-5.3.3-tests/code.lua
  229. +312 −0 test/lua/lua-5.3.3-tests/constructs.lua
  230. +859 −0 test/lua/lua-5.3.3-tests/coroutine.lua
  231. +841 −0 test/lua/lua-5.3.3-tests/db.lua
  232. +535 −0 test/lua/lua-5.3.3-tests/errors.lua
  233. +455 −0 test/lua/lua-5.3.3-tests/events.lua
  234. +791 −0 test/lua/lua-5.3.3-tests/files.lua
  235. +623 −0 test/lua/lua-5.3.3-tests/gc.lua
  236. +231 −0 test/lua/lua-5.3.3-tests/goto.lua
  237. +301 −0 test/lua/lua-5.3.3-tests/literals.lua
  238. +161 −0 test/lua/lua-5.3.3-tests/locals.lua
  239. +380 −0 test/lua/lua-5.3.3-tests/main.lua
  240. +821 −0 test/lua/lua-5.3.3-tests/math.lua
  241. +630 −0 test/lua/lua-5.3.3-tests/nextvar.lua
  242. +373 −0 test/lua/lua-5.3.3-tests/pm.lua
  243. +309 −0 test/lua/lua-5.3.3-tests/sort.lua
  244. +372 −0 test/lua/lua-5.3.3-tests/strings.lua
  245. +321 −0 test/lua/lua-5.3.3-tests/tpack.lua
  246. +209 −0 test/lua/lua-5.3.3-tests/utf8.lua
  247. +141 −0 test/lua/lua-5.3.3-tests/vararg.lua
  248. +151 −0 test/lua/lua-5.3.3-tests/verybig.lua
@@ -0,0 +1,7 @@
.DS_STORE
.idea
.stack-work
out
a.out
cubix.cabal
*.class
@@ -1,2 +1,20 @@
# cubix
The Cubix framework for multi-language transformation. Explained in the OOPSLA 2018 paper "One Tool, Many Languages: Language-Parametric Transformation with Incremental Parametric Syntax"


# Compilation notes

With -O1 or -O2, compilation takes forever.

We recommend using the following command to build Cubix:

alias stackfastbuild="stack build --ghc-options='-O0 -j +RTS -A256m -n2m -RTS'"

This builds Cubix in parallel with minimal optimization, and sets the initial GHC heap to larger than usual.

We found the following two minimal sets of compilation flags that mitigate this blowup and make compilation manageable:

1: -fno-cse -fno-full-laziness
2: -fno-specialize -funfolding-creation-threshold=0

If disable everything except CSE and specialise, blow-up still occurs. Remains true with -O1
@@ -0,0 +1,2 @@
import Distribution.Simple
main = defaultMain
@@ -0,0 +1,253 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeSynonymInstances #-}

module Main where

import Control.DeepSeq ( NFData(..) )
import Control.Monad ( (=<<) )
import Data.Maybe ( fromJust )

import Control.Lens ( (^.) )

import Criterion.Main

import qualified Language.C as CLib
import qualified Language.Java.Pretty as JLib
import qualified Language.Java.Syntax as JLib
import qualified Language.JavaScript.Parser as JSLib
import qualified Language.JavaScript.Pretty.Printer.Extended as JSLib
import qualified Language.Lua.Annotated as LuaLib
import qualified Language.Python.Common as PLib
import qualified Language.Python.Version3.Parser as PLib

import Data.Comp.Multi ( HFunctor, ShowHF )

import Cubix.Language.Info
import Cubix.Language.Parametric.Semantics.Cfg

import Cubix.Language.C.Parametric.Common as CCommon
import qualified Cubix.Language.C.Parametric.Full as CFull
import qualified Cubix.Language.C.Parse as CParse
import qualified Cubix.Language.Java.Parse as JParse
import Cubix.Language.Java.Parametric.Common as JCommon
import qualified Cubix.Language.Java.Parametric.Full as JFull
import Cubix.Language.JavaScript.Parametric.Common as JSCommon
import qualified Cubix.Language.JavaScript.Parametric.Full as JSFull
import Cubix.Language.Lua.Parametric.Common as LCommon
import qualified Cubix.Language.Lua.Parametric.Full as LFull
import Cubix.Language.Python.Parametric.Common as PCommon
import qualified Cubix.Language.Python.Parametric.Full as PFull

import Cubix.Transformations.Hoist
import Cubix.Transformations.TAC
import Cubix.Transformations.TestCoverage

import Cubix.Sin.NFData ()

fromRight :: Either a b -> b
fromRight (Right x) = x
fromRight (Left x) = error "Benchmarks.fromRight passed a Left"

instance (Show a) => NFData (CLib.CTranslationUnit a) where
rnf = rnf . show

instance NFData JLib.CompilationUnit where
rnf = rnf . show

instance NFData JSLib.JSAST where
rnf = rnf . show

instance NFData (PLib.Module ()) where
rnf = rnf . show

-- Evaluating all but the term
instance NFData (CfgNode f) where
rnf n = (rnf $ n ^. cfg_node_prevs)
`seq` (rnf $ n ^. cfg_node_succs)
`seq` (rnf $ n ^. cfg_node_lab)
`seq` (rnf $ n ^. cfg_node_type)
`seq` ()

instance NFData (Cfg f) where
rnf cfg = (rnf $ cfg ^. cfg_nodes)
`seq` (rnf $ cfg ^. cfg_ast_nodes)
`seq` ()


#ifndef ONLY_ONE_LANGUAGE
getC :: FilePath -> IO ( CLib.CTranslUnit, CFull.CTerm CTranslationUnitL
, MCTerm CTranslationUnitL, MCTermLab CTranslationUnitL
, Cfg MCSig)
getC path = do
raw <- fromRight <$> CParse.parse path
gen <- mkCSLabelGen OriginSynthetic
let fullTree = CFull.translate $ fmap (const ()) raw
let commTree = CCommon.translate fullTree
let labTree = labelProg gen commTree
return (raw, fullTree, commTree, labTree, makeCfg labTree)



getJava :: FilePath -> IO ( JLib.CompilationUnit, JFull.JavaTerm CompilationUnitL
, MJavaTerm CompilationUnitL, MJavaTermLab CompilationUnitL
, Cfg MJavaSig)
getJava path = do
raw <- fromRight <$> JParse.parse path
gen <- mkCSLabelGen OriginSynthetic
let fullTree = JFull.translate raw
let commTree = JCommon.translate fullTree
let labTree = labelProg gen commTree
return (raw, fullTree, commTree, labTree, makeCfg labTree)


getJS :: FilePath -> IO ( JSLib.JSAST, JSFull.JSTerm JSASTL
, MJSTerm JSASTL, MJSTermLab JSASTL
, Cfg MJSSig)
getJS path = do
raw <- JSLib.parseFile path
gen <- mkCSLabelGen OriginSynthetic
let fullTree = JSFull.translate raw
let commTree = JSCommon.translate fullTree
let labTree = labelProg gen commTree
return (raw, fullTree, commTree, labTree, makeCfg labTree)


getPython :: FilePath -> IO (PLib.Module (), PFull.PythonTerm ModuleL
, MPythonTerm ModuleL, MPythonTermLab ModuleL
, Cfg MPythonSig)
getPython path = do
contents <- readFile path
let rawAnnot = fst $ fromRight $ PLib.parseModule contents path
let raw = fmap (const ()) rawAnnot
gen <- mkCSLabelGen OriginSynthetic
let fullTree = PFull.translate raw
let commTree = PCommon.translate fullTree
let labTree = labelProg gen commTree
return (raw, fullTree, commTree, labTree, makeCfg labTree)
#endif

getLua :: FilePath -> IO ( LuaLib.Block, LFull.LuaTerm LBlockL
, MLuaTerm LBlockL, MLuaTermLab LBlockL
, Cfg MLuaSig)
getLua path = do
raw <- fromRight <$> LuaLib.parseFile path
gen <- mkCSLabelGen OriginSynthetic
let fullTree = LFull.translate raw
let commTree = LCommon.translate fullTree
let labTree = labelProg gen commTree
return (raw, fullTree, commTree, labTree, makeCfg labTree)


poorManNf :: (Show b) => (a -> b) -> a -> Benchmarkable
poorManNf f = nf (show . f)

poorManNfIO :: (Show b) => (a -> IO b) -> a -> Benchmarkable
poorManNfIO f x = nfIO (show <$> f x)

dummyNodeInfo :: CLib.NodeInfo
dummyNodeInfo = CLib.mkNodeInfoOnlyPos CLib.nopos

--labelProgIO :: Term f l -> IO (TermLab f l)
--labelProgIO x = labelProg <$> mkCSLabelGen <$> pure x

main = do
gen <- mkCSLabelGen OriginSynthetic
defaultMain [
#ifndef ONLY_ONE_LANGUAGE
env (getC "input-files/c/Foo.c") $
\ ~(lib, full, ips, lab, cfg) -> bgroup "c" [
bench "showOverheadLib" $ nf id lib
, bench "showOverheadMod" $ nf id full
, bench "showOverheadIps" $ nf id ips
, bench "showOverheadCfg" $ nf id cfg
, bench "removeAnnot" $ nf (fmap (const ())) lib
, bench "pretty" $ nf (show . CLib.pretty) lib

, bench "transMod" $ nf (CFull.translate . fmap (const ())) lib
, bench "transIps" $ nf CCommon.translate full
, bench "label" $ nf (labelProg gen) ips
, bench "cfg" $ nf makeCfg lab
, bench "hoist" $ nf hoistDeclarations ips
, bench "testCov" $ nfIO $ instrumentTestCoverage lab
, bench "untransIps" $ nf CCommon.untranslate ips
, bench "untransMod" $ nf CFull.untranslate full
]

, env (getJava "input-files/java/Foo.java") $
\ ~(lib, full, ips, lab, cfg) -> bgroup "java" [
bench "showOverheadLib" $ nf id lib
, bench "showOverheadMod" $ nf id full
, bench "showOverheadIps" $ nf id ips
, bench "showOverheadCfg" $ nf id cfg
, bench "pretty" $ nf (show . JLib.prettyPrint) lib

, bench "transMod" $ nf JFull.translate lib
, bench "transIps" $ nf JCommon.translate full
, bench "label" $ nf (labelProg gen) ips
, bench "cfg" $ nf makeCfg lab
, bench "hoist" $ nf hoistDeclarations ips
, bench "testCov" $ nfIO $ instrumentTestCoverage lab
, bench "untransIps" $ nf JCommon.untranslate ips
, bench "untransMod" $ nf JFull.untranslate full
]

, env (getJS "input-files/javascript/Foo.js") $
\ ~(lib, full, ips, lab, cfg) -> bgroup "js" [
bench "showOverheadLib" $ nf id lib
, bench "showOverheadMod" $ nf id full
, bench "showOverheadIps" $ nf id ips
, bench "showOverheadCfg" $ nf id cfg
, bench "pretty" $ nf (show . JSLib.prettyPrint) lib

, bench "transMod" $ nf JSFull.translate lib
, bench "transIps" $ nf JSCommon.translate full
, bench "label" $ nf (labelProg gen) ips
, bench "cfg" $ nf makeCfg lab
, bench "hoist" $ nf hoistDeclarations ips
, bench "tac" $ nfIO $ toTAC lab
, bench "testCov" $ nfIO $ instrumentTestCoverage lab
, bench "untransIps" $ nf JSCommon.untranslate ips
, bench "untransMod" $ nf JSFull.untranslate full
]

, env (getPython "input-files/python/Foo.py") $
\ ~(lib, full, ips, lab, cfg) -> bgroup "python" [
bench "showOverheadLib" $ nf id lib
, bench "showOverheadMod" $ nf id full
, bench "showOverheadIps" $ nf id ips
, bench "showOverheadCfg" $ nf id cfg
, bench "pretty" $ nf (show . PLib.pretty) lib

, bench "transMod" $ nf PFull.translate lib
, bench "transIps" $ nf PCommon.translate full
, bench "label" $ nf (labelProg gen) ips
, bench "cfg" $ nf makeCfg lab
, bench "tac" $ nfIO $ toTAC lab
, bench "testCov" $ nfIO $ instrumentTestCoverage lab
, bench "untransIps" $ nf PCommon.untranslate ips
, bench "untransMod" $ nf PFull.untranslate full
]

,
#endif
env (getLua "input-files/lua/Foo.lua") $
\ ~(lib, full, ips, lab, cfg) -> bgroup "lua" [
bench "showOverheadMod" $ nf id full
, bench "showOverheadIps" $ nf id ips
, bench "showOverheadCfg" $ nf id cfg
, bench "pretty" $ nf (show . LuaLib.pprint) lib

, bench "transMod" $ nf LFull.translate lib
, bench "transIps" $ nf LCommon.translate full
, bench "label" $ nf (labelProg gen) ips
, bench "cfg" $ nf makeCfg lab
, bench "hoist" $ nf hoistDeclarations ips
, bench "tac" $ nfIO $ toTAC lab
, bench "testCov" $ nfIO $ instrumentTestCoverage lab
, bench "untransIps" $ nf LCommon.untranslate ips
, bench "untransMod" $ nf LFull.untranslate full
]
]

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,3 @@
9/22/17

stack build --ghc-options='-O0 -j +RTS -A256m -n2m -RTS' 430.82s user 107.05s system 268% cpu 3:20.65 total
Binary file not shown.
@@ -0,0 +1,13 @@
build
dist
dummy.cabal
*~
*\#
*.orig
*.o
*.hi
*.tix
*.mix
hpcreport
*.DS_Store
.stack-work
@@ -0,0 +1,29 @@
env:
- CABALVER=1.18 GHCVER=7.8.4 HAPPYVER=1.19.5
- CABALVER=1.22 GHCVER=7.10.3 HAPPYVER=1.19.5
- CABALVER=1.24 GHCVER=8.0.1 HAPPYVER=1.19.5

# Note: the distinction between `before_install` and `install` is not important.
before_install:
- travis_retry sudo add-apt-repository -y ppa:hvr/ghc
- travis_retry sudo apt-get update
- travis_retry sudo apt-get install cabal-install-$CABALVER ghc-$GHCVER happy-$HAPPYVER # see note about happy/alex
- export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:/opt/happy/$HAPPYVER/bin:$PATH

install:
- cabal --version
- echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
- travis_retry cabal update
- cabal install --only-dependencies --enable-tests --enable-benchmarks

script:
- if [ -f configure.ac ]; then autoreconf -i; fi
- cabal configure --enable-tests --enable-benchmarks -v2 # -v2 provides useful information for debugging
- cabal build # this builds all libraries and executables (including tests/benchmarks)
- cabal test
- cabal check
- cabal sdist # tests that a source-distribution can be generated

# check that the generated source-distribution can be built & installed
- SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz &&
(cd dist && cabal install --force-reinstalls "$SRC_TGZ")
@@ -0,0 +1,30 @@
Copyright (c) 2010--2011 Patrick Bahr, Tom Hvitved

All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

3. Neither the name of the author nor the names of his contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Oops, something went wrong.

0 comments on commit 993860e

Please sign in to comment.
You can’t perform that action at this time.