Haskell.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

ghc-commits

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
ghc-commits@haskell.org

  • 1 participants
  • 10169 discussions
[Git][ghc/ghc][wip/dcoutts/io-manager-feature-bitset] Deleted 1 commit: Remove is_io_mng_native_p helper, replacing with iomgr_type
by Duncan Coutts (@dcoutts) 16 Sep '26

16 Sep '26
Duncan Coutts pushed to branch wip/dcoutts/io-manager-feature-bitset at Glasgow Haskell Compiler / GHC WARNING: The push did not contain any new commits, but force pushed to delete the commits and changes below. Deleted commits: 02d23436 by Duncan Coutts at 2026-09-16T13:38:38+01:00 Remove is_io_mng_native_p helper, replacing with iomgr_type The comment said: Temporary compat helper function used in the Win32 I/O managers. TODO: replace by consulting the iomgr_type global instead. - - - - - 5 changed files: - rts/IOManager.c - rts/IOManager.h - rts/RtsStartup.c - rts/win32/AwaitEvent.c - rts/win32/ThrIOManager.c Changes: ===================================== rts/IOManager.c ===================================== @@ -490,6 +490,9 @@ void startIOManager(void) #endif #if defined(IOMGR_ENABLED_WINIO) case IO_MANAGER_WINIO: + /* Initialize console Codepage. */ + initConsoleCP(); + /* The WinIO I/O manager sadly has two implementations of this * startup, depending on the threading mode. * TODO: rationalise this into one entry point, that internally @@ -606,6 +609,7 @@ exitIOManager(bool wait_threads) #if defined(IOMGR_ENABLED_WINIO) case IO_MANAGER_WINIO: shutdownAsyncWinIO(wait_threads); + hs_restoreConsoleCP(); break; #endif #if defined(IOMGR_ENABLED_WIN32_LEGACY) @@ -1076,21 +1080,5 @@ static void insertIntoSleepingQueue(CapIOManager *iomgr, StgTSO *tso, LowResTime } #endif -/* Temporary compat helper function used in the Win32 I/O managers. - * TODO: replace by consulting the iomgr_type global instead. - */ -bool is_io_mng_native_p (void) -{ - switch (iomgr_type) { -#if defined(IOMGR_ENABLED_WINIO) - case IO_MANAGER_WINIO: - return true; -#endif - default: - return false; - } -} - - /* See comment above with the #pragma GCC diagnostic push */ #pragma GCC diagnostic pop ===================================== rts/IOManager.h ===================================== @@ -285,11 +285,6 @@ parseIOManagerFlag(const char *iomgrstr, IO_MANAGER_FLAG *flag); char * showIOManager(void); -/* Temporary compat helper function used in the Win32 I/O managers. - * TODO: replace by consulting the iomgr_type global instead. - */ -bool is_io_mng_native_p (void); - /* Values for StgAsyncIOOp.operation. * * Note: this is encoded in 6 bits in StgAsyncIOOp. ===================================== rts/RtsStartup.c ===================================== @@ -338,12 +338,6 @@ hs_init_ghc(int *argc, char **argv[], RtsConfig rts_config) /* Set the supported level of vector registers */ setVectorSupport(); - /* Initialize console Codepage. */ -#if defined(mingw32_HOST_OS) - if (is_io_mng_native_p()) - initConsoleCP(); -#endif - /* Initialise the adjustors subsystem */ initAdjustors(); @@ -613,11 +607,7 @@ hs_exit_(bool wait_foreign) exitIOManager(wait_foreign); - /* Restore the console Codepage. */ #if defined(mingw32_HOST_OS) - if (is_io_mng_native_p()) - hs_restoreConsoleCP(); - /* Disable console signal handlers, we're going down!. */ finiUserSignals (); #endif ===================================== rts/win32/AwaitEvent.c ===================================== @@ -36,13 +36,14 @@ awaitCompletedTimeoutsOrIOWin32(Capability *cap, bool wait) /* Try to de-queue completed IO requests */ workerWaitingForRequests = true; - if (is_io_mng_native_p()) - awaitAsyncRequests(wait); - /* FIXME: no support yet for interrupting in WinIO I/O manager - * See issue #27403 - */ - else - interrupt = !awaitRequests(wait); + if (iomgr_type == IO_MANAGER_WINIO) { + awaitAsyncRequests(wait); + /* FIXME: no support yet for interrupting in WinIO I/O manager + * See issue #27403 + */ + } else { + interrupt = !awaitRequests(wait); + } workerWaitingForRequests = false; // If a signal was raised, we need to service it ===================================== rts/win32/ThrIOManager.c ===================================== @@ -115,7 +115,7 @@ sendIOManagerEvent (HsWord32 event) void interruptIOManagerEvent (void) { - if (is_io_mng_native_p ()) { + if (iomgr_type == IO_MANAGER_WINIO) { OS_ACQUIRE_LOCK(&event_buf_mutex); /* How expensive is this??. */ View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/02d23436c6c7246a47c72349c7d7926… -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/02d23436c6c7246a47c72349c7d7926… You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1 0
0 0
[Git][ghc/ghc][wip/jeltsch/improve-closure-property-check] Improve the definition of the closure property once more
by Wolfgang Jeltsch (@jeltsch) 16 Sep '26

16 Sep '26
Wolfgang Jeltsch pushed to branch wip/jeltsch/improve-closure-property-check at Glasgow Haskell Compiler / GHC Commits: 1445547c by Wolfgang Jeltsch at 2026-09-16T20:12:25+03:00 Improve the definition of the closure property once more - - - - - 1 changed file: - compiler/GHC/Unit/Env.hs Changes: ===================================== compiler/GHC/Unit/Env.hs ===================================== @@ -443,8 +443,12 @@ The flow: Closure Property ---------------- -A unit environment must have the closure property, which means that a home unit -must not directly or indirectly depend on an external unit that directly or +A unit environment must have the closure property: + + No used external unit depends on a home unit. + +More concretely, a unit environment has the closure property exactly if no home +unit directly or indirectly depends on an external unit that directly or indirectly depends on a home unit. 'GHC.Driver.Downsweep.checkHomeUnitsClosed' checks whether a given unit environment indeed has this property. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1445547c7b052510245896cb57c89cb… -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1445547c7b052510245896cb57c89cb… You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1 0
0 0
[Git][ghc/ghc][wip/jeltsch/improve-closure-property-check] Improve the definition of the closure property one more
by Wolfgang Jeltsch (@jeltsch) 16 Sep '26

16 Sep '26
Wolfgang Jeltsch pushed to branch wip/jeltsch/improve-closure-property-check at Glasgow Haskell Compiler / GHC Commits: 515774d0 by Wolfgang Jeltsch at 2026-09-16T20:10:18+03:00 Improve the definition of the closure property one more - - - - - 1 changed file: - compiler/GHC/Unit/Env.hs Changes: ===================================== compiler/GHC/Unit/Env.hs ===================================== @@ -443,8 +443,12 @@ The flow: Closure Property ---------------- -A unit environment must have the closure property, which means that a home unit -must not directly or indirectly depend on an external unit that directly or +A unit environment must have the closure property: + + No used external unit depends on a home unit. + +More concretely, a unit environment has the closure property exactly if no home +unit directly or indirectly depends on an external unit that directly or indirectly depends on a home unit. 'GHC.Driver.Downsweep.checkHomeUnitsClosed' checks whether a given unit environment indeed has this property. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/515774d0e80951798ef1a5d35bcd88f… -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/515774d0e80951798ef1a5d35bcd88f… You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1 0
0 0
[Git][ghc/ghc][wip/10.0.1-backports] 5 commits: ghc-internal: annotateSTM should use catchSTM# rather than catch#
by Zubin (@wz1000) 16 Sep '26

16 Sep '26
Zubin pushed to branch wip/10.0.1-backports at Glasgow Haskell Compiler / GHC Commits: cc79cc62 by Zubin Duggal at 2026-09-16T18:28:37+05:30 ghc-internal: annotateSTM should use catchSTM# rather than catch# A catch# frame inside a transaction breaks retry and async exception delivery. Fixes #27657 (cherry picked from commit fd22f71ee92595f4634206455d8eab111488d836) - - - - - 916a4f04 by Ian-Woo Kim at 2026-09-16T19:06:38+05:30 Make the order of usages deterministic It has been observed that the ordering of usages can be non-determinstic in parallel builds. Therefore, this contribution introduces sorting of usages based on a platform- and race-independent sorting criterion. Resolves #26877. Co-authored-by: Wolfgang Jeltsch <wolfgang(a)well-typed.com> (cherry picked from commit d216412babfd5b5746365f0686ec370fb0892ec7) - - - - - a3f4ed4c by mangoiv at 2026-09-16T19:06:38+05:30 compiler: refactor error reporting code for ExplicitLevelImports Refactors error reporting code for ExplicitLevelImports to pass in a RdrName and a GlobalReaderElt to be able to report errors that are faithful to the source and to more precisely distinguish between names that are in scope from different qualifications. Fixes #27385 and #26616 (cherry picked from commit 141986e3680a24b76e21a7ad4ce6290a7413c7f5) - - - - - be82ccef by Simon Jakobi at 2026-09-16T19:10:47+05:30 ci: Actually pass --ignore-perf-failures to the testsuite driver 684c0018d9 changed the IGNORE_PERF_FAILURES handling to append to RUNTEST_ARGS with bash array syntax, but the three use sites still expand RUNTEST_ARGS as a scalar, which yields only the first array element. The appended flag was therefore dropped in every job, so perf improvements kept failing Marge Bot batches and master pipelines, contrary to #19562. Append as a string instead, matching the existing --force-colors append in test_hadrian. Fixes #27563. Assisted-by: Claude Fable 5.1 (cherry picked from commit 4e9297ea064704da1606364365287ccf0039f7c2) - - - - - 3a434988 by Zubin Duggal at 2026-09-16T22:28:37+05:30 Prepare 10.0.1-alpha1 Metric Increase: T4801 Metric Decrease: CoOpt_Read InstanceMatching ManyAlternatives RecordUpdPerf T13719 T14683 T15164 T16577 T20261 T4801 T5321Fun T783 T9233 T9872b_defer - - - - - 154 changed files: - .gitlab/ci.sh - − changelog.d/27532 - − changelog.d/27626 - − changelog.d/27627 - − changelog.d/27703 - − changelog.d/27704 - − changelog.d/27717 - − changelog.d/T25636 - − changelog.d/T26423 - − changelog.d/T26716 - − changelog.d/T26978 - − changelog.d/T26979 - − changelog.d/T27046 - − changelog.d/T27047 - − changelog.d/T27121.md - − changelog.d/T27123.md - − changelog.d/T27124.md - − changelog.d/T27131 - − changelog.d/T27182.md - − changelog.d/T27202 - − changelog.d/T27225 - − changelog.d/T27308 - − changelog.d/T27314.md - − changelog.d/T27359 - − changelog.d/T27360 - − changelog.d/T27386 - − changelog.d/T27440 - − changelog.d/T27455 - − changelog.d/T27456 - − changelog.d/T27583 - − changelog.d/T27586 - − changelog.d/T27629 - − changelog.d/T27639 - − changelog.d/T27705 - − changelog.d/T27749 - − changelog.d/T27764 - − changelog.d/arm_ncg_fixes_T27430 - − changelog.d/bump-process - − changelog.d/dynamic-trace-flags - − changelog.d/fix-absent-dict-projection - − changelog.d/fix-blackhole-handling - − changelog.d/fix-cmm-atomic-load-store - − changelog.d/fix-compacting-gc-ap-27434 - − changelog.d/fix-compacting-gc-constr-27649 - − changelog.d/fix-control0-mask-trampoline - − changelog.d/fix-exponential-case-desugar-27383 - − changelog.d/fix-finalizers-27072 - − changelog.d/fix-layout-stack-fcall - − changelog.d/fix-parallel-gc-selector-race-27477 - − changelog.d/fix-peekitbl-no-tntc - − changelog.d/fix-threadlabel-segfault-27618 - − changelog.d/fix-use-std-ap-thunk - − changelog.d/ghc-pkg-faster-closure - − changelog.d/hadrian-stale-package-confs-26661 - − changelog.d/inter-module-far-jumps-aarch64-default - − changelog.d/ipe-event-class - − changelog.d/jobserver-leak-fix - − changelog.d/link-deterministic-order - − changelog.d/llvm-22 - − changelog.d/llvm-23 - − changelog.d/more-efficient-home-unit-imports-finding - − changelog.d/reexported-module-errors - − changelog.d/semaphore-v2 - − changelog.d/tag-inference-27005 - − changelog.d/tcplugin_init.md - − changelog.d/tcplugins-pmc.md - − changelog.d/typecheckModule-API.md - − changelog.d/unit-index - − changelog.d/unused-type - − changelog.d/wasm-fix-serviceworker - − changelog.d/windows-rethrow-overlapped-exception - − changelog.d/withTcPlugins.md - compiler/GHC/Hs/Expr.hs - compiler/GHC/HsToCore/Usage.hs - compiler/GHC/Rename/Env.hs - compiler/GHC/Rename/Expr.hs - compiler/GHC/Rename/HsType.hs - compiler/GHC/Rename/Module.hs - compiler/GHC/Rename/Pat.hs - compiler/GHC/Rename/Splice.hs - compiler/GHC/Rename/Splice.hs-boot - compiler/GHC/Rename/Unbound.hs - compiler/GHC/Tc/Errors.hs - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Gen/Export.hs - compiler/GHC/Tc/Utils/Env.hs - compiler/GHC/Tc/Utils/Monad.hs - compiler/GHC/Types/Name/Reader.hs - compiler/GHC/Unit/Module/Deps.hs - docs/users_guide/10.0.1-notes.rst - docs/users_guide/exts/static_pointers.rst - docs/users_guide/runtime_control.rst - libraries/base/changelog.md - libraries/ghc-experimental/CHANGELOG.md - libraries/ghc-internal/CHANGELOG.md - libraries/ghc-internal/src/GHC/Internal/STM.hs - testsuite/tests/annotations/should_fail/annfail03.stderr - testsuite/tests/annotations/should_fail/annfail04.stderr - testsuite/tests/annotations/should_fail/annfail06.stderr - testsuite/tests/annotations/should_fail/annfail09.stderr - + testsuite/tests/concurrent/should_run/T27657a.hs - + testsuite/tests/concurrent/should_run/T27657a.stdout - + testsuite/tests/concurrent/should_run/T27657b.hs - + testsuite/tests/concurrent/should_run/T27657b.stdout - testsuite/tests/concurrent/should_run/all.T - testsuite/tests/ghci/T27532/Makefile - − testsuite/tests/ghci/T27532/T27532.stdout - − testsuite/tests/ghci/T27532/a.script - testsuite/tests/ghci/T27532/all.T - − testsuite/tests/ghci/T27532/b.script - testsuite/tests/quasiquotation/qq001/qq001.stderr - testsuite/tests/quasiquotation/qq002/qq002.stderr - testsuite/tests/quasiquotation/qq003/qq003.stderr - testsuite/tests/quasiquotation/qq004/qq004.stderr - testsuite/tests/quotes/LiftErrMsg.stderr - testsuite/tests/quotes/LiftErrMsgDefer.stderr - testsuite/tests/quotes/LiftErrMsgTyped.stderr - testsuite/tests/quotes/T10384.stderr - testsuite/tests/quotes/T5721.stderr - testsuite/tests/quotes/TH_localname.stderr - testsuite/tests/splice-imports/SI03.stderr - testsuite/tests/splice-imports/SI05.stderr - testsuite/tests/splice-imports/SI08.stderr - testsuite/tests/splice-imports/SI08_oneshot.stderr - testsuite/tests/splice-imports/SI16.stderr - testsuite/tests/splice-imports/SI18.stderr - testsuite/tests/splice-imports/SI20.stderr - testsuite/tests/splice-imports/SI25.stderr - testsuite/tests/splice-imports/SI28.stderr - testsuite/tests/splice-imports/SI29.stderr - testsuite/tests/splice-imports/SI31.stderr - testsuite/tests/splice-imports/SI36.stderr - testsuite/tests/splice-imports/T26088.stderr - testsuite/tests/splice-imports/T26090.stderr - + testsuite/tests/splice-imports/T26616.hs - + testsuite/tests/splice-imports/T26616.stderr - testsuite/tests/splice-imports/all.T - testsuite/tests/th/T16976z.stderr - testsuite/tests/th/T17820a.stderr - testsuite/tests/th/T17820b.stderr - testsuite/tests/th/T17820c.stderr - testsuite/tests/th/T17820d.stderr - testsuite/tests/th/T17820e.stderr - testsuite/tests/th/T21547.stderr - testsuite/tests/th/T23829_hasty.stderr - testsuite/tests/th/T23829_hasty_b.stderr - testsuite/tests/th/T23829_tardy.ghc.stderr - testsuite/tests/th/T26098_local.stderr - testsuite/tests/th/T26098_quote.stderr - testsuite/tests/th/T26098_splice.stderr - testsuite/tests/th/T26099.stderr - testsuite/tests/th/T26568.stderr - testsuite/tests/th/T5795.stderr The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/cff5f0af3dc479f6e5fea4704a7be8… -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/cff5f0af3dc479f6e5fea4704a7be8… You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1 0
0 0
[Git][ghc/ghc][wip/fendor/has-field-hie] 4 commits: Record `FieldLabel` source span in AST node
by Hannes Siebenhandl (@fendor) 16 Sep '26

16 Sep '26
Hannes Siebenhandl pushed to branch wip/fendor/has-field-hie at Glasgow Haskell Compiler / GHC Commits: e01153ff by fendor at 2026-09-16T17:46:04+02:00 Record `FieldLabel` source span in AST node We attach evidence variables based on the source span of the concrete AST node in the HIE file. The evidence for the `HasField` constraint has the source span of the field selector, e.g. the AST node that gave rise to the `HasField` constraint. Since the AST node doesn't show up in the HIE file, the evidence for `HasField` was also not recorded for the span. Thus, `getEvidenceTree` wouldn't even list `HasField` as evidence, even in the perfectly normal case of: baz :: HasField "foo" f Int => f -> Int baz f = f.foo Requesting the evidence tree for `.foo` should point to the definition of `baz`, but since we omitted the source span for the field selector `.foo` from the AST node, the HIE file doesn't list it as evidence. By using the source spans of the individual field selectors, there are two consequences: * We can see the `HasField` evidence for record dot syntax at the field selector span * The reported type of `.foo` is `Foo -> Int` instead of just `Int` The latter is a change of behaviour that is unfortunate but the right behaviour, since there is now a source span for the whole expression `x.foo`, one for `x` and one for the selector `.foo`. If you query for the type at span `x.foo`, then the correct type `Int` is shown, but in downstream tooling (such as HLS), such requests are not possible in LSP. Thus, the behaviour changes. - - - - - 2dfa2ef6 by fendor at 2026-09-16T17:46:04+02:00 Allow any `Id` to be used for HIE evidence HIE evidence is used to show how a constraint has been solved and allows users to go directly to the definition or introduction of a particular evidence variable. So far, we only looked at evidence introduced by type class variables, but some evidence terms refer to other variables as well, such as record selectors. Such evidence terms add additional details and source locations. For generated evidence, such as `HasField` evidence to support `-XRecordDotSyntax`, the type class evidence is lacking and doesn't give us any usable source span pointing to the actual record selector. See this example evidence: $dHasField_aLw = GHC.Internal.Records.C:HasField @GHC.Internal.Types.Symbol @GHC.Internal.Types.LiftedRep @GHC.Internal.Types.LiftedRep @"foo" @Foo @Int (foo `cast` (<Foo -> Int>_R :: (Foo -> Int) ~R# (Foo -> Int))) The free variables of this term are `{C:HasField, foo}`. `foo` is the record selector from the type `Foo` and is crucial to guide users how this evidence is constructed, as the evidence `HasField` is not helpful. During HIE generation, we now take any `Id` into account to provide additional source spans to point to user to the definition site of the record selector. As a direct consequence, this allows HLS to implement a limited form of `Goto Definition` for expressions of the form `x.foo`, where `x :: Foo`. Capturing more `Id`s for evidence may have some side effects that are somewhat tricky to predict, since the tests are quite lacking. - - - - - 6f15256b by fendor at 2026-09-16T17:46:04+02:00 Add additional details to evidence bindings Evidence bindings can be all sorts of things, such as type class evidence, a record selector or other builtin constructs such as `Typeable`. - - - - - 84937391 by fendor at 2026-09-16T17:46:04+02:00 Typeable test - - - - - 13 changed files: - + changelog.d/record-dot-evidence - compiler/GHC/Iface/Ext/Ast.hs - compiler/GHC/Iface/Ext/Types.hs - compiler/GHC/Iface/Ext/Utils.hs - compiler/GHC/Rename/Expr.hs - + testsuite/tests/hiefile/should_run/HasFieldQueries.hs - + testsuite/tests/hiefile/should_run/HasFieldQueries.stdout - + testsuite/tests/hiefile/should_run/HieTypeable.hs - + testsuite/tests/hiefile/should_run/HieTypeable.stdout - testsuite/tests/hiefile/should_run/RecordDotTypes.hs - testsuite/tests/hiefile/should_run/RecordDotTypes.stdout - testsuite/tests/hiefile/should_run/T23492.stdout - testsuite/tests/hiefile/should_run/all.T Changes: ===================================== changelog.d/record-dot-evidence ===================================== @@ -0,0 +1,12 @@ +section: compiler +synopsis: Record selector functions as evidence for `HasField` constraints during .hie file generation. +description: { + We record the record selector `foo` of an expression such as `f.foo` as evidence for + solving the constraint `HasField "foo" record ty`. + + This allows us to point to the definition source location of the record selector `foo`, allowing + users to jump to definition using the evidence variables. +} + +issues: #25418 +mrs: !16694 ===================================== compiler/GHC/Iface/Ext/Ast.hs ===================================== @@ -23,7 +23,6 @@ import GHC.Core.DataCon ( dataConWrapperType ) import GHC.Core.Type ( Type, ForAllTyFlag(..) ) import GHC.Core.TyCon ( TyCon, tyConClass_maybe ) import GHC.Core.InstEnv -import GHC.Core.Predicate ( isEvId ) import GHC.Hs import GHC.Hs.Syn.Type @@ -33,7 +32,7 @@ import GHC.Types.Basic import GHC.Types.UnresolvedImport ( isGeneratedImport ) import GHC.Types.FieldLabel import GHC.Types.Avail ( Avails ) -import GHC.Types.Id ( isDataConId_maybe ) +import GHC.Types.Id ( isDataConId_maybe, isId, idDetails ) import GHC.Types.Name ( Name, nameSrcSpan, nameUnique, wiredInNameTyThing_maybe, getName ) import GHC.Types.Name.Env ( NameEnv, emptyNameEnv, extendNameEnv, lookupNameEnv ) import GHC.Types.Name.Reader ( RecFieldInfo(..), WithUserRdr(..) ) @@ -81,6 +80,7 @@ import Control.Applicative ( (<|>) ) import GHC.Types.TypeEnv ( TypeEnv ) import Control.Arrow ( second ) import Data.Traversable ( mapAccumR ) +import GHC.Types.Id.Info (IdDetails(..), recSelParentName) {- Note [Updating HieAst for changes in the GHC AST] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -682,7 +682,7 @@ instance ToHie (Context (Located (WithUserRdr Name))) where hieEvIdsOfTerm :: EvTerm -> [EvId] -- Returns only EvIds satisfying relevantEvId -hieEvIdsOfTerm = runFVSelectiveList isEvId . evTermFVs +hieEvIdsOfTerm = runFVSelectiveList isId . evTermFVs instance ToHie (EvBindContext (LocatedA TcEvBinds)) where toHie (EvBindContext sc sp (L span (EvBinds bs))) @@ -690,7 +690,7 @@ instance ToHie (EvBindContext (LocatedA TcEvBinds)) where where go evbind = do let evDeps = hieEvIdsOfTerm $ eb_rhs evbind - depNames = EvBindDeps $ map varName evDeps + depNames = EvBindDeps $ map classifyEvBindDep evDeps concatM $ [ toHie (C (EvidenceVarBind (EvLetBind depNames) (combineScopes sc (mkScope span)) sp) (L span $ eb_lhs evbind)) @@ -698,6 +698,12 @@ instance ToHie (EvBindContext (LocatedA TcEvBinds)) where ] toHie _ = pure [] +classifyEvBindDep :: EvId -> EvBindDep +classifyEvBindDep evId = + case idDetails evId of + RecSelId{sel_tycon} -> RecordField (varName evId) (recSelParentName sel_tycon) + _ -> EvidenceVar (varName evId) + instance ToHie (LocatedA HsWrapper) where toHie (L osp wrap) = case wrap of ===================================== compiler/GHC/Iface/Ext/Types.hs ===================================== @@ -598,17 +598,61 @@ instance Outputable EvVarSource where ppr (EvInstBind True cls) = text "bound due to a superclass of " <+> ppr cls ppr (EvLetBind deps) = text "bound by a let, depending on:" <+> ppr deps +data EvBindDep + = EvidenceVar Name + | RecordField Name Name + | TypeableEvidence Name + deriving (Eq, Ord) + +instance Outputable EvBindDep where + ppr = \ case + EvidenceVar n -> ppr n + RecordField sel parent -> ppr sel <+> text "of Record" <+> ppr parent + TypeableEvidence n -> ppr n <+> text "bound by Typeable" + +evBindDepName :: EvBindDep -> Name +evBindDepName = \ case + EvidenceVar n -> n + RecordField selector _record -> selector + TypeableEvidence n -> n + +evBindDepHieName :: EvBindDep -> HieName +evBindDepHieName = toHieName . evBindDepName + +instance Binary EvBindDep where + put_ bh = \ case + EvidenceVar n -> do + putByte bh 0 + put_ bh n + RecordField n sel -> do + putByte bh 1 + put_ bh n + put_ bh sel + TypeableEvidence n -> do + putByte bh 2 + put_ bh n + + get bh = + getByte bh >>= \ case + 0 -> EvidenceVar <$> get bh + 1 -> RecordField <$> get bh <*> get bh + 2 -> TypeableEvidence <$> get bh + t -> fail $ "EvBindDep: Unknown tag: " ++ show t + -- | Eq/Ord instances compare on the converted HieName, -- as non-exported names may have different uniques after -- a roundtrip -newtype EvBindDeps = EvBindDeps { getEvBindDeps :: [Name] } +newtype EvBindDeps = EvBindDeps { getEvBindDeps :: [EvBindDep] } deriving Outputable +evBindDepsNames :: EvBindDeps -> [Name] +evBindDepsNames = map evBindDepName . getEvBindDeps + instance Eq EvBindDeps where - (==) = coerce ((==) `on` map toHieName) + (==) = coerce ((==) `on` map evBindDepHieName) instance Ord EvBindDeps where - compare = coerce (compare `on` map toHieName) + compare = coerce (compare `on` map evBindDepHieName) instance Binary EvBindDeps where put_ bh (EvBindDeps xs) = put_ bh xs ===================================== compiler/GHC/Iface/Ext/Utils.hs ===================================== @@ -82,15 +82,19 @@ resolveVisibility kind ty_args foldType :: (HieType a -> a) -> HieTypeFix -> a foldType f (Roll t) = f $ fmap (foldType f) t -selectPoint :: HieFile -> (Int,Int) -> Maybe (HieAST Int) -selectPoint hf (sl,sc) = getFirst $ +selectPoint :: HieFile -> (Int,Int) -> Maybe (HieAST TypeIndex) +selectPoint hf p = selectRange hf p p + +selectRange :: HieFile -> (Int,Int) -> (Int,Int) -> Maybe (HieAST TypeIndex) +selectRange hf (sl,sc) (el, ec) = getFirst $ flip foldMap (M.toList (getAsts $ hie_asts hf)) $ \(HiePath fs,ast) -> First $ case selectSmallestContaining (sp fs) ast of Nothing -> Nothing Just ast' -> Just ast' where sloc fs = mkRealSrcLoc fs sl sc - sp fs = mkRealSrcSpan (sloc fs) (sloc fs) + eloc fs = mkRealSrcLoc fs el ec + sp fs = mkRealSrcSpan (sloc fs) (eloc fs) findEvidenceUse :: NodeIdentifiers a -> [Name] findEvidenceUse ni = [n | (Right n, dets) <- xs, any isEvidenceUse (identInfo dets)] @@ -141,7 +145,7 @@ getEvidenceTree refmap var = go emptyNameSet var det <- S.toList $ identInfo dets case det of EvidenceVarBind src@(EvLetBind (getEvBindDeps -> xs)) scp spn -> - pure $ Just ((src,scp,spn),mapMaybe (go $ extendNameSet seen var) xs) + pure $ Just ((src,scp,spn),mapMaybe (go (extendNameSet seen var) . evBindDepName) xs) EvidenceVarBind src scp spn -> pure $ Just ((src,scp,spn),[]) _ -> pure Nothing pure $ Tree.Node (EvidenceInfo var sp typ (Just evdet)) children @@ -386,7 +390,7 @@ definedInAsts asts n = case nameSrcSpan n of getEvidenceBindDeps :: ContextInfo -> [Name] getEvidenceBindDeps (EvidenceVarBind (EvLetBind xs) _ _) = - getEvBindDeps xs + evBindDepsNames xs getEvidenceBindDeps _ = [] isEvidenceBind :: ContextInfo -> Bool ===================================== compiler/GHC/Rename/Expr.hs ===================================== @@ -422,7 +422,7 @@ rnExpr (HsGetField _ e f) ; let f' = rnDotFieldOcc <$> f ; return ( mkExpandedExpr (HsGetField noExtField e f') - (mkGetField getField e (fmap (unLoc . dfoLabel) f')) + (mkGetField getField e (dfoLabel $ unLoc f')) , fv_e `plusFN` fv_getField ) } rnExpr (HsProjection _ fs) @@ -431,7 +431,7 @@ rnExpr (HsProjection _ fs) ; let fs' = NE.map rnDotFieldOcc fs ; return ( mkExpandedExpr (HsProjection noExtField fs') - (mkProjection getField circ $ NE.map (unLoc . dfoLabel) fs') + (mkProjection getField circ $ NE.map dfoLabel fs') , unitFN circ `plusFN` fv_getField) } ------------------------------------------ @@ -2882,8 +2882,9 @@ rnHsIf p b1 b2 -- mkGetField arg field calculates a get_field @field arg expression. -- e.g. z.x = mkGetField z x = get_field @x z -mkGetField :: Name -> LHsExpr GhcRn -> LocatedAn NoEpAnns FieldLabelString -> HsExpr GhcRn -mkGetField get_field arg field = unLoc (head $ mkGet get_field (arg :| []) field) +mkGetField :: Name -> LHsExpr GhcRn -> XRec GhcRn FieldLabelString -> HsExpr GhcRn +mkGetField get_field arg field = + HsApp noExtField (mkGetFieldExpr get_field field) arg -- mkSetField a field b calculates a set_field @field expression. -- e.g mkSetSetField a field b = set_field @"field" a b (read as "set field 'field' to a on b"). @@ -2902,14 +2903,16 @@ mkSet set_field acc (field, g) = wrapGenSpan (mkSetField set_field g field acc) -- mkProjection fields calculates a projection. -- e.g. .x = mkProjection [x] = getField @"x" -- .x.y = mkProjection [.x, .y] = (.y) . (.x) = getField @"y" . getField @"x" -mkProjection :: Name -> Name -> NonEmpty FieldLabelString -> HsExpr GhcRn -mkProjection getFieldName circName (field :| fields) = foldl' f (proj field) fields +mkProjection :: Name -> Name -> NonEmpty (XRec GhcRn FieldLabelString) -> HsExpr GhcRn +mkProjection getFieldName circName (field :| fields) = + unLoc $ foldl' f (mkGetFieldExpr getFieldName field) fields where - f :: HsExpr GhcRn -> FieldLabelString -> HsExpr GhcRn - f acc field = genHsApps circName $ map wrapGenSpan [proj field, acc] + f :: LHsExpr GhcRn -> XRec GhcRn FieldLabelString -> LHsExpr GhcRn + f acc field = wrapGenSpan $ genHsApps circName [mkGetFieldExpr getFieldName field, acc] - proj :: FieldLabelString -> HsExpr GhcRn - proj (FieldLabelString f) = genHsVar getFieldName `genAppType` genHsTyLit f +mkGetFieldExpr :: Name -> XRec GhcRn FieldLabelString -> LHsExpr GhcRn +mkGetFieldExpr getFieldName (L ann (FieldLabelString f)) = + wrapGenSpan' (getHasLoc ann) (genHsVar getFieldName `genAppType` genHsTyLit f) -- mkProjUpdateSetField calculates functions representing dot notation record updates. -- e.g. Suppose an update like foo.bar = 1. ===================================== testsuite/tests/hiefile/should_run/HasFieldQueries.hs ===================================== @@ -0,0 +1,52 @@ +{-# LANGUAGE OverloadedRecordDot #-} +module Main where + +import TestUtils +import GHC.Records +import GHC.TypeLits +import Data.Tree + +data Thing = Thing {field1 :: Char, field2 :: Bool} + deriving (Show, Eq) + +foo :: Thing -> String +foo t = show t.field1 +-- ^ this is the point + +testing2 (x :: Thing) = x.field1 +-- ^ this is the point +-- ^ this is the point + +data NestedThing = NestedThing { nested1 :: Thing } + +nestedSig :: NestedThing -> Char +nestedSig n = n.nested1.field1 +-- ^ this is the point +-- ^ this is the point + +nestedNoSig n = n.nested1.field2 :: Bool +-- ^ this is the point +-- ^ this is the point + + +withConstraint :: HasField "field1" x Char => x -> Char +withConstraint x = x.field1 +-- ^ this is the point + +points = + [ (13,17) + , (16,25) + , (16,27) + , (23,17) + , (23,25) + , (27,20) + , (27,28) + , (33,22) + ] + +main = do + (df, hf) <- readTestHie "HasFieldQueries.hie" + let refmap = generateReferencesMap $ getAsts $ hie_asts hf + + traverse (explainEv df hf refmap) points + return () ===================================== testsuite/tests/hiefile/should_run/HasFieldQueries.stdout ===================================== @@ -0,0 +1,156 @@ +========================== +At point (13,17), we found: +========================== +┌ +│ $dHasField at HasFieldQueries.hs:1:1, of type: HasField "field1" Thing Char +│ is an evidence variable bound by a let, depending on: [C:HasField, +│ field1 of Record Thing] +│ with scope: ModuleScope +│ +│ Defined at <no location info> +└ +| ++- ┌ +| │ C:HasField at HasFieldQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a +| │ is a usage of an external evidence variable +| │ Defined in `GHC.Internal.Records' +| └ +| +`- ┌ + │ field1 at HasFieldQueries.hs:1:1, of type: Thing -> Char + │ is a usage of an external evidence variable + │ Defined at HasFieldQueries.hs:9:21 + └ + +========================== +At point (16,25), we found: +========================== +========================== +At point (16,27), we found: +========================== +┌ +│ $dHasField at HasFieldQueries.hs:16:1-32, of type: HasField "field1" Thing Char +│ is an evidence variable bound by a let, depending on: [C:HasField, +│ field1 of Record Thing] +│ with scope: LocalScope HasFieldQueries.hs:16:1-32 +│ bound at: HasFieldQueries.hs:16:1-32 +│ Defined at <no location info> +└ +| ++- ┌ +| │ C:HasField at HasFieldQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a +| │ is a usage of an external evidence variable +| │ Defined in `GHC.Internal.Records' +| └ +| +`- ┌ + │ field1 at HasFieldQueries.hs:1:1, of type: Thing -> Char + │ is a usage of an external evidence variable + │ Defined at HasFieldQueries.hs:9:21 + └ + +========================== +At point (23,17), we found: +========================== +┌ +│ $dHasField at HasFieldQueries.hs:1:1, of type: HasField "nested1" NestedThing Thing +│ is an evidence variable bound by a let, depending on: [C:HasField, +│ nested1 of Record NestedThing] +│ with scope: ModuleScope +│ +│ Defined at <no location info> +└ +| ++- ┌ +| │ C:HasField at HasFieldQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a +| │ is a usage of an external evidence variable +| │ Defined in `GHC.Internal.Records' +| └ +| +`- ┌ + │ nested1 at HasFieldQueries.hs:1:1, of type: NestedThing -> Thing + │ is a usage of an external evidence variable + │ Defined at HasFieldQueries.hs:20:34 + └ + +========================== +At point (23,25), we found: +========================== +┌ +│ $dHasField at HasFieldQueries.hs:1:1, of type: HasField "field1" Thing Char +│ is an evidence variable bound by a let, depending on: [C:HasField, +│ field1 of Record Thing] +│ with scope: ModuleScope +│ +│ Defined at <no location info> +└ +| ++- ┌ +| │ C:HasField at HasFieldQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a +| │ is a usage of an external evidence variable +| │ Defined in `GHC.Internal.Records' +| └ +| +`- ┌ + │ field1 at HasFieldQueries.hs:1:1, of type: Thing -> Char + │ is a usage of an external evidence variable + │ Defined at HasFieldQueries.hs:9:21 + └ + +========================== +At point (27,20), we found: +========================== +┌ +│ $dHasField at HasFieldQueries.hs:27:1-40, of type: HasField "nested1" r r +│ is an evidence variable bound by a let, depending on: [$dHasField] +│ with scope: LocalScope HasFieldQueries.hs:27:1-40 +│ bound at: HasFieldQueries.hs:27:1-40 +│ Defined at <no location info> +└ +| +`- ┌ + │ $dHasField at HasFieldQueries.hs:27:1-40, of type: HasField "nested1" r r + │ is an evidence variable bound by a type signature + │ with scope: LocalScope HasFieldQueries.hs:27:1-40 + │ bound at: HasFieldQueries.hs:27:1-40 + │ Defined at <no location info> + └ + +========================== +At point (27,28), we found: +========================== +┌ +│ $dHasField at HasFieldQueries.hs:27:1-40, of type: HasField "field2" r Bool +│ is an evidence variable bound by a let, depending on: [$dHasField] +│ with scope: LocalScope HasFieldQueries.hs:27:1-40 +│ bound at: HasFieldQueries.hs:27:1-40 +│ Defined at <no location info> +└ +| +`- ┌ + │ $dHasField at HasFieldQueries.hs:27:1-40, of type: HasField "field2" r Bool + │ is an evidence variable bound by a type signature + │ with scope: LocalScope HasFieldQueries.hs:27:1-40 + │ bound at: HasFieldQueries.hs:27:1-40 + │ Defined at <no location info> + └ + +========================== +At point (33,22), we found: +========================== +┌ +│ $dHasField at HasFieldQueries.hs:33:1-27, of type: HasField "field1" x Char +│ is an evidence variable bound by a let, depending on: [$dHasField] +│ with scope: LocalScope HasFieldQueries.hs:33:1-27 +│ bound at: HasFieldQueries.hs:33:1-27 +│ Defined at <no location info> +└ +| +`- ┌ + │ $dHasField at HasFieldQueries.hs:33:1-27, of type: HasField "field1" x Char + │ is an evidence variable bound by a HsWrapper + │ with scope: LocalScope HasFieldQueries.hs:33:1-27 + │ bound at: HasFieldQueries.hs:33:1-27 + │ Defined at <no location info> + └ + ===================================== testsuite/tests/hiefile/should_run/HieTypeable.hs ===================================== @@ -0,0 +1,28 @@ +module Main where + +import Data.Dynamic +import Data.Typeable +import TestUtils + +data Thing = Thing {field1 :: Char, field2 :: Bool} + deriving (Show, Eq) + +castFromDynamic :: Dynamic -> Maybe Thing +castFromDynamic d = fromDynamic d + -- ^ this is the point + +rep :: Thing -> TypeRep +rep d = typeOf d + -- ^ this is the point + +points = + [ (11,21) + , (15,10) + ] + +main = do + (df, hf) <- readTestHie "HieTypeable.hie" + let refmap = generateReferencesMap $ getAsts $ hie_asts hf + + traverse (explainEv df hf refmap) points + return () ===================================== testsuite/tests/hiefile/should_run/HieTypeable.stdout ===================================== @@ -0,0 +1,30 @@ +========================== +At point (11,21), we found: +========================== +┌ +│ $dTypeable at HieTypeable.hs:1:1, of type: Typeable Thing +│ is an evidence variable bound by a let, depending on: [$dTypeable] +│ with scope: ModuleScope +│ +│ Defined at <no location info> +└ +| +`- ┌ + │ $dTypeable at HieTypeable.hs:1:1, of type: Typeable Thing + │ is an evidence variable bound by a let, depending on: [] + │ with scope: ModuleScope + │ + │ Defined at <no location info> + └ + +========================== +At point (15,10), we found: +========================== +┌ +│ $dTypeable at HieTypeable.hs:1:1, of type: Typeable Thing +│ is an evidence variable bound by a let, depending on: [] +│ with scope: ModuleScope +│ +│ Defined at <no location info> +└ + ===================================== testsuite/tests/hiefile/should_run/RecordDotTypes.hs ===================================== @@ -22,6 +22,11 @@ x = MyRecord { a = "Hello", b = 12, c = MyChild { z = "there" } } y = x.a ++ show x.b ++ x.c.z -- ^ ^ ^ ^^ -- 1 2 3 45 +-- ^-^ ^-^ ^-^ +-- 6 7 8 +-- ^---^ +-- 9 + p1,p2,p3,p4 :: (Int,Int) p1 = (22,6) @@ -30,10 +35,19 @@ p3 = (22,25) p4 = (22,28) p5 = (22,29) +r6 = (p1, (22, 8)) +r7 = ((22,17), p2) +r8 = (p3, (22, 27)) +r9 = (p3, p5) + selectPoint' :: HieFile -> (Int,Int) -> HieAST Int selectPoint' hf loc = maybe (error "point not found") id $ selectPoint hf loc +selectRange' :: HieFile -> ((Int,Int), (Int, Int)) -> HieAST Int +selectRange' hf (s, e) = + maybe (error "range not found") id $ selectRange hf s e + main = do (df, hf) <- readTestHie "RecordDotTypes.hie" forM_ [p1,p2,p3,p4,p5] $ \point -> do @@ -41,3 +55,11 @@ main = do let types = concatMap nodeType $ getSourcedNodeInfo $ sourcedNodeInfo $ selectPoint' hf point forM_ types $ \typ -> do putStrLn (renderHieType df $ recoverFullType typ (hie_types hf)) + + forM_ [r6, r7, r8, r9] $ \range -> do + putStr $ "At " ++ showRange range ++ ", got type: " + let types = concatMap nodeType $ getSourcedNodeInfo $ sourcedNodeInfo $ selectRange' hf range + forM_ types $ \typ -> do + putStrLn (renderHieType df $ recoverFullType typ (hie_types hf)) + where + showRange (p1, p2) = show p1 ++ " - " ++ show p2 ===================================== testsuite/tests/hiefile/should_run/RecordDotTypes.stdout ===================================== @@ -1,5 +1,9 @@ At (22,6), got type: MyRecord -At (22,20), got type: Integer +At (22,20), got type: MyRecord -> Integer At (22,25), got type: MyRecord -At (22,28), got type: String -At (22,29), got type: String \ No newline at end of file +At (22,28), got type: MyChild -> [Char] +At (22,29), got type: MyChild -> [Char] +At (22,6) - (22,8), got type: [Char] +At (22,17) - (22,20), got type: Integer +At (22,25) - (22,27), got type: MyChild +At (22,25) - (22,29), got type: [Char] ===================================== testsuite/tests/hiefile/should_run/T23492.stdout ===================================== @@ -4,4 +4,4 @@ PartialFieldSelector At (18,7), got type: PartialFieldSelector -> Bool At (23,7), got type: PartialFieldSelector At (23,8), got type: PartialFieldSelector -At (23,9), got type: Bool +At (23,9), got type: PartialFieldSelector -> Bool ===================================== testsuite/tests/hiefile/should_run/all.T ===================================== @@ -10,3 +10,5 @@ test('T23120', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUti test('T24544', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info']) test('HieGadtConSigs', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info']) test('T25709', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info']) +test('HasFieldQueries', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info']) +test('HieTypeable', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/bb8f0d262689a9ae75cd31cfe9a03a… -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/bb8f0d262689a9ae75cd31cfe9a03a… You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1 0
0 0
[Git][ghc/ghc][wip/jeltsch/portable-bco-byte-array-serialization] Change the oder of definition of (de)serialization operations
by Wolfgang Jeltsch (@jeltsch) 16 Sep '26

16 Sep '26
Wolfgang Jeltsch pushed to branch wip/jeltsch/portable-bco-byte-array-serialization at Glasgow Haskell Compiler / GHC Commits: 3b17b6f0 by Wolfgang Jeltsch at 2026-09-16T18:14:54+03:00 Change the oder of definition of (de)serialization operations - - - - - 1 changed file: - libraries/ghci/GHCi/ResolvedBCO.hs Changes: ===================================== libraries/ghci/GHCi/ResolvedBCO.hs ===================================== @@ -152,34 +152,6 @@ instance Binary ResolvedBCO where 1 -> ResolvedStaticCon <$> get <*> get <*> get <*> get <*> get <*> get _ -> error "Binary ResolvedBCO: invalid byte" -#if !defined(WORDS_BIGENDIAN) - --- | Serialize a 'BCOByteArray', writing the payload verbatim instead of --- serializing the individual elements. This must only be used when the host --- platform uses little endian and the bitsize of the element type of the --- array is the one that is used for the serialized form of elements. -putBCOByteArrayDirectly :: Storable a => BCOByteArray a -> Put -putBCOByteArrayDirectly @a (BCOByteArray byteArray#) - = putWord64le (fromIntegral size) <> - putBuilder (fromShortByteString (SBS byteArray#)) - where - - size :: Int - size = I# (sizeofByteArray# byteArray#) `div` sizeOf (undefined :: a) - --- | Deserialize a 'BCOByteArray', reading the payload verbatim instead of --- deserializing the individual elements. This must only be used when the host --- platform uses little endian and the bitsize of the element type of the --- array is the one that is used for the serialized form of elements. -getBCOByteArrayDirectly :: Storable a => Get (BCOByteArray a) -getBCOByteArrayDirectly @a = do - size <- fromIntegral <$> getWord64le :: Get Int - SBS byteArray# <- toShort <$> getByteString (size * sizeOf (undefined :: a)) - -- Beware that there is no overflow check for the byte count computation. - return (BCOByteArray byteArray#) - -#endif - #if defined(WORDS_BIGENDIAN) || SIZEOF_HSWORD == 4 -- | Serialize a 'BCOByteArray', not writing the payload verbatim but @@ -215,6 +187,34 @@ getBCOByteArrayPortably getElement = do #endif +#if !defined(WORDS_BIGENDIAN) + +-- | Serialize a 'BCOByteArray', writing the payload verbatim instead of +-- serializing the individual elements. This must only be used when the host +-- platform uses little endian and the bitsize of the element type of the +-- array is the one that is used for the serialized form of elements. +putBCOByteArrayDirectly :: Storable a => BCOByteArray a -> Put +putBCOByteArrayDirectly @a (BCOByteArray byteArray#) + = putWord64le (fromIntegral size) <> + putBuilder (fromShortByteString (SBS byteArray#)) + where + + size :: Int + size = I# (sizeofByteArray# byteArray#) `div` sizeOf (undefined :: a) + +-- | Deserialize a 'BCOByteArray', reading the payload verbatim instead of +-- deserializing the individual elements. This must only be used when the host +-- platform uses little endian and the bitsize of the element type of the +-- array is the one that is used for the serialized form of elements. +getBCOByteArrayDirectly :: Storable a => Get (BCOByteArray a) +getBCOByteArrayDirectly @a = do + size <- fromIntegral <$> getWord64le :: Get Int + SBS byteArray# <- toShort <$> getByteString (size * sizeOf (undefined :: a)) + -- Beware that there is no overflow check for the byte count computation. + return (BCOByteArray byteArray#) + +#endif + -- See [BCOByteArray serialization]. instance Binary (BCOByteArray Word16) where View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3b17b6f0b709ae21e807b505d873b54… -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3b17b6f0b709ae21e807b505d873b54… You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1 0
0 0
[Git][ghc/ghc][wip/jeltsch/portable-bco-byte-array-serialization] Eliminate bugs that show up only outside of 64-bit little endian
by Wolfgang Jeltsch (@jeltsch) 16 Sep '26

16 Sep '26
Wolfgang Jeltsch pushed to branch wip/jeltsch/portable-bco-byte-array-serialization at Glasgow Haskell Compiler / GHC Commits: e49f0e96 by Wolfgang Jeltsch at 2026-09-16T18:13:21+03:00 Eliminate bugs that show up only outside of 64-bit little endian - - - - - 1 changed file: - libraries/ghci/GHCi/ResolvedBCO.hs Changes: ===================================== libraries/ghci/GHCi/ResolvedBCO.hs ===================================== @@ -31,8 +31,8 @@ import qualified GHC.Exts.Heap as Heap import Data.Word (Word16) import Data.ByteString.Short (ShortByteString (SBS), toShort) import Data.Array.Base (UArray (UArray)) -import Data.Binary.Builder (putWord64le, fromShortByteString) -import Data.Binary.Put (Put, putWord8, putBuilder) +import Data.Binary.Builder (fromShortByteString) +import Data.Binary.Put (Put, putWord8, putWord64le, putBuilder) import Data.Binary.Get (Get, getWord8, getWord64le, getByteString) import Data.Binary (Binary (put, get)) import Foreign.Storable (Storable, sizeOf) @@ -40,13 +40,13 @@ import GHC.Data.SmallArray (SmallArray) import GHC.Generics (Generic) #if defined(WORDS_BIGENDIAN) -import Data.Binary.Builder (putWord16le) -import Data.Binary.Get (getWord16) +import Data.Binary.Put (putWord16le) +import Data.Binary.Get (getWord16le) #endif #if defined(WORDS_BIGENDIAN) || SIZEOF_HSWORD == 4 import Control.Monad (replicateM) -import Data.Array.Base (listArray, numElements, elems) +import Data.Array.Base (IArray, listArray, numElements, elems) #endif isLittleEndian :: Bool @@ -160,8 +160,8 @@ instance Binary ResolvedBCO where -- array is the one that is used for the serialized form of elements. putBCOByteArrayDirectly :: Storable a => BCOByteArray a -> Put putBCOByteArrayDirectly @a (BCOByteArray byteArray#) - = putBuilder $ - putWord64le (fromIntegral size) <> fromShortByteString (SBS byteArray#) + = putWord64le (fromIntegral size) <> + putBuilder (fromShortByteString (SBS byteArray#)) where size :: Int @@ -185,13 +185,13 @@ getBCOByteArrayDirectly @a = do -- | Serialize a 'BCOByteArray', not writing the payload verbatim but -- serializing the individual elements. This can be used with any host -- platform and element type. -putBCOByteArrayPortably :: (a -> Put) +putBCOByteArrayPortably :: (Storable a, IArray UArray a) + => (a -> Put) -- ^ The serializer to use for each element -> (BCOByteArray a -> Put) -- ^ The 'BCOByteArray' serializer -putBCOByteArrayPortably putElement bcoByteArray - = putBuilder $ - putWord64le (fromIntegral size) <> foldMap putElement (elems array) +putBCOByteArrayPortably @a putElement bcoByteArray + = putWord64le (fromIntegral size) <> foldMap putElement (elems array) where array :: UArray Int a @@ -203,7 +203,8 @@ putBCOByteArrayPortably putElement bcoByteArray -- | Deserialize a 'BCOByteArray', not reading the payload verbatim but -- deserializing the individual elements. This can be used with any host -- platform and element type. -getBCOByteArrayPortably :: Get a +getBCOByteArrayPortably :: IArray UArray a + => Get a -- ^ The deserializer to use for each element -> Get (BCOByteArray a) -- ^ The 'BCOByteArray' deserializer View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e49f0e966890efc926a642eb5e55b79… -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e49f0e966890efc926a642eb5e55b79… You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1 0
0 0
[Git][ghc/ghc][wip/fendor/has-field-hie] 3 commits: Allow any `Id` to be used for HIE evidence
by Hannes Siebenhandl (@fendor) 16 Sep '26

16 Sep '26
Hannes Siebenhandl pushed to branch wip/fendor/has-field-hie at Glasgow Haskell Compiler / GHC Commits: f1e31835 by fendor at 2026-09-16T15:31:55+02:00 Allow any `Id` to be used for HIE evidence HIE evidence is used to show how a constraint has been solved and allows users to go directly to the definition or introduction of a particular evidence variable. So far, we only looked at evidence introduced by type class variables, but some evidence terms refer to other variables as well, such as record selectors. Such evidence terms add additional details and source locations. For generated evidence, such as `HasField` evidence to support `-XRecordDotSyntax`, the type class evidence is lacking and doesn't give us any usable source span pointing to the actual record selector. See this example evidence: $dHasField_aLw = GHC.Internal.Records.C:HasField @GHC.Internal.Types.Symbol @GHC.Internal.Types.LiftedRep @GHC.Internal.Types.LiftedRep @"foo" @Foo @Int (foo `cast` (<Foo -> Int>_R :: (Foo -> Int) ~R# (Foo -> Int))) The free variables of this term are `{C:HasField, foo}`. `foo` is the record selector from the type `Foo` and is crucial to guide users how this evidence is constructed, as the evidence `HasField` is not helpful. During HIE generation, we now take any `Id` into account to provide additional source spans to point to user to the definition site of the record selector. As a direct consequence, this allows HLS to implement a limited form of `Goto Definition` for expressions of the form `x.foo`, where `x :: Foo`. Capturing more `Id`s for evidence may have some side effects that are somewhat tricky to predict, since the tests are quite lacking. - - - - - 5c3ce3fe by fendor at 2026-09-16T15:32:17+02:00 Add additional details to evidence bindings Evidence bindings can be all sorts of things, such as type class evidence, a record selector or other builtin constructs such as `Typeable`. - - - - - bb8f0d26 by fendor at 2026-09-16T15:32:23+02:00 Typeable test - - - - - 9 changed files: - + changelog.d/record-dot-evidence - compiler/GHC/Iface/Ext/Ast.hs - compiler/GHC/Iface/Ext/Types.hs - compiler/GHC/Iface/Ext/Utils.hs - testsuite/tests/hiefile/should_run/HasFieldQueries.stdout - + testsuite/tests/hiefile/should_run/HieTypeable.hs - + testsuite/tests/hiefile/should_run/HieTypeable.stdout - testsuite/tests/hiefile/should_run/RecordDotTypes.stdout - testsuite/tests/hiefile/should_run/all.T Changes: ===================================== changelog.d/record-dot-evidence ===================================== @@ -0,0 +1,12 @@ +section: compiler +synopsis: Record selector functions as evidence for `HasField` constraints during .hie file generation. +description: { + We record the record selector `foo` of an expression such as `f.foo` as evidence for + solving the constraint `HasField "foo" record ty`. + + This allows us to point to the definition source location of the record selector `foo`, allowing + users to jump to definition using the evidence variables. +} + +issues: #25418 +mrs: !16694 ===================================== compiler/GHC/Iface/Ext/Ast.hs ===================================== @@ -23,7 +23,6 @@ import GHC.Core.DataCon ( dataConWrapperType ) import GHC.Core.Type ( Type, ForAllTyFlag(..) ) import GHC.Core.TyCon ( TyCon, tyConClass_maybe ) import GHC.Core.InstEnv -import GHC.Core.Predicate ( isEvId ) import GHC.Hs import GHC.Hs.Syn.Type @@ -33,7 +32,7 @@ import GHC.Types.Basic import GHC.Types.UnresolvedImport ( isGeneratedImport ) import GHC.Types.FieldLabel import GHC.Types.Avail ( Avails ) -import GHC.Types.Id ( isDataConId_maybe ) +import GHC.Types.Id ( isDataConId_maybe, isId, idDetails ) import GHC.Types.Name ( Name, nameSrcSpan, nameUnique, wiredInNameTyThing_maybe, getName ) import GHC.Types.Name.Env ( NameEnv, emptyNameEnv, extendNameEnv, lookupNameEnv ) import GHC.Types.Name.Reader ( RecFieldInfo(..), WithUserRdr(..) ) @@ -81,6 +80,7 @@ import Control.Applicative ( (<|>) ) import GHC.Types.TypeEnv ( TypeEnv ) import Control.Arrow ( second ) import Data.Traversable ( mapAccumR ) +import GHC.Types.Id.Info (IdDetails(..), recSelParentName) {- Note [Updating HieAst for changes in the GHC AST] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -682,7 +682,7 @@ instance ToHie (Context (Located (WithUserRdr Name))) where hieEvIdsOfTerm :: EvTerm -> [EvId] -- Returns only EvIds satisfying relevantEvId -hieEvIdsOfTerm = runFVSelectiveList isEvId . evTermFVs +hieEvIdsOfTerm = runFVSelectiveList isId . evTermFVs instance ToHie (EvBindContext (LocatedA TcEvBinds)) where toHie (EvBindContext sc sp (L span (EvBinds bs))) @@ -690,7 +690,7 @@ instance ToHie (EvBindContext (LocatedA TcEvBinds)) where where go evbind = do let evDeps = hieEvIdsOfTerm $ eb_rhs evbind - depNames = EvBindDeps $ map varName evDeps + depNames = EvBindDeps $ map classifyEvBindDep evDeps concatM $ [ toHie (C (EvidenceVarBind (EvLetBind depNames) (combineScopes sc (mkScope span)) sp) (L span $ eb_lhs evbind)) @@ -698,6 +698,12 @@ instance ToHie (EvBindContext (LocatedA TcEvBinds)) where ] toHie _ = pure [] +classifyEvBindDep :: EvId -> EvBindDep +classifyEvBindDep evId = + case idDetails evId of + RecSelId{sel_tycon} -> RecordField (varName evId) (recSelParentName sel_tycon) + _ -> EvidenceVar (varName evId) + instance ToHie (LocatedA HsWrapper) where toHie (L osp wrap) = case wrap of ===================================== compiler/GHC/Iface/Ext/Types.hs ===================================== @@ -598,17 +598,61 @@ instance Outputable EvVarSource where ppr (EvInstBind True cls) = text "bound due to a superclass of " <+> ppr cls ppr (EvLetBind deps) = text "bound by a let, depending on:" <+> ppr deps +data EvBindDep + = EvidenceVar Name + | RecordField Name Name + | TypeableEvidence Name + deriving (Eq, Ord) + +instance Outputable EvBindDep where + ppr = \ case + EvidenceVar n -> ppr n + RecordField sel parent -> ppr sel <+> text "of Record" <+> ppr parent + TypeableEvidence n -> ppr n <+> text "bound by Typeable" + +evBindDepName :: EvBindDep -> Name +evBindDepName = \ case + EvidenceVar n -> n + RecordField selector _record -> selector + TypeableEvidence n -> n + +evBindDepHieName :: EvBindDep -> HieName +evBindDepHieName = toHieName . evBindDepName + +instance Binary EvBindDep where + put_ bh = \ case + EvidenceVar n -> do + putByte bh 0 + put_ bh n + RecordField n sel -> do + putByte bh 1 + put_ bh n + put_ bh sel + TypeableEvidence n -> do + putByte bh 2 + put_ bh n + + get bh = + getByte bh >>= \ case + 0 -> EvidenceVar <$> get bh + 1 -> RecordField <$> get bh <*> get bh + 2 -> TypeableEvidence <$> get bh + t -> fail $ "EvBindDep: Unknown tag: " ++ show t + -- | Eq/Ord instances compare on the converted HieName, -- as non-exported names may have different uniques after -- a roundtrip -newtype EvBindDeps = EvBindDeps { getEvBindDeps :: [Name] } +newtype EvBindDeps = EvBindDeps { getEvBindDeps :: [EvBindDep] } deriving Outputable +evBindDepsNames :: EvBindDeps -> [Name] +evBindDepsNames = map evBindDepName . getEvBindDeps + instance Eq EvBindDeps where - (==) = coerce ((==) `on` map toHieName) + (==) = coerce ((==) `on` map evBindDepHieName) instance Ord EvBindDeps where - compare = coerce (compare `on` map toHieName) + compare = coerce (compare `on` map evBindDepHieName) instance Binary EvBindDeps where put_ bh (EvBindDeps xs) = put_ bh xs ===================================== compiler/GHC/Iface/Ext/Utils.hs ===================================== @@ -145,7 +145,7 @@ getEvidenceTree refmap var = go emptyNameSet var det <- S.toList $ identInfo dets case det of EvidenceVarBind src@(EvLetBind (getEvBindDeps -> xs)) scp spn -> - pure $ Just ((src,scp,spn),mapMaybe (go $ extendNameSet seen var) xs) + pure $ Just ((src,scp,spn),mapMaybe (go (extendNameSet seen var) . evBindDepName) xs) EvidenceVarBind src scp spn -> pure $ Just ((src,scp,spn),[]) _ -> pure Nothing pure $ Tree.Node (EvidenceInfo var sp typ (Just evdet)) children @@ -390,7 +390,7 @@ definedInAsts asts n = case nameSrcSpan n of getEvidenceBindDeps :: ContextInfo -> [Name] getEvidenceBindDeps (EvidenceVarBind (EvLetBind xs) _ _) = - getEvBindDeps xs + evBindDepsNames xs getEvidenceBindDeps _ = [] isEvidenceBind :: ContextInfo -> Bool ===================================== testsuite/tests/hiefile/should_run/HasFieldQueries.stdout ===================================== @@ -3,16 +3,23 @@ At point (13,17), we found: ========================== ┌ │ $dHasField at HasFieldQueries.hs:1:1, of type: HasField "field1" Thing Char -│ is an evidence variable bound by a let, depending on: [C:HasField] +│ is an evidence variable bound by a let, depending on: [C:HasField, +│ field1 of Record Thing] │ with scope: ModuleScope │ │ Defined at <no location info> └ | ++- ┌ +| │ C:HasField at HasFieldQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a +| │ is a usage of an external evidence variable +| │ Defined in `GHC.Internal.Records' +| └ +| `- ┌ - │ C:HasField at HasFieldQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a + │ field1 at HasFieldQueries.hs:1:1, of type: Thing -> Char │ is a usage of an external evidence variable - │ Defined in `GHC.Internal.Records' + │ Defined at HasFieldQueries.hs:9:21 └ ========================== @@ -23,16 +30,23 @@ At point (16,27), we found: ========================== ┌ │ $dHasField at HasFieldQueries.hs:16:1-32, of type: HasField "field1" Thing Char -│ is an evidence variable bound by a let, depending on: [C:HasField] +│ is an evidence variable bound by a let, depending on: [C:HasField, +│ field1 of Record Thing] │ with scope: LocalScope HasFieldQueries.hs:16:1-32 │ bound at: HasFieldQueries.hs:16:1-32 │ Defined at <no location info> └ | ++- ┌ +| │ C:HasField at HasFieldQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a +| │ is a usage of an external evidence variable +| │ Defined in `GHC.Internal.Records' +| └ +| `- ┌ - │ C:HasField at HasFieldQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a + │ field1 at HasFieldQueries.hs:1:1, of type: Thing -> Char │ is a usage of an external evidence variable - │ Defined in `GHC.Internal.Records' + │ Defined at HasFieldQueries.hs:9:21 └ ========================== @@ -40,16 +54,23 @@ At point (23,17), we found: ========================== ┌ │ $dHasField at HasFieldQueries.hs:1:1, of type: HasField "nested1" NestedThing Thing -│ is an evidence variable bound by a let, depending on: [C:HasField] +│ is an evidence variable bound by a let, depending on: [C:HasField, +│ nested1 of Record NestedThing] │ with scope: ModuleScope │ │ Defined at <no location info> └ | ++- ┌ +| │ C:HasField at HasFieldQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a +| │ is a usage of an external evidence variable +| │ Defined in `GHC.Internal.Records' +| └ +| `- ┌ - │ C:HasField at HasFieldQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a + │ nested1 at HasFieldQueries.hs:1:1, of type: NestedThing -> Thing │ is a usage of an external evidence variable - │ Defined in `GHC.Internal.Records' + │ Defined at HasFieldQueries.hs:20:34 └ ========================== @@ -57,16 +78,23 @@ At point (23,25), we found: ========================== ┌ │ $dHasField at HasFieldQueries.hs:1:1, of type: HasField "field1" Thing Char -│ is an evidence variable bound by a let, depending on: [C:HasField] +│ is an evidence variable bound by a let, depending on: [C:HasField, +│ field1 of Record Thing] │ with scope: ModuleScope │ │ Defined at <no location info> └ | ++- ┌ +| │ C:HasField at HasFieldQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a +| │ is a usage of an external evidence variable +| │ Defined in `GHC.Internal.Records' +| └ +| `- ┌ - │ C:HasField at HasFieldQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a + │ field1 at HasFieldQueries.hs:1:1, of type: Thing -> Char │ is a usage of an external evidence variable - │ Defined in `GHC.Internal.Records' + │ Defined at HasFieldQueries.hs:9:21 └ ========================== ===================================== testsuite/tests/hiefile/should_run/HieTypeable.hs ===================================== @@ -0,0 +1,28 @@ +module Main where + +import Data.Dynamic +import Data.Typeable +import TestUtils + +data Thing = Thing {field1 :: Char, field2 :: Bool} + deriving (Show, Eq) + +castFromDynamic :: Dynamic -> Maybe Thing +castFromDynamic d = fromDynamic d + -- ^ this is the point + +rep :: Thing -> TypeRep +rep d = typeOf d + -- ^ this is the point + +points = + [ (11,21) + , (15,10) + ] + +main = do + (df, hf) <- readTestHie "HieTypeable.hie" + let refmap = generateReferencesMap $ getAsts $ hie_asts hf + + traverse (explainEv df hf refmap) points + return () ===================================== testsuite/tests/hiefile/should_run/HieTypeable.stdout ===================================== @@ -0,0 +1,30 @@ +========================== +At point (11,21), we found: +========================== +┌ +│ $dTypeable at HieTypeable.hs:1:1, of type: Typeable Thing +│ is an evidence variable bound by a let, depending on: [$dTypeable] +│ with scope: ModuleScope +│ +│ Defined at <no location info> +└ +| +`- ┌ + │ $dTypeable at HieTypeable.hs:1:1, of type: Typeable Thing + │ is an evidence variable bound by a let, depending on: [] + │ with scope: ModuleScope + │ + │ Defined at <no location info> + └ + +========================== +At point (15,10), we found: +========================== +┌ +│ $dTypeable at HieTypeable.hs:1:1, of type: Typeable Thing +│ is an evidence variable bound by a let, depending on: [] +│ with scope: ModuleScope +│ +│ Defined at <no location info> +└ + ===================================== testsuite/tests/hiefile/should_run/RecordDotTypes.stdout ===================================== @@ -1,9 +1,9 @@ At (22,6), got type: MyRecord At (22,20), got type: MyRecord -> Integer At (22,25), got type: MyRecord -At (22,28), got type: MyChild -> String -At (22,29), got type: MyChild -> String -At (22,6) - (22,8), got type: String +At (22,28), got type: MyChild -> [Char] +At (22,29), got type: MyChild -> [Char] +At (22,6) - (22,8), got type: [Char] At (22,17) - (22,20), got type: Integer At (22,25) - (22,27), got type: MyChild -At (22,25) - (22,29), got type: String +At (22,25) - (22,29), got type: [Char] ===================================== testsuite/tests/hiefile/should_run/all.T ===================================== @@ -11,3 +11,4 @@ test('T24544', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUti test('HieGadtConSigs', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info']) test('T25709', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info']) test('HasFieldQueries', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info']) +test('HieTypeable', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/1793ebd827282dcd8e6900e798cca0… -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/1793ebd827282dcd8e6900e798cca0… You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1 0
0 0
[Git][ghc/ghc][wip/jeltsch/improve-closure-property-check] Remove class instantiations for `GlobalUnitKey`
by Wolfgang Jeltsch (@jeltsch) 16 Sep '26

16 Sep '26
Wolfgang Jeltsch pushed to branch wip/jeltsch/improve-closure-property-check at Glasgow Haskell Compiler / GHC Commits: 8134bb63 by Wolfgang Jeltsch at 2026-09-16T16:35:58+03:00 Remove class instantiations for `GlobalUnitKey` - - - - - 1 changed file: - compiler/GHC/Unit/External/Index.hs Changes: ===================================== compiler/GHC/Unit/External/Index.hs ===================================== @@ -308,7 +308,6 @@ data GlobalUnitKey = GlobalUnitKey !UnitId -- ^ Unit Id of the 'UnitInfo' !UnitAbiHash -- ^ ABI hash of the 'UnitInfo' - deriving (Eq, Ord) globalUnitKeyFromUnitInfo :: UnitInfo -> GlobalUnitKey globalUnitKeyFromUnitInfo ui = mkGlobalUnitKey (unitId ui) (unitAbiHash ui) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/8134bb633f49a0de1abee88a7a79dcf… -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/8134bb633f49a0de1abee88a7a79dcf… You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1 0
0 0
[Git][ghc/ghc][wip/dcoutts/io-manager-feature-bitset] 25 commits: ci: Actually pass --ignore-perf-failures to the testsuite driver
by Duncan Coutts (@dcoutts) 16 Sep '26

16 Sep '26
Duncan Coutts pushed to branch wip/dcoutts/io-manager-feature-bitset at Glasgow Haskell Compiler / GHC Commits: 4e9297ea by Simon Jakobi at 2026-09-11T08:32:45-04:00 ci: Actually pass --ignore-perf-failures to the testsuite driver 684c0018d9 changed the IGNORE_PERF_FAILURES handling to append to RUNTEST_ARGS with bash array syntax, but the three use sites still expand RUNTEST_ARGS as a scalar, which yields only the first array element. The appended flag was therefore dropped in every job, so perf improvements kept failing Marge Bot batches and master pipelines, contrary to #19562. Append as a string instead, matching the existing --force-colors append in test_hadrian. Fixes #27563. Assisted-by: Claude Fable 5.1 - - - - - 4f78dfdf by Simon Jakobi at 2026-09-11T08:33:24-04:00 testsuite: Give T26537 a 1.5x compile timeout Its -fregs-graph compile step tends to time out in unoptimized builds (#27188, #27776). Assisted-by: Claude Fable 5.1 - - - - - 130286e3 by Alan Zimmerman at 2026-09-11T08:34:08-04:00 EPA: Remove ListBanana / ListParens from AnnListBrackets This is a step towards making AnnList only represent lists of items which can have either braces or layout. - - - - - a9827d13 by Simon Jakobi at 2026-09-11T18:53:32-04:00 Reject ~, UNPACK and multiplicity annotations on type data fields Only `!` was rejected so far. `~`, UNPACK and multiplicity annotations were silently accepted. None of them make sense at the type level, so restriction (R3) of Note [Type data declarations] now covers all of them. Fixes #27732. Assisted-by: Claude Fable 5.1 - - - - - c71d5e23 by Alan Zimmerman at 2026-09-11T18:54:11-04:00 EPA: Add a Note for the exact print main loop - - - - - 7a108e43 by Simon Jakobi at 2026-09-12T18:35:59-04:00 FastString: Drop mkFastStringWith's constructor callback All three callers passed the same callback, a partial application of mkNewFastStringShortByteString to the string being interned. That partial application is allocated as a closure before the table lookup, on the common hit path too, although the callback is needed only after a miss. Drop the parameter and call mkNewFastStringShortByteString directly after a miss. Since nothing is passed "with" anymore, rename the function to internSB. Suggested by Simon PJ in #27528: https://gitlab.haskell.org/ghc/ghc/-/work_items/27528#note_687031 Assisted-by: Claude Fable 5 - - - - - 82c73b22 by Alan Zimmerman at 2026-09-12T18:36:38-04:00 EPA: More targeted HsDo exact print annotation HsDo is multi-purpose, as encoded in its HsDoFlavour field. Some of these are in a layout context (DoExpr, MDoExpr), others are not (ListComp, MonadComp). We are moving towards using AnnList only in layout contexts, so we switch the HsDo TTG annotation from holding an AnnList for this, to holding Either (EpToken "[", EpToken "]") AnnList This also allows us to trim down AnnListBrackets to only have braces or None, thereby opening the door for unification with the existing layout context data type EpLayout. - - - - - 749d2448 by Luite Stegeman at 2026-09-15T14:07:01-04:00 rts: handle large CONSTR closures in compacting GC The function update_fwd_large in the compacting GC could run into an unexpected object with the following error: internal error: update_fwd_large: unknown/strange object 1 Closure type 1 is CONSTR. This patch adds cases for CONSTR and CONSTR_NOCAF. This is the same problem as #27434 (large AP closures, fixed by cca0d58963), which missed this case. Fixes #27649 - - - - - 177d6155 by Luite Stegeman at 2026-09-15T14:07:02-04:00 testsuite: fix T27434 test with compacting GC Ensure that the interpreter is actually run with the compacting GC - - - - - 5796aa63 by Luite Stegeman at 2026-09-15T14:07:49-04:00 rts: initialise the stack frame header for mask_frame and apply_mask_frame We must leave the stack in consistent state before jumping to mask_frame or apply_mask_frame because they may result. Failing to do so could lead to a crash if there were waiting exceptions. Fixes #27651 - - - - - 2486cc92 by Simon Peyton Jones at 2026-09-15T14:08:36-04:00 Re-introduce the "weird SpecDict" case In this commit commit f80375dd4945350a1d784e436975b48b9c736eaf Author: Simon Peyton Jones <simon.peytonjones(a)gmail.com> Date: Sun Jun 29 15:26:58 2025 +0100 Refactor of Specialise.hs I removed a test for a dictionary with unbound type variables. This turned out to be wrong; see #27629. So this MR re-introduces it. - - - - - 8e09a46f by Duncan Coutts at 2026-09-15T20:11:35-04:00 Refactor (and rename) removeFromQueues, to simplify I/O managers Rename it to unblockAndAppendToRunQueue which better reflects what it is intended to do. The post-condition for unblockAndAppendToRunQueue is that the TSO is on the run queue or it is in the process of migrating to another cap. Previously it achieved that by always directly adding the TSO to the run queue itself. But this actually made things more complicated for the I/O managers, because it meant they needed a separate code path for notifying for cancellation compared to notifying for completion. The general notification code would always add the TSO to the run queue itself. So the improvement is to allow different cases in unblockAndAppendToRunQueue to achieve the same outcome in different ways: either directly adding to the run queue or calling helper functions that do so themselves. This then allows the new I/O managers to share code between the sync and async cancellation, and to reuse their notifyIOCompletion helpers for cancellation. This avoids a source of bugs where the completion path may be updated but the cancellation path may be forgotten, or similarly in future for sync/async operations. Update all the existing in-RTS I/O managers, and the posix timeout code. - - - - - d668782c by Duncan Coutts at 2026-09-15T20:11:35-04:00 Document that awaitCompletedTimeoutsOrIO expects an empty run queue This was true before but implicit and not relied on much. It's better to be explicit, and allow things to depend on it. - - - - - 11d938bb by Duncan Coutts at 2026-09-15T20:11:35-04:00 Store the I/O opcode and fd in the StgAsyncIOOp This will be useful in several I/O managers and it is handy for logging and debugging. It also doesn't increase the size of the StgAsyncIOOp structure. There was enough spare padding space already. Update the poll I/O manager to set the new fields. Add a helper function to convert the enum IOReadOrWrite into the enum IOOpCode. Also change IOReadOrWrite to be an enum without a typedef, for consistency with other enumerations in IOManager.h - - - - - bfa87882 by Duncan Coutts at 2026-09-15T20:11:36-04:00 Add a new I/O manager based on select() Yes, this is the second such I/O manager, but it is a modern re-implementation based on the new in-RTS I/O manager infrastructure. So it is cleaner and faster than the old select I/O manager. Why do we need another I/O manager based on select? Why isn't the poll() one good enough as a baseline portable unix I/O manager? Because macOS. Apple Inc. is why we cannot have nice things. The man page for poll on macOS documents the fact that it does not work. At least, it does not work for all files. Specifically, it does not work for device files. Whereas macOS select() does work for device files. Aaaaarg! We _do_ want to deprecate and remove the old select I/O manager, but due to macOS we cannot do that until we have a replacement. This is that replacement. Until of course a nice new k-queue I/O manager arrives, which could become the new default for macOS and FreeBSD. Interestingly, this select I/O manager is actually faster than the poll one, on Linix, in some circumstances: specifically when many Haskell threads are waiting on the same fd. The poll I/O manager does O(n) work for n threads waiting on I/O, whereas the select one does O(fds) work for the number of fds that threads are waiting on. Usually this is 1:1, so it's not noticable, but one can concoct extreme benchmarks to show the difference. - - - - - 8e9de15a by Duncan Coutts at 2026-09-15T20:11:36-04:00 Minor updates in the poll I/O manager to keep in sync with select This keeps it in sync with select one. The changes are based on code review while implementing the new select I/O manager. The two I/O managers are so similar in structure that it makes sense to try to minimise the diff between them. This should aid understanding, and fixes to both in future. - - - - - 222668bb by Duncan Coutts at 2026-09-15T20:11:36-04:00 Document the new select I/O manager in the user guide in the RTS section about I/O managers. And add a changelog entry. - - - - - 0f48735b by Cheng Shao at 2026-09-15T20:12:23-04:00 Revert "wasm: workaround WebKit bug in dyld" This reverts commit c9b8465c2c338176fcab9d197e9d31f4aee11f68. The underlying webkit bug has been fixed in https://commits.webkit.org/314219@main. Closes #27564. - - - - - 809294f1 by Luite Stegeman at 2026-09-15T20:13:08-04:00 rts: make stg_threadLabelzh return a valid pointer for unlabeled threads. This fixes a segfault in the GC caused by stg_threadLabelzh returning a 0 pointer in a GC pointer field. stg_threadLabelzh returns a tuple of type (# Int#, ByteArray# #). If a thread has no label, the second field is unused. We must still return a valid heap object pointer. Instead of returning 0, we now return stg_DEAD_SLOT_closure. fixes #27618 - - - - - e2d57026 by Luite Stegeman at 2026-09-15T20:13:54-04:00 JS: fix selector thunk handling fix a bug where entering a selector thunk could lead to a crash if the selected field was still a thunk. fixes #27788 - - - - - f8a7e988 by Duncan Coutts at 2026-09-16T13:38:38+01:00 Fix a couple comments in the new selectbis I/O manager Noticed late in the review process. - - - - - 8272e000 by Duncan Coutts at 2026-09-16T13:38:38+01:00 New rts_IOManagerFeatures bitset for I/O manager features The idea is that code in the RTS and ghc-internal can use this feature bitset to do things that have to be conditional. But instead of basing it on threaded/non-threaded, win32 etc it can be based on features of the current I/O manager. In particular this will allow us to have in-RTS I/O managers when using the threaded RTS way, by changing code to use the feature test rather than testing for threaded/non-threaded. There are also numerous conditions in existing RTS and library code that could benefit from being clearly based on I/O manager features rather than on (historically) correlated aspects of the platform. For example, a major difference between WinIO and the win32-legacy I/O manager is whether it uses C lib fds or Win32 API HANDLEs. This distinction is not necessarily unique forever to these I/O managers. Future Windows I/O managers may want to take advantage of the same distinction. For example, we could have a feature to say if the I/O manager supports readiness notifications threadWaitRead# etc (win32-legacy does not support these for example), so I/O code in ghc-internal can use appropriate workarounds. Similarly, if/when we add support for async I/O, or I/O to files at given offsets (without affecting or being affected by the file pointer) then library code can consult the feature bits and either use emulated fallbacks or throw appropriate exceptions. - - - - - 6f859ae2 by Duncan Coutts at 2026-09-16T13:38:38+01:00 Use rts_IOManagerFeatures bitset in GHC.Internal.IO.SubSystem Establish a pattern for exposing the features. We will start using them in subsequent commits. - - - - - 7c8a4f79 by Duncan Coutts at 2026-09-16T13:38:38+01:00 Turn rts_IOManagerIsWin32Native into a feature bit of rts_IOManagerFeatures And update where it is used in ghc-internal - - - - - 02d23436 by Duncan Coutts at 2026-09-16T13:38:38+01:00 Remove is_io_mng_native_p helper, replacing with iomgr_type The comment said: Temporary compat helper function used in the Win32 I/O managers. TODO: replace by consulting the iomgr_type global instead. - - - - - 89 changed files: - .gitlab/ci.sh - + changelog.d/27732 - + changelog.d/T27629 - + changelog.d/T27788-js-selector - + changelog.d/fix-compacting-gc-constr-27649 - + changelog.d/fix-control0-mask-trampoline - + changelog.d/fix-threadlabel-segfault-27618 - + changelog.d/select-io-manager - compiler/GHC/Core/Opt/Specialise.hs - compiler/GHC/Data/FastString.hs - compiler/GHC/Hs/Expr.hs - compiler/GHC/Hs/Pat.hs - compiler/GHC/Hs/Utils.hs - compiler/GHC/Parser.y - compiler/GHC/Parser/Annotation.hs - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/Rename/Module.hs - compiler/GHC/StgToJS/Apply.hs - compiler/GHC/StgToJS/Symbols.hs - compiler/GHC/Tc/Errors/Types.hs - docs/users_guide/exts/type_data.rst - docs/users_guide/runtime_control.rst - libraries/base/src/GHC/RTS/Flags.hs - libraries/ghc-internal/src/GHC/Internal/IO/SubSystem.hs - libraries/ghc-internal/src/GHC/Internal/RTS/Flags.hsc - rts/ContinuationOps.cmm - rts/IOManager.c - rts/IOManager.h - rts/IOManagerInternals.h - rts/PrimOps.cmm - rts/RaiseAsync.c - rts/RtsStartup.c - rts/RtsSymbols.c - rts/StgMiscClosures.cmm - rts/configure.ac - rts/include/rts/Flags.h - rts/include/rts/storage/Closures.h - rts/include/stg/MiscClosures.h - rts/posix/Poll.c - rts/posix/Poll.h - + rts/posix/SelectBis.c - + rts/posix/SelectBis.h - rts/posix/Timeout.c - rts/posix/Timeout.h - rts/rts.cabal - rts/sm/Compact.c - rts/win32/AwaitEvent.c - rts/win32/ThrIOManager.c - testsuite/tests/codeGen/should_run/all.T - testsuite/tests/ghc-api/T25121_status.stdout - testsuite/tests/interface-stability/ghc-experimental-exports.stdout - testsuite/tests/interface-stability/ghc-experimental-exports.stdout-mingw32 - + testsuite/tests/javascript/T27788.hs - + testsuite/tests/javascript/T27788.stdout - testsuite/tests/javascript/all.T - testsuite/tests/parser/should_compile/DumpParsedAstComments.stderr - testsuite/tests/parser/should_compile/DumpSemis.stderr - testsuite/tests/printer/Test20297.stdout - + testsuite/tests/rts/T27618.hs - + testsuite/tests/rts/T27618.stdout - + testsuite/tests/rts/T27649.hs - + testsuite/tests/rts/T27649.stdout - testsuite/tests/rts/all.T - + testsuite/tests/rts/continuations/T27651.hs - + testsuite/tests/rts/continuations/T27651.stdout - testsuite/tests/rts/continuations/all.T - testsuite/tests/simplCore/should_compile/Makefile - + testsuite/tests/simplCore/should_compile/T27629.hs - + testsuite/tests/simplCore/should_compile/T27629.stderr - + testsuite/tests/simplCore/should_compile/T27629Plugin.hs - testsuite/tests/simplCore/should_compile/all.T - + testsuite/tests/type-data/should_fail/T27732a.hs - + testsuite/tests/type-data/should_fail/T27732a.stderr - + testsuite/tests/type-data/should_fail/T27732b.hs - + testsuite/tests/type-data/should_fail/T27732b.stderr - + testsuite/tests/type-data/should_fail/T27732c.hs - + testsuite/tests/type-data/should_fail/T27732c.stderr - + testsuite/tests/type-data/should_fail/T27732d.hs - + testsuite/tests/type-data/should_fail/T27732d.stderr - + testsuite/tests/type-data/should_fail/T27732e.hs - + testsuite/tests/type-data/should_fail/T27732e.stderr - + testsuite/tests/type-data/should_fail/T27732f.hs - + testsuite/tests/type-data/should_fail/T27732f.stderr - testsuite/tests/type-data/should_fail/TDStrictnessGADT.stderr - testsuite/tests/type-data/should_fail/TDStrictnessH98.stderr - testsuite/tests/type-data/should_fail/all.T - utils/check-exact/ExactPrint.hs - utils/check-exact/Utils.hs - utils/jsffi/dyld.mjs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/8804d9944d9cb39ce6f5fc48d8e7fd… -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/8804d9944d9cb39ce6f5fc48d8e7fd… You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • ...
  • 1017
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.