Skip to content

NODE_ZSUPER from deeply nested blocks will result in a truncated digits for block index in OP_ARGARY #6270

Description

@dearblue
  • Good case : Calling super from a 15-level lambda

    % bin/mruby -vce 'def m(a, b, c); ->{->{->{->{->{->{->{->{->{->{->{->{->{->{->{ super }}}}}}}}}}}}}}}; end'
    
    ...SNIP...
    
    irep 0x220d1d869550 nregs=6 nlocals=2 pools=0 syms=0 reps=0 ilen=13
    file: -e
        1 000 ENTER         0:0:0:0:0:0:0 (0x0)
        1 004 ARGARY        R3      3:0:0:0 (15)    ### see "(15)" (good) ###
        1 008 SUPER         R2      n=*
        1 011 RETURN        R2
    
    Syntax OK
  • Wrong case : Calling super from a 17-level lambda

    % bin/mruby -vce 'def m(a, b, c); ->{->{->{->{->{->{->{->{->{->{->{->{->{->{->{->{->{ super }}}}}}}}}}}}}}}}}; end'
    
    ...SNIP...
    
    irep 0x32923e8695f0 nregs=6 nlocals=2 pools=0 syms=0 reps=0 ilen=13
    file: -e
        1 000 ENTER         0:0:0:0:0:0:0 (0x0)
        1 004 ARGARY        R3      3:0:0:0 (1)     ### see "(1)" (overflowed) ###
        1 008 SUPER         R2      n=*
        1 011 RETURN        R2
    
    Syntax OK

😸 The strongest solution I have come up with is to call codegen_error(s, "too complex expression") if the number exceeds 15.

There may be a better solution, so I'm just reporting it for now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions