Issue #14730 has been updated by ahorek (Pavel Rosick).


confirmed, thanks

----------------------------------------
Bug #14730: [MJIT] lambda stack consistency error
https://bugs.ruby-lang.org/issues/14730#change-71804

* Author: ahorek (Pavel Rosick)
* Status: Closed
* Priority: Normal
* Assignee: k0kubun (Takashi Kokubun)
* Target version: 
* ruby -v: 
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
```ruby
fib = lambda do |x|
  return x if x == 0 || x == 1
  fib.call(x-1) + fib.call(x-2)
end
fib.call(35)
```

```
ruby --jit fib.rb
...
 Stack consistency error (sp: 119, bp: 118) (fatal)
== disasm: #<ISeq:block in <main>@fib.rb:1 (1,13)-(4,3)> (catch: FALSE)
== catch table
| catch type: redo   st: 0001 ed: 0048 sp: 0000 cont: 0001
| catch type: next   st: 0001 ed: 0048 sp: 0000 cont: 0048
|------------------------------------------------------------------------
local table (size: 1, argc: 1 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1])
[ 1] x@0<Arg>
0000 nop                                                              (   1)[Bc]
0001 getlocal_WC_0    x@0                                             (   2)[Li]
0003 putobject_INT2FIX_0_
0004 opt_eq           <callinfo!mid:==, argc:1, ARGS_SIMPLE>, <callcache>
0007 branchif         17
0009 getlocal_WC_0    x@0
0011 putobject_INT2FIX_1_
0012 opt_eq           <callinfo!mid:==, argc:1, ARGS_SIMPLE>, <callcache>
0015 branchunless     22
0017 getlocal_WC_0    x@0
0019 throw            1
0021 pop
0022 getlocal_WC_1    fib@0                                           (   3)[Li]
0024 getlocal_WC_0    x@0
0026 putobject_INT2FIX_1_
0027 opt_minus        <callinfo!mid:-, argc:1, ARGS_SIMPLE>, <callcache>
0030 opt_send_without_block <callinfo!mid:call, argc:1, ARGS_SIMPLE>, <callcache>
0033 getlocal_WC_1    fib@0
0035 getlocal_WC_0    x@0
0037 putobject        2
0039 opt_minus        <callinfo!mid:-, argc:1, ARGS_SIMPLE>, <callcache>
0042 opt_send_without_block <callinfo!mid:call, argc:1, ARGS_SIMPLE>, <callcache>
0045 opt_plus         <callinfo!mid:+, argc:1, ARGS_SIMPLE>, <callcache>
0048 leave                                                            (   4)[Br]
```

```
ruby -v
ruby 2.6.0dev (2018-05-01 trunk 63314) [x86_64-linux]
```



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>