Project

General

Profile

Actions

Feature #11589

closed

Disasm callinfo kw output as list of keywords used

Added by bpblack (Brian Black) over 8 years ago. Updated over 8 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:71076]

Description

Feature https://bugs.ruby-lang.org/issues/10440 changed the disasm output so that only the number of keywords used at a call site is added to the callinfo output. This means that if a function has n keyword arguments and k are used at a call site, then there are n!/(n-k)! possible combinations of k (keyword, argument) pairs. Essentially, this means that it is impossible to determine what keywords were used and in what order from the disasm without referring to the original source code. I changed the disasm output (https://github.com/ruby/ruby/compare/trunk...bpblack:kwargs) to replace the number of keywords with the ordered list of keywords used in the call info disasm. For example:

def test1(a: 'default', b:, c: 'default') 
  puts a, b, c
end

test1 a: 'a', b: 'b', c: 'c'

Currently, the call info disasm for the call to test1 looks like:

0088 opt_send_without_block <callinfo!mid:test1, argc:3, kw:3, FCALL|KWARG>, <callcache>

Based on this disasm, all I know without referring to the original source code is that the arguments are passed as one of the 6 possible orderings of keywords a, b, and c.

With my changes it looks like:

0088 opt_send_without_block <callinfo!mid:test1, argc:3, kw:[a,b,c], FCALL|KWARG>, <callcache>

Updated by nobu (Nobuyoshi Nakada) over 8 years ago

  • Tracker changed from Bug to Feature
Actions #2

Updated by nobu (Nobuyoshi Nakada) over 8 years ago

  • Status changed from Open to Closed

Applied in changeset r52123.


iseq.c: list of keywords [Fix GH-1056]

  • iseq.c (rb_insn_operand_intern): change kw in callinfo disasm from the
    number of keyword arguments to an ordered list of the keywords used.
    [Feature #11589]
Actions

Also available in: Atom PDF

Like0
Like0Like0