
Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: 99b233f4 by Alison at 2025-09-13T16:51:04-04:00 ghc-heap: Fix race condition with profiling builds Apply the same fix from Closures.hs (64fd0fac83) to Heap.hs by adding empty imports to make way-dependent dependencies visible to `ghc -M`. Fixes #15197, #26407 - - - - - b26086b9 by Cheng Shao at 2025-09-14T16:49:22-04:00 hadrian: build in-tree gmp with -fvisibility=hidden When hadrian builds in-tree gmp, it should build the shared objects with -fvisibility=hidden. The gmp symbols are only used by bignum logic in ghc-internal and shouldn't be exported by the ghc-internal shared library. We should always strive to keep shared library symbol table lean, which benefits platforms with slow dynamic linker or even hard limits about how many symbols can be exported (e.g. macos dyld, win32 dll and wasm dyld). - - - - - 47efd3d7 by Cheng Shao at 2025-09-14T16:49:26-04:00 Revert "wasm: add brotli compression for ghci browser mode" This reverts commit 731217ce68a1093b5f9e26a07d5bd2cdade2b352. Benchmarks show non-negligible overhead when browser runs on the same host, which is the majority of actual use cases. - - - - - 5b767424 by Cheng Shao at 2025-09-14T16:49:26-04:00 wasm: remove etag logic in ghci browser mode web server This commit removes the etag logic in dyld script's ghci browser mode web server. It was meant to support caching logic of wasm shared libraries, but even if the port is manually specified to make caching even relevant, for localhost the extra overhead around etag logic is simply not worth it according to benchmarks. - - - - - 3 changed files: - hadrian/src/Rules/Gmp.hs - libraries/ghc-heap/GHC/Exts/Heap.hs - utils/jsffi/dyld.mjs Changes: ===================================== hadrian/src/Rules/Gmp.hs ===================================== @@ -12,7 +12,6 @@ import Utilities import Hadrian.BuildPath import Hadrian.Expression import Settings.Builders.Common (cArgs, getStagedCCFlags) -import GHC.Platform.ArchOS -- | Build in-tree GMP library objects (if GmpInTree flag is set) and return -- their paths. @@ -128,7 +127,10 @@ gmpRules = do mconcat [ cArgs , getStagedCCFlags - , anyTargetArch [ArchWasm32] ? arg "-fvisibility=default" + -- gmp symbols are only used by bignum logic in + -- ghc-internal and shouldn't be exported by the + -- ghc-internal shared library. + , arg "-fvisibility=hidden" ] env <- sequence [ builderEnvironment "CC" $ Cc CompileC (stage ctx) ===================================== libraries/ghc-heap/GHC/Exts/Heap.hs ===================================== @@ -67,10 +67,26 @@ import GHC.Exts.Heap.ClosureTypes import GHC.Exts.Heap.Constants import GHC.Exts.Heap.ProfInfo.Types #if defined(PROFILING) +import GHC.Exts.Heap.InfoTable () -- See Note [No way-dependent imports] import GHC.Exts.Heap.InfoTableProf #else import GHC.Exts.Heap.InfoTable +import GHC.Exts.Heap.InfoTableProf () -- See Note [No way-dependent imports] + +{- +Note [No way-dependent imports] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +`ghc -M` currently assumes that the imports for a module are the same +in every way. This is arguably a bug, but breaking this assumption by +importing different things in different ways can cause trouble. For +example, this module in the profiling way imports and uses +GHC.Exts.Heap.InfoTableProf. When it was not also imported in the +vanilla way, there were intermittent build failures due to this module +being compiled in the profiling way before GHC.Exts.Heap.InfoTableProf +in the profiling way. (#15197) +-} #endif + import GHC.Exts.Heap.Utils import qualified GHC.Exts.Heap.FFIClosures as FFIClosures import qualified GHC.Exts.Heap.ProfInfo.PeekProfInfo as PPI ===================================== utils/jsffi/dyld.mjs ===================================== @@ -291,7 +291,7 @@ const isNode = Boolean(globalThis?.process?.versions?.node); // factor out browser-only/node-only logic into different modules. For // now, just make these global let bindings optionally initialized if // isNode and be careful to not use them in browser-only logic. -let fs, http, path, require, stream, util, wasi, ws, zlib; +let fs, http, path, require, stream, wasi, ws; if (isNode) { require = (await import("node:module")).createRequire(import.meta.url); @@ -300,9 +300,7 @@ if (isNode) { http = require("http"); path = require("path"); stream = require("stream"); - util = require("util"); wasi = require("wasi"); - zlib = require("zlib"); // Optional npm dependencies loaded via NODE_PATH try { @@ -561,30 +559,8 @@ args.rpc.opened.then(() => main(args)); }[path.extname(p)] || "application/octet-stream" ); - const buf = Buffer.from(await fs.promises.readFile(p)); - const etag = `sha512-${Buffer.from( - await crypto.subtle.digest("SHA-512", buf) - ).toString("base64")}`; - - res.setHeader("ETag", etag); - - if (req.headers["if-none-match"] === etag) { - res.writeHead(304); - res.end(); - return; - } - - res.setHeader("Content-Encoding", "br"); - res.writeHead(200); - res.end( - await util.promisify(zlib.brotliCompress)(buf, { - params: { - [zlib.constants.BROTLI_PARAM_QUALITY]: - zlib.constants.BROTLI_MIN_QUALITY, - }, - }) - ); + fs.createReadStream(p).pipe(res); return; } View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/8e8daf8c4c50c2e5022b8bddfd56bbc... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/8e8daf8c4c50c2e5022b8bddfd56bbc... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Marge Bot (@marge-bot)