[ruby-cvs:69872] k0kubun:r62717 (trunk): compile.c: mark all ISeq ancestors as catch_except_p

k0kubun at ruby-lang.org k0kubun at ruby-lang.org
Sat Mar 10 23:52:12 JST 2018


k0kubun	2018-03-10 23:52:12 +0900 (Sat, 10 Mar 2018)

  New Revision: 62717

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62717

  Log:
    compile.c: mark all ISeq ancestors as catch_except_p
    
    This change assumes that continuously reading `parent_iseq` from block
    ISeq would reach non-block ISeq finally.
    
    test/ruby/test_jit.rb: add test that catches 2-depth exception
    
    Combination of r62654 and r62678 caused following error in this test.
    
    -e:12:in `wrapper': Stack consistency error (sp: 14, bp: 13) (fatal)
    == disasm: #<ISeq:wrapper at -e:10 (10,0)-(12,3)> (catch: FALSE)===========
    local table (size: 2, argc: 2 [opts: 0, rest: -1, post: 0, block: -1, kw: -1 at -1, kwrest: -1])
    [ 2] paths<Arg> [ 1] prefixes<Arg>
    0000 putself                                                          (  11)[LiCa]
    0001 getlocal_WC_0    paths
    0003 getlocal_WC_0    prefixes
    0005 opt_send_without_block <callinfo!mid:catch_true, argc:2, FCALL|ARGS_SIMPLE>, <callcache>
    0008 leave                                                            (  12)[Re]
    
    As you can see, it says `catch: FALSE`, but obviously it catches
    exception raised from `return path`.
    
    As of r62655, it was kind of intentional because I only cared about
    expiration of JIT-ed frame and I've thought calling `vm_exec` is only
    needed once for it. So r62654 was NOT actually checking if it may catch
    exception.
    
    But for r62678, obviously we should set catch_except_p=TRUE for all
    ISeqs which may catch exception. Otherwise catch table lookup would
    fail.
    
    With this bugfix, code generated by r62655 might be worse, but at least
    while loop can be marked as `catch: FALSE` as expected.

  Modified files:
    trunk/compile.c
    trunk/test/ruby/test_jit.rb


More information about the ruby-cvs mailing list