This is sth I wanted to do for years, but I never really figured out how to do that exactly:
I want to get rid of thorin::Scope and, instead, work with free Vars. This is a major milestone with the new subsystem working but the old stuff is still in place - although I've already ported some of it. So, expect more PRs to come.
Def::local_muts()/Def::local_vars() are Vars/mutables reachable by following immutableDef::extended_ops().
Def::local_muts()/Def::local_vars() are cached and hash-consed.
Def::free_vars() compute a global solution, i.e., by transitively following mutables as well.
Def::free_vars() are computed on demand and cached.
They will be transitively invalidated by following fv_consumers(), if a mutable is mutated.
Def::is_closed()/Def::is_open() to check whether a Def contains free vars.
Change log
removed ScopeRewriter in favor of new free_var-based VarRewriter
simplifed rewrite interface
PooledSet and Pool to hash-cons and arena-allocate sets
sanity check whether externals are closed
fixed issue in cps2ds.cpp but one issue remains (#271)
minor bug fixes/additions here & there
Future directions
lazy rewrite/substitution (only substitute one mutable and a time and continue substituting as needed to prevent quadratic runtime when resolving curried beta-reduction etc)
completely remove thorin::Scope
new textual outputs
a simple output that dumps everything up to mutables
a proper "decompilation" of the thorin Graph into a thorin AST
This is sth I wanted to do for years, but I never really figured out how to do that exactly: I want to get rid of
thorin::Scope
and, instead, work with free Vars. This is a major milestone with the new subsystem working but the old stuff is still in place - although I've already ported some of it. So, expect more PRs to come.Def::local_muts()
/Def::local_vars()
areVar
s/mutables reachable by following immutableDef::extended_ops()
.Def::local_muts()
/Def::local_vars()
are cached and hash-consed.Def::free_vars()
compute a global solution, i.e., by transitively following mutables as well.Def::free_vars()
are computed on demand and cached. They will be transitively invalidated by followingfv_consumers()
, if a mutable is mutated.Def::is_closed()
/Def::is_open()
to check whether aDef
contains free vars.Change log
removed
ScopeRewriter
in favor of newfree_var
-basedVarRewriter
simplifed
rewrite
interfacePooledSet
andPool
to hash-cons and arena-allocate setssanity check whether externals are closed
fixed issue in
cps2ds.cpp
but one issue remains (#271)minor bug fixes/additions here & there
Future directions
thorin::Scope