[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 9 commits: rel_eng: Update hackage docs upload scripts

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Tue Mar 5 19:54:40 UTC 2024



Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC


Commits:
18ad1077 by Matthew Pickering at 2024-03-05T14:22:31-05:00
rel_eng: Update hackage docs upload scripts

This adds the upload of ghc-internal and ghc-experimental to our scripts
which upload packages to hackage.

- - - - -
bf47c9ba by Matthew Pickering at 2024-03-05T14:22:31-05:00
docs: Remove stray module comment from GHC.Profiling.Eras

- - - - -
37d9b340 by Matthew Pickering at 2024-03-05T14:22:31-05:00
Fix ghc-internal cabal file

The file mentioned some artifacts relating to the base library. I have
renamed these to the new ghc-internal variants.

- - - - -
23f2a478 by Matthew Pickering at 2024-03-05T14:22:31-05:00
Fix haddock source links and hyperlinked source

There were a few issues with the hackage links:

1. We were using the package id rather than the package name for the
   package links. This is fixed by now allowing the template to mention
   %pkg% or %pkgid% and substituing both appropiatly.
2. The `--haddock-base-url` flag is renamed to `--haddock-for-hackage`
   as the new base link works on a local or remote hackage server.
3. The "src" path including too much stuff, so cross-package source
   links were broken as the template was getting double expanded.

Fixes #24086

- - - - -
2fa336a9 by Ben Gamari at 2024-03-05T14:23:07-05:00
filepath: Bump submodule to 1.5.2.0

- - - - -
31217944 by Ben Gamari at 2024-03-05T14:23:07-05:00
os-string: Bump submodule to 2.0.2

- - - - -
aed47084 by Matthew Pickering at 2024-03-05T14:54:13-05:00
base: Reflect new era profiling RTS flags in GHC.RTS.Flags

* -he profiling mode
* -he profiling selector
* --automatic-era-increment

CLC proposal #254 - https://github.com/haskell/core-libraries-committee/issues/254

- - - - -
ac6745cc by Sylvain Henry at 2024-03-05T14:54:24-05:00
JS: faster implementation for some numeric primitives (#23597)

Use faster implementations for the following primitives in the JS
backend by not using JavaScript's BigInt:
- plusInt64
- minusInt64
- minusWord64
- timesWord64
- timesInt64

Co-authored-by: Josh Meredith <joshmeredith2008 at gmail.com>

- - - - -
efcce4aa by Cheng Shao at 2024-03-05T14:54:26-05:00
rts: add -xr option to control two step allocator reserved space size

This patch adds a -xr RTS option to control the size of virtual memory
address space reserved by the two step allocator on a 64-bit platform,
see added documentation for explanation. Closes #24498.

- - - - -


23 changed files:

- .gitlab/generate-ci/gen_ci.hs
- .gitlab/jobs.yaml
- .gitlab/rel_eng/upload_ghc_libs.py
- docs/users_guide/9.10.1-notes.rst
- docs/users_guide/runtime_control.rst
- hadrian/README.md
- hadrian/src/CommandLine.hs
- hadrian/src/Settings/Builders/Haddock.hs
- libraries/base/changelog.md
- libraries/filepath
- libraries/ghc-experimental/src/GHC/Profiling/Eras.hs
- libraries/ghc-internal/ghc-internal.cabal
- libraries/ghc-internal/src/GHC/Internal/RTS/Flags.hsc
- libraries/os-string
- rts/RtsFlags.c
- rts/include/rts/Flags.h
- rts/js/arith.js
- rts/sm/MBlock.c
- testsuite/tests/interface-stability/base-exports.stdout
- testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
- testsuite/tests/interface-stability/base-exports.stdout-mingw32
- testsuite/tests/interface-stability/base-exports.stdout-ws-32
- testsuite/tests/rts/all.T


Changes:

=====================================
.gitlab/generate-ci/gen_ci.hs
=====================================
@@ -1031,7 +1031,7 @@ job_groups =
     -- (see Note [Object unloading]).
     fullyStaticBrokenTests = modifyJobs (addVariable "BROKEN_TESTS" "ghcilink002 linker_unload_native")
 
-    hackage_doc_job = rename (<> "-hackage") . modifyJobs (addVariable "HADRIAN_ARGS" "--haddock-base-url")
+    hackage_doc_job = rename (<> "-hackage") . modifyJobs (addVariable "HADRIAN_ARGS" "--haddock-for-hackage")
 
     tsan_jobs =
       modifyJobs


=====================================
.gitlab/jobs.yaml
=====================================
@@ -2330,7 +2330,7 @@
       "BIN_DIST_NAME": "ghc-x86_64-linux-fedora33-release",
       "BUILD_FLAVOUR": "release",
       "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
-      "HADRIAN_ARGS": "--haddock-base-url",
+      "HADRIAN_ARGS": "--haddock-for-hackage",
       "LLC": "/bin/false",
       "OPT": "/bin/false",
       "RUNTEST_ARGS": "",
@@ -4007,7 +4007,7 @@
       "BIN_DIST_NAME": "ghc-x86_64-linux-fedora33-release",
       "BUILD_FLAVOUR": "release",
       "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
-      "HADRIAN_ARGS": "--haddock-base-url --hash-unit-ids",
+      "HADRIAN_ARGS": "--haddock-for-hackage --hash-unit-ids",
       "IGNORE_PERF_FAILURES": "all",
       "LLC": "/bin/false",
       "OPT": "/bin/false",


=====================================
.gitlab/rel_eng/upload_ghc_libs.py
=====================================
@@ -49,6 +49,10 @@ def prep_base():
     shutil.copy('config.guess', 'libraries/base')
     shutil.copy('config.sub', 'libraries/base')
 
+def prep_ghc_internal():
+    shutil.copy('config.guess', 'libraries/ghc-internal')
+    shutil.copy('config.sub', 'libraries/ghc-internal')
+
 def build_copy_file(pkg: Package, f: Path):
     target = Path('_build') / 'stage1' / pkg.path / 'build' / f
     dest = pkg.path / f
@@ -93,6 +97,8 @@ PACKAGES = {
     pkg.name: pkg
     for pkg in [
         Package('base', Path("libraries/base"), prep_base),
+        Package('ghc-internal', Path("libraries/ghc-internal"), prep_ghc_internal),
+        Package('ghc-experimental', Path("libraries/ghc-experimental"), no_prep),
         Package('ghc-prim', Path("libraries/ghc-prim"), prep_ghc_prim),
         Package('integer-gmp', Path("libraries/integer-gmp"), no_prep),
         Package('ghc-bignum', Path("libraries/ghc-bignum"), prep_ghc_bignum),


=====================================
docs/users_guide/9.10.1-notes.rst
=====================================
@@ -232,6 +232,11 @@ Runtime system
 - Add a :rts-flag:`--no-automatic-time-samples` flag which stops time profiling samples being automatically started on
   startup. Time profiling can be controlled manually using functions in ``GHC.Profiling``.
 
+- Add a :rts-flag:`-xr ⟨size⟩` which controls the size of virtual
+  memory address space reserved by the two step allocator on a 64-bit
+  platform. The default size is now 1T on aarch64 as well. See
+  :ghc-ticket:`24498`.
+
 ``base`` library
 ~~~~~~~~~~~~~~~~
 


=====================================
docs/users_guide/runtime_control.rst
=====================================
@@ -368,6 +368,18 @@ Miscellaneous RTS options
     thread can execute its exception handlers. The ``-xq`` controls the
     size of this additional quota.
 
+.. rts-flag:: -xr ⟨size⟩
+
+    :default: 1T
+
+    This option controls the size of virtual memory address space
+    reserved by the two step allocator on a 64-bit platform. It can be
+    useful in scenarios where even reserving a large address range
+    without committing can be expensive (e.g. WSL1), or when you
+    actually have enough physical memory and want to support a Haskell
+    heap larger than 1T. ``-xr`` is a no-op if GHC is configured with
+    ``--disable-large-address-space`` or if the platform is 32-bit.
+
 .. _rts-options-gc:
 
 RTS options to control the garbage collector


=====================================
hadrian/README.md
=====================================
@@ -306,9 +306,9 @@ all of the documentation targets:
 You can pass several `--docs=...` flags, Hadrian will combine
 their effects.
 
-To build haddock documentation for upload to hackage you need to pass the `--haddock-base-url` flag,
-by default this will choose a url suitable for uploading to hackage but you might also want to pass something like
-`http://127.0.0.1:8080/package/%pkg%/docs` for testing upload locally on a local hackage server.
+To build haddock documentation for upload to hackage you need to pass the `--haddock-for-hackage` flag,
+This will generate URLs which are appropiate for either uploading to a local hackage
+server or the global hackage server.
 
 #### Source distribution
 


=====================================
hadrian/src/CommandLine.hs
=====================================
@@ -17,7 +17,6 @@ import System.Environment
 import qualified System.Directory as Directory
 
 import qualified Data.Set as Set
-import Data.Maybe
 
 data TestSpeed = TestSlow | TestNormal | TestFast deriving (Show, Eq)
 
@@ -114,7 +113,7 @@ data DocArgs = DocArgs
   } deriving (Eq, Show)
 
 defaultDocArgs :: DocArgs
-defaultDocArgs = DocArgs { docsBaseUrl = "../%pkg%" }
+defaultDocArgs = DocArgs { docsBaseUrl = "../%pkgid%" }
 
 readConfigure :: Either String (CommandLineArgs -> CommandLineArgs)
 readConfigure = Left "hadrian --configure has been deprecated (see #20167). Please run ./boot; ./configure manually"
@@ -192,11 +191,11 @@ readTestOnlyPerf = Right $ \flags -> flags { testArgs = (testArgs flags) { testO
 readTestSkipPerf :: Either String (CommandLineArgs -> CommandLineArgs)
 readTestSkipPerf = Right $ \flags -> flags { testArgs = (testArgs flags) { testSkipPerf = True } }
 
-readHaddockBaseUrl :: Maybe String -> Either String (CommandLineArgs -> CommandLineArgs)
-readHaddockBaseUrl base_url = Right $ \flags ->
-  flags { docsArgs = (docsArgs flags) { docsBaseUrl = base_url' } }
+readHaddockBaseUrl :: Either String (CommandLineArgs -> CommandLineArgs)
+readHaddockBaseUrl = Right $ \flags ->
+  flags { docsArgs = (docsArgs flags) { docsBaseUrl = base_url } }
 
-  where base_url' = fromMaybe "https://hackage.haskell.org/package/%pkg%/docs" base_url
+  where base_url = "/package/%pkg%/docs"
 
 
 readTestRootDirs :: Maybe String -> Either String (CommandLineArgs -> CommandLineArgs)
@@ -320,8 +319,8 @@ optDescrs =
         "Destination path for the bindist 'install' rule"
     , Option [] ["complete-setting"] (OptArg readCompleteStg "SETTING")
         "Setting key to autocomplete, for the 'autocomplete' target."
-    , Option [] ["haddock-base-url"] (OptArg readHaddockBaseUrl "BASE_URL")
-        "Generate documentation suitable for upload to hackage or for another base URL (for example a local hackage server)."
+    , Option [] ["haddock-for-hackage"] (NoArg readHaddockBaseUrl)
+        "Generate documentation suitable for upload to a hackage server."
     ]
 
 -- | A type-indexed map containing Hadrian command line arguments to be passed


=====================================
hadrian/src/Settings/Builders/Haddock.hs
=====================================
@@ -43,12 +43,15 @@ haddockBuilderArgs = mconcat
         version  <- expr $ pkgVersion  pkg
         synopsis <- expr $ pkgSynopsis pkg
         haddocks <- expr $ haddockDependencies context
-        haddocks_with_versions <- expr $ sequence $ [(,h) <$> pkgUnitId stage p | (p, h) <- haddocks]
+        haddocks_with_versions <- expr $ sequence $ [(,,h) <$> pkgSimpleIdentifier p <*> pkgUnitId stage p | (p, h) <- haddocks]
 
         hVersion <- expr $ pkgVersion haddock
         statsDir <- expr $ haddockStatsFilesDir
         baseUrlTemplate <- expr (docsBaseUrl <$> userSetting defaultDocArgs)
-        let baseUrl p = substituteTemplate baseUrlTemplate p
+        -- The path to where the docs for a package are
+        let docpath p = substituteTemplate baseUrlTemplate p
+        -- The path to where the src folder is for a package (typically docs ++ "/src/")
+        let srcpath p = docpath p ++ "/src/"
         ghcOpts  <- haddockGhcArgs
         -- These are the options which are necessary to perform the build. Additional
         -- options such as `--hyperlinked-source`, `--hoogle`, `--quickjump` are
@@ -67,14 +70,18 @@ haddockBuilderArgs = mconcat
             , arg $ "--optghc=-D__HADDOCK_VERSION__="
                     ++ show (versionToInt hVersion)
             , map ("--hide=" ++) <$> getContextData otherModules
-            , pure [ "--read-interface=../" ++ p
-                     ++ "," ++ baseUrl p ++ "/src/%{MODULE}.html#%{NAME},"
-                     ++ haddock | (p, haddock) <- haddocks_with_versions ]
+            , pure [ "--read-interface=" ++ docpath (p, pid)
+                     ++ "," ++ srcpath (p, pid) ++ ","
+                     ++ haddock | (p, pid, haddock) <- haddocks_with_versions ]
             , pure [ "--optghc=" ++ opt | opt <- ghcOpts, not ("--package-db" `isInfixOf` opt) ]
             , arg "+RTS"
             , arg $ "-t" ++ (statsDir -/- pkgName pkg ++ ".t")
             , arg "--machine-readable"
             , arg "-RTS" ] ]
 
-substituteTemplate :: String -> String -> String
-substituteTemplate baseTemplate pkgId = T.unpack . T.replace "%pkg%" (T.pack pkgId) . T.pack $ baseTemplate
+substituteTemplate :: String -> (String, String) -> String
+substituteTemplate baseTemplate (pkg, pkgId) =
+  T.unpack
+    . T.replace "%pkg%" (T.pack pkg)
+    . T.replace "%pkgid%" (T.pack pkgId)
+    . T.pack $ baseTemplate


=====================================
libraries/base/changelog.md
=====================================
@@ -50,6 +50,10 @@
 
   * Treat all FDs as "nonblocking" on wasm32 ([CLC proposal #234](https://github.com/haskell/core-libraries-committee/issues/234))
 
+  * Add `HeapByEra`, `eraSelector` and `automaticEraIncrement` to `GHC.RTS.Flags` to
+    reflect the new RTS flags: `-he` profiling mode, `-he` selector and `--automatic-era-increment`.
+    ([CLC proposal #254](https://github.com/haskell/core-libraries-committee/issues/254))
+
 ## 4.19.0.0 *October 2023*
   * Add `{-# WARNING in "x-partial" #-}` to `Data.List.{head,tail}`.
     Use `{-# OPTIONS_GHC -Wno-x-partial #-}` to disable it.


=====================================
libraries/filepath
=====================================
@@ -1 +1 @@
-Subproject commit b55465e3d174ccd63914e7146079435503204187
+Subproject commit 4dd36add328032f9cbf0eff2a3511ab4369b18eb


=====================================
libraries/ghc-experimental/src/GHC/Profiling/Eras.hs
=====================================
@@ -1,7 +1,6 @@
 {-# LANGUAGE Trustworthy #-}
 {-# LANGUAGE NoImplicitPrelude #-}
 
--- | TODO move this module into ghc-internals
 module GHC.Profiling.Eras ( setUserEra
                      , getUserEra
                      , incrementUserEra


=====================================
libraries/ghc-internal/ghc-internal.cabal
=====================================
@@ -17,7 +17,7 @@ description:
 
 extra-tmp-files:
     autom4te.cache
-    base.buildinfo
+    ghc-internal.buildinfo
     config.log
     config.status
     include/EventConfig.h
@@ -25,8 +25,8 @@ extra-tmp-files:
 
 extra-source-files:
     aclocal.m4
-    base.buildinfo.in
-    changelog.md
+    ghc-internal.buildinfo.in
+    CHANGELOG.md
     configure
     configure.ac
     include/CTypes.h


=====================================
libraries/ghc-internal/src/GHC/Internal/RTS/Flags.hsc
=====================================
@@ -274,6 +274,7 @@ data DoHeapProfile
     | HeapByLDV
     | HeapByClosureType
     | HeapByInfoTable
+    | HeapByEra -- ^ @since base-4.20.0.0
     deriving ( Show -- ^ @since base-4.8.0.0
              , Generic -- ^ @since base-4.15.0.0
              )
@@ -289,6 +290,7 @@ instance Enum DoHeapProfile where
     fromEnum HeapByLDV         = #{const HEAP_BY_LDV}
     fromEnum HeapByClosureType = #{const HEAP_BY_CLOSURE_TYPE}
     fromEnum HeapByInfoTable   = #{const HEAP_BY_INFO_TABLE}
+    fromEnum HeapByEra         = #{const HEAP_BY_ERA}
 
     toEnum #{const NO_HEAP_PROFILING}    = NoHeapProfiling
     toEnum #{const HEAP_BY_CCS}          = HeapByCCS
@@ -299,6 +301,7 @@ instance Enum DoHeapProfile where
     toEnum #{const HEAP_BY_LDV}          = HeapByLDV
     toEnum #{const HEAP_BY_CLOSURE_TYPE} = HeapByClosureType
     toEnum #{const HEAP_BY_INFO_TABLE}   = HeapByInfoTable
+    toEnum #{const HEAP_BY_ERA}          = HeapByEra
     toEnum e = errorWithoutStackTrace ("invalid enum for DoHeapProfile: " ++ show e)
 
 -- | Parameters of the cost-center profiler
@@ -311,6 +314,7 @@ data ProfFlags = ProfFlags
     , startHeapProfileAtStartup :: Bool
     , startTimeProfileAtStartup :: Bool   -- ^ @since base-4.20.0.0
     , showCCSOnException       :: Bool
+    , automaticEraIncrement    :: Bool   -- ^ @since 4.20.0.0
     , maxRetainerSetSize       :: Word
     , ccsLength                :: Word
     , modSelector              :: Maybe String
@@ -320,6 +324,7 @@ data ProfFlags = ProfFlags
     , ccsSelector              :: Maybe String
     , retainerSelector         :: Maybe String
     , bioSelector              :: Maybe String
+    , eraSelector              :: Word -- ^ @since base-4.20.0.0
     } deriving ( Show -- ^ @since base-4.8.0.0
                , Generic -- ^ @since base-4.15.0.0
                )
@@ -633,6 +638,8 @@ getProfFlags = do
                   (#{peek PROFILING_FLAGS, startTimeProfileAtStartup} ptr :: IO CBool))
             <*> (toBool <$>
                   (#{peek PROFILING_FLAGS, showCCSOnException} ptr :: IO CBool))
+            <*> (toBool <$>
+                  (#{peek PROFILING_FLAGS, incrementUserEra} ptr :: IO CBool))
             <*> #{peek PROFILING_FLAGS, maxRetainerSetSize} ptr
             <*> #{peek PROFILING_FLAGS, ccsLength} ptr
             <*> (peekCStringOpt =<< #{peek PROFILING_FLAGS, modSelector} ptr)
@@ -642,6 +649,7 @@ getProfFlags = do
             <*> (peekCStringOpt =<< #{peek PROFILING_FLAGS, ccsSelector} ptr)
             <*> (peekCStringOpt =<< #{peek PROFILING_FLAGS, retainerSelector} ptr)
             <*> (peekCStringOpt =<< #{peek PROFILING_FLAGS, bioSelector} ptr)
+            <*> #{peek PROFILING_FLAGS, eraSelector} ptr
 
 getTraceFlags :: IO TraceFlags
 getTraceFlags = do


=====================================
libraries/os-string
=====================================
@@ -1 +1 @@
-Subproject commit fb2711ba1f43fd609de0e231e161025ee8ed3216
+Subproject commit 6c567f572e62437b8431b0f64b91393c40b677c8


=====================================
rts/RtsFlags.c
=====================================
@@ -186,6 +186,9 @@ void initRtsFlagsDefaults(void)
     RtsFlags.GcFlags.ringBell           = false;
     RtsFlags.GcFlags.longGCSync         = 0; /* detection turned off */
 
+    // 1 TBytes
+    RtsFlags.GcFlags.addressSpaceSize   = (StgWord64)1 << 40;
+
     RtsFlags.DebugFlags.scheduler       = false;
     RtsFlags.DebugFlags.interpreter     = false;
     RtsFlags.DebugFlags.weak            = false;
@@ -552,6 +555,11 @@ usage_text[] = {
 "  -xq        The allocation limit given to a thread after it receives",
 "             an AllocationLimitExceeded exception. (default: 100k)",
 "",
+#if defined(USE_LARGE_ADDRESS_SPACE)
+"  -xr        The size of virtual memory address space reserved by the",
+"             two step allocator (default: 1T)",
+"",
+#endif
 "  -Mgrace=<n>",
 "             The amount of allocation after the program receives a",
 "             HeapOverflow exception before the exception is thrown again, if",
@@ -1820,6 +1828,12 @@ error = true;
                           / BLOCK_SIZE;
                   break;
 
+                case 'r':
+                    OPTION_UNSAFE;
+                    RtsFlags.GcFlags.addressSpaceSize
+                      = decodeSize(rts_argv[arg], 3, MBLOCK_SIZE, HS_WORD64_MAX);
+                    break;
+
                   default:
                     OPTION_SAFE;
                     errorBelch("unknown RTS option: %s",rts_argv[arg]);
@@ -2118,7 +2132,9 @@ decodeSize(const char *flag, uint32_t offset, StgWord64 min, StgWord64 max)
         m = atof(s);
         c = s[strlen(s)-1];
 
-        if (c == 'g' || c == 'G')
+        if (c == 't' || c == 'T')
+            m *= (StgWord64)1024*1024*1024*1024;
+        else if (c == 'g' || c == 'G')
             m *= 1024*1024*1024;
         else if (c == 'm' || c == 'M')
             m *= 1024*1024;
@@ -2737,4 +2753,3 @@ doingErasProfiling( void )
             || RtsFlags.ProfFlags.eraSelector != 0);
 }
 #endif /* PROFILING */
-


=====================================
rts/include/rts/Flags.h
=====================================
@@ -89,6 +89,8 @@ typedef struct _GC_FLAGS {
 
     bool numa;                   /* Use NUMA */
     StgWord numaMask;
+
+    StgWord64 addressSpaceSize;  /* large address space size in bytes */
 } GC_FLAGS;
 
 /* See Note [Synchronization of flags and base APIs] */


=====================================
rts/js/arith.js
=====================================
@@ -44,19 +44,23 @@ function h$hs_remWord64(h1,l1,h2,l2) {
 }
 
 function h$hs_timesWord64(h1,l1,h2,l2) {
-  var a = W64(h1,l1);
-  var b = W64(h2,l2);
-  var r = BigInt.asUintN(64, a * b);
-  TRACE_ARITH("Word64: " + a + " * " + b + " ==> " + r)
-  RETURN_W64(r);
+  var rh = h$mul2Word32(l1,l2);
+  var rl = h$ret1;
+
+  rh += Math.imul(l1,h2)>>>0;
+  rh += Math.imul(l2,h1)>>>0;
+  rh >>>= 0;
+
+  TRACE_ARITH("Word64: " + (h1,l1) + " * " + (h2,l2) + " ==> " + (rh,rl))
+  RETURN_UBX_TUP2(rh,rl);
 }
 
 function h$hs_minusWord64(h1,l1,h2,l2) {
-  var a = (BigInt(h1) << BigInt(32)) | BigInt(l1>>>0);
-  var b = (BigInt(h2) << BigInt(32)) | BigInt(l2>>>0);
-  var r = BigInt.asUintN(64, a - b);
-  TRACE_ARITH("Word64: " + a + " - " + b + " ==> " + r)
-  RETURN_W64(r);
+  var l  = l1-l2;
+  var rl = l>>>0;
+  var rh = (h1-h2-(l!=rl?1:0))>>>0;
+  TRACE_ARITH("Word64: " + (h1,l1) + " - " + (h2,l2) + " ==> " + (rh,rl))
+  RETURN_UBX_TUP2(rh,rl);
 }
 
 function h$hs_plusWord64(h1,l1,h2,l2) {
@@ -68,11 +72,15 @@ function h$hs_plusWord64(h1,l1,h2,l2) {
 }
 
 function h$hs_timesInt64(h1,l1,h2,l2) {
-  var a = I64(h1,l1);
-  var b = I64(h2,l2);
-  var r = BigInt.asIntN(64, a * b);
-  TRACE_ARITH("Int64: " + a + " * " + b + " ==> " + r)
-  RETURN_I64(r);
+  var rh = h$mul2Word32(l1,l2);
+  var rl = h$ret1;
+
+  rh += Math.imul(l1,h2)|0;
+  rh += Math.imul(l2,h1)|0;
+  rh |= 0;
+
+  TRACE_ARITH("Int64: " + (h1,l1) + " * " + (h2,l2) + " ==> " + (rh,rl))
+  RETURN_UBX_TUP2(rh,rl);
 }
 
 function h$hs_quotInt64(h1,l1,h2,l2) {
@@ -92,19 +100,19 @@ function h$hs_remInt64(h1,l1,h2,l2) {
 }
 
 function h$hs_plusInt64(h1,l1,h2,l2) {
-  var a = I64(h1,l1);
-  var b = I64(h2,l2);
-  var r = BigInt.asIntN(64, a + b);
-  TRACE_ARITH("Int64: " + a + " + " + b + " ==> " + r)
-  RETURN_I64(r);
+  var l  = l1+l2;
+  var rl = l>>>0;
+  var rh = (h1+h2+(l!=rl?1:0))|0;
+  TRACE_ARITH("Int64: " + (h1,l1) + " + " + (h2,l2) + " ==> " + (rh,rl))
+  RETURN_UBX_TUP2(rh,rl);
 }
 
 function h$hs_minusInt64(h1,l1,h2,l2) {
-  var a = I64(h1,l1);
-  var b = I64(h2,l2);
-  var r = BigInt.asIntN(64, a - b);
-  TRACE_ARITH("Int64: " + a + " - " + b + " ==> " + r)
-  RETURN_I64(r);
+  var l  = l1-l2;
+  var rl = l>>>0;
+  var rh = (h1-h2-(l!=rl?1:0))|0;
+  TRACE_ARITH("Int64: " + (h1,l1) + " - " + (h2,l2) + " ==> " + (rh,rl))
+  RETURN_UBX_TUP2(rh,rl);
 }
 
 function h$hs_uncheckedShiftLWord64(h,l,n) {


=====================================
rts/sm/MBlock.c
=====================================
@@ -659,20 +659,14 @@ initMBlocks(void)
 
 #if defined(USE_LARGE_ADDRESS_SPACE)
     {
-        W_ size;
-#if defined(aarch64_HOST_ARCH)
-        size = (W_)1 << 38; // 1/4 TByte
-#else
-        size = (W_)1 << 40; // 1 TByte
-#endif
         void *startAddress = NULL;
         if (RtsFlags.GcFlags.heapBase) {
             startAddress = (void*) RtsFlags.GcFlags.heapBase;
         }
-        void *addr = osReserveHeapMemory(startAddress, &size);
+        void *addr = osReserveHeapMemory(startAddress, &RtsFlags.GcFlags.addressSpaceSize);
 
         mblock_address_space.begin = (W_)addr;
-        mblock_address_space.end = (W_)addr + size;
+        mblock_address_space.end = (W_)addr + RtsFlags.GcFlags.addressSpaceSize;
         mblock_high_watermark = (W_)addr;
     }
 #elif SIZEOF_VOID_P == 8


=====================================
testsuite/tests/interface-stability/base-exports.stdout
=====================================
@@ -9029,7 +9029,7 @@ module GHC.RTS.Flags where
   type DoCostCentres :: *
   data DoCostCentres = CostCentresNone | CostCentresSummary | CostCentresVerbose | CostCentresAll | CostCentresJSON
   type DoHeapProfile :: *
-  data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable
+  data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable | HeapByEra
   type DoTrace :: *
   data DoTrace = TraceNone | TraceEventLog | TraceStderr
   type GCFlags :: *
@@ -9080,6 +9080,7 @@ module GHC.RTS.Flags where
                  startHeapProfileAtStartup :: GHC.Types.Bool,
                  startTimeProfileAtStartup :: GHC.Types.Bool,
                  showCCSOnException :: GHC.Types.Bool,
+                 automaticEraIncrement :: GHC.Types.Bool,
                  maxRetainerSetSize :: GHC.Types.Word,
                  ccsLength :: GHC.Types.Word,
                  modSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String,
@@ -9088,7 +9089,8 @@ module GHC.RTS.Flags where
                  ccSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String,
                  ccsSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String,
                  retainerSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String,
-                 bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String}
+                 bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String,
+                 eraSelector :: GHC.Types.Word}
   type RTSFlags :: *
   data RTSFlags = RTSFlags {gcFlags :: GCFlags, concurrentFlags :: ConcFlags, miscFlags :: MiscFlags, debugFlags :: DebugFlags, costCentreFlags :: CCFlags, profilingFlags :: ProfFlags, traceFlags :: TraceFlags, tickyFlags :: TickyFlags, parFlags :: ParFlags, hpcFlags :: HpcFlags}
   type RtsTime :: *


=====================================
testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
=====================================
@@ -12071,7 +12071,7 @@ module GHC.RTS.Flags where
   type DoCostCentres :: *
   data DoCostCentres = CostCentresNone | CostCentresSummary | CostCentresVerbose | CostCentresAll | CostCentresJSON
   type DoHeapProfile :: *
-  data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable
+  data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable | HeapByEra
   type DoTrace :: *
   data DoTrace = TraceNone | TraceEventLog | TraceStderr
   type GCFlags :: *
@@ -12122,6 +12122,7 @@ module GHC.RTS.Flags where
                  startHeapProfileAtStartup :: GHC.Types.Bool,
                  startTimeProfileAtStartup :: GHC.Types.Bool,
                  showCCSOnException :: GHC.Types.Bool,
+                 automaticEraIncrement :: GHC.Types.Bool,
                  maxRetainerSetSize :: GHC.Types.Word,
                  ccsLength :: GHC.Types.Word,
                  modSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String,
@@ -12130,7 +12131,8 @@ module GHC.RTS.Flags where
                  ccSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String,
                  ccsSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String,
                  retainerSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String,
-                 bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String}
+                 bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String,
+                 eraSelector :: GHC.Types.Word}
   type RTSFlags :: *
   data RTSFlags = RTSFlags {gcFlags :: GCFlags, concurrentFlags :: ConcFlags, miscFlags :: MiscFlags, debugFlags :: DebugFlags, costCentreFlags :: CCFlags, profilingFlags :: ProfFlags, traceFlags :: TraceFlags, tickyFlags :: TickyFlags, parFlags :: ParFlags, hpcFlags :: HpcFlags}
   type RtsTime :: *


=====================================
testsuite/tests/interface-stability/base-exports.stdout-mingw32
=====================================
@@ -9253,7 +9253,7 @@ module GHC.RTS.Flags where
   type DoCostCentres :: *
   data DoCostCentres = CostCentresNone | CostCentresSummary | CostCentresVerbose | CostCentresAll | CostCentresJSON
   type DoHeapProfile :: *
-  data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable
+  data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable | HeapByEra
   type DoTrace :: *
   data DoTrace = TraceNone | TraceEventLog | TraceStderr
   type GCFlags :: *
@@ -9304,6 +9304,7 @@ module GHC.RTS.Flags where
                  startHeapProfileAtStartup :: GHC.Types.Bool,
                  startTimeProfileAtStartup :: GHC.Types.Bool,
                  showCCSOnException :: GHC.Types.Bool,
+                 automaticEraIncrement :: GHC.Types.Bool,
                  maxRetainerSetSize :: GHC.Types.Word,
                  ccsLength :: GHC.Types.Word,
                  modSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String,
@@ -9312,7 +9313,8 @@ module GHC.RTS.Flags where
                  ccSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String,
                  ccsSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String,
                  retainerSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String,
-                 bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String}
+                 bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String,
+                 eraSelector :: GHC.Types.Word}
   type RTSFlags :: *
   data RTSFlags = RTSFlags {gcFlags :: GCFlags, concurrentFlags :: ConcFlags, miscFlags :: MiscFlags, debugFlags :: DebugFlags, costCentreFlags :: CCFlags, profilingFlags :: ProfFlags, traceFlags :: TraceFlags, tickyFlags :: TickyFlags, parFlags :: ParFlags, hpcFlags :: HpcFlags}
   type RtsTime :: *


=====================================
testsuite/tests/interface-stability/base-exports.stdout-ws-32
=====================================
@@ -9029,7 +9029,7 @@ module GHC.RTS.Flags where
   type DoCostCentres :: *
   data DoCostCentres = CostCentresNone | CostCentresSummary | CostCentresVerbose | CostCentresAll | CostCentresJSON
   type DoHeapProfile :: *
-  data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable
+  data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable | HeapByEra
   type DoTrace :: *
   data DoTrace = TraceNone | TraceEventLog | TraceStderr
   type GCFlags :: *
@@ -9080,6 +9080,7 @@ module GHC.RTS.Flags where
                  startHeapProfileAtStartup :: GHC.Types.Bool,
                  startTimeProfileAtStartup :: GHC.Types.Bool,
                  showCCSOnException :: GHC.Types.Bool,
+                 automaticEraIncrement :: GHC.Types.Bool,
                  maxRetainerSetSize :: GHC.Types.Word,
                  ccsLength :: GHC.Types.Word,
                  modSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String,
@@ -9088,7 +9089,8 @@ module GHC.RTS.Flags where
                  ccSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String,
                  ccsSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String,
                  retainerSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String,
-                 bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String}
+                 bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String,
+                 eraSelector :: GHC.Types.Word}
   type RTSFlags :: *
   data RTSFlags = RTSFlags {gcFlags :: GCFlags, concurrentFlags :: ConcFlags, miscFlags :: MiscFlags, debugFlags :: DebugFlags, costCentreFlags :: CCFlags, profilingFlags :: ProfFlags, traceFlags :: TraceFlags, tickyFlags :: TickyFlags, parFlags :: ParFlags, hpcFlags :: HpcFlags}
   type RtsTime :: *


=====================================
testsuite/tests/rts/all.T
=====================================
@@ -3,7 +3,7 @@ test('testblockalloc',
      compile_and_run, [''])
 
 test('testmblockalloc',
-     [c_src, only_ways(['normal','threaded1']), extra_run_opts('+RTS -I0'),
+     [c_src, only_ways(['normal','threaded1']), extra_run_opts('+RTS -I0 -xr0.125T'),
       when(arch('wasm32'), skip)], # MBlocks can't be freed on wasm32, see Note [Megablock allocator on wasm] in rts
      compile_and_run, [''])
 # -I0 is important: the idle GC will run the memory leak detector,



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5472fdf1fe1fc502ca16fe30a1d80ffa68d0c9cc...efcce4aab88b2d85ec3aa8670680217f78b6b341

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5472fdf1fe1fc502ca16fe30a1d80ffa68d0c9cc...efcce4aab88b2d85ec3aa8670680217f78b6b341
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/20240305/e8ca001d/attachment-0001.html>


More information about the ghc-commits mailing list