Ruby: iseq.c File Reference

Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)

Data Structures | Macros | Typedefs | Functions | Variables
iseq.c File Reference
`#include "ruby/internal/config.h"`
`#include "eval_intern.h"`
`#include "gc.h"`
`#include "id_table.h"`
`#include "internal.h"`
`#include "internal/bits.h"`
`#include "internal/class.h"`
`#include "internal/compile.h"`
`#include "internal/error.h"`
`#include "internal/file.h"`
`#include "internal/hash.h"`
`#include "internal/parse.h"`
`#include "internal/sanitizers.h"`
`#include "internal/symbol.h"`
`#include "internal/thread.h"`
`#include "internal/variable.h"`
`#include "iseq.h"`
`#include "mjit.h"`
`#include "ruby/util.h"`
`#include "vm_core.h"`
`#include "vm_callinfo.h"`
`#include "builtin.h"`
`#include "insns.inc"`
`#include "insns_info.inc"`
`#include "node_name.inc"`

Go to the source code of this file.

## Data Structures
struct | insn_data_struct
struct | trace_set_local_events_struct
struct | trace_clear_local_events_struct

## Macros
#define | RUBY_VM_INSNS_INFO 1
#define | hidden_obj_p(obj) (!SPECIAL_CONST_P(obj) && !RBASIC(obj)->klass)
#define | SET_COMPILE_OPTION(o, h, mem)
#define | SET_COMPILE_OPTION_NUM(o, h, mem)
#define | SET_COMPILE_OPTION(o, h, mem) rb_hash_aset((h), ID2SYM(rb_intern(#mem)), (o)->mem ? Qtrue : Qfalse)
#define | SET_COMPILE_OPTION_NUM(o, h, mem) rb_hash_aset((h), ID2SYM(rb_intern(#mem)), INT2NUM((o)->mem))
#define | CHECK_ARRAY(v) rb_to_array_type(v)
#define | CHECK_HASH(v) rb_to_hash_type(v)
#define | CHECK_STRING(v) rb_str_to_str(v)
#define | CHECK_SYMBOL(v) rb_to_symbol_type(v)
#define | INITIALIZED /* volatile */
#define | CALL_FLAG(n) if (vm_ci_flag(ci) & VM_CALL_##n) rb_ary_push(flags, rb_str_new2(#n))
#define | C(ev, cstr, l) if (events & ev) rb_ary_push(ary, rb_ary_new_from_args(2, l, ID2SYM(rb_intern(cstr))));
#define | DECL_SYMBOL(name) static ID sym_##name
#define | INIT_SYMBOL(name) sym_##name = rb_intern(#name)
#define | CHECK_EVENT(ev) if (events & ev) rb_ary_push(body, ID2SYM(rb_intern(#ev)));
#define | PARAM_TYPE(type) rb_ary_push(a = rb_ary_new2(2), ID2SYM(type))
#define | PARAM_ID(i) body->local_table[(i)]
#define | PARAM(i, type)
#define | INSN_CODE(insn) (insn)

## Typedefs
typedef VALUE | iseq_value_itr_t(void *ctx, VALUE obj)
typedef VALUE | rb_vm_insns_translator_t(const void *addr)
typedef struct insn_data_struct | insn_data_t

## Functions
void | rb_iseq_free (const rb_iseq_t *iseq)
void | rb_iseq_update_references (rb_iseq_t *iseq)
void | rb_iseq_mark (const rb_iseq_t *iseq)
size_t | rb_iseq_memsize (const rb_iseq_t *iseq)
struct rb_iseq_constant_body * | rb_iseq_constant_body_alloc (void)
VALUE | rb_iseq_pathobj_new (VALUE path, VALUE realpath)
void | rb_iseq_pathobj_set (const rb_iseq_t *iseq, VALUE path, VALUE realpath)
void | rb_iseq_insns_info_encode_positions (const rb_iseq_t *iseq)
void | rb_iseq_init_trace (rb_iseq_t *iseq)
rb_iseq_t * | rb_iseq_new (const rb_ast_body_t *ast, VALUE name, VALUE path, VALUE realpath, const rb_iseq_t *parent, enum iseq_type type)
rb_iseq_t * | rb_iseq_new_top (const rb_ast_body_t *ast, VALUE name, VALUE path, VALUE realpath, const rb_iseq_t *parent)
rb_iseq_t * | rb_iseq_new_main (const rb_ast_body_t *ast, VALUE path, VALUE realpath, const rb_iseq_t *parent)
rb_iseq_t * | rb_iseq_new_eval (const rb_ast_body_t *ast, VALUE name, VALUE path, VALUE realpath, VALUE first_lineno, const rb_iseq_t *parent, int isolated_depth)
rb_iseq_t * | rb_iseq_new_with_opt (const rb_ast_body_t *ast, VALUE name, VALUE path, VALUE realpath, VALUE first_lineno, const rb_iseq_t *parent, int isolated_depth, enum iseq_type type, const rb_compile_option_t *option)
rb_iseq_t * | rb_iseq_new_with_callback (const struct rb_iseq_new_with_callback_callback_func *ifunc, VALUE name, VALUE path, VALUE realpath, VALUE first_lineno, const rb_iseq_t *parent, enum iseq_type type, const rb_compile_option_t *option)
const rb_iseq_t * | rb_iseq_load_iseq (VALUE fname)
VALUE | rb_iseq_load (VALUE data, VALUE parent, VALUE opt)
VALUE | rb_iseq_path (const rb_iseq_t *iseq)
VALUE | rb_iseq_realpath (const rb_iseq_t *iseq)
VALUE | rb_iseq_absolute_path (const rb_iseq_t *iseq)
VALUE | rb_iseq_label (const rb_iseq_t *iseq)
VALUE | rb_iseq_base_label (const rb_iseq_t *iseq)
VALUE | rb_iseq_first_lineno (const rb_iseq_t *iseq)
VALUE | rb_iseq_method_name (const rb_iseq_t *iseq)
void | rb_iseq_code_location (const rb_iseq_t *iseq, int *beg_pos_lineno, int *beg_pos_column, int *end_pos_lineno, int *end_pos_column)
VALUE | rb_iseq_coverage (const rb_iseq_t *iseq)
void | rb_iseq_remove_coverage_all (void)
VALUE | rb_iseqw_new (const rb_iseq_t *iseq)
const rb_iseq_t * | rb_iseqw_to_iseq (VALUE iseqw)
unsigned int | rb_iseq_line_no (const rb_iseq_t *iseq, size_t pos)
rb_event_flag_t | rb_iseq_event_flags (const rb_iseq_t *iseq, size_t pos)
void | rb_iseq_clear_event_flags (const rb_iseq_t *iseq, size_t pos, rb_event_flag_t reset)
int | rb_insn_unified_local_var_level (VALUE)
VALUE | rb_dump_literal (VALUE lit)
VALUE | rb_insn_operand_intern (const rb_iseq_t *iseq, VALUE insn, int op_no, VALUE op, int len, size_t pos, const VALUE *pnop, VALUE child)
int | rb_iseq_disasm_insn (VALUE ret, const VALUE *code, size_t pos, const rb_iseq_t *iseq, VALUE child)
| Disassemble a instruction Iseq -> Iseq inspect object. More...
VALUE | rb_iseq_disasm (const rb_iseq_t *iseq)
const char * | ruby_node_name (int node)
VALUE | rb_iseq_parameters (const rb_iseq_t *iseq, int is_proc)
VALUE | rb_iseq_defined_string (enum defined_type type)
void | rb_vm_encoded_insn_data_table_init (void)
int | rb_vm_insn_addr2insn (const void *addr)
void | rb_iseq_trace_flag_cleared (const rb_iseq_t *iseq, size_t pos)
int | rb_iseq_add_local_tracepoint_recursively (const rb_iseq_t *iseq, rb_event_flag_t turnon_events, VALUE tpval, unsigned int target_line)
int | rb_iseq_remove_local_tracepoint_recursively (const rb_iseq_t *iseq, VALUE tpval)
void | rb_iseq_trace_set (const rb_iseq_t *iseq, rb_event_flag_t turnon_events)
void | rb_iseq_trace_set_all (rb_event_flag_t turnon_events)
VALUE | rb_iseqw_local_variables (VALUE iseqval)
void | Init_ISeq (void)

## Variables
VALUE | rb_cISeq

## Macro Definition Documentation

## ◆ C

#define C | ( |  | ev,
|  |  | cstr,
|  |  | l
| ) |  | if (events & ev) rb_ary_push(ary, rb_ary_new_from_args(2, l, ID2SYM(rb_intern(cstr))));

## ◆ CALL_FLAG

#define CALL_FLAG | ( |  | n | ) | if (vm_ci_flag(ci) & VM_CALL_##n) rb_ary_push(flags, rb_str_new2(#n))

## ◆ CHECK_ARRAY

#define CHECK_ARRAY | ( |  | v | ) | rb_to_array_type(v)

Definition at line 918 of file iseq.c.

## ◆ CHECK_EVENT

#define CHECK_EVENT | ( |  | ev | ) | if (events & ev) rb_ary_push(body, ID2SYM(rb_intern(#ev)));

## ◆ CHECK_HASH

#define CHECK_HASH | ( |  | v | ) | rb_to_hash_type(v)

Definition at line 919 of file iseq.c.

## ◆ CHECK_STRING

#define CHECK_STRING | ( |  | v | ) | rb_str_to_str(v)

Definition at line 920 of file iseq.c.

## ◆ CHECK_SYMBOL

#define CHECK_SYMBOL | ( |  | v | ) | rb_to_symbol_type(v)

Definition at line 921 of file iseq.c.

## ◆ DECL_SYMBOL

#define DECL_SYMBOL | ( |  | name | ) | static ID sym_##name

Definition at line 2603 of file iseq.c.

## ◆ hidden_obj_p

#define hidden_obj_p | ( |  | obj | ) | (!SPECIAL_CONST_P(obj) && !RBASIC(obj)->klass)

Definition at line 56 of file iseq.c.

## ◆ INIT_SYMBOL

#define INIT_SYMBOL | ( |  | name | ) | sym_##name = rb_intern(#name)

Definition at line 2606 of file iseq.c.

## ◆ INITIALIZED

#define INITIALIZED /* volatile */

## ◆ INSN_CODE

#define INSN_CODE | ( |  | insn | ) | (insn)

## ◆ PARAM

#define PARAM | ( |  | i,
|  |  | type
| ) |  |

Value:
( \
PARAM_TYPE(type), \
rb_id2str(PARAM_ID(i)) ? \
rb_ary_push(a, ID2SYM(PARAM_ID(i))) : \
a)
ID2SYM
#define ID2SYM
Definition: symbol.h:44
PARAM_ID
#define PARAM_ID(i)
ruby::backward::cxxanyargs::type
VALUE type(ANYARGS)
ANYARGS-ed function type.
Definition: cxxanyargs.hpp:56

## ◆ PARAM_ID

#define PARAM_ID | ( |  | i | ) | body->local_table[(i)]

## ◆ PARAM_TYPE

#define PARAM_TYPE | ( |  | type | ) | rb_ary_push(a = rb_ary_new2(2), ID2SYM(type))

## ◆ RUBY_VM_INSNS_INFO

#define RUBY_VM_INSNS_INFO 1

Definition at line 12 of file iseq.c.

## ◆ SET_COMPILE_OPTION [1/2]

#define SET_COMPILE_OPTION | ( |  | o,
|  |  | h,
|  |  | mem
| ) |  |

