Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: 156f09b8 by Simon Jakobi at 2026-05-25T08:30:50-04:00 Ensure that SetOps.{minusList,unionListsOrd} can be specialized ...by marking them INLINABLE. Haddock allocates 0.1–0.3% less as a result. This also removes some redundant constraints on unionListsOrd. - - - - - 6a76e7aa by Cheng Shao at 2026-05-25T08:30:50-04:00 wasm: ensure post-linker output is synchronous ESM This patch fixes wasm backend's post-linker output script to ensure it's synchronous ESM and doesn't use top-level await, which doesn't work in ServiceWorkers. Fixes #27257. - - - - - 3 changed files: - + changelog.d/wasm-fix-serviceworker - compiler/GHC/Data/List/SetOps.hs - utils/jsffi/prelude.mjs Changes: ===================================== changelog.d/wasm-fix-serviceworker ===================================== @@ -0,0 +1,4 @@ +section: wasm-backend +synopsis: Ensure post-linker output is synchronous ESM and fix loading in ServiceWorker +issues: #27257 +mrs: !16093 ===================================== compiler/GHC/Data/List/SetOps.hs ===================================== @@ -60,12 +60,13 @@ getNth xs n = assertPpr (xs `lengthExceeds` n) (ppr n $$ ppr xs) $ -- -- Uses a set internally to record duplicates. This makes it slightly slower for -- very small lists but avoids quadratic behaviour for large lists. -unionListsOrd :: (HasDebugCallStack, Outputable a, Ord a) => [a] -> [a] -> [a] +unionListsOrd :: Ord a => [a] -> [a] -> [a] unionListsOrd xs ys - -- Since both arguments don't have internal duplicates we can just take all of xs - -- and every element of ys that's not already in xs. + -- Since both arguments don't have internal duplicates we can just take all of ys + -- and every element of xs that's not already in ys. = let set_ys = S.fromList ys in (filter (\e -> not $ S.member e set_ys) xs) ++ ys +{-# INLINABLE unionListsOrd #-} -- Ensure the function can be specialized. -- | Assumes that the arguments contain no duplicates unionLists :: (HasDebugCallStack, Outputable a, Eq a) => [a] -> [a] -> [a] @@ -108,6 +109,7 @@ minusList xs [y] = filter (/= y) xs minusList xs ys = filter (`S.notMember` yss) xs where yss = S.fromList ys +{-# INLINABLE minusList #-} -- Ensure the function can be specialized. {- ************************************************************************ ===================================== utils/jsffi/prelude.mjs ===================================== @@ -39,19 +39,13 @@ export class JSValManager { // To benchmark different setImmediate() implementations in the // browser, use https://github.com/jphpsf/setImmediate-shim-demo as a // starting point. -export const setImmediate = await (async () => { - // node, bun, or other scripts might have set this up in the browser +export const setImmediate = (() => { + // node, deno, bun, or other scripts might have set this up in the + // browser if (globalThis.setImmediate) { return globalThis.setImmediate; } - // deno - if (globalThis.Deno) { - try { - return (await import("node:timers")).setImmediate; - } catch {} - } - // https://developer.mozilla.org/en-US/docs/Web/API/Scheduler/postTask if (globalThis.scheduler) { return (cb, ...args) => scheduler.postTask(() => cb(...args)); View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4d8d8e379bb06b8b0416d8e4422908f... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4d8d8e379bb06b8b0416d8e4422908f... You're receiving this email because of your account on gitlab.haskell.org.