-
Notifications
You must be signed in to change notification settings - Fork 17
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
Exceptions refactoring and try-finally transform #171
Commits on Jun 12, 2021
-
cps/[transform, environment]: use one exception local per try
Nim has a "exception stack" system where inner except branches will push a new exception to the stack then pop it after it's done. To replicate this accurately in CPS, we use one local per cps `try` instead of a single field like how it is done currently. This is because we set the global exception to whatever the stored exception was in our continuation leg, so to prevent inner cps `try`s from overriding what is perceived to be the "current" exception of the outer branch, we simply give them different locals. Ideally we can tap right into Nim's exception `up` field, but it's not exported.
Configuration menu - View commit details
-
Copy full SHA for 46ccbf0 - Browse repository at this point
Copy the full SHA 46ccbf0View commit details -
cps/transform: rewrite
n
instead of doing a roundaboutNot sure what I thought of when I wrote that code, but we can just run filter on the outer node and don't have to think about the bugs this `for` would cause us.
Configuration menu - View commit details
-
Copy full SHA for 9e05a1a - Browse repository at this point
Copy the full SHA 9e05a1aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 1d63dd7 - Browse repository at this point
Copy the full SHA 1d63dd7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 23a2a06 - Browse repository at this point
Copy the full SHA 23a2a06View commit details -
cps/rewrites: add a simplifying rewrite for except T as e
Fixes disruptek/cps#164
Configuration menu - View commit details
-
Copy full SHA for 6667e2b - Browse repository at this point
Copy the full SHA 6667e2bView commit details -
cps/transform: rewrite cps try-except into one continuation
Instead of creating a continuation leg for each except branch, we merge all except branches into one, then turn that into a continuation. That way we only have one continuation for all handlers, allow for a better implementation of cps exceptions in the future.
2Configuration menu - View commit details
-
Copy full SHA for de6eeb9 - Browse repository at this point
Copy the full SHA de6eeb9View commit details
Commits on Jun 13, 2021
-
cps/transform: try-finally transformation
Implements try-finally transformation for CPS by generating finally as a continuation leg with a static generic for where it will continues after. Untested because the compiler broke. Known issues: - Early returns are not handled, which can be fixed by improving isScopeExit and making early termination an annotation. Fixes #80.
Configuration menu - View commit details
-
Copy full SHA for 10ab771 - Browse repository at this point
Copy the full SHA 10ab771View commit details -
cps/transform: switch the implementation of try-finally to templating
Instead of waiting for nim-lang/Nim#18254 and any other templates bug to be fix. We take the initiative and write our own continuation templater. It appears to work well enough to use as an alternative until a better alternative become available. I've also added an extra test that verify the exception re-raise property.
Configuration menu - View commit details
-
Copy full SHA for 9963c65 - Browse repository at this point
Copy the full SHA 9963c65View commit details -
Configuration menu - View commit details
-
Copy full SHA for d82a710 - Browse repository at this point
Copy the full SHA d82a710View commit details -
cps/environment: implement early returns as an annotation
We implement early returns as `cpsTerminate` then tie them up at the end via `cpsResolver`. This way try-finally can capture early termination and specialize to those. Need @disruptek to review this stuff.
1Configuration menu - View commit details
-
Copy full SHA for 9d41232 - Browse repository at this point
Copy the full SHA 9d41232View commit details
Commits on Jun 14, 2021
-
Configuration menu - View commit details
-
Copy full SHA for aee6f50 - Browse repository at this point
Copy the full SHA aee6f50View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9223ded - Browse repository at this point
Copy the full SHA 9223dedView commit details -
Configuration menu - View commit details
-
Copy full SHA for 5de974e - Browse repository at this point
Copy the full SHA 5de974eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 22ceffa - Browse repository at this point
Copy the full SHA 22ceffaView commit details