Skip to content

Bad code generated for lazy vals with try #1462

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

Closed
odersky opened this issue Aug 23, 2016 · 1 comment
Closed

Bad code generated for lazy vals with try #1462

odersky opened this issue Aug 23, 2016 · 1 comment

Comments

@odersky
Copy link
Contributor

odersky commented Aug 23, 2016

See tests/run/pending/t2333.scala.

Running this gives:

Exception in thread "main" java.lang.VerifyError: Inconsistent stackmap frames at branch target 36

@nicolasstucki
Copy link
Contributor

Still an issue. Fails with:

Exception in thread "main" java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at dotty.tools.vulpix.ChildJVMMain.runMain(ChildJVMMain.java:23)
	at dotty.tools.vulpix.ChildJVMMain.main(ChildJVMMain.java:30)
Caused by: java.lang.VerifyError: Inconsistent stackmap frames at branch target 33
Exception Details:
  Location:
    A.b$lzyINIT1$1(Ldotty/runtime/LazyInt;)I @30: goto
  Reason:
    Current frame's stack size doesn't match stackmap.
  Current Frame:
    bci: @30
    flags: { }
    locals: { 'dotty/runtime/LazyInt', 'dotty/runtime/LazyInt' }
    stack: { integer }
  Stackmap Frame:
    bci: @33
    flags: { }
    locals: { 'dotty/runtime/LazyInt', 'dotty/runtime/LazyInt' }
    stack: { top, integer }
  Bytecode:
    0x0000000: 2a59 4cc2 2ab6 001b 9900 0a2a b600 1fa7
    0x0000010: 0019 2a04 b600 232a 05a7 0008 5703 a700
    0x0000020: 03b6 0027 2ab6 001f b800 2d4d 2bc3 2ca7
    0x0000030: 0006 2bc3 bfb8 0031 ac                 
  Exception Handler Table:
    bci [24, 25] => handler: 28
    bci [4, 44] => handler: 50
  Stackmap Table:
    append_frame(@18,Object[#14])
    same_locals_1_stack_item_frame(@28,Object[#53])
    full_frame(@33,{Object[#14],Object[#14]},{Top,Integer})
    same_locals_1_stack_item_frame(@40,Integer)
    same_locals_1_stack_item_frame(@50,Object[#53])
    full_frame(@53,{Object[#14],Object[#14],Object[#55]},{Object[#55]})

	at Test$.main(t2333.scala:12)
	at Test.main(t2333.scala)
	... 6 more

smarter added a commit to dotty-staging/dotty that referenced this issue Jan 26, 2019
Otherwise we might miss try which end up on a non-empty expression stack
due to a late transform such as LazyVals.
smarter added a commit to dotty-staging/dotty that referenced this issue Jan 26, 2019
Otherwise we might miss try expressions which end up on a non-empty
expression stack due to a late transform such as LazyVals.
smarter added a commit that referenced this issue Jan 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants