Skip to content

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

@headius

Description

@headius

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions