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

Compiled resumers #44

Open
timholy opened this issue Feb 17, 2019 · 0 comments
Open

Compiled resumers #44

timholy opened this issue Feb 17, 2019 · 0 comments

Comments

@timholy
Copy link
Member

timholy commented Feb 17, 2019

#41 introduced the idea of using Compiled mode to finish tests (or preparatory steps) that take too long, so that an Abort doesn't nix later tests depending on the results. However, the implementation has several deficiencies:

  • it starts again from the beginning of the highest-level statement; instead, it should start at the lowest level on the stack and work its way back up. That will prevent it from repeating work (which is what it does now).
  • in some cases it may not fix the performance problem: it still has to interpret the frame that threw the Abort. Compiled means it won't need to recurse anymore, but if that frame happens to have an insanely long loop you'll still be stuck for a long time.

What we need instead is the notion of a compiled "resumer" function: starting from the method body, build a (temporary) function that schematically looks like this (would be built from lowered expressions in reality):

function #foo_resumer#34(slotvalues...)
    $(slotname[1]) = slotvalues[1]
...
    $(slotname[n]) = slotvalues[n]
    goto pc_where_it_quit
    $body
end

Then this could be called, in which case it would finish the computations in a truly compiled mode.

It has not escaped my attention that together with evaluate_limited!, this implements a possible means of addressing Julia's compiler-latency problems. Once this last piece is in place, I believe it would be a complete implementation of "interpret by default, then fall back gracefully to compiled mode for 'hot' portions of the code."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant