Asciidoctor.js on Nashorn JDK9

Guillaume Grossetie grossetieg at gmail.com
Tue Dec 16 20:02:03 UTC 2014


Hello,

My name is Guillaume and I'm working on Asciidoctor.js[1]
We are testing Asciidoctor.js against the latest JDK9
http://download.java.net/jdk9/archive/b42/binaries/jdk-9-ea-bin-b42-linux-x64-10_dec_2014.tar.gz

We have a simple jjs script that load the Asciidoctor.js file:

load("./dist/asciidoctor-all.js");

var data = "= asciidoctor.js, AsciiDoc in JavaScript\n" +
"Doc Writer <docwriter at example.com>\n\n" +
"Asciidoctor and Opal come together to bring\n" +
"http://asciidoc.org[AsciiDoc] to the browser!.\n\n" +
"== Technologies\n\n" +
"* AsciiDoc\n" +
"* Asciidoctor\n" +
"* Opal\n\n" +
"NOTE: That's all she wrote!!!\n\n" +
"include::spec/share/include.adoc[]";

var options = Opal.hash2(['safe', 'attributes'], {'safe': 'server',
attributes: ['showtitle']});
var html = Opal.Asciidoctor.$convert(data, options);
print(html);

The asciidoctor-all.js is generated from Ruby using Opal[1] so the code is
a bit hard to read but you can view the source here[2].
Here is the error thrown by Nashorn:

./dist/asciidoctor-all.js:24407 TypeError: java.lang.VerifyError: Bad local
variable type
Exception Details:
  Location:

jdk/nashorn/internal/scripts/Script$Recompilation$2859$767708AA$asciidoctor_all.L:19884$L:19887$L:19892$L:20994(Ljdk/nashorn/internal/runtime/ScriptFunction;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
@242: aload
  Reason:
    Type top (current frame, locals[7]) is not assignable to reference type
  Current Frame:
    bci: @242
    flags: { }
    locals: { 'jdk/nashorn/internal/runtime/ScriptFunction',
'java/lang/Object', 'java/lang/Object', 'java/lang/Object',
'jdk/nashorn/internal/runtime/ScriptObject', top, top, top, integer, top,
'java/lang/Object', integer }
    stack: { }
  Bytecode:
    0000000: 2ab6 0014 3a04 2b3a 0a19 04b6 0019 ba00
    0000010: 2500 0057 1904 b600 19ba 0025 0000 572d
    0000020: 5912 27ba 002b 0000 5f04 ba00 3000 0059
    0000030: 360b b800 3859 123a ba00 2b00 005f ba00
    0000040: 3c00 0059 123e ba00 2b00 005f ba00 4200
    0000050: 0036 0815 08b8 0038 03b8 0047 b800 4d99
    0000060: 0090 1508 b800 3819 04b6 0019 ba00 2500
    0000070: 00b8 004d 9900 7b15 0bb8 0038 5912 27ba
    0000080: 002b 0000 5f03 ba00 5000 0059 ba00 5300
    0000090: 005f ba00 5500 0059 360c b800 3859 1257
    00000a0: ba00 2b00 005f 1064 ba00 5900 0059 3609
    00000b0: b800 3803 b800 47b8 004d 9900 1d15 09b8
    00000c0: 0038 1904 b600 19ba 0025 0000 b800 4d99
    00000d0: 0008 1509 a700 1815 0cb8 0038 5912 57ba
    00000e0: 002b 0000 5f10 66ba 005b 0000 a700 0515
    00000f0: 0857 1907 03b8 0047 b800 4d99 0037 1907
    0000100: 1904 b600 19ba 0025 0000 b800 4d99 0025
    0000110: 150b b800 3859 125d ba00 2b00 005f 1904
    0000120: ba00 6000 00ba 0063 0000 ba00 6600 00a7
    0000130: 0005 1907 593a 0619 04b6 0019 ba00 2500
    0000140: 00b8 004d 9900 2119 06ba 0069 0000 b800
    0000150: 6f99 000f 1906 04b8 0047 b800 7299 0008
    0000160: 03b8 0047 b02c 5912 74ba 002b 0000 5fba
    0000170: 0076 0000 5936 05b8 0038 1904 b600 19ba
    0000180: 0025 0000 b800 4d99 001c 1505 b800 38ba
    0000190: 0069 0000 b800 6f99 0009 1505 04a0 0006
    00001a0: a700 0803 b800 47b0 1904 ba00 6000 00ba
    00001b0: 007b 0000 59ba 007e 0000 5fba 0080 0000
    00001c0: 5936 05b8 0038 1904 b600 19ba 0025 0000
    00001d0: b800 4d99 006b 1505 b800 38ba 0069 0000
    00001e0: b800 6f99 0009 1505 04a0 0055 190a 593a
    00001f0: 0612 83ba 0086 0000 59ba 0089 0000 5f19
    0000200: 0657 3a0e 3a0d 190d 190e 1906 03b8 008d
    0000210: b800 9359 ba00 9600 005f 3a10 3a0f 190f
    0000220: 1910 2c59 ba00 9900 005f 05ba 009b 0000
    0000230: ba00 9d00 00ba 00a1 0000 b800 38b0 190a
    0000240: 5912 83ba 002b 0000 5f57 3a0d 190d 190a
    0000250: 2c59 ba00 a400 005f ba00 a600 00ba 00a8
    0000260: 0000 b800 38b0 100c bd00 b6b2 00ba 59ba
    0000270: 00c5 0000 a700 1210 0cbd 00b6 150b b200
    0000280: baba 00c8 0000 b200 ba59 190a ba00 cc00
    0000290: 00a7 0047 100c bd00 b6b2 00ba ba00 d000
    00002a0: 00a7 000f 100c bd00 b615 0cba 00d3 0000
    00002b0: b200 ba19 0a15 0bba 00d7 0000 a700 1510
    00002c0: 0cbd 00b6 1509 190a 150b 150c ba00 da00
    00002d0: 0015 08ba 00db 0000 b200 ba59 ba00 dc00
    00002e0: 00a7 006d 1010 bd00 b619 0f19 10ba 00e0
    00002f0: 0000 a700 0810 0ebd 00b6 190d 190e ba00
    0000300: e200 00a7 0008 100c bd00 b619 06b2 00ba
    0000310: 1508 b200 ba19 0a15 0bb2 00ba ba00 e500
    0000320: 00a7 002d 100d bd00 b619 0dba 00e8 0000
    0000330: a700 0810 0cbd 00b6 1505 b200 ba15 08b2
    0000340: 00ba 190a 150b b200 baba 00eb 0000 2a2b
    0000350: 2c2d 1904 ba00 ee00 0004 b800 f2b8 00f6
    0000360: bf
  Exception Handler Table:
    bci [42, 47] => handler: 614
    bci [76, 81] => handler: 631
    bci [146, 151] => handler: 660
    bci [168, 173] => handler: 676
    bci [231, 236] => handler: 703
    bci [367, 372] => handler: 774
    bci [443, 448] => handler: 819
    bci [555, 560] => handler: 740
    bci [560, 565] => handler: 757
    bci [565, 570] => handler: 774
    bci [600, 605] => handler: 804
    bci [605, 610] => handler: 819
  Stackmap Table:

full_frame(@215,{Object[#16],Object[#182],Object[#182],Object[#182],Object[#22],Top,Top,Top,Integer,Integer,Object[#182],Integer,Integer},{})
    same_locals_1_stack_item_frame(@236,Integer)

full_frame(@239,{Object[#16],Object[#182],Object[#182],Object[#182],Object[#22],Top,Top,Top,Integer,Top,Object[#182],Integer},{})
    same_locals_1_stack_item_frame(@241,Integer)
    same_frame_extended(@306)
    same_locals_1_stack_item_frame(@308,Top)
    same_frame(@352)
    same_frame(@357)

full_frame(@416,{Object[#16],Object[#182],Object[#182],Object[#182],Object[#22],Integer,Top,Top,Integer,Top,Object[#182],Integer},{})
    same_frame(@419)
    same_frame(@424)
    same_frame_extended(@492)
    same_frame_extended(@574)

full_frame(@614,{Object[#16],Object[#182],Object[#182],Object[#182],Object[#22],Top,Top,Top,Top,Top,Object[#182]},{Object[#50]})

full_frame(@631,{Object[#16],Object[#182],Object[#182],Object[#182],Object[#22],Top,Top,Top,Top,Top,Object[#182],Integer},{Object[#50]})

full_frame(@646,{Object[#16],Object[#182],Object[#182],Object[#182],Object[#22],Top,Top,Top,Top,Top,Object[#182]},{Object[#50],Object[#247]})

full_frame(@660,{Object[#16],Object[#182],Object[#182],Object[#182],Object[#22],Top,Top,Top,Integer,Top,Object[#182],Integer},{Object[#50]})

full_frame(@676,{Object[#16],Object[#182],Object[#182],Object[#182],Object[#22],Top,Top,Top,Integer,Top,Object[#182],Integer,Integer},{Object[#50]})

full_frame(@688,{Object[#16],Object[#182],Object[#182],Object[#182],Object[#22],Top,Top,Top,Integer,Top,Object[#182],Integer},{Object[#50],Object[#247]})

full_frame(@703,{Object[#16],Object[#182],Object[#182],Object[#182],Object[#22],Top,Top,Top,Integer,Integer,Object[#182],Integer,Integer},{Object[#50]})

full_frame(@721,{Object[#16],Object[#182],Object[#182],Object[#182],Object[#22],Top,Top,Top,Integer,Top,Object[#182],Integer},{Object[#50],Object[#247]})

full_frame(@728,{Object[#16],Object[#182],Object[#182],Object[#182],Object[#22],Top,Top,Top,Top,Top,Object[#182]},{Object[#50],Object[#247]})

full_frame(@740,{Object[#16],Object[#182],Object[#182],Object[#182],Object[#22],Integer,Object[#182],Top,Integer,Top,Object[#182],Integer,Top,Object[#182],Object[#182],Object[#182],Object[#249]},{Object[#50]})
    same_locals_1_stack_item_frame(@757,Object[#50])

full_frame(@762,{Object[#16],Object[#182],Object[#182],Object[#182],Object[#22],Integer,Object[#182],Top,Integer,Top,Object[#182],Integer,Top,Object[#182],Object[#182],Object[#182],Object[#249]},{Object[#50],Object[#247]})

full_frame(@774,{Object[#16],Object[#182],Object[#182],Object[#182],Object[#22],Top,Top,Top,Integer,Top,Object[#182],Integer},{Object[#50]})

full_frame(@779,{Object[#16],Object[#182],Object[#182],Object[#182],Object[#22],Top,Top,Top,Integer,Top,Object[#182],Integer},{Object[#50],Object[#247]})

full_frame(@804,{Object[#16],Object[#182],Object[#182],Object[#182],Object[#22],Integer,Top,Top,Integer,Top,Object[#182],Integer,Top,Object[#182]},{Object[#50]})

full_frame(@819,{Object[#16],Object[#182],Object[#182],Object[#182],Object[#22],Integer,Top,Top,Integer,Top,Object[#182],Integer},{Object[#50]})

full_frame(@824,{Object[#16],Object[#182],Object[#182],Object[#182],Object[#22],Integer,Top,Top,Integer,Top,Object[#182],Integer},{Object[#50],Object[#247]})

full_frame(@846,{Object[#16],Object[#182],Object[#182],Object[#182],Object[#22],Top,Top,Top,Top,Top,Object[#182]},{Object[#50],Object[#247]})

Note that the same code is working with the latest JDK8.

Thanks,
Guillaume

[1] https://github.com/asciidoctor/asciidoctor.js
[2] https://github.com/opal/opal
[3]
https://github.com/asciidoctor/asciidoctor.js/blob/master/dist/asciidoctor-all.js


More information about the nashorn-dev mailing list