Method: RubyVM::InstructionSequence#to_a
- Defined in:
- iseq.c
#to_a ⇒ Array
Returns an Array with 14 elements representing the instruction sequence with the following data:
- magic
-
A string identifying the data format. Always
YARVInstructionSequence/SimpleDataFormat. - major_version
-
The major version of the instruction sequence.
- minor_version
-
The minor version of the instruction sequence.
- format_type
-
A number identifying the data format. Always 1.
- misc
-
A hash containing:
:arg_size
the total number of arguments taken by the method or the block (0 if iseq doesn’t represent a method or block)
[+:local_size+]
the number of local variables + 1
[+:stack_max+]
used in calculating the stack depth at which a SystemStackError is thrown.
- #label
-
The name of the context (block, method, class, module, etc.) that this instruction sequence belongs to.
<main>if it’s at the top level,<compiled>if it was evaluated from a string. - #path
-
The relative path to the Ruby file where the instruction sequence was loaded from.
<compiled>if the iseq was evaluated from a string. - #absolute_path
-
The absolute path to the Ruby file where the instruction sequence was loaded from.
nilif the iseq was evaluated from a string. - #first_lineno
-
The number of the first source line where the instruction sequence was loaded from.
- type
-
The type of the instruction sequence.
Valid values are
:top,:method,:block,:class,:rescue,:ensure,:eval,:main, andplain. - locals
-
An array containing the names of all arguments and local variables as symbols.
- params
-
An Hash object containing parameter information.
More info about these values can be found in
vm_core.h. - catch_table
-
A list of exceptions and control flow operators (rescue, next, redo, break, etc.).
- bytecode
-
An array of arrays containing the instruction names and operands that make up the body of the instruction sequence.
Note that this format is MRI specific and version dependent.
2167 2168 2169 2170 2171 2172 |
# File 'iseq.c', line 2167 static VALUE iseqw_to_a(VALUE self) { const rb_iseq_t *iseq = iseqw_check(self); return iseq_data_to_ary(iseq); } |