Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.VerifyError in bytecode produced by CodeGen #407

Open
rohanpadhye opened this issue Mar 11, 2018 · 2 comments

Comments

@rohanpadhye
Copy link

@rohanpadhye rohanpadhye commented Mar 11, 2018

Input to Rhino 1.7.8:

(function(g_0, h_1, q_2, q_2){ try { while ((null)){ var j_3;;throw ((null)[(g_0)]);throw ((j_3) && (e_4));{ for((u_5);;(e_4)){ var g_0 };try { break;;([((++ (s_6)).g_0)]) }catch (h_1) { return;(g_0);var k_7 } } } }catch (s_6) { var d_8; } })

Compilation fails with:

java.lang.VerifyError: Stack map does not match the one at exception handler 206
Exception Details:
  Location:
    org/mozilla/javascript/gen/input_1._c_anonymous_1(Lorg/mozilla/javascript/gen/input_1;Lorg/mozilla/javascript/Context;Lorg/mozilla/javascript/Scriptable;Lorg/mozilla/javascript/Scriptable;[Ljava/lang/Object;)Ljava/lang/Object; @206: nop
  Reason:
    Type top (current frame, locals[6]) is not assignable to 'org/mozilla/javascript/Scriptable' (stack map, locals[6])
  Current Frame:
    bci: @123
    flags: { }
    locals: { 'org/mozilla/javascript/gen/input_1', 'org/mozilla/javascript/Context', 'org/mozilla/javascript/Scriptable', 'org/mozilla/javascript/Scriptable', '[Ljava/lang/Object;' }
    stack: { 'org/mozilla/javascript/JavaScriptException' }
  Stackmap Frame:
    bci: @206
    flags: { }
    locals: { 'org/mozilla/javascript/gen/input_1', 'org/mozilla/javascript/Context', 'org/mozilla/javascript/Scriptable', 'org/mozilla/javascript/Scriptable', '[Ljava/lang/Object;', top, 'org/mozilla/javascript/Scriptable' }
    stack: { 'java/lang/Throwable' }
  Bytecode:
    0x0000000: 2ab9 0075 0100 4d2a 2c19 0403 b800 794d
    0x0000010: 2b2c b800 7c2c 3a06 a700 ce01 2b2c 124e
    0x0000020: b800 812b 2cb8 0085 bb00 875a 5f12 8803
    0x0000030: b700 8bbf 0000 0000 0000 0000 0000 0000
    0x0000040: 0000 0000 0000 0000 00bf 0000 0000 0000
    0x0000050: 0000 0000 00bf 0000 0000 0000 0000 0000
    0x0000060: bf00 0000 0000 0000 bf00 0000 0000 0000
    0x0000070: 0000 0000 bf00 0000 0000 bf00 0000 0000
    0x0000080: 0000 0000 0000 0000 0000 0000 0000 0000
    0x0000090: 0000 0000 0000 0000 0000 00bf 0000 0000
    0x00000a0: 0000 0000 0000 0000 0000 0000 0000 0000
    0x00000b0: 0000 0000 00bf 0000 0000 0000 0000 0000
    0x00000c0: 0000 0000 00bf 0000 0000 bf00 00bf 0000
    0x00000d0: 0000 0000 00bf 0000 0000 0000 00bf 0000
    0x00000e0: 0000 0000 00bf 01b8 008f 9aff 31a7 0003
    0x00000f0: a700 2419 0501 129b 2b2c b800 af3a 0719
    0x0000100: 072b 2cb8 00b3 4d2c b800 b74d a700 0800
    0x0000110: 0000 00bf a700 1b3a 0519 064d a7ff d73a
    0x0000120: 0519 064d a7ff cf3a 0519 064d a7ff c7b2
    0x0000130: 006d a700 032b b800 bbb0 3a05 2bb8 00bb
    0x0000140: 1905 bf                                
  Exception Handler Table:
    bci [120, 156] => handler: 206
    bci [120, 156] => handler: 214
    bci [120, 156] => handler: 222
    bci [24, 243] => handler: 279
    bci [24, 243] => handler: 287
    bci [24, 243] => handler: 295
    bci [21, 309] => handler: 314
  Stackmap Table:
    append_frame(@27,Top,Object[#20])
    same_locals_1_stack_item_frame(@52,Object[#189])
    same_locals_1_stack_item_frame(@74,Object[#189])
    same_locals_1_stack_item_frame(@86,Object[#189])
    same_locals_1_stack_item_frame(@97,Object[#189])
    same_locals_1_stack_item_frame(@105,Object[#189])
    same_locals_1_stack_item_frame(@117,Object[#189])
    full_frame(@123,{Object[#2],Object[#22],Object[#20],Object[#20],Object[#64]},{Object[#189]})
    full_frame(@156,{Object[#2],Object[#22],Object[#20],Object[#20],Object[#64],Top,Object[#20]},{Object[#189]})
    same_locals_1_stack_item_frame(@182,Object[#189])
    same_locals_1_stack_item_frame(@198,Object[#189])
    same_locals_1_stack_item_frame(@203,Object[#189])
    same_locals_1_stack_item_frame(@206,Object[#189])
    same_locals_1_stack_item_frame(@214,Object[#189])
    same_locals_1_stack_item_frame(@222,Object[#189])
    same_frame(@230)
    same_frame(@240)
    full_frame(@243,{Object[#2],Object[#22],Object[#20],Object[#20],Object[#64],Object[#191],Object[#20]},{})
    full_frame(@271,{Object[#2],Object[#22],Object[#20],Object[#20],Object[#64]},{Object[#189]})
    append_frame(@276,Top,Object[#20])
    same_locals_1_stack_item_frame(@279,Object[#135])
    same_locals_1_stack_item_frame(@287,Object[#169])
    same_locals_1_stack_item_frame(@295,Object[#171])
    same_frame(@303)
    same_locals_1_stack_item_frame(@309,Object[#45])
    full_frame(@314,{Object[#2],Object[#22],Object[#20],Object[#20],Object[#64]},{Object[#189]})

Sorry for the cryptic test case. It was generated automatically by JQF.

@sainaen

This comment has been minimized.

Copy link
Contributor

@sainaen sainaen commented Mar 27, 2018

Here’s a somewhat clearer reproducer in case anyone wants to take a stab at this issue:

try {
    while (false) {
        throw 1;
        try {
            break;
        } catch (_) {}
    }
} catch (_) {}

(tag: "good first issue" 😜 )

@GauravMishra13

This comment has been minimized.

Copy link

@GauravMishra13 GauravMishra13 commented Oct 13, 2019

hey i am in interested in your project! From which folder i should or from where should i begin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.