Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Shayne Fletcher
Glasgow Haskell Compiler
Commits
25753b0c
Commit
25753b0c
authored
Apr 27, 2007
by
Simon Marlow
Browse files
We shouldn't let-bind expressions with unlifted type
Now I can single step through Happy-generated parsers
parent
b1a53311
Changes
1
Hide whitespace changes
Inline
Side-by-side
compiler/ghci/ByteCodeGen.lhs
View file @
25753b0c
...
...
@@ -435,18 +435,24 @@ schemeE d s p (AnnLet binds (_,body))
thunk_codes <- sequence compile_binds
return (alloc_code `appOL` concatOL thunk_codes `appOL` body_code)
-- introduce a let binding for a ticked case expression. This rule *should* only fire when the
-- expression was not already let-bound (the code gen for let bindings should take care of that).
-- Todo: we call exprFreeVars on a deAnnotated expression, this may not be the best way
-- to calculate the free vars but it seemed like the least intrusive thing to do
-- introduce a let binding for a ticked case expression. This rule
-- *should* only fire when the expression was not already let-bound
-- (the code gen for let bindings should take care of that). Todo: we
-- call exprFreeVars on a deAnnotated expression, this may not be the
-- best way to calculate the free vars but it seemed like the least
-- intrusive thing to do
schemeE d s p exp@(AnnCase {})
| Just (tickInfo, _exp) <- isTickedExp' exp = do
let fvs = exprFreeVars $ deAnnotate' exp
let ty = exprType $ deAnnotate' exp
id <- newId ty
-- Todo: is emptyVarSet correct on the next line?
let letExp = AnnLet (AnnNonRec id (fvs, exp)) (emptyVarSet, AnnVar id)
schemeE d s p letExp
| Just (tickInfo,rhs) <- isTickedExp' exp
= if isUnLiftedType ty
then schemeE d s p (snd rhs)
else do
id <- newId ty
-- Todo: is emptyVarSet correct on the next line?
let letExp = AnnLet (AnnNonRec id (fvs, exp)) (emptyVarSet, AnnVar id)
schemeE d s p letExp
where exp' = deAnnotate' exp
fvs = exprFreeVars exp'
ty = exprType exp'
schemeE d s p (AnnCase scrut bndr _ [(DataAlt dc, [bind1, bind2], rhs)])
| isUnboxedTupleCon dc, VoidArg <- typeCgRep (idType bind1)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment