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, and:defined_guard. - locals
-
An array containing the names of all arguments and local variables as symbols.
- args
-
The arity if the method or block only has required arguments.
Otherwise an array of:
[required_argc, [optional_arg_labels, ...], splat_index, post_splat_argc, post_splat_index, block_index, simple]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.
1067 1068 1069 1070 1071 1072 1073 |
# File 'iseq.c', line 1067
static VALUE
iseq_to_a(VALUE self)
{
rb_iseq_t *iseq = iseq_check(self);
rb_secure(1);
return iseq_data_to_ary(iseq);
}
|