Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
GHC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gesh
GHC
Commits
375001f6
Commit
375001f6
authored
27 years ago
by
sof
Browse files
Options
Downloads
Patches
Plain Diff
[project @ 1997-09-09 18:02:36 by sof]
parent
57a11b6b
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ghc/compiler/simplCore/SetLevels.lhs
+21
-6
21 additions, 6 deletions
ghc/compiler/simplCore/SetLevels.lhs
with
21 additions
and
6 deletions
ghc/compiler/simplCore/SetLevels.lhs
+
21
−
6
View file @
375001f6
...
...
@@ -27,7 +27,7 @@ import AnnCoreSyn
import CoreSyn
import CoreUtils ( coreExprType )
import CoreUnfold (
whnfOrBottom
)
import CoreUnfold (
FormSummary, whnfOrBottom, mkFormSummary
)
import FreeVars -- all of it
import Id ( idType, mkSysLocal,
nullIdEnv, addOneToIdEnv, growIdEnvList,
...
...
@@ -37,12 +37,12 @@ import Id ( idType, mkSysLocal,
)
import Pretty ( ptext, hcat, char, int )
import SrcLoc ( noSrcLoc )
import Type ( isPrimType, mkTyVarTys, mkForAllTys, SYN_IE(Type) )
import Type ( isPrimType, mkTyVarTys, mkForAllTys,
tyVarsOfTypes,
SYN_IE(Type) )
import TyVar ( nullTyVarEnv, addOneToTyVarEnv,
growTyVarEnvList, lookupTyVarEnv,
tyVarSetToList,
tyVarSetToList,
SYN_IE(TyVarEnv), SYN_IE(TyVar),
unionManyTyVarSets
unionManyTyVarSets
, unionTyVarSets
)
import UniqSupply ( thenUs, returnUs, mapUs, mapAndUnzipUs,
mapAndUnzip3Us, getUnique, SYN_IE(UniqSM),
...
...
@@ -482,7 +482,7 @@ setFloatLevel alreadyLetBound ctxt_lvl envs@(venv, tenv)
offending tyvar = ids_only_lvl `ltLvl` tyvarLevel tenv tyvar
manifestly_whnf = whnfOrBottom de_ann_expr
manifestly_whnf = whnfOrBottom
(mkFormSummary
de_ann_expr
)
maybe_unTopify Top | not (canFloatToTop (ty, expr)) = Level 0 0
maybe_unTopify lvl = lvl
...
...
@@ -635,7 +635,8 @@ decideRecFloatLevel ctxt_lvl envs@(venv, tenv) ids rhss
| rhs' <- rhss' -- mkCoLet* requires Core...
]
poly_binds = zipEqual "poly_binds" [(poly_var, ids_only_lvl) | poly_var <- poly_vars] poly_var_rhss
poly_binds = zipEqual "poly_binds" [(poly_var, ids_only_lvl) | poly_var <- poly_vars]
poly_var_rhss
in
returnLvl (ctxt_lvl, [Rec poly_binds], d_rhss)
...
...
@@ -656,6 +657,20 @@ decideRecFloatLevel ctxt_lvl envs@(venv, tenv) ids rhss
fvs = unionManyIdSets [freeVarsOf rhs | rhs <- rhss] `minusIdSet` mkIdSet ids
tfvs = unionManyTyVarSets [freeTyVarsOf rhs | rhs <- rhss]
`unionTyVarSets`
tyVarsOfTypes tys
-- Why the "tyVarsOfTypes" part? Consider this:
-- /\a -> letrec x::a = x in E
-- Now, there are no explicit free type variables in the RHS of x,
-- but nevertheless "a" is free in its definition. So we add in
-- the free tyvars of the types of the binders.
-- This actually happened in the defn of errorIO in IOBase.lhs:
-- errorIO (ST io) = case (errorIO# io) of
-- _ -> bottom
-- where
-- bottom = bottom -- Never evaluated
-- I don't think this can every happen for non-recursive bindings.
fv_list = idSetToList fvs
tv_list = tyVarSetToList tfvs
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment