Class: Optimize::IR::CallData

Inherits:
Struct
  • Object
show all
Defined in:
lib/optimize/ir/call_data.rb

Overview

One call-site’s calldata record. Mirrors the on-disk shape at research/cruby/ibf-format.md §4.1 “call info (ci) entries”: per-cd: mid_idx, flag, argc, kwlen, kw_indices.

mid_idx and kw_indices are OBJECT-TABLE indices (ID refs), not resolved symbols — that mirrors how other operands are stored and preserves byte-identical round-trip. Resolution to Symbol happens via the passed object table (see IR::CallData#mid_symbol).

Constant Summary collapse

FLAG_ARGS_SPLAT =

Calldata flag bits we care about in v1. Values from vm_callinfo.h (iseq.c). These are the exact C enum values.

0x01
FLAG_ARGS_BLOCKARG =
0x02
FLAG_FCALL =
0x04
FLAG_VCALL =
0x08
FLAG_ARGS_SIMPLE =
0x10
FLAG_BLOCKISEQ =
0x20
FLAG_KWARG =
0x40
FLAG_KW_SPLAT =
0x80
FLAG_TAILCALL =
0x100
FLAG_SUPER =
0x200
FLAG_ZSUPER =
0x400
FLAG_OPT_SEND =
0x800
FLAG_KW_SPLAT_MUT =
0x1000
FLAG_FORWARDING =
0x2000

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#argcObject

Returns the value of attribute argc

Returns:

  • (Object)

    the current value of argc



13
14
15
# File 'lib/optimize/ir/call_data.rb', line 13

def argc
  @argc
end

#flagObject

Returns the value of attribute flag

Returns:

  • (Object)

    the current value of flag



13
14
15
# File 'lib/optimize/ir/call_data.rb', line 13

def flag
  @flag
end

#kw_indicesObject

Returns the value of attribute kw_indices

Returns:

  • (Object)

    the current value of kw_indices



13
14
15
# File 'lib/optimize/ir/call_data.rb', line 13

def kw_indices
  @kw_indices
end

#kwlenObject

Returns the value of attribute kwlen

Returns:

  • (Object)

    the current value of kwlen



13
14
15
# File 'lib/optimize/ir/call_data.rb', line 13

def kwlen
  @kwlen
end

#mid_idxObject

Returns the value of attribute mid_idx

Returns:

  • (Object)

    the current value of mid_idx



13
14
15
# File 'lib/optimize/ir/call_data.rb', line 13

def mid_idx
  @mid_idx
end

Instance Method Details

#args_simple?Boolean

Returns:

  • (Boolean)


32
# File 'lib/optimize/ir/call_data.rb', line 32

def args_simple?  = (flag & FLAG_ARGS_SIMPLE) != 0

#blockarg?Boolean

Returns:

  • (Boolean)


33
# File 'lib/optimize/ir/call_data.rb', line 33

def blockarg?     = (flag & FLAG_ARGS_BLOCKARG) != 0

#fcall?Boolean

Returns:

  • (Boolean)


31
# File 'lib/optimize/ir/call_data.rb', line 31

def fcall?        = (flag & FLAG_FCALL) != 0

#has_kwargs?Boolean

Returns:

  • (Boolean)


34
# File 'lib/optimize/ir/call_data.rb', line 34

def has_kwargs?   = kwlen.positive?

#has_splat?Boolean

Returns:

  • (Boolean)


35
# File 'lib/optimize/ir/call_data.rb', line 35

def has_splat?    = (flag & FLAG_ARGS_SPLAT) != 0

#mid_symbol(object_table) ⇒ Object



37
38
39
# File 'lib/optimize/ir/call_data.rb', line 37

def mid_symbol(object_table)
  object_table.resolve(mid_idx)
end