-
Notifications
You must be signed in to change notification settings - Fork 143
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
Aggressively clear local references #79
Comments
Since an initial implementation of #23 has been done on the Moreover, Eta's bytecode has a concept of "checkpoints". These checkpoints happen whenever a lazy value is evaluated through a The basic outline for how we go about this:
Let's take a look at an example to make this more concrete [3]: contrived :: Int -> Int -> Int -> Int
contrived x y z = case x > 1 of
True -> case y > 2 of
True -> y + z
False -> y
False -> sum [z, 1, 2]
This entire logic also goes hand-in-hand in making #23 more feasible. It was found that the naive implementation for context switching causes a code explosion and in some cases can cause methods to just barely touch the 65,535 JVM bytecode size limit for a single method. So by only saving the references that absolutely need to be saved, we again free up references more eagerly for GC and make the generated bytecode minimal. [1] Once we implement more optimisations, of course! |
Tips from @ashishnegi about managing lazy garbage:
Relevant links:
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L5046
https://groups.google.com/forum/#!searchin/clojure/local$20clearing|sort:relevance/clojure/FLrtjyYJdRU/itFqPRk0BrcJ
http://stackoverflow.com/questions/15994316/clojure-head-retention
This issue should be tackled after #23 since that ticket will make lots of nontrivial changes to the generated bytecode.
The text was updated successfully, but these errors were encountered: