You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
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.
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.
The text was updated successfully, but these errors were encountered: