blaze icon indicating copy to clipboard operation
blaze copied to clipboard

Make blaze native-image compatible

Open asm0dey opened this issue 5 years ago • 1 comments

Corresponding issue in graalvm tracker: https://github.com/oracle/graal/issues/772 Main point: currently blaze uses nashorn as js engine, potentially using graal.js instead will make blaze native-image build-able. If it will be possible to build blaze with native-image then we'll get almost imstant startup time, which is must have for scripting.

asm0dey avatar Feb 21 '19 06:02 asm0dey

I just glanced through blazes code base and even if nashhorn was removed/replaced it still would not work for plain Java because Blaze uses dynamic reflection to call the methods as seen here:

https://github.com/fizzed/blaze/blob/master/blaze-core/src/main/java/com/fizzed/blaze/jdk/TargetObjectScript.java

One of the problem is that there isn't really a truffle implementation of Java. Consequently the "Script" would have to be compiled either with just the regular JDK or JDK + native-image. native-image blaze.jar calling slower JDK compiled Java is probably slower than just a pure JDK (just a guess).

The only way I can see this working blaze would have to do code generation to build a stub to call the tasks to avoid the reflection and then call the graalvm to compile the Java code to native.

agentgt avatar May 15 '19 19:05 agentgt