
Issue #19454 has been updated by nobu (Nobuyoshi Nakada). 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"? ---------------------------------------- Bug #19454: Instruction `send` has nil blockiseq and ARGS_SIMPLE flag https://bugs.ruby-lang.org/issues/19454#change-101972 * Author: dmitry.pogrebnoy (Dmitry Pogrebnoy) * Status: Feedback * Priority: Normal * ruby -v: ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [x86_64-linux] * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- ### 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) -- https://bugs.ruby-lang.org/