Compiling to bytecode files
Jim Laskey (Oracle)
james.laskey at oracle.com
Mon Sep 9 04:04:15 PDT 2013
Currently, there is no way to do so. Generated code is a combination of byte code and data. We could serialize everything, but we have not had time to investigate. Another smaller other issue is that, as a first release, the runtime has been quite fluid and caching would require versioning to make sure the cache is valid.
On the flip side, there is a byte code live cache maintained by Nashorn, which should handle reuse per session (primarily for server side apps.)
Cheers,
-- Jim
On 2013-09-09, at 7:19 AM, Tal Liron <tal.liron at threecrickets.com> wrote:
> Is there a way to create compiled bytecode files from Nashorn, so that Nashorn can reuse them?
>
> The issue is that I'm working right now on integrating Nashorn into Scripturian:
>
> http://threecrickets.com/scripturian/
>
> Scripturian is an alternative to JSR-223 that support various high-concurrency features. One thing it can do is cache source files to avoid re-parsing or re-compilation. In Rhino, I can create class bytecode for me that I can store in files and then simply load the next time the code needs to be accessed. Specifically, Rhino has a interface named org.mozilla.javascript.GeneratedClassLoader that lets me reload the bytes.
>
> Is there anything like this in Nashorn? Following the source code through the Compiler class led me nowhere...
>
More information about the nashorn-dev
mailing list