[Git][ghc/ghc][master] 2 commits: StgToByteCode: Fix overly-broad handling of Addr# literals
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Wed Jan 29 07:31:51 UTC 2025
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
2ca41c62 by Ben Gamari at 2025-01-29T02:30:29-05:00
StgToByteCode: Fix overly-broad handling of Addr# literals
Previously we assumed that all unlifted types were `Addr#` but this
isn't true. As noted in #25638, unlifted nullary data constructor
workers can also appear at the top-level and are obviously not of type
`Addr#`.
Note that there is more work to be done to properly handle unlifted data
constructors (especially nullary; see #25636). However, this is a small
step in the right direction.
Closes #25641.
- - - - -
ec26c54d by Ben Gamari at 2025-01-29T02:30:29-05:00
StgToByteCode: Assert that PUSH_G'd values are lifted
We currently do not support top-level unlifted data constructor applications,
therefore this is a safe assertion.
Pointed out by @sheaf.
- - - - -
3 changed files:
- compiler/GHC/StgToByteCode.hs
- testsuite/tests/codeGen/should_run/T23146/all.T
- testsuite/tests/unlifted-datatypes/should_run/all.T
Changes:
=====================================
compiler/GHC/StgToByteCode.hs
=====================================
@@ -1951,14 +1951,17 @@ pushAtom d p (StgVarArg var)
Nothing
-- see Note [Generating code for top-level string literal bindings]
- | isUnliftedType (idType var) -> do
- massert (idType var `eqType` addrPrimTy)
+ | idType var `eqType` addrPrimTy ->
return (unitOL (PUSH_ADDR (getName var)), szb)
| otherwise -> do
+ let varTy = idType var
+ massertPpr (definitelyLiftedType varTy) $
+ vcat [ text "pushAtom: unhandled unlifted type"
+ , text "var:" <+> ppr var <+> dcolon <+> ppr varTy <> dcolon <+> ppr (typeKind varTy)
+ ]
return (unitOL (PUSH_G (getName var)), szb)
-
pushAtom _ _ (StgLitArg lit) = pushLiteral True lit
pushLiteral :: Bool -> Literal -> BcM (BCInstrList, ByteOff)
=====================================
testsuite/tests/codeGen/should_run/T23146/all.T
=====================================
@@ -1,4 +1,4 @@
-test('T23146', expect_broken_for(23060, ghci_ways), compile_and_run, [''])
+test('T23146', normal, compile_and_run, [''])
test('T23146_lifted', normal, compile_and_run, [''])
test('T23146_liftedeq', expect_broken_for(23060, ghci_ways), compile_and_run, [''])
test('T23146_lifted_unlifted', normal, compile_and_run, [''])
=====================================
testsuite/tests/unlifted-datatypes/should_run/all.T
=====================================
@@ -1,3 +1,3 @@
test('UnlData1', normal, compile_and_run, [''])
-test('UnlGadt1', [exit_code(1), expect_broken_for(23060, ghci_ways)], compile_and_run, [''])
+test('UnlGadt1', exit_code(1), compile_and_run, [''])
test('T23549', normal, multimod_compile_and_run, ['T23549', ''])
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/85abc69c223a692652c8767c49dacfd1ce6c9bf3...ec26c54d818e0cd328276196930313f66b780905
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/85abc69c223a692652c8767c49dacfd1ce6c9bf3...ec26c54d818e0cd328276196930313f66b780905
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20250129/e8bbd3fd/attachment-0001.html>
More information about the ghc-commits
mailing list