Thank you Sundar, that explains it perfectly. JITWatch visualises JavaScript/bytecode/asm correctly with -ot=false on JDK9. I'll now try and make it work with optimistic typing enabled.
Cheers, Chris @chriswhocodes On Wed, June 10, 2015 05:22, A. Sundararajan wrote: > Hi, > > > Filed a bug to track for future reference: > https://bugs.openjdk.java.net/browse/JDK-8087102 > > > Actually, this is not a bug. Two things: > > > 1) --compile-only / -co option is no longer mandatory to use > --debug-dump-dir option/ > 2) optimistic types is off by default in jdk8u and it is on by default > with jdk9. > > With optimistic types, code generation is lazier & optimistic -- code is > generated/re-generated as you run the code. With jdk9, you can either > > 1) Turn off optimistic types with jdk9 (using -ot=false option) and dump > similar code as in jdk8u 2) or run the code (i.e., remove -co / > --compile-only option) and get > all generated (and regenerated) code dumped. > > PS. I've resolved the bug as "not an issue". > > > Hope this explains, > -Sundar > > > On Wednesday 10 June 2015 02:55 AM, Chris Newland wrote: > >> Hi, >> >> >> Has Nashorn's behaviour for dumping bytecode changed in JDK9? >> >> >> Given this JavaScript: >> https://gist.github.com/chriswhocodes/bfe139592adb846967d8 >> >> >> Executed using >> $JAVA_HOME/bin/jjs -co --dump-debug-dir=. run.js >> >> >> Under 8u60b18 the bytecode is produced as expected: >> >> >> https://gist.github.com/chriswhocodes/e3a85c3613b084e45356 >> >> >> This visualises correctly in JITWatch[1] and the bytecode maps back to >> the source as expected. >> >> But under 9b67 only a small amount of bytecode is output that doesn't >> represent the source program: >> >> https://gist.github.com/chriswhocodes/c6c6e33e7994c98d4975 >> >> >> The correct program output is produced under both executions so I don't >> think the difference is down to dead code elimination. >> >> Possible regression? >> >> >> Thanks, >> >> >> Chris >> @chriswhocodes >> >> >> [1] https://github.com/AdoptOpenJDK/jitwatch >> >> >> > >