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

Pre-compiled methods do not have AST available for re-compilation #1395

Closed
headius opened this issue Jan 10, 2014 · 2 comments
Closed

Pre-compiled methods do not have AST available for re-compilation #1395

headius opened this issue Jan 10, 2014 · 2 comments

Comments

@headius
Copy link
Member

headius commented Jan 10, 2014

Upcoming runtimes/backends for JRuby like IR and Truffle will often be able to do a better job of optimizing pre-compiled code. However, they both need the original AST to be able to generate their intermediate format.

When precompiling Ruby code, the best we can do is to emit straightforward JVM bytecode from the original AST. The resulting class does not have any references to the AST since the AST is not serializable. Therefore, if we want to access the original AST, we need to make it serializable and pack it into the precompiled class.

See Helpers.def/defs and InvocationMethodCompiler.getCompiledMethod for a few places where we would like to be able to save off the AST.

Note that this may be moot if the current compiler goes completely away in favor of the other options. However, there will always be a desire to precompile, so the AST-saving aspect may remain valid.

headius added a commit that referenced this issue Jan 10, 2014
Precompiled method definition does not have access to an AST, so
there's no way to build a MethodNodes object usable by Truffle. We
will null out MethodNodes for now and look to (possibly) add AST
to precompiled classes for #1395.
@chrisseaton
Copy link
Contributor

I've worked around this for the most common case where the class is both generated and used in the same VM in 4d6d1e8.

This solves my immediate need for method nodes from jitted methods so that I can truffelize them. It doesn't solve getting nodes from AOT methods.

It also is potentially a space leak, as it keeps the method nodes around forever. I've marked with a named TODO and will re-visit before the next major.

@headius headius modified the milestones: JRuby 9.0.0.0, Post-9000 Jan 15, 2015
@enebo enebo added this to the 9.0.0.0.pre2 milestone Apr 17, 2015
@enebo
Copy link
Member

enebo commented Apr 17, 2015

for AOT we solved this by using IR persistence to save intermediate format into the class.

@enebo enebo closed this as completed Apr 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants