Project

General

Profile

Bug #14730

[MJIT] lambda stack consistency error

Added by ahorek (Pavel Rosický) almost 2 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
[ruby-core:86804]

Description

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]

Updated by hsbt (Hiroshi SHIBATA) almost 2 years ago

  • Assignee set to k0kubun (Takashi Kokubun)

Updated by k0kubun (Takashi Kokubun) almost 2 years ago

  • Status changed from Open to Closed

Thanks for a very good bug report. I fixed this bug in r63320. Please confirm that.

I have some ideas to systematically prevent similar bugs. I'll fix so later.

Updated by ahorek (Pavel Rosický) almost 2 years ago

confirmed, thanks

Also available in: Atom PDF