Bug #19454
closedInstruction `send` has nil blockiseq and ARGS_SIMPLE flag
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¶
-
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. -
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 ofsend
.
It would be good to get rid of send
insn with nil blockiseq and use opt_send_without_block
instruction in such cases.
Files
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.