Project

General

Profile

Actions

Bug #19454

closed

Instruction `send` has nil blockiseq and ARGS_SIMPLE flag

Added by dmitry.pogrebnoy (Dmitry Pogrebnoy) over 2 years ago. Updated over 2 years ago.

Status:
Feedback
Assignee:
-
Target version:
-
ruby -v:
ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [x86_64-linux]
[ruby-core:112523]

Description

Setup

  • OS: MacOS Monterey 12.4
  • VM: rbenv
  • Gems: test-unit 3.5.3
  • Ruby: ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [x86_64-linux]

Problem Description

In some cases the instruction send has nil block argument and ARGS_SIMPLE flag. But send is supposed to have a valid blockiseq parameter. For the case with a missing block there is an instruction opt_send_without_block. This breaks some of the logic of the dependent program .

How to reproduce

  1. Open attached project and run test in test_project\test\my_example_test.rb

    You should get this output:

    == disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(1,22)> (catch: FALSE)
    0000 opt_getinlinecache                     9, <is:0>                 (   1)[Li]
    0003 putobject                              true
    0005 getconstant                            :MyModule
    0007 opt_setinlinecache                     <is:0>
    0009 send                                   <calldata!mid:some_method, argc:0, ARGS_SIMPLE>, nil
    0012 leave
    

    Here you can see the send insn with nil blockiseq and ARGS_SIMPLE flag.

  2. But if you run the same code as a script (lib\my_example_script.rb) you should get this output:

    == disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(1,22)> (catch: FALSE)
    0000 opt_getinlinecache                     9, <is:0>                 (   1)[Li]
    0003 putobject                              true
    0005 getconstant                            :MyModule
    0007 opt_setinlinecache                     <is:0>
    0009 opt_send_without_block                 <calldata!mid:some_method, argc:0, ARGS_SIMPLE>
    0011 leave
    

    Here you can see the opt_send_without_block insn instead of send.

It would be good to get rid of send insn with nil blockiseq and use opt_send_without_block instruction in such cases.


Files

test_project.zip (38.3 KB) test_project.zip dmitry.pogrebnoy (Dmitry Pogrebnoy), 02/21/2023 01:19 PM
Actions #1

Updated by dmitry.pogrebnoy (Dmitry Pogrebnoy) over 2 years ago

  • Subject changed from Instruction `send` has nil blockiseq parameter and ARGS_SIMPLE flag to Instruction `send` has nil blockiseq and ARGS_SIMPLE flag

Updated by nobu (Nobuyoshi Nakada) over 2 years ago

  • Status changed from Open to Feedback

It seems test-unit turns off specialized_instruction in RubyVM::InstructionSequence.compile_option.

This breaks some of the logic of the dependent program .

What is "the dependent program"?

Updated by dmitry.pogrebnoy (Dmitry Pogrebnoy) over 2 years ago

It seems test-unit turns off specialized_instruction in RubyVM::InstructionSequence.compile_option.

Indeed, thank you. Where can I find the description of each compile flags?

What is "the dependent program"?

I support the proprietary gem debugger. And this is the case when it breaks.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0