Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: b418408b by Irene Knapp at 2025-09-25T09:47:54-04:00 Document etymology of "bind" as the name for `>>=` It took me twenty years of contemplation to realize why it's called that. I therefore feel that it may not be obvious to beginners. - - - - - e9c5e46f by Brandon Chinn at 2025-09-25T09:48:36-04:00 Fix tabs in string gaps (#26415) Tabs in string gaps were broken in bb030d0d because previously, string gaps were manually parsed, but now it's lexed by the usual Alex grammar and post-processed after successful lexing. It broke because of a discrepancy between GHC's lexer grammar and the Haskell Report. The Haskell Report includes tabs in whitechar: whitechar → newline | vertab | space | tab | uniWhite $whitechar used to include tabs until 18 years ago, when it was removed in order to exclude tabs from $white_no_nl in order to warn on tabs: 6e202120. In this MR, I'm adding \t back into $whitechar, and explicitly excluding \t from the $white_no_nl+ rule ignoring all whitespace in source code, which more accurately colocates the "ignore all whitespace except tabs, which is handled in the next line" logic. As a side effect of this MR, tabs are now allowed in pragmas; currently, a pragma written as {-# \t LANGUAGE ... #-} is interpreted as the tab character being the pragma name, and GHC warns "Unrecognized pragma". With this change, tabs are ignored as whitespace, which more closely matches the Report anyway. - - - - - 8bf5b309 by Cheng Shao at 2025-09-25T09:49:18-04:00 wasm: remove the --no-turbo-fast-api-calls hack from dynamic linker shebang This patch removes the `--no-turbo-fast-api-calls` hack from the dyld script shebang; it was used to workaround v8 fast call coredumps in nodejs and no longer needed, and comes with a performance penalty, hence the removal. - - - - - 35622b41 by Sylvain Henry at 2025-09-26T05:25:33-04:00 Revert "Add necessary flag for js linking" This reverts commit 84f68e2231b2eddb2e1dc4e90af394ef0f2e803f. This commit didn't have the expected effect. See discussion in #26290. Instead we export HEAP8 and HEAPU8 from rts/js/mem.js - - - - - 179265cd by Sylvain Henry at 2025-09-26T05:25:33-04:00 JS: export HEAPU8 (#26290) This is now required by newer Emscripten versions. - - - - - ad319868 by Andreas Klebinger at 2025-09-26T05:25:34-04:00 sizeExpr: Improve Tick handling. When determining if we scrutinize a function argument we now properly look through ticks. Fixes #26444. - - - - - 12 changed files: - compiler/GHC/Core/Unfold.hs - compiler/GHC/Parser/Lexer.x - compiler/GHC/Parser/Lexer/String.x - libraries/ghc-internal/src/GHC/Internal/Base.hs - m4/fptools_set_c_ld_flags.m4 - rts/js/mem.js - testsuite/driver/testlib.py - + testsuite/tests/parser/should_run/T26415.hs - + testsuite/tests/parser/should_run/T26415.stdout - testsuite/tests/parser/should_run/all.T - utils/ghc-toolchain/src/GHC/Toolchain/Tools/Link.hs - utils/jsffi/dyld.mjs Changes: ===================================== compiler/GHC/Core/Unfold.hs ===================================== @@ -637,6 +637,7 @@ sizeExpr opts !bOMB_OUT_SIZE top_args expr where is_top_arg (Var v) | v `elem` top_args = Just v is_top_arg (Cast e _) = is_top_arg e + is_top_arg (Tick _t e) = is_top_arg e is_top_arg _ = Nothing where ===================================== compiler/GHC/Parser/Lexer.x ===================================== @@ -145,7 +145,7 @@ import GHC.Parser.String $unispace = \x05 -- Trick Alex into handling Unicode. See Note [Unicode in Alex]. $nl = [\n\r\f] $space = [\ $unispace] -$whitechar = [$nl \v $space] +$whitechar = [$nl \t \v $space] $white_no_nl = $whitechar # \n -- TODO #8424 $tab = \t @@ -248,7 +248,7 @@ haskell :- -- Alex "Rules" -- everywhere: skip whitespace -$white_no_nl+ ; +($white_no_nl # \t)+ ; $tab { warnTab } -- Everywhere: deal with nested comments. We explicitly rule out ===================================== compiler/GHC/Parser/Lexer/String.x ===================================== @@ -25,7 +25,7 @@ import GHC.Utils.Panic (panic) $unispace = \x05 -- Trick Alex into handling Unicode. See Note [Unicode in Alex]. $nl = [\n\r\f] $space = [\ $unispace] -$whitechar = [$nl \v $space] +$whitechar = [$nl \t \v $space] $tab = \t $ascdigit = 0-9 ===================================== libraries/ghc-internal/src/GHC/Internal/Base.hs ===================================== @@ -1353,9 +1353,9 @@ class Applicative m => Monad m where -- bs a -- @ -- - -- An alternative name for this function is \'bind\', but some people - -- may refer to it as \'flatMap\', which results from it being equivalent - -- to + -- An alternative name for this function is \'bind\', because it + -- is used to introduce bindings in monadic contexts, but some people may + -- refer to it as \'flatMap\', which results from it being equivalent to -- -- @\\x f -> 'join' ('fmap' f x) :: Monad m => m a -> (a -> m b) -> m b@ -- ===================================== m4/fptools_set_c_ld_flags.m4 ===================================== @@ -109,9 +109,6 @@ AC_DEFUN([FPTOOLS_SET_C_LD_FLAGS], $2="$$2 -mcmodel=medium" ;; - javascript*) - $3="$$3 -sEXPORTED_RUNTIME_METHODS=HEAP8,HEAPU8" - esac AC_MSG_RESULT([done]) ===================================== rts/js/mem.js ===================================== @@ -1,5 +1,5 @@ //#OPTIONS:CPP -//#OPTIONS:EMCC:EXPORTED_RUNTIME_METHODS=addFunction,removeFunction,getEmptyTableSlot,HEAP8 +//#OPTIONS:EMCC:EXPORTED_RUNTIME_METHODS=addFunction,removeFunction,getEmptyTableSlot,HEAP8,HEAPU8 // #define GHCJS_TRACE_META 1 ===================================== testsuite/driver/testlib.py ===================================== @@ -3005,7 +3005,7 @@ def normalise_errmsg(s: str) -> str: # Emscripten displays cache info and old emcc doesn't support EMCC_LOGGING=0 s = re.sub('cache:INFO: .*\n', '', s) # Old emcc warns when we export HEAP8 but new one requires it (see #26290) - s = s.replace('warning: invalid item in EXPORTED_RUNTIME_METHODS: HEAP8\nemcc: warning: warnings in JS library compilation [-Wjs-compiler]\n','') + s = s.replace('warning: invalid item in EXPORTED_RUNTIME_METHODS: HEAP8\nwarning: invalid item in EXPORTED_RUNTIME_METHODS: HEAPU8\nemcc: warning: warnings in JS library compilation [-Wjs-compiler]\n','') return s ===================================== testsuite/tests/parser/should_run/T26415.hs ===================================== @@ -0,0 +1,7 @@ +{-# LANGUAGE MultilineStrings #-} + +main :: IO () +main = do + -- The below strings contain the characters ['\\', '\t', '\\'] + print "\ \" + print """\ \""" ===================================== testsuite/tests/parser/should_run/T26415.stdout ===================================== @@ -0,0 +1,2 @@ +"" +"" ===================================== testsuite/tests/parser/should_run/all.T ===================================== @@ -27,6 +27,7 @@ test('RecordDotSyntax4', [extra_files(['RecordDotSyntaxA.hs'])], multimod_compil test('RecordDotSyntax5', normal, compile_and_run, ['']) test('ListTuplePunsConstraints', extra_files(['ListTuplePunsConstraints.hs']), ghci_script, ['ListTuplePunsConstraints.script']) test('T25937', normal, compile_and_run, ['']) +test('T26415', normal, compile_and_run, ['']) # Multiline strings test('MultilineStrings', normal, compile_and_run, ['']) ===================================== utils/ghc-toolchain/src/GHC/Toolchain/Tools/Link.hs ===================================== @@ -324,10 +324,6 @@ addPlatformDepLinkFlags archOs cc ccLink0 = do ArchOS ArchPPC OSAIX -> -- We need `-D_THREAD_SAFE` to unlock the thread-local `errno`. return $ ccLink2 & over _prgFlags (++["-D_THREAD_SAFE","-Wl,-bnotextro"]) - ArchOS ArchJavaScript OSGhcjs -> - -- Since https://github.com/emscripten-core/emscripten/blob/main/ChangeLog.md#407---0... - -- the emcc linker does not export the HEAP8 memory view which is used by the js RTS by default anymore. - return $ ccLink2 & _prgFlags %++ "-sEXPORTED_RUNTIME_METHODS=HEAP8,HEAPU8" _ -> return ccLink2 ===================================== utils/jsffi/dyld.mjs ===================================== @@ -1,4 +1,4 @@ -#!/usr/bin/env -S node --disable-warning=ExperimentalWarning --max-old-space-size=65536 --no-turbo-fast-api-calls --wasm-lazy-validation +#!/usr/bin/env -S node --disable-warning=ExperimentalWarning --max-old-space-size=65536 --wasm-lazy-validation // Note [The Wasm Dynamic Linker] // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/893a94deae6551baac3b4b3e964046f... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/893a94deae6551baac3b4b3e964046f... You're receiving this email because of your account on gitlab.haskell.org.