[Git][ghc/ghc][wip/js-staging] 2 commits: Hadrian: add useNativeBignum transformer

doyougnu (@doyougnu) gitlab at gitlab.haskell.org
Thu Nov 3 01:04:38 UTC 2022



doyougnu pushed to branch wip/js-staging at Glasgow Haskell Compiler / GHC


Commits:
93be6a34 by doyougnu at 2022-11-02T11:42:49-04:00
Hadrian: add useNativeBignum transformer

- - - - -
a0438b57 by doyougnu at 2022-11-02T21:03:22-04:00
Hadrian: add Flavours.JavaScript

Better Cohesion.

- - - - -


6 changed files:

- hadrian/hadrian.cabal
- hadrian/src/Flavour.hs
- hadrian/src/Settings.hs
- + hadrian/src/Settings/Flavours/JavaScript.hs
- hadrian/src/Settings/Flavours/Release.hs
- hadrian/src/Way/Type.hs


Changes:

=====================================
hadrian/hadrian.cabal
=====================================
@@ -125,6 +125,7 @@ executable hadrian
                        , Settings.Flavours.Quickest
                        , Settings.Flavours.Validate
                        , Settings.Flavours.Release
+                       , Settings.Flavours.JavaScript
                        , Settings.Packages
                        , Settings.Parser
                        , Settings.Program


=====================================
hadrian/src/Flavour.hs
=====================================
@@ -16,6 +16,8 @@ module Flavour
   , disableProfiledLibs
   , enableLinting
   , enableHaddock
+  , useNativeBignum
+  , omitPragmas
 
   , completeSetting
   , applySettings
@@ -51,6 +53,7 @@ flavourTransformers = M.fromList
     , "profiled_ghc"     =: enableProfiledGhc
     , "no_dynamic_ghc"   =: disableDynamicGhcPrograms
     , "no_dynamic_libs"  =: disableDynamicLibs
+    , "native_bignum"    =: useNativeBignum
     , "no_profiled_libs" =: disableProfiledLibs
     , "omit_pragmas"     =: omitPragmas
     , "ipe"              =: enableIPE
@@ -254,6 +257,11 @@ disableProfiledLibs flavour =
     prune :: Ways -> Ways
     prune = fmap $ Set.filter (not . wayUnit Profiling)
 
+useNativeBignum :: Flavour -> Flavour
+useNativeBignum flavour =
+  flavour { bignumBackend = "native"
+          }
+
 -- | Build stage2 compiler with -fomit-interface-pragmas to reduce
 -- recompilation.
 omitPragmas :: Flavour -> Flavour


=====================================
hadrian/src/Settings.hs
=====================================
@@ -23,6 +23,7 @@ import Settings.Flavours.Quickest
 import Settings.Flavours.QuickCross
 import Settings.Flavours.Validate
 import Settings.Flavours.Release
+import Settings.Flavours.JavaScript
 
 
 getArgs :: Args
@@ -53,7 +54,7 @@ hadrianFlavours :: [Flavour]
 hadrianFlavours =
     [ benchmarkFlavour, defaultFlavour, developmentFlavour Stage1
     , developmentFlavour Stage2, performanceFlavour
-    , releaseFlavour
+    , releaseFlavour, releaseJsFlavour
     , quickFlavour, quickValidateFlavour, quickDebugFlavour
     , quickestFlavour
     , quickCrossFlavour


=====================================
hadrian/src/Settings/Flavours/JavaScript.hs
=====================================
@@ -0,0 +1,57 @@
+module Settings.Flavours.JavaScript
+ ( quickJsFlavour
+ , perfJsFlavour
+ , releaseJsFlavour
+ ) where
+
+import qualified Data.Set as Set
+
+import Flavour
+import Expression
+import Settings.Flavours.Performance
+import {-# SOURCE #-} Settings.Default
+
+releaseJsFlavour :: Flavour
+releaseJsFlavour =   disableDynamicLibs
+                   . disableDynamicGhcPrograms
+                   . disableProfiledLibs
+                   . enableO2Stage0
+                   . useNativeBignum
+                   $ performanceFlavour { name = "release-js" }
+
+quickJsFlavour :: Flavour
+quickJsFlavour = defaultFlavour
+    { name        = "quick-js"
+    , args        = defaultBuilderArgs <> quickJsArgs <> defaultPackageArgs
+    , dynamicGhcPrograms = pure False
+    , libraryWays = pure $ Set.singleton vanilla
+    , rtsWays     = pure $ Set.singleton vanilla
+    }
+
+perfJsFlavour :: Flavour
+perfJsFlavour = defaultFlavour
+    { name        = "perf-js"
+    , args        = defaultBuilderArgs <> perfJsArgs <> defaultPackageArgs
+    , dynamicGhcPrograms = pure False
+    , libraryWays = pure $ Set.singleton vanilla
+    , rtsWays     = pure $ Set.singleton vanilla
+    }
+
+quickJsArgs :: Args
+quickJsArgs = sourceArgs SourceArgs
+    { hsDefault  = mconcat $
+        [ pure ["-O0", "-H64m"]
+        ]
+    , hsLibrary  = notStage0 ? mconcat [ arg "-O" ]
+    , hsCompiler = stage0 ? arg "-O2"
+    , hsGhc      = mconcat
+                   [ stage0 ? arg "-O"
+                   , stage1 ? mconcat [ arg "-O0" ] ] }
+
+perfJsArgs :: Args
+perfJsArgs = sourceArgs SourceArgs
+    { hsDefault  = mconcat [ arg "-O2", arg "-H64m"]
+    , hsLibrary  = arg "-O2"
+    , hsCompiler = arg "-O2"
+    , hsGhc      = arg "-O2"
+    }


=====================================
hadrian/src/Settings/Flavours/Release.hs
=====================================
@@ -5,10 +5,3 @@ import Flavour
 
 releaseFlavour :: Flavour
 releaseFlavour = enableHaddock performanceFlavour { name = "release" }
-
-releaseJsFlavour :: Flavour
-releaseJsFlavour = disableDynamicLibs
-                   . disableDynamicGhcPrograms
-                   . disableProfiledLibs
-                   . enableO2Stage0
-                   $ performanceFlavour { name = "release-js" }


=====================================
hadrian/src/Way/Type.hs
=====================================
@@ -1,5 +1,6 @@
+{-# LANGUAGE DerivingStrategies         #-}
 {-# LANGUAGE GeneralizedNewtypeDeriving #-}
-{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE LambdaCase                 #-}
 module Way.Type where
 
 import Data.IntSet (IntSet)



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/2b8b98f8d83b1a7668d83ba4692fc5b4846d037e...a0438b5737d48b6ed09db2b134a0905c2a2e0e27

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/2b8b98f8d83b1a7668d83ba4692fc5b4846d037e...a0438b5737d48b6ed09db2b134a0905c2a2e0e27
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/20221102/394277e1/attachment-0001.html>


More information about the ghc-commits mailing list