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

[Truffle] Allow for lazy parsing #3290

Merged
merged 3 commits into from
Aug 28, 2015
Merged

Conversation

bbelleville
Copy link
Contributor

These changes make it possible to lazily parse methods in ahead of time compiled images. During image generation method bodies are elided from the core source files and stored in a separate data structure. When the file is initially parsed, the method body is replaced with a node to perform the lazy parsing. When this node is executed, it performs the parsing and then replaces itself with the code of the method.

@eregon
Copy link
Member

eregon commented Aug 27, 2015

Is it lazy parsing or lazy translation? I would guess the latter, right?

@bbelleville
Copy link
Contributor Author

It does parsing and translation of method bodies lazily. During image generation we parse all ruby files, identify the method boundaries, and delete the method bodies. So a method like:

def sort!(&block)
    replace sort(&block)
end

Becomes:

def sort!(&block)
end

The actual code of the method body is stored in another data structure. When a file is parsed, if I have entries for the methods in that file, I insert a node that does lazy parsing as the method's body. This node gets the original code for the method, parses and translates it, and replaces itself with the result.

@eregon
Copy link
Member

eregon commented Aug 28, 2015

Nice, merging!

eregon added a commit that referenced this pull request Aug 28, 2015
[Truffle] Allow for lazy parsing
@eregon eregon merged commit 677c3f6 into jruby:master Aug 28, 2015
@enebo enebo modified the milestone: Non-Release May 25, 2016
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

Successfully merging this pull request may close these issues.

None yet

3 participants