Hello,
I've been attempting to modify the nashorn shell so that you can specify a byte
code file to load in and execute instead of having to do the compilation prior
to execution every time. This allows hand modification of byte code for
example. I've hit an issue which I don't know how to get past, hoping someone
can give me a tip.
To get started I've passed the compile only and dump flags to the shell to get
the byte code for a simple hello world JS file, and have been hackily trying to
get this to work with a new "precompiled" flag. I load in the byte code file,
and tried to follow a similar flow to when it is compiled at runtime without
going through the compilation phases -- I just add the byte code to the
compiler and then call install on it with the byte code and file name.
I am currently getting the following exception:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at jdk.nashorn.internal.scripts.Script$test.$getMap(test.js)
at jdk.nashorn.internal.scripts.Script$test.runScript(test.js)
at
jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:520)
at
jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:203)
at
jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:366)
at jdk.nashorn.tools.Shell.apply(Shell.java:619)
at jdk.nashorn.tools.Shell.runScripts(Shell.java:529)
at jdk.nashorn.tools.Shell.run(Shell.java:296)
at jdk.nashorn.tools.Shell.main(Shell.java:154)
at jdk.nashorn.tools.Shell.main(Shell.java:133)
I'm guessing this has something to do with the execution environment not being
set up correctly, as there is an empty array being loaded from.
Thanks for any assistance you can give me.
Jordan Fix