fuzion icon indicating copy to clipboard operation
fuzion copied to clipboard

Example with infinite list results in `VerifyError: Expecting a stack map frame`

Open simonvonhackewitz opened this issue 1 year ago • 1 comments

Example code from the tutorial:

ones => list 1 ones
say ones.count   # error: does not terminate

The error message

Exception Details:
  Location:
    fzC_list_i32__1count.fzRoutine(LfzI_Cons__i32__list_i32;I)I @66: ldc
  Reason:
    Expected stackmap frame at this location.
  Bytecode:
    0000000: bb00 0259 b700 134d 2c2a b500 152c 1bb5
    0000010: 0017 2cb4 0015 59c6 0022 2c5f b500 192c
    0000020: b400 19c0 001b c000 1bb8 0021 4b2c b400
    0000030: 1704 b800 273c a7ff d257 1229 b800 2fa7
    0000040: 0000 1231 b800 2fa7 0000               
  Stackmap Table:
    full_frame(@0,{Object[#52],Integer},{})
    full_frame(@8,{Object[#52],Integer,Object[#2]},{})
    full_frame(@23,{Object[#52],Integer,Object[#2]},{Object[#52],Object[#52]})
    full_frame(@54,{Object[#52],Integer,Object[#2]},{})
    full_frame(@57,{Object[#52],Integer,Object[#2]},{Object[#52]})
    full_frame(@63,{Object[#52],Integer,Object[#2]},{})
    full_frame(@71,{Object[#52],Integer,Object[#2]},{})

        at fzC_list_i32__count.fzRoutine($MODULE/list.fz:66)
        at fzC_universe.fzRoutine(--builtin--:3)
        at fzC_universe.fz_run(--builtin--)
        at dev.flang.be.jvm.runtime.FuzionThread.lambda$new$1(FuzionThread.java:97)
        at dev.flang.util.Errors.runAndExit(Errors.java:964)
        at dev.flang.be.jvm.runtime.FuzionThread.lambda$new$2(FuzionThread.java:106)
        at java.base/java.lang.Thread.run(Thread.java:1570)


*** fatal errors encountered, stopping.
one error.

simonvonhackewitz avatar Jun 04 '24 14:06 simonvonhackewitz

Problem is that reportErrorInCodeis used consecutively but then the trick with the endless goto loop does not work.

        58: ldc           #41                 // String no targets for access of (list i32).count.n within (list i32).count(1 args) at 805306396
        60: invokestatic  #47                 // Method dev/flang/be/jvm/runtime/Runtime.fatal:(Ljava/lang/String;)V
        63: goto          63
        66: ldc           #49                 // String Can not return result field that does not exist1: (list i32).count#1
        68: invokestatic  #47                 // Method dev/flang/be/jvm/runtime/Runtime.fatal:(Ljava/lang/String;)V
        71: goto          71

michaellilltokiwa avatar Jun 24 '24 12:06 michaellilltokiwa