Value:
{ VALUE flag = rb_hash_aref((h), ID2SYM(rb_intern(#mem))); \
if (flag == Qtrue) { (o)->mem = 1; } \
else if (flag == Qfalse) { (o)->mem = 0; } \
}
rb_hash_aref
VALUE rb_hash_aref(VALUE hash, VALUE key)
Definition: hash.c:2046
rb_intern
ID rb_intern(const char *)
Definition: symbol.c:785
Qtrue
#define Qtrue
Definition: special_consts.h:52
Qfalse
#define Qfalse
Definition: special_consts.h:50
VALUE
unsigned long VALUE
Definition: value.h:38

## ◆ SET_COMPILE_OPTION [2/2]

#define SET_COMPILE_OPTION | ( |  | o,
|  |  | h,
|  |  | mem
| ) |  | rb_hash_aset((h), ID2SYM(rb_intern(#mem)), (o)->mem ? Qtrue : Qfalse)

## ◆ SET_COMPILE_OPTION_NUM [1/2]

#define SET_COMPILE_OPTION_NUM | ( |  | o,
|  |  | h,
|  |  | mem
| ) |  |

Value:
{ VALUE num = rb_hash_aref(opt, ID2SYM(rb_intern(#mem))); \
if (!NIL_P(num)) (o)->mem = NUM2INT(num); \
}
num
big_t * num
Definition: enough.c:232
NUM2INT
#define NUM2INT
Definition: int.h:44
NIL_P
#define NIL_P
Definition: special_consts.h:46

## ◆ SET_COMPILE_OPTION_NUM [2/2]

#define SET_COMPILE_OPTION_NUM | ( |  | o,
|  |  | h,
|  |  | mem
| ) |  | rb_hash_aset((h), ID2SYM(rb_intern(#mem)), INT2NUM((o)->mem))

## Typedef Documentation

## ◆ insn_data_t

typedef struct insn_data_struct insn_data_t

## ◆ iseq_value_itr_t

typedef VALUE iseq_value_itr_t(void *ctx, VALUE obj)

Definition at line 158 of file iseq.c.

## ◆ rb_vm_insns_translator_t

typedef VALUE rb_vm_insns_translator_t(const void *addr)

Definition at line 159 of file iseq.c.

## Function Documentation

## ◆ Init_ISeq()

void Init_ISeq | ( | void |  | ) |

Definition at line 3605 of file iseq.c.

References CLASS_OF, rb_cISeq, rb_cObject, rb_cRubyVM, rb_define_class_under(), rb_define_method, rb_define_private_method, rb_define_singleton_method, rb_undef_alloc_func(), and rb_undef_method().

## ◆ rb_dump_literal()

VALUE rb_dump_literal | ( | VALUE | lit | ) |

Definition at line 83 of file node.c.

References FL_SINGLETON, FL_TEST, PRIsVALUE, rb_class_path(), rb_inspect(), rb_sprintf(), str, T_CLASS, T_ICLASS, and T_MODULE.

Referenced by rb_insn_operand_intern().

## ◆ rb_insn_operand_intern()

VALUE rb_insn_operand_intern | ( | const rb_iseq_t * | iseq,
|  | VALUE | insn,
|  | int | op_no,
|  | VALUE | op,
|  | int | len,
|  | size_t | pos,
|  | const VALUE * | pnop,
|  | VALUE | child
| ) |  |

Definition at line 1889 of file iseq.c.

References rb_builtin_function::argc, rb_iseq_struct::body, CALL_FLAG, rb_call_data::ci, CLASS_OF, DEFINED_CONST_FROM, DEFINED_FUNC, DEFINED_REF, FIXNUM_P, ID2SYM, INT2FIX, rb_iseq_constant_body::is_entries, rb_callinfo_kwarg::keyword_len, rb_callinfo_kwarg::keywords, rb_iseq_location_struct::label, len, rb_iseq_constant_body::location, rb_callinfo::mid, rb_builtin_function::name, NUM2INT, PRIdPTRDIFF, PRIdVALUE, PRIsVALUE, PRIuVALUE, Qundef, rb_ary_join(), rb_ary_new(), rb_ary_new_from_values(), rb_ary_push(), rb_bug(), rb_cISeq, rb_dump_literal(), rb_fstring_lit, rb_id2str, rb_insn_unified_local_var_level(), rb_inspect(), rb_iseq_defined_string(), rb_sprintf(), rb_str_new2, rb_str_new_cstr, rb_type_str(), types, VM_CALL_KWARG, and VM_ENV_DATA_SIZE.

Referenced by rb_iseq_disasm_insn().

## ◆ rb_insn_unified_local_var_level()

int rb_insn_unified_local_var_level | ( | VALUE |  | ) |

Referenced by rb_insn_operand_intern().

## ◆ rb_iseq_absolute_path()

VALUE rb_iseq_absolute_path | ( | const rb_iseq_t * | iseq | ) |

Definition at line 1099 of file iseq.c.

References rb_iseq_realpath().

## ◆ rb_iseq_add_local_tracepoint_recursively()

int rb_iseq_add_local_tracepoint_recursively | ( | const rb_iseq_t * | iseq,
|  | rb_event_flag_t | turnon_events,
|  | VALUE | tpval,
|  | unsigned int | target_line
| ) |  |

Definition at line 3266 of file iseq.c.

References trace_set_local_events_struct::n, Qnil, rb_funcall(), rb_intern(), rb_iseq_disasm(), trace_set_local_events_struct::target_line, trace_set_local_events_struct::tpval, and trace_set_local_events_struct::turnon_events.

## ◆ rb_iseq_base_label()

VALUE rb_iseq_base_label | ( | const rb_iseq_t * | iseq | ) |

Definition at line 1111 of file iseq.c.

References rb_iseq_location_struct::base_label, rb_iseq_struct::body, and rb_iseq_constant_body::location.

Referenced by rb_profile_frame_base_label().

## ◆ rb_iseq_clear_event_flags()

void rb_iseq_clear_event_flags | ( | const rb_iseq_t * | iseq,
|  | size_t | pos,
|  | rb_event_flag_t | reset
| ) |  |

Definition at line 1846 of file iseq.c.

References rb_iseq_struct::aux, iseq_insn_info_entry::events, rb_iseq_struct::exec, rb_iseq_struct::global_trace_events, and rb_iseq_trace_flag_cleared().

## ◆ rb_iseq_code_location()

void rb_iseq_code_location | ( | const rb_iseq_t * | iseq,
|  | int * | beg_pos_lineno,
|  | int * | beg_pos_column,
|  | int * | end_pos_lineno,
|  | int * | end_pos_column
| ) |  |

Definition at line 1136 of file iseq.c.

References rb_code_location_struct::beg_pos, rb_iseq_struct::body, rb_iseq_location_struct::code_location, rb_code_position_struct::column, rb_code_location_struct::end_pos, rb_code_position_struct::lineno, and rb_iseq_constant_body::location.

## ◆ rb_iseq_constant_body_alloc()

struct rb_iseq_constant_body * rb_iseq_constant_body_alloc | ( | void |  | ) |

Definition at line 486 of file iseq.c.

References ZALLOC.

## ◆ rb_iseq_coverage()

VALUE rb_iseq_coverage | ( | const rb_iseq_t * | iseq | ) |

Definition at line 1146 of file iseq.c.

References ISEQ_COVERAGE.

## ◆ rb_iseq_defined_string()

VALUE rb_iseq_defined_string | ( | enum defined_type | type | ) |

Definition at line 3087 of file iseq.c.

References numberof, OBJ_FREEZE, rb_gc_register_mark_object(), rb_str_new_cstr, ruby_xcalloc(), and str.

Referenced by rb_insn_operand_intern().

## ◆ rb_iseq_disasm()

VALUE rb_iseq_disasm | ( | const rb_iseq_t * | iseq | ) |

Definition at line 2335 of file iseq.c.

References rb_str_new, rb_str_resize(), RSTRING_LEN, and str.

Referenced by rb_iseq_add_local_tracepoint_recursively().

## ◆ rb_iseq_disasm_insn()

int rb_iseq_disasm_insn | ( | VALUE | ret,
|  | const VALUE * | code,
|  | size_t | pos,
|  | const rb_iseq_t * | iseq,
|  | VALUE | child
| ) |  |

Disassemble a instruction Iseq -> Iseq inspect object.

Definition at line 2078 of file iseq.c.

References len, PRIuSIZE, rb_insn_operand_intern(), rb_iseq_event_flags(), rb_iseq_line_no(), rb_str_cat2, rb_str_catf(), rb_str_concat(), rb_str_new, RSTRING_LEN, RSTRING_PTR, RUBY_EVENT_B_CALL, RUBY_EVENT_B_RETURN, RUBY_EVENT_C_CALL, RUBY_EVENT_C_RETURN, RUBY_EVENT_CALL, RUBY_EVENT_CLASS, RUBY_EVENT_COVERAGE_BRANCH, RUBY_EVENT_COVERAGE_LINE, RUBY_EVENT_END, RUBY_EVENT_LINE, RUBY_EVENT_RETURN, str, and types.

Referenced by rb_vmdebug_debug_print_pre().

## ◆ rb_iseq_event_flags()

rb_event_flag_t rb_iseq_event_flags | ( | const rb_iseq_t * | iseq,
|  | size_t | pos
| ) |  |

Definition at line 1834 of file iseq.c.

References iseq_insn_info_entry::events.

Referenced by rb_iseq_disasm_insn(), and rb_iseq_trace_set().

## ◆ rb_iseq_first_lineno()

VALUE rb_iseq_first_lineno | ( | const rb_iseq_t * | iseq | ) |

Definition at line 1117 of file iseq.c.

References rb_iseq_struct::body, rb_iseq_location_struct::first_lineno, and rb_iseq_constant_body::location.

Referenced by rb_profile_frame_first_lineno(), and rb_vm_get_sourceline().

## ◆ rb_iseq_free()

void rb_iseq_free | ( | const rb_iseq_t * | iseq | ) |

Definition at line 105 of file iseq.c.

References rb_iseq_struct::aux, rb_iseq_constant_body::iseq_insn_info::body, rb_iseq_struct::body, rb_iseq_constant_body::call_data, rb_iseq_constant_body::catch_table, rb_iseq_struct::exec, rb_iseq_constant_body::insns_info, rb_iseq_constant_body::is_entries, rb_iseq_constant_body::iseq_encoded, ISEQ_EXECUTABLE_P, rb_iseq_constant_body::keyword, LIKELY, rb_iseq_struct::local_hooks, rb_iseq_constant_body::local_table, NULL, rb_iseq_constant_body::opt_table, rb_iseq_constant_body::outer_variables, rb_iseq_constant_body::param, rb_iseq_constant_body::iseq_insn_info::positions, rb_hook_list_free(), rb_id_table_free(), rb_iseq_shared_exc_local_tbl, RUBY_FREE_ENTER, RUBY_FREE_LEAVE, and ruby_xfree().

## ◆ rb_iseq_init_trace()

void rb_iseq_init_trace | ( | rb_iseq_t * | iseq | ) |

Definition at line 675 of file iseq.c.

References rb_iseq_struct::aux, rb_iseq_struct::exec, rb_iseq_struct::global_trace_events, ISEQ_TRACE_EVENTS, rb_iseq_trace_set(), and ruby_vm_event_enabled_global_flags.

Referenced by rb_ibf_load_iseq_complete().

## ◆ rb_iseq_insns_info_encode_positions()

void rb_iseq_insns_info_encode_positions | ( | const rb_iseq_t * | iseq | ) |

Definition at line 646 of file iseq.c.

References rb_iseq_struct::body, if(), rb_iseq_constant_body::insns_info, rb_iseq_constant_body::iseq_size, NULL, rb_iseq_constant_body::iseq_insn_info::positions, ruby_xfree(), and rb_iseq_constant_body::iseq_insn_info::size.

## ◆ rb_iseq_label()

VALUE rb_iseq_label | ( | const rb_iseq_t * | iseq | ) |

Definition at line 1105 of file iseq.c.

References rb_iseq_struct::body, rb_iseq_location_struct::label, and rb_iseq_constant_body::location.

Referenced by rb_profile_frame_label().

## ◆ rb_iseq_line_no()

unsigned int rb_iseq_line_no | ( | const rb_iseq_t * | iseq,
|  | size_t | pos
| ) |  |

Definition at line 1821 of file iseq.c.

References iseq_insn_info_entry::line_no.

Referenced by rb_iseq_disasm_insn().

## ◆ rb_iseq_load()

VALUE rb_iseq_load | ( | VALUE | data,
|  | VALUE | parent,
|  | VALUE | opt
| ) |  |

Definition at line 1032 of file iseq.c.

References NULL, and RTEST.

## ◆ rb_iseq_load_iseq()

const rb_iseq_t * rb_iseq_load_iseq | ( | VALUE | fname | ) |

Definition at line 907 of file iseq.c.

References NULL, rb_check_funcall(), rb_cISeq, rb_intern(), RBASIC_CLASS, and SPECIAL_CONST_P.

## ◆ rb_iseq_mark()

void rb_iseq_mark | ( | const rb_iseq_t * | iseq | ) |

Definition at line 332 of file iseq.c.

References rb_iseq_struct::aux, rb_iseq_location_struct::base_label, rb_iseq_struct::body, rb_iseq_constant_body::call_data, rb_iseq_constant_body::catch_table, iseq_compile_data::catch_table_ary, rb_call_data::cc, rb_call_data::ci, rb_iseq_constant_body::ci_size, rb_iseq_constant_body::coverage, iseq_compile_data::err_info, rb_iseq_struct::exec, FL_TEST, FL_TEST_RAW, rb_iseq_constant_body::flags, rb_iseq_constant_body::has_kw, iseq_compile_data::insn, iseq_catch_table_entry::iseq, ISEQ_EXECUTABLE_P, ISEQ_MARKABLE_ISEQ, ISEQ_NOT_LOADED_YET, ISEQ_USE_COMPILE_DATA, rb_iseq_constant_body::keyword, rb_iseq_location_struct::label, rb_iseq_struct::loader, rb_iseq_struct::local_hooks, rb_iseq_constant_body::location, NULL, rb_iseq_struct::obj, rb_iseq_constant_body::param, rb_iseq_constant_body::parent_iseq, rb_iseq_location_struct::pathobj, rb_iseq_constant_body::pc2branchindex, rb_gc_mark(), rb_gc_mark_movable(), rb_hook_list_mark(), rb_iseq_mark_insn_storage(), rb_vm_empty_cc(), RTEST, RUBY_MARK_ENTER, RUBY_MARK_LEAVE, RUBY_MARK_MOVABLE_UNLESS_NULL, RUBY_MARK_UNLESS_NULL, SPECIAL_CONST_P, iseq_compile_data::storage_head, UNALIGNED_MEMBER_PTR, rb_iseq_constant_body::variable, VM_ASSERT, and rb_iseq_struct::wrapper.

## ◆ rb_iseq_memsize()

size_t rb_iseq_memsize | ( | const rb_iseq_t * | iseq | ) |

Definition at line 442 of file iseq.c.

References rb_iseq_struct::body, rb_iseq_constant_body::catch_table, rb_iseq_constant_body::ci_size, rb_iseq_constant_body::insns_info, int(), rb_iseq_constant_body::is_size, ISEQ_EXECUTABLE_P, rb_iseq_constant_body::iseq_size, rb_iseq_constant_body::keyword, rb_iseq_constant_body::local_table_size, iseq_compile_data_storage::next, iseq_compile_data::node, offsetof, rb_iseq_constant_body::opt_num, rb_iseq_constant_body::param, iseq_compile_data_storage::size, rb_iseq_constant_body::iseq_insn_info::size, and iseq_compile_data::storage_head.

## ◆ rb_iseq_method_name()

VALUE rb_iseq_method_name | ( | const rb_iseq_t * | iseq | ) |

Definition at line 1123 of file iseq.c.

References rb_iseq_location_struct::base_label, rb_iseq_struct::body, rb_iseq_constant_body::ISEQ_TYPE_METHOD, rb_iseq_constant_body::local_iseq, rb_iseq_constant_body::location, Qnil, and rb_iseq_constant_body::type.

Referenced by rb_profile_frame_method_name().

## ◆ rb_iseq_new()

rb_iseq_t * rb_iseq_new | ( | const rb_ast_body_t * | ast,
|  | VALUE | name,
|  | VALUE | path,
|  | VALUE | realpath,
|  | const rb_iseq_t * | parent,
|  | enum iseq_type | type
| ) |  |

Definition at line 809 of file iseq.c.

References INT2FIX, name, and rb_iseq_new_with_opt().

Referenced by Init_VM(), rb_binding_add_dynavars(), and rb_vm_call_cfunc().

## ◆ rb_iseq_new_eval()

rb_iseq_t * rb_iseq_new_eval | ( | const rb_ast_body_t * | ast,
|  | VALUE | name,
|  | VALUE | path,
|  | VALUE | realpath,
|  | VALUE | first_lineno,
|  | const rb_iseq_t * | parent,
|  | int | isolated_depth
| ) |  |

Definition at line 841 of file iseq.c.

References rb_iseq_constant_body::ISEQ_TYPE_EVAL, name, and rb_iseq_new_with_opt().

## ◆ rb_iseq_new_main()

rb_iseq_t * rb_iseq_new_main | ( | const rb_ast_body_t * | ast,
|  | VALUE | path,
|  | VALUE | realpath,
|  | const rb_iseq_t * | parent
| ) |  |

Definition at line 833 of file iseq.c.

References INT2FIX, rb_iseq_constant_body::ISEQ_TYPE_MAIN, rb_fstring_lit, and rb_iseq_new_with_opt().

## ◆ rb_iseq_new_top()

rb_iseq_t * rb_iseq_new_top | ( | const rb_ast_body_t * | ast,
|  | VALUE | name,
|  | VALUE | path,
|  | VALUE | realpath,
|  | const rb_iseq_t * | parent
| ) |  |

Definition at line 817 of file iseq.c.

References rb_iseq_constant_body::coverage, COVERAGE_TARGET_ONESHOT_LINES, INT2FIX, rb_iseq_constant_body::ISEQ_TYPE_TOP, len, rb_ast_body_struct::line_count, name, rb_default_coverage(), rb_get_coverage_mode(), rb_get_coverages(), rb_hash_aset(), rb_iseq_new_with_opt(), and RTEST.

Referenced by rb_binding_add_dynavars().

## ◆ rb_iseq_new_with_callback()

rb_iseq_t * rb_iseq_new_with_callback | ( | const struct rb_iseq_new_with_callback_callback_func * | ifunc,
|  | VALUE | name,
|  | VALUE | path,
|  | VALUE | realpath,
|  | VALUE | first_lineno,
|  | const rb_iseq_t * | parent,
|  | enum iseq_type | type,
|  | const rb_compile_option_t * | option
| ) |  |

Definition at line 888 of file iseq.c.

References iseq_alloc(), name, NULL, and rb_iseq_compile_callback().

## ◆ rb_iseq_new_with_opt()

rb_iseq_t * rb_iseq_new_with_opt | ( | const rb_ast_body_t * | ast,
|  | VALUE | name,
|  | VALUE | path,
|  | VALUE | realpath,
|  | VALUE | first_lineno,
|  | const rb_iseq_t * | parent,
|  | int | isolated_depth,
|  | enum iseq_type | type,
|  | const rb_compile_option_t * | option
| ) |  |

Definition at line 862 of file iseq.c.

References rb_ast_body_struct::compile_option, iseq_alloc(), name, RNode::nd_loc, nd_node_id, NULL, rb_iseq_compile_node(), and rb_ast_body_struct::root.

Referenced by rb_iseq_new(), rb_iseq_new_eval(), rb_iseq_new_main(), and rb_iseq_new_top().

## ◆ rb_iseq_parameters()

VALUE rb_iseq_parameters | ( | const rb_iseq_t * | iseq,
|  | int | is_proc
| ) |  |

Definition at line 2993 of file iseq.c.

References rb_iseq_constant_body::accepts_no_kwarg, rb_iseq_constant_body::block_start, rb_iseq_struct::body, CONST_ID, rb_iseq_constant_body::flags, rb_iseq_constant_body::has_block, rb_iseq_constant_body::has_kw, rb_iseq_constant_body::has_kwrest, rb_iseq_constant_body::has_rest, ID2SYM, key, rb_iseq_constant_body::keyword, rb_iseq_constant_body::lead_num, rb_iseq_constant_body::opt_num, PARAM, rb_iseq_constant_body::param, PARAM_ID, PARAM_TYPE, rb_iseq_constant_body::post_num, rb_iseq_constant_body::post_start, Qnil, rb_ary_new2, rb_ary_push(), rb_id2str, rb_iseq_constant_body::rest_start, and rb_iseq_constant_body::size.

Referenced by rb_tracearg_parameters().

## ◆ rb_iseq_path()

VALUE rb_iseq_path | ( | const rb_iseq_t * | iseq | ) |

Definition at line 1087 of file iseq.c.

References rb_iseq_struct::body, rb_iseq_constant_body::location, and rb_iseq_location_struct::pathobj.

Referenced by rb_block_to_s(), rb_method_definition_set(), rb_profile_frame_path(), rb_resolve_me_location(), rb_source_location(), and rb_sourcefile().

## ◆ rb_iseq_pathobj_new()

VALUE rb_iseq_pathobj_new | ( | VALUE | path,
|  | VALUE | realpath
| ) |  |

Definition at line 502 of file iseq.c.

References NIL_P, Qnil, rb_ary_new_from_args, rb_fstring(), rb_obj_freeze(), rb_str_cmp(), T_STRING, and VM_ASSERT.

Referenced by rb_iseq_pathobj_set().

## ◆ rb_iseq_pathobj_set()

void rb_iseq_pathobj_set | ( | const rb_iseq_t * | iseq,
|  | VALUE | path,
|  | VALUE | realpath
| ) |  |

Definition at line 521 of file iseq.c.

References rb_iseq_struct::body, rb_iseq_constant_body::location, rb_iseq_location_struct::pathobj, rb_iseq_pathobj_new(), and RB_OBJ_WRITE.

Referenced by rb_vm_set_progname().

## ◆ rb_iseq_realpath()

VALUE rb_iseq_realpath | ( | const rb_iseq_t * | iseq | ) |

Definition at line 1093 of file iseq.c.

References rb_iseq_struct::body, rb_iseq_constant_body::location, and rb_iseq_location_struct::pathobj.

Referenced by rb_current_realfilepath(), rb_iseq_absolute_path(), rb_profile_frame_absolute_path(), and rb_vm_set_progname().

## ◆ rb_iseq_remove_coverage_all()

void rb_iseq_remove_coverage_all | ( | void |  | ) |

Definition at line 1170 of file iseq.c.

References NULL, and rb_objspace_each_objects().

Referenced by rb_reset_coverages().

## ◆ rb_iseq_remove_local_tracepoint_recursively()

int rb_iseq_remove_local_tracepoint_recursively | ( | const rb_iseq_t * | iseq,
|  | VALUE | tpval
| ) |  |

Definition at line 3322 of file iseq.c.

References trace_clear_local_events_struct::n, and trace_clear_local_events_struct::tpval.

## ◆ rb_iseq_trace_flag_cleared()

void rb_iseq_trace_flag_cleared | ( | const rb_iseq_t * | iseq,
|  | size_t | pos
| ) |  |

Definition at line 3204 of file iseq.c.

References rb_iseq_struct::body, and rb_iseq_constant_body::iseq_encoded.

Referenced by rb_iseq_clear_event_flags().

## ◆ rb_iseq_trace_set()

void rb_iseq_trace_set | ( | const rb_iseq_t * | iseq,
|  | rb_event_flag_t | turnon_events
| ) |  |

Definition at line 3333 of file iseq.c.

References rb_iseq_struct::aux, rb_iseq_struct::body, rb_hook_list_struct::events, rb_iseq_struct::exec, rb_iseq_struct::global_trace_events, rb_iseq_constant_body::iseq_encoded, ISEQ_EXECUTABLE_P, rb_iseq_constant_body::iseq_size, rb_iseq_struct::local_hooks, and rb_iseq_event_flags().

Referenced by rb_iseq_init_trace().

## ◆ rb_iseq_trace_set_all()

void rb_iseq_trace_set_all | ( | rb_event_flag_t | turnon_events | ) |

Definition at line 3379 of file iseq.c.

References rb_objspace_each_objects().

## ◆ rb_iseq_update_references()

void rb_iseq_update_references | ( | rb_iseq_t * | iseq | ) |

Definition at line 257 of file iseq.c.

References rb_iseq_location_struct::base_label, rb_iseq_struct::body, rb_iseq_constant_body::call_data, rb_iseq_constant_body::catch_table, rb_call_data::cc, rb_call_data::ci, rb_iseq_constant_body::ci_size, rb_iseq_constant_body::coverage, FL_TEST, rb_iseq_constant_body::flags, rb_iseq_constant_body::has_kw, iseq_catch_table_entry::iseq, ISEQ_MARKABLE_ISEQ, rb_iseq_constant_body::iseq_size, rb_iseq_constant_body::keyword, rb_iseq_location_struct::label, rb_iseq_constant_body::local_iseq, rb_iseq_constant_body::location, NULL, rb_iseq_constant_body::param, rb_iseq_constant_body::parent_iseq, rb_iseq_location_struct::pathobj, rb_iseq_constant_body::pc2branchindex, Qundef, rb_gc_location(), SPECIAL_CONST_P, UNALIGNED_MEMBER_PTR, and rb_iseq_constant_body::variable.

## ◆ rb_iseqw_to_iseq()

const rb_iseq_t * rb_iseqw_to_iseq | ( | VALUE | iseqw | ) |

Definition at line 1410 of file iseq.c.

## ◆ rb_vm_encoded_insn_data_table_init()

void rb_vm_encoded_insn_data_table_init | ( | void |  | ) |

Definition at line 3139 of file iseq.c.

References insn_data_struct::insn, INSN_CODE, insn_data_struct::insn_len, int(), insn_data_struct::notrace_encoded_insn, rb_vm_get_insns_address_table(), st_add_direct, st_init_numtable_with_size, and insn_data_struct::trace_encoded_insn.

Referenced by ruby_setup().

## ◆ rb_vm_insn_addr2insn()

int rb_vm_insn_addr2insn | ( | const void * | addr | ) |

Definition at line 3172 of file iseq.c.

References insn_data_struct::insn, key, rb_bug(), and st_lookup.

Referenced by rb_iseq_original_iseq().

## ◆ ruby_node_name()

const char * ruby_node_name | ( | int | node | ) |

Definition at line 2593 of file iseq.c.

References rb_bug().

Referenced by rb_ast_node_type_change(), and ruby_debug_print_node().

## Variable Documentation

## ◆ rb_cISeq

VALUE rb_cISeq

Definition at line 46 of file iseq.c.

Referenced by Init_ISeq(), rb_insn_operand_intern(), and rb_iseq_load_iseq().