JDK-8057703 : Still, lots of trivial classes are generated by Nashorn compiler
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: jdk.nashorn
  • Affected Version: 9
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2014-09-05
  • Updated: 2015-06-04
  • Resolved: 2014-09-10
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u40Fixed 9 b31Fixed
Related Reports
Relates :  
Description
Fix for JDK-8057588 was incomplete.

Running the fresh Nashorn with dumping all classes:

~/trunks/jdk9-dev/build/linux-x86_64-normal-server-release/images/j2sdk-image/bin/java -jar ~/trunks/jdk9-dev/build/linux-x86_64-normal-server-release/images/j2sdk-image/jre/lib/ext/nashorn.jar -Dnashorn.typeInfo.disabled=false --class-cache-size=0 --persistent-code-cache=false -scripting --log=time -d=generated/ test/script/basic/compile-octane.js -- --iterations 1

...still yields lots of trivial classes. 2300/3900 of all classes are those trivial.
 http://cr.openjdk.java.net/~shade/8057703/nashorn-generated-classes-2.list

Also, the additional stage introduced in JDK-8057588 takes considerable time:
 [time] 'Tag Compile Units Used' 1231 ms
Comments
Fix is here http://cr.openjdk.java.net/~lagergren/8057703/
08-09-2014

Uploading webrev to take care of this. There are some more bytecode overhead related things that should be solved, i.e. avoid boilerplate defineCommonUtilities per generated compile unit, but I have to investigate runtime overhead if I am to move them to ScriptRuntime.
08-09-2014

I'll take a look first thing Monday
07-09-2014