Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Direct-style (DS) JS Backend #316

Merged
merged 49 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
59496d2
First draft of direct-style (DS) version of the JS backend
b-studios Nov 24, 2023
6fe7bf4
Support run
b-studios Nov 24, 2023
99e0009
Use bind monad to work around JS limitations
b-studios Nov 24, 2023
6eef4de
Add try-catch around entrypoints
b-studios Nov 24, 2023
9a6f349
Implement free variables, once more...
b-studios Nov 24, 2023
c6923f7
debug free variables
b-studios Nov 24, 2023
8c16835
Refactor rename
b-studios Nov 24, 2023
92e52ea
Track locals explicitly
b-studios Nov 24, 2023
7dcd981
Emit continuations
b-studios Nov 24, 2023
73d390f
Start translating handler
b-studios Nov 24, 2023
1ea3705
Support discarding the continuation
b-studios Nov 25, 2023
9e10001
First support of resuming continuation
b-studios Nov 25, 2023
4871641
Minor improvements
b-studios Nov 25, 2023
8389346
Start working on lambda lifting (closures still need to be eta-expanded)
b-studios Nov 25, 2023
6e2d08d
Implement lambda lifting
b-studios Nov 27, 2023
c803500
Start to support pattern matching
b-studios Nov 27, 2023
8da634b
Add some tests
b-studios Nov 27, 2023
22b1715
Mark tests that rely on local mutable state, regions, or bidirectiona…
b-studios Nov 27, 2023
cd357da
Implement local backtrackable mutable state
b-studios Nov 27, 2023
9d4c748
Support regions
b-studios Nov 28, 2023
dbff4c6
Support bidirectional effects
b-studios Nov 28, 2023
86a448e
Also rename types when testing for alpha equivalence
b-studios Nov 30, 2023
bdb5c91
Move LambdaLifting to separate file
b-studios Nov 30, 2023
1d113ea
Adapt Renamer to new structure of BlockParam
b-studios Dec 1, 2023
ee17b9a
Stub compileSeparate and implement it later
b-studios Dec 1, 2023
eaf9165
Make DS backend work with the website (note that these changes need t…
b-studios Dec 2, 2023
5dbcab6
Add two simple lambda lifting tests
b-studios Dec 2, 2023
2af69d7
Fix some bugs in Renamer and simplify Optimizer
b-studios Dec 3, 2023
42124ac
fix local non-recursive definitions in renamer
b-studios Dec 3, 2023
1117134
Transform binder in its scope, even though this is wrong
b-studios Dec 3, 2023
99440a7
Add some optimizer tests
b-studios Dec 3, 2023
0e5745b
Fix one bug where inferred capture was not propagated
b-studios Dec 3, 2023
675ae60
Also fix same bug for regions
b-studios Dec 3, 2023
dcfa4ba
Perform inlining only once and then iterate
b-studios Dec 3, 2023
0ffeea3
Add macro based tracing tool
b-studios Dec 3, 2023
ce93739
Forgot file
b-studios Dec 3, 2023
5eff913
Slightly refactor optimizer
b-studios Dec 4, 2023
beb1124
Fix inline full to not drop count
b-studios Dec 4, 2023
cf05dbd
Fix annotated free variables and avoid passing result twice
b-studios Dec 4, 2023
f86c82b
Share common code between JS backends
b-studios Dec 4, 2023
cf73a03
Prepare runtime to deal with tailcall trampolining
b-studios Dec 4, 2023
cb22749
Reify continuation
b-studios Dec 4, 2023
ac865aa
Use effects to express tail calls (UNSOUND)
b-studios Dec 4, 2023
86b295a
Deprecate tail calls for now
b-studios Dec 4, 2023
a584793
Add while and continue
b-studios Dec 4, 2023
c58a5da
Support obvious tail calls manually in JS
b-studios Dec 4, 2023
eea5266
Fix Renamer to conform to contract given in docs
marzipankaiser Dec 4, 2023
e9d56de
Drop unbind
b-studios Dec 4, 2023
95d8d32
Reactive last failing test
b-studios Dec 4, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions effekt/jvm/src/test/scala/effekt/core/RenamerTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ class RenamerTests extends CoreTests {
test("pseudo recursive"){
val input =
""" module main
|
| def bar = { () => return 1 }
| def main = { () =>
| def foo = { () => (bar : () => Unit @ {})() }
Expand All @@ -138,6 +139,7 @@ class RenamerTests extends CoreTests {

val expected =
""" module main
|
| def bar = { () => return 1 }
| def main = { () =>
| def renamed1 = { () => (bar : () => Unit @ {})() }
Expand All @@ -148,4 +150,28 @@ class RenamerTests extends CoreTests {

assertRenamedTo(input, expected)
}
// TODO this needs to be fixed
// test("shadowing let bindings"){
// val input =
// """ module main
// |
// | def main = { () =>
// | let x = 1
// | let x = 2
// | return x:Int
// | }
// |""".stripMargin
//
// val expected =
// """ module main
// |
// | def main = { () =>
// | let renamed1 = 1
// | let renamed2 = 2
// | return renamed2:Int
// | }
// |""".stripMargin
//
// assertRenamedTo(input, expected)
// }
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marzipankaiser this test shows that Renamer right now is not correct.

}
5 changes: 2 additions & 3 deletions effekt/shared/src/main/scala/effekt/core/Renamer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,8 @@ class Renamer(names: Names = Names(Map.empty), prefix: String = "") extends core
// can be recursive
withBinding(d.id) { go(rest, defs :+ rewrite(d)) }
case (d : core.Definition.Let) :: rest =>
// non-recursive
val renamed = rewrite(d)
withBinding(d.id) { go(rest, defs :+ renamed) }
// TODO let bindings are non-recursive (check that this holds!)
withBinding(d.id) { go(rest, defs :+ rewrite(d)) }
case Nil => core.Scope(defs, rewrite(body))
}

Expand Down