Ruby 2.0.0p247(2013-06-27revision41674)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

Data Structures | Macros | Functions | Variables
iseq.c File Reference
`#include "ruby/ruby.h"`
`#include "internal.h"`
`#include "eval_intern.h"`
`#include "gc.h"`
`#include "vm_core.h"`
`#include "iseq.h"`
`#include "insns.inc"`
`#include "insns_info.inc"`
`#include "node_name.inc"`
Include dependency graph for iseq.c:

Go to the source code of this file.

## Data Structures
struct | set_specifc_data

## Macros
#define | numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
#define | ISEQ_MAJOR_VERSION 2
#define | ISEQ_MINOR_VERSION 0
#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_convert_type((v), T_ARRAY, "Array", "to_ary")
#define | CHECK_STRING(v) rb_convert_type((v), T_STRING, "String", "to_str")
#define | CHECK_SYMBOL(v) rb_convert_type((v), T_SYMBOL, "Symbol", "to_sym")
#define | DECL_SYMBOL(name) static VALUE sym_##name
#define | INIT_SYMBOL(name) sym_##name = ID2SYM(rb_intern(#name))
#define | PARAM_TYPE(type) rb_ary_push(a = rb_ary_new2(2), ID2SYM(type))
#define | PARAM_ID(i) iseq->local_table[(i)]
#define | PARAM(i, type)
#define | ALLOC_AND_COPY(dst, src, type, size)

## Functions
static VALUE | obj_resurrect (VALUE obj)
static void | compile_data_free (struct iseq_compile_data *compile_data)
static void | iseq_free (void *ptr)
static void | iseq_mark (void *ptr)
static size_t | iseq_memsize (const void *ptr)
static VALUE | iseq_alloc (VALUE klass)
static rb_iseq_location_t * | iseq_location_setup (rb_iseq_t *iseq, VALUE path, VALUE absolute_path, VALUE name, size_t first_lineno)
static void | set_relation (rb_iseq_t *iseq, const VALUE parent)
static VALUE | prepare_iseq_build (rb_iseq_t *iseq, VALUE name, VALUE path, VALUE absolute_path, VALUE first_lineno, VALUE parent, enum iseq_type type, VALUE block_opt, const rb_compile_option_t *option)
static VALUE | cleanup_iseq_build (rb_iseq_t *iseq)
static void | make_compile_option (rb_compile_option_t *option, VALUE opt)
static VALUE | make_compile_option_value (rb_compile_option_t *option)
VALUE | rb_iseq_new (NODE *node, VALUE name, VALUE path, VALUE absolute_path, VALUE parent, enum iseq_type type)
VALUE | rb_iseq_new_top (NODE *node, VALUE name, VALUE path, VALUE absolute_path, VALUE parent)
VALUE | rb_iseq_new_main (NODE *node, VALUE path, VALUE absolute_path)
static VALUE | rb_iseq_new_with_bopt_and_opt (NODE *node, VALUE name, VALUE path, VALUE absolute_path, VALUE first_lineno, VALUE parent, enum iseq_type type, VALUE bopt, const rb_compile_option_t *option)
VALUE | rb_iseq_new_with_opt (NODE *node, VALUE name, VALUE path, VALUE absolute_path, VALUE first_lineno, VALUE parent, enum iseq_type type, const rb_compile_option_t *option)
VALUE | rb_iseq_new_with_bopt (NODE *node, VALUE name, VALUE path, VALUE absolute_path, VALUE first_lineno, VALUE parent, enum iseq_type type, VALUE bopt)
static VALUE | CHECK_INTEGER (VALUE v)
static VALUE | iseq_load (VALUE self, VALUE data, VALUE parent, VALUE opt)
static VALUE | iseq_s_load (int argc, VALUE *argv, VALUE self)
VALUE | rb_iseq_load (VALUE data, VALUE parent, VALUE opt)
static NODE * | parse_string (VALUE str, const char *file, int line)
VALUE | rb_iseq_compile_with_option (VALUE src, VALUE file, VALUE absolute_path, VALUE line, rb_block_t *base_block, VALUE opt)
VALUE | rb_iseq_compile (VALUE src, VALUE file, VALUE line)
VALUE | rb_iseq_compile_on_base (VALUE src, VALUE file, VALUE line, rb_block_t *base_block)
static VALUE | iseq_s_compile (int argc, VALUE *argv, VALUE self)
static VALUE | iseq_s_compile_file (int argc, VALUE *argv, VALUE self)
static VALUE | iseq_s_compile_option_set (VALUE self, VALUE opt)
static VALUE | iseq_s_compile_option_get (VALUE self)
static rb_iseq_t * | iseq_check (VALUE val)
static VALUE | iseq_eval (VALUE self)
static VALUE | iseq_inspect (VALUE self)
static VALUE | iseq_path (VALUE self)
static VALUE | iseq_absolute_path (VALUE self)
static VALUE | iseq_label (VALUE self)
static VALUE | iseq_base_label (VALUE self)
static VALUE | iseq_first_lineno (VALUE self)
static VALUE | iseq_data_to_ary (rb_iseq_t *iseq)
static VALUE | iseq_to_a (VALUE self)
int | rb_iseq_first_lineno (const rb_iseq_t *iseq)
static struct iseq_line_info_entry * | get_line_info (const rb_iseq_t *iseq, size_t pos)
static unsigned int | find_line_no (const rb_iseq_t *iseq, size_t pos)
unsigned int | rb_iseq_line_no (const rb_iseq_t *iseq, size_t pos)
static VALUE | id_to_name (ID id, VALUE default_value)
VALUE | insn_operand_intern (rb_iseq_t *iseq, VALUE insn, int op_no, VALUE op, int len, size_t pos, VALUE *pnop, VALUE child)
int | rb_iseq_disasm_insn (VALUE ret, VALUE *iseq, size_t pos, rb_iseq_t *iseqdat, VALUE child)
| Disassemble a instruction Iseq -> Iseq inspect object. More...
static const char * | catch_type (int type)
VALUE | rb_iseq_disasm (VALUE self)
static VALUE | iseq_s_of (VALUE klass, VALUE body)
static VALUE | iseq_s_disasm (VALUE klass, VALUE body)
const char * | ruby_node_name (int node)
static VALUE | register_label (struct st_table *table, unsigned long idx)
static VALUE | exception_type2symbol (VALUE type)
static int | cdhash_each (VALUE key, VALUE value, VALUE ary)
VALUE | rb_iseq_clone (VALUE iseqval, VALUE newcbase)
VALUE | rb_iseq_parameters (const rb_iseq_t *iseq, int is_proc)
VALUE | rb_iseq_defined_string (enum defined_type type)
VALUE | rb_iseq_build_for_ruby2cext (const rb_iseq_t *iseq_template, const rb_insn_func_t *func, const struct iseq_line_info_entry *line_info_table, const char **local_table, const VALUE *arg_opt_table, const struct iseq_catch_table_entry *catch_table, const char *name, const char *path, const unsigned short first_lineno)
int | rb_iseq_line_trace_each (VALUE iseqval, int(*func)(int line, rb_event_flag_t *events_ptr, void *d), void *data)
static int | collect_trace (int line, rb_event_flag_t *events_ptr, void *ptr)
VALUE | rb_iseq_line_trace_all (VALUE iseqval)
static int | line_trace_specify (int line, rb_event_flag_t *events_ptr, void *ptr)
VALUE | rb_iseq_line_trace_specify (VALUE iseqval, VALUE pos, VALUE set)
void | Init_ISeq (void)

## Variables
VALUE | rb_cISeq
static const rb_data_type_t | iseq_data_type
static rb_compile_option_t | COMPILE_OPTION_DEFAULT
static const rb_compile_option_t | COMPILE_OPTION_FALSE = {0}

## Macro Definition Documentation

#define ALLOC_AND_COPY | ( |  | dst,
|  |  | src,
|  |  | type,
|  |  | size
| ) |  |

Value:
do { \
if (size) { \
(dst) = ALLOC_N(type, (size)); \
MEMCPY((dst), (src), type, (size)); \
} \
} while (0)

Referenced by rb_iseq_build_for_ruby2cext().

#define CHECK_ARRAY | ( |  | v) |  | rb_convert_type((v), T_ARRAY, "Array", "to_ary")

Definition at line 457 of file iseq.c.

Referenced by iseq_load().

#define CHECK_STRING | ( |  | v) |  | rb_convert_type((v), T_STRING, "String", "to_str")

Definition at line 458 of file iseq.c.

Referenced by iseq_load().

#define CHECK_SYMBOL | ( |  | v) |  | rb_convert_type((v), T_SYMBOL, "Symbol", "to_sym")

Definition at line 459 of file iseq.c.

Referenced by iseq_load().

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

Definition at line 1576 of file iseq.c.

Referenced by iseq_data_to_ary().

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

Definition at line 31 of file iseq.c.

Referenced by obj_resurrect().

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

Definition at line 1579 of file iseq.c.

Referenced by iseq_data_to_ary().

#define ISEQ_MAJOR_VERSION 2

Definition at line 26 of file iseq.c.

Referenced by iseq_data_to_ary().

#define ISEQ_MINOR_VERSION 0

Definition at line 27 of file iseq.c.

Referenced by iseq_data_to_ary().

#define numberof | ( |  | array) |  | (int)(sizeof(array) / sizeof((array)[0]))

Definition at line 21 of file iseq.c.

Referenced by rb_iseq_defined_string().

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

Value:
( \
PARAM_TYPE(type), \
rb_id2str(PARAM_ID(i)) ? \
rb_ary_push(a, ID2SYM(PARAM_ID(i))) : \
a)

Referenced by rb_iseq_parameters().

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

Referenced by rb_iseq_parameters().

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

Referenced by rb_iseq_parameters().

#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; } \
}

Referenced by make_compile_option(), and make_compile_option_value().

#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
| ) |  |

Value:
{ VALUE num = rb_hash_aref(opt, ID2SYM(rb_intern(#mem))); \
if (!NIL_P(num)) (o)->mem = NUM2INT(num); \
}

Referenced by make_compile_option(), and make_compile_option_value().

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

## Function Documentation

static const char* catch_type | ( | int | type) |  |
| static

Definition at line 1302 of file iseq.c.

References rb_bug().

Referenced by iseq_set_exception_table(), and rb_iseq_disasm().

static int cdhash_each | ( | VALUE | key,
|  | VALUE | value,
|  | VALUE | ary
| ) |  |
| static

Definition at line 1612 of file iseq.c.

References obj_resurrect(), rb_ary_push(), and ST_CONTINUE.

Referenced by iseq_data_to_ary().

static VALUE CHECK_INTEGER | ( | VALUE | v) |  |
| inline static

Definition at line 460 of file iseq.c.

References NUM2LONG, and v.

Referenced by iseq_load().

static VALUE cleanup_iseq_build | ( | rb_iseq_t * | iseq) |  |
| static

Definition at line 306 of file iseq.c.

References rb_iseq_struct::compile_data, compile_data_free(), err, iseq_compile_data::err_info, rb_iseq_struct::location, rb_iseq_location_struct::path, Qtrue, rb_exc_raise(), rb_funcall2(), rb_intern, and RTEST.

Referenced by iseq_load(), and rb_iseq_new_with_bopt_and_opt().

static int collect_trace | ( | int | line,
|  | rb_event_flag_t * | events_ptr,
|  | void * | ptr
| ) |  |
| static

Definition at line 2123 of file iseq.c.

References INT2NUM, rb_ary_push(), and result.

Referenced by rb_iseq_line_trace_all().

static void compile_data_free | ( | struct iseq_compile_data * | compile_data) |  |
| static

Definition at line 50 of file iseq.c.

References iseq_compile_data_storage::next, ruby_xfree(), and iseq_compile_data::storage_head.

Referenced by cleanup_iseq_build(), and iseq_free().

static VALUE exception_type2symbol | ( | VALUE | type) |  |
| static

Definition at line 1595 of file iseq.c.

References iseq_catch_table_entry::CATCH_TYPE_BREAK, iseq_catch_table_entry::CATCH_TYPE_ENSURE, iseq_catch_table_entry::CATCH_TYPE_NEXT, iseq_catch_table_entry::CATCH_TYPE_REDO, iseq_catch_table_entry::CATCH_TYPE_RESCUE, iseq_catch_table_entry::CATCH_TYPE_RETRY, CONST_ID, id, ID2SYM, and rb_bug().

Referenced by iseq_data_to_ary().

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

Definition at line 1086 of file iseq.c.

References get_line_info(), and iseq_line_info_entry::line_no.

Referenced by rb_iseq_disasm_insn(), rb_iseq_line_no(), and rb_iseq_line_trace_each().

static struct iseq_line_info_entry* get_line_info | ( | const rb_iseq_t * | iseq,
|  | size_t | pos
| ) |  |
| static

Definition at line 1051 of file iseq.c.

References debug, i, rb_iseq_struct::line_info_size, rb_iseq_struct::line_info_table, iseq_line_info_entry::line_no, iseq_line_info_entry::position, PRIdSIZE, and size.

Referenced by find_line_no().

static VALUE id_to_name | ( | ID | id,
|  | VALUE | default_value
| ) |  |
| static

Definition at line 1109 of file iseq.c.

References rb_id2str(), rb_str_inspect(), and rb_str_symname_p().

Referenced by insn_operand_intern(), and rb_iseq_disasm().

void Init_ISeq | ( | void | ) |  |

Definition at line 2227 of file iseq.c.

References iseq_absolute_path(), iseq_alloc(), iseq_base_label(), iseq_eval(), iseq_first_lineno(), iseq_inspect(), iseq_label(), iseq_path(), iseq_s_compile(), iseq_s_compile_file(), iseq_s_compile_option_get(), iseq_s_compile_option_set(), iseq_s_disasm(), iseq_s_load(), iseq_s_of(), iseq_to_a(), rb_cISeq, rb_cObject, rb_cRubyVM, rb_define_alloc_func(), rb_define_class_under(), rb_define_method(), rb_define_private_method(), rb_define_singleton_method(), rb_iseq_disasm(), rb_iseq_line_trace_all(), and rb_iseq_line_trace_specify().

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

Definition at line 1122 of file iseq.c.

References rb_call_info_struct::blockiseq, CLASS_OF, rb_call_info_struct::flag, i, rb_iseq_struct::ic_entries, rb_global_entry::id, ID2SYM, id_to_name(), INT2FIX, rb_iseq_location_struct::label, level, rb_iseq_struct::local_size, rb_iseq_struct::local_table, rb_iseq_struct::location, rb_call_info_struct::mid, obj_resurrect(), rb_call_info_struct::orig_argc, rb_iseq_struct::parent_iseq, PRIdPTRDIFF, PRIdVALUE, PRIsVALUE, PRIuVALUE, rb_ary_join(), rb_ary_new(), rb_ary_push(), rb_bug(), rb_cISeq, rb_id2name(), rb_id2str(), rb_inspect(), rb_sprintf(), rb_str_dup(), rb_str_new2, rb_iseq_struct::self, type, VM_CALL_ARGS_BLOCKARG, VM_CALL_ARGS_SKIP_SETUP, VM_CALL_ARGS_SPLAT, VM_CALL_FCALL, VM_CALL_OPT_SEND, VM_CALL_SUPER, VM_CALL_TAILCALL, and VM_CALL_VCALL.

Referenced by rb_iseq_disasm_insn().

static VALUE iseq_absolute_path | ( | VALUE | self) |  |
| static

Definition at line 861 of file iseq.c.

References rb_iseq_location_struct::absolute_path, GetISeqPtr, and rb_iseq_struct::location.

Referenced by Init_ISeq().

static VALUE iseq_alloc | ( | VALUE | klass) |  |
| static

Definition at line 180 of file iseq.c.

References TypedData_Make_Struct.

Referenced by Init_ISeq(), iseq_load(), rb_iseq_build_for_ruby2cext(), rb_iseq_clone(), and rb_iseq_new_with_bopt_and_opt().

static VALUE iseq_base_label | ( | VALUE | self) |  |
| static

Definition at line 920 of file iseq.c.

References rb_iseq_location_struct::base_label, GetISeqPtr, and rb_iseq_struct::location.

Referenced by Init_ISeq().

static rb_iseq_t* iseq_check | ( | VALUE | val) |  |
| static

Definition at line 770 of file iseq.c.

References GetISeqPtr, rb_iseq_location_struct::label, rb_iseq_struct::location, rb_eTypeError, and rb_raise().

Referenced by iseq_to_a(), and rb_iseq_disasm().

static VALUE iseq_data_to_ary | ( | rb_iseq_t * | iseq) |  |
| static

Definition at line 1620 of file iseq.c.

References rb_iseq_location_struct::absolute_path, rb_iseq_struct::arg_block, rb_iseq_struct::arg_opt_table, rb_iseq_struct::arg_opts, rb_iseq_struct::arg_post_len, rb_iseq_struct::arg_post_start, rb_iseq_struct::arg_rest, rb_iseq_struct::arg_simple, rb_iseq_struct::arg_size, rb_iseq_struct::argc, args, rb_call_info_struct::blockiseq, rb_iseq_struct::catch_table, rb_iseq_struct::catch_table_size, cdhash_each(), iseq_catch_table_entry::cont, DECL_SYMBOL, iseq_catch_table_entry::end, exception_type2symbol(), rb_iseq_location_struct::first_lineno, FIX2INT, rb_call_info_struct::flag, GetISeqPtr, hash(), i, rb_iseq_struct::ic_entries, rb_global_entry::id, ID2SYM, INIT_SYMBOL, INT2FIX, iseq_catch_table_entry::iseq, rb_iseq_struct::iseq, ISEQ_MAJOR_VERSION, ISEQ_MINOR_VERSION, rb_iseq_struct::iseq_size, rb_iseq_location_struct::label, rb_iseq_struct::line_info_table, iseq_line_info_entry::line_no, rb_iseq_struct::local_size, rb_iseq_struct::local_table, rb_iseq_struct::local_table_size, rb_iseq_struct::location, main(), rb_call_info_struct::mid, obj_resurrect(), rb_call_info_struct::orig_argc, rb_iseq_location_struct::path, iseq_line_info_entry::position, Qnil, RARRAY_LEN, RARRAY_LENINT, RARRAY_PTR, rb_ary_entry(), rb_ary_new(), rb_ary_new2(), rb_ary_push(), rb_ary_store(), rb_bug(), rb_hash_aset(), rb_hash_foreach(), rb_hash_new(), rb_id2str(), rb_intern, rb_str_new2, register_label(), iseq_catch_table_entry::sp, st_free_table(), st_init_numtable(), st_lookup(), rb_iseq_struct::stack_max, iseq_catch_table_entry::start, top, iseq_catch_table_entry::type, type, rb_iseq_struct::type, ULONG2NUM, and val.

Referenced by iseq_to_a().

static VALUE iseq_eval | ( | VALUE | self) |  |
| static

Definition at line 789 of file iseq.c.

References rb_iseq_eval(), and rb_secure().

Referenced by Init_ISeq().

static VALUE iseq_first_lineno | ( | VALUE | self) |  |
| static

Definition at line 938 of file iseq.c.

References rb_iseq_location_struct::first_lineno, GetISeqPtr, and rb_iseq_struct::location.

Referenced by Init_ISeq().

static void iseq_free | ( | void * | ptr) |  |
| static

Definition at line 65 of file iseq.c.

References rb_iseq_struct::arg_keyword_table, rb_iseq_struct::arg_opt_table, rb_iseq_struct::callinfo_entries, rb_iseq_struct::catch_table, rb_iseq_struct::compile_data, compile_data_free(), rb_iseq_struct::ic_entries, rb_iseq_struct::iseq, rb_iseq_struct::iseq_encoded, rb_iseq_location_struct::label, rb_iseq_struct::line_info_table, rb_iseq_struct::local_table, rb_iseq_struct::location, rb_iseq_struct::orig, rb_iseq_location_struct::path, RSTRING_PTR, RUBY_FREE_ENTER, RUBY_FREE_LEAVE, RUBY_FREE_UNLESS_NULL, RUBY_GC_INFO, and ruby_xfree().

static VALUE iseq_inspect | ( | VALUE | self) |  |
| static

Definition at line 800 of file iseq.c.

References GetISeqPtr, rb_iseq_location_struct::label, rb_iseq_struct::location, rb_iseq_location_struct::path, rb_obj_classname(), rb_sprintf(), and RSTRING_PTR.

Referenced by Init_ISeq(), and rb_iseq_disasm().

static VALUE iseq_label | ( | VALUE | self) |  |
| static

Definition at line 892 of file iseq.c.

References GetISeqPtr, rb_iseq_location_struct::label, and rb_iseq_struct::location.

Referenced by Init_ISeq().

static VALUE iseq_load | ( | VALUE | self,
|  | VALUE | data,
|  | VALUE | parent,
|  | VALUE | opt
| ) |  |
| static

Definition at line 462 of file iseq.c.

References args, CHECK_ARRAY, CHECK_INTEGER(), CHECK_STRING, CHECK_SYMBOL, cleanup_iseq_build(), FIXNUM_P, GetISeqPtr, i, ID2SYM, iseq_alloc(), make_compile_option(), name, NIL_P, prepare_iseq_build(), PRIsVALUE, Qnil, rb_ary_entry(), rb_eTypeError, rb_id2str(), rb_intern, rb_iseq_build_from_ary(), rb_raise(), rb_iseq_struct::self, st_init_numtable(), st_insert(), st_lookup(), SYM2ID, and type.

Referenced by iseq_s_load(), and rb_iseq_load().

static rb_iseq_location_t* iseq_location_setup | ( | rb_iseq_t * | iseq,
|  | VALUE | path,
|  | VALUE | absolute_path,
|  | VALUE | name,
|  | size_t | first_lineno
| ) |  |
| static

Definition at line 187 of file iseq.c.

References rb_iseq_location_struct::absolute_path, rb_iseq_location_struct::base_label, rb_iseq_location_struct::first_lineno, rb_iseq_location_struct::label, rb_iseq_struct::location, name, and rb_iseq_location_struct::path.

Referenced by prepare_iseq_build().

static void iseq_mark | ( | void * | ptr) |  |
| static

Definition at line 99 of file iseq.c.

References rb_iseq_location_struct::absolute_path, rb_iseq_location_struct::base_label, iseq_compile_data::catch_table_ary, rb_iseq_struct::compile_data, rb_iseq_struct::coverage, rb_iseq_struct::cref_stack, iseq_compile_data::err_info, rb_iseq_struct::klass, rb_iseq_location_struct::label, rb_iseq_struct::location, iseq_compile_data::mark_ary, rb_iseq_struct::mark_ary, rb_iseq_struct::orig, rb_iseq_location_struct::path, RSTRING_PTR, RUBY_GC_INFO, RUBY_MARK_ENTER, RUBY_MARK_LEAVE, and RUBY_MARK_UNLESS_NULL.

static size_t iseq_memsize | ( | const void * | ptr) |  |
| static

Definition at line 134 of file iseq.c.

References rb_iseq_struct::arg_opts, rb_iseq_struct::callinfo_size, rb_iseq_struct::catch_table_size, rb_iseq_struct::compile_data, rb_iseq_struct::ic_size, rb_iseq_struct::iseq, rb_iseq_struct::iseq_encoded, rb_iseq_struct::iseq_size, rb_iseq_struct::line_info_size, rb_iseq_struct::local_table_size, iseq_compile_data_storage::next, rb_iseq_struct::orig, size, iseq_compile_data_storage::size, and iseq_compile_data::storage_head.

static VALUE iseq_path | ( | VALUE | self) |  |
| static

Definition at line 837 of file iseq.c.

References GetISeqPtr, rb_iseq_struct::location, and rb_iseq_location_struct::path.

Referenced by Init_ISeq().

static VALUE iseq_s_compile | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | self
| ) |  |
| static

Definition at line 655 of file iseq.c.

References INT2FIX, NIL_P, Qnil, rb_iseq_compile_with_option(), rb_scan_args(), rb_secure(), and rb_str_new2.

Referenced by Init_ISeq().

static VALUE iseq_s_compile_file | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | self
| ) |  |
| static

Definition at line 689 of file iseq.c.

References f, FilePathValue, INT2FIX, make_compile_option(), NUM2INT, Qfalse, Qnil, rb_file_open_str(), rb_iseq_new_with_opt(), rb_parser_compile_file(), rb_parser_new(), rb_realpath_internal(), rb_scan_args(), rb_secure(), rb_str_new2, and StringValueCStr.

Referenced by Init_ISeq().

static VALUE iseq_s_compile_option_get | ( | VALUE | self) |  |
| static

Definition at line 764 of file iseq.c.

References make_compile_option_value().

Referenced by Init_ISeq().

static VALUE iseq_s_compile_option_set | ( | VALUE | self,
|  | VALUE | opt
| ) |  |
| static

Definition at line 746 of file iseq.c.

References make_compile_option(), and rb_secure().

Referenced by Init_ISeq().

static VALUE iseq_s_disasm | ( | VALUE | klass,
|  | VALUE | body
| ) |  |
| static

Definition at line 1559 of file iseq.c.

References iseq_s_of(), NIL_P, Qnil, and rb_iseq_disasm().

Referenced by Init_ISeq().

static VALUE iseq_s_load | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | self
| ) |  |
| static

Definition at line 550 of file iseq.c.

References iseq_load(), Qnil, and rb_scan_args().

Referenced by Init_ISeq().

static VALUE iseq_s_of | ( | VALUE | klass,
|  | VALUE | body
| ) |  |
| static

Definition at line 1484 of file iseq.c.

References rb_proc_t::block, GetProcPtr, iseq_catch_table_entry::iseq, rb_block_struct::iseq, Qnil, rb_method_get_iseq(), rb_obj_is_proc(), rb_secure(), RUBY_VM_NORMAL_ISEQ_P, and rb_iseq_struct::self.

Referenced by Init_ISeq(), and iseq_s_disasm().

static VALUE iseq_to_a | ( | VALUE | self) |  |
| static

Definition at line 1034 of file iseq.c.

References iseq_check(), iseq_data_to_ary(), and rb_secure().

Referenced by Init_ISeq().

static int line_trace_specify | ( | int | line,
|  | rb_event_flag_t * | events_ptr,
|  | void * | ptr
| ) |  |
| static

Definition at line 2150 of file iseq.c.

References set_specifc_data::pos, set_specifc_data::prev, RUBY_EVENT_SPECIFIED_LINE, and set_specifc_data::set.

Referenced by rb_iseq_line_trace_specify().

static void make_compile_option | ( | rb_compile_option_t * | option,
|  | VALUE | opt
| ) |  |
| static

Definition at line 333 of file iseq.c.

References CLASS_OF, COMPILE_OPTION_DEFAULT, COMPILE_OPTION_FALSE, Qfalse, Qnil, Qtrue, rb_cHash, rb_eTypeError, rb_raise(), SET_COMPILE_OPTION, and SET_COMPILE_OPTION_NUM.

Referenced by iseq_load(), iseq_s_compile_file(), iseq_s_compile_option_set(), and rb_iseq_compile_with_option().

static VALUE make_compile_option_value | ( | rb_compile_option_t * | option) |  |
| static

Definition at line 374 of file iseq.c.

References rb_hash_new(), SET_COMPILE_OPTION, and SET_COMPILE_OPTION_NUM.

Referenced by iseq_s_compile_option_get().

static VALUE obj_resurrect | ( | VALUE | obj) |  |
| inline static

Definition at line 34 of file iseq.c.

References BUILTIN_TYPE, hidden_obj_p, rb_ary_resurrect(), rb_str_resurrect(), T_ARRAY, and T_STRING.

Referenced by cdhash_each(), insn_operand_intern(), and iseq_data_to_ary().

static NODE* parse_string | ( | VALUE | str,
|  | const char * | file,
|  | int | line
| ) |  |
| static

Definition at line 565 of file iseq.c.

References GET_THREAD(), rb_exc_raise(), rb_parser_compile_string(), and rb_parser_new().

Referenced by rb_iseq_compile_with_option().

static VALUE prepare_iseq_build | ( | rb_iseq_t * | iseq,
|  | VALUE | name,
|  | VALUE | path,
|  | VALUE | absolute_path,
|  | VALUE | first_lineno,
|  | VALUE | parent,
|  | enum iseq_type | type,
|  | VALUE | block_opt,
|  | const rb_compile_option_t * | option
| ) |  |
| static

Definition at line 241 of file iseq.c.

References ALLOC, ALLOC_N, rb_iseq_struct::arg_block, rb_iseq_struct::arg_keyword, rb_iseq_struct::arg_rest, rb_iseq_location_struct::base_label, iseq_compile_data_storage::buff, iseq_compile_data::catch_table_ary, rb_iseq_struct::compile_data, rb_iseq_struct::coverage, rb_iseq_struct::defined_method_id, iseq_compile_data::err_info, GET_THREAD(), INITIAL_ISEQ_COMPILE_DATA_STORAGE_BUFF_SIZE, iseq_location_setup(), rb_iseq_struct::klass, rb_iseq_location_struct::label, iseq_compile_data::last_coverable_line, rb_iseq_struct::local_iseq, rb_iseq_struct::location, iseq_compile_data::mark_ary, rb_iseq_struct::mark_ary, MEMZERO, iseq_compile_data_storage::next, NIL_P, OBJ_FREEZE, OBJ_UNTRUST, iseq_compile_data::option, rb_thread_struct::parse_in_eval, iseq_compile_data_storage::pos, Qfalse, Qnil, Qtrue, rb_ary_new(), rb_ary_tmp_new(), rb_get_coverages(), rb_hash_lookup, RBASIC, RTEST, set_relation(), iseq_compile_data_storage::size, iseq_compile_data::storage_current, iseq_compile_data::storage_head, type, and rb_iseq_struct::type.

Referenced by iseq_load(), and rb_iseq_new_with_bopt_and_opt().

VALUE rb_iseq_build_for_ruby2cext | ( | const rb_iseq_t * | iseq_template,
|  | const rb_insn_func_t * | func,
|  | const struct iseq_line_info_entry * | line_info_table,
|  | const char ** | local_table,
|  | const VALUE * | arg_opt_table,
|  | const struct iseq_catch_table_entry * | catch_table,
|  | const char * | name,
|  | const char * | path,
|  | const unsigned short | first_lineno
| ) |  |

Definition at line 2029 of file iseq.c.

References ALLOC_AND_COPY, ALLOC_N, rb_iseq_struct::arg_opt_table, rb_iseq_struct::arg_opts, rb_iseq_struct::catch_table, rb_iseq_struct::catch_table_size, rb_iseq_location_struct::first_lineno, GetISeqPtr, i, iseq_catch_table_entry::iseq, rb_iseq_struct::iseq, iseq_alloc(), rb_iseq_struct::iseq_size, rb_iseq_location_struct::label, rb_iseq_struct::line_info_size, rb_iseq_struct::line_info_table, rb_iseq_struct::location, rb_iseq_struct::mark_ary, OBJ_UNTRUST, rb_iseq_location_struct::path, rb_ary_tmp_new(), rb_cISeq, rb_iseq_translate_threaded_code(), rb_str_new2, rb_iseq_struct::self, and set_relation().

VALUE rb_iseq_clone | ( | VALUE | iseqval,
|  | VALUE | newcbase
| ) |  |

Definition at line 1884 of file iseq.c.

References rb_iseq_struct::cref_stack, GetISeqPtr, iseq_alloc(), rb_iseq_struct::klass, rb_iseq_struct::local_iseq, NEW_CREF, rb_iseq_struct::orig, rb_cISeq, and rb_iseq_struct::self.

Referenced by clone_method(), and vm_define_method().

VALUE rb_iseq_compile | ( | VALUE | src,
|  | VALUE | file,
|  | VALUE | line
| ) |  |

Definition at line 622 of file iseq.c.

References Qnil, and rb_iseq_compile_with_option().

VALUE rb_iseq_compile_on_base | ( | VALUE | src,
|  | VALUE | file,
|  | VALUE | line,
|  | rb_block_t * | base_block
| ) |  |

Definition at line 628 of file iseq.c.

References Qnil, and rb_iseq_compile_with_option().

VALUE rb_iseq_compile_with_option | ( | VALUE | src,
|  | VALUE | file,
|  | VALUE | absolute_path,
|  | VALUE | line,
|  | rb_block_t * | base_block,
|  | VALUE | opt
| ) |  |

Definition at line 577 of file iseq.c.

References rb_thread_struct::base_block, EXEC_TAG, GET_THREAD(), rb_block_struct::iseq, JUMP_TAG, rb_iseq_location_struct::label, rb_iseq_struct::location, make_compile_option(), NUM2INT, parse_string(), Qfalse, Qundef, rb_compile_file(), rb_iseq_new_with_opt(), rb_str_new2, RB_TYPE_P, rb_iseq_struct::self, StringValue, StringValueCStr, T_FILE, TH_POP_TAG, and TH_PUSH_TAG.

Referenced by eval_string_with_cref(), iseq_s_compile(), rb_iseq_compile(), and rb_iseq_compile_on_base().

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

Definition at line 1988 of file iseq.c.

References GET_VM, numberof, OBJ_FREEZE, rb_str_new_cstr(), and ruby_xcalloc().

Referenced by defined_expr(), and iseq_compile_each().

VALUE rb_iseq_disasm | ( | VALUE | self) |  |

Definition at line 1342 of file iseq.c.

References rb_iseq_struct::arg_block, rb_iseq_struct::arg_opt_table, rb_iseq_struct::arg_opts, rb_iseq_struct::arg_post_len, rb_iseq_struct::arg_post_start, rb_iseq_struct::arg_rest, rb_iseq_struct::arg_simple, argc, rb_iseq_struct::argc, rb_iseq_struct::catch_table, rb_iseq_struct::catch_table_size, catch_type(), iseq_catch_table_entry::cont, iseq_catch_table_entry::end, i, id_to_name(), iseq_catch_table_entry::iseq, rb_iseq_struct::iseq, iseq_check(), iseq_inspect(), rb_iseq_struct::iseq_size, rb_iseq_struct::local_size, rb_iseq_struct::local_table, rb_iseq_struct::local_table_size, name, PRIdVALUE, RARRAY_LEN, rb_ary_entry(), rb_ary_new(), rb_iseq_disasm(), rb_iseq_disasm_insn(), rb_secure(), rb_str_append(), rb_str_cat2(), rb_str_catf(), rb_str_concat(), rb_str_new(), rb_str_resize(), RSTRING_LEN, RSTRING_PTR, rb_iseq_struct::self, size, snprintf, iseq_catch_table_entry::sp, iseq_catch_table_entry::start, and iseq_catch_table_entry::type.

Referenced by eval_string_with_cref(), Init_ISeq(), iseq_s_disasm(), iseq_setup(), and rb_iseq_disasm().

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

Disassemble a instruction Iseq -> Iseq inspect object.

Definition at line 1250 of file iseq.c.

References find_line_no(), insn_operand_intern(), PRIdSIZE, rb_str_cat2(), rb_str_catf(), rb_str_concat(), rb_str_new(), RSTRING_LEN, and RSTRING_PTR.

Referenced by rb_iseq_disasm(), and rb_vmdebug_debug_print_pre().

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

Definition at line 1042 of file iseq.c.

References rb_iseq_location_struct::first_lineno, FIX2INT, and rb_iseq_struct::location.

Referenced by argument_error(), iseq_location(), proc_binding(), proc_to_s(), and rb_method_entry_make().

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

Definition at line 1098 of file iseq.c.

References find_line_no().

Referenced by calc_lineno().

VALUE rb_iseq_line_trace_all | ( | VALUE | iseqval) |  |

Definition at line 2136 of file iseq.c.

References collect_trace(), rb_ary_new(), rb_iseq_line_trace_each(), and result.

Referenced by Init_ISeq().

int rb_iseq_line_trace_each | ( | VALUE | iseqval,
|  | int(*)(int line, rb_event_flag_t *events_ptr, void *d) | func,
|  | void * | data
| ) |  |

Definition at line 2089 of file iseq.c.

References iseq_catch_table_entry::cont, find_line_no(), func, GetISeqPtr, if(), iseq_catch_table_entry::iseq, rb_iseq_struct::iseq, rb_iseq_struct::iseq_encoded, rb_iseq_struct::iseq_size, RUBY_EVENT_LINE, and RUBY_EVENT_SPECIFIED_LINE.

Referenced by rb_iseq_line_trace_all(), and rb_iseq_line_trace_specify().

VALUE rb_iseq_line_trace_specify | ( | VALUE | iseqval,
|  | VALUE | pos,
|  | VALUE | set
| ) |  |

Definition at line 2183 of file iseq.c.

References line_trace_specify(), NUM2INT, set_specifc_data::pos, set_specifc_data::prev, Qfalse, Qtrue, rb_eTypeError, rb_iseq_line_trace_each(), rb_raise(), and set_specifc_data::set.

Referenced by Init_ISeq().

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

Definition at line 559 of file iseq.c.

References iseq_load(), and rb_cISeq.

Referenced by iseq_build_from_ary_exception(), and iseq_build_load_iseq().

VALUE rb_iseq_new | ( | NODE * | node,
|  | VALUE | name,
|  | VALUE | path,
|  | VALUE | absolute_path,
|  | VALUE | parent,
|  | enum iseq_type | type
| ) |  |

Definition at line 398 of file iseq.c.

References INT2FIX, and rb_iseq_new_with_opt().

Referenced by Init_VM(), and rb_vm_call_cfunc().

VALUE rb_iseq_new_main | ( | NODE * | node,
|  | VALUE | path,
|  | VALUE | absolute_path
| ) |  |

Definition at line 413 of file iseq.c.

References rb_thread_struct::base_block, GET_THREAD(), INT2FIX, rb_block_struct::iseq, rb_iseq_new_with_opt(), rb_str_new2, and rb_iseq_struct::self.

Referenced by process_options().

VALUE rb_iseq_new_top | ( | NODE * | node,
|  | VALUE | name,
|  | VALUE | path,
|  | VALUE | absolute_path,
|  | VALUE | parent
| ) |  |

Definition at line 406 of file iseq.c.

References INT2FIX, and rb_iseq_new_with_opt().

Referenced by rb_load_internal().

VALUE rb_iseq_new_with_bopt | ( | NODE * | node,
|  | VALUE | name,
|  | VALUE | path,
|  | VALUE | absolute_path,
|  | VALUE | first_lineno,
|  | VALUE | parent,
|  | enum iseq_type | type,
|  | VALUE | bopt
| ) |  |

Definition at line 449 of file iseq.c.

References rb_iseq_new_with_bopt_and_opt().

static VALUE rb_iseq_new_with_bopt_and_opt | ( | NODE * | node,
|  | VALUE | name,
|  | VALUE | path,
|  | VALUE | absolute_path,
|  | VALUE | first_lineno,
|  | VALUE | parent,
|  | enum iseq_type | type,
|  | VALUE | bopt,
|  | const rb_compile_option_t * | option
| ) |  |
| static

Definition at line 422 of file iseq.c.

References cleanup_iseq_build(), GetISeqPtr, iseq_alloc(), prepare_iseq_build(), rb_cISeq, rb_iseq_compile_node(), and rb_iseq_struct::self.

Referenced by rb_iseq_new_with_bopt(), and rb_iseq_new_with_opt().

VALUE rb_iseq_new_with_opt | ( | NODE * | node,
|  | VALUE | name,
|  | VALUE | path,
|  | VALUE | absolute_path,
|  | VALUE | first_lineno,
|  | VALUE | parent,
|  | enum iseq_type | type,
|  | const rb_compile_option_t * | option
| ) |  |

Definition at line 439 of file iseq.c.

References Qfalse, and rb_iseq_new_with_bopt_and_opt().

Referenced by iseq_s_compile_file(), new_child_iseq(), rb_iseq_compile_with_option(), rb_iseq_new(), rb_iseq_new_main(), and rb_iseq_new_top().

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

Definition at line 1914 of file iseq.c.

References rb_iseq_struct::arg_block, rb_iseq_struct::arg_keyword, rb_iseq_struct::arg_keyword_table, rb_iseq_struct::arg_keywords, rb_iseq_struct::arg_opts, rb_iseq_struct::arg_post_len, rb_iseq_struct::arg_post_start, rb_iseq_struct::arg_rest, rb_iseq_struct::arg_size, rb_iseq_struct::argc, args, CONST_ID, i, ID2SYM, key, rb_iseq_struct::local_table, PARAM, PARAM_ID, PARAM_TYPE, Qnil, rb_ary_new2(), rb_ary_push(), and rb_id2str().

Referenced by rb_method_parameters(), and rb_proc_parameters().

static VALUE register_label | ( | struct st_table * | table,
|  | unsigned long | idx
| ) |  |
| static

Definition at line 1583 of file iseq.c.

References CHAR_BIT, ID2SYM, rb_intern, snprintf, st_insert(), and sym.

Referenced by iseq_data_to_ary().

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

Definition at line 1566 of file iseq.c.

References rb_bug().

Referenced by compile_array_(), iseq_compile_each(), iseq_set_arguments(), ruby_debug_print_node(), and setup_args().

static void set_relation | ( | rb_iseq_t * | iseq,
|  | const VALUE | parent
| ) |  |
| static

Definition at line 198 of file iseq.c.

References rb_iseq_struct::cref_stack, GET_THREAD(), GetISeqPtr, rb_iseq_struct::local_iseq, NEW_CREF, NOEX_PRIVATE, rb_iseq_struct::parent_iseq, Qnil, rb_cObject, RTEST, rb_thread_struct::top_wrapper, type, and rb_iseq_struct::type.

Referenced by prepare_iseq_build(), and rb_iseq_build_for_ruby2cext().

## Variable Documentation

rb_compile_option_t COMPILE_OPTION_DEFAULT
| static

Initial value:
= {
OPT_INLINE_CONST_CACHE,
OPT_PEEPHOLE_OPTIMIZATION,
OPT_TAILCALL_OPTIMIZATION,
OPT_SPECIALISED_INSTRUCTION,
OPT_OPERANDS_UNIFICATION,
OPT_INSTRUCTIONS_UNIFICATION,
OPT_STACK_CACHING,
OPT_TRACE_INSTRUCTION,
}

Definition at line 320 of file iseq.c.

Referenced by make_compile_option().

const rb_compile_option_t COMPILE_OPTION_FALSE = {0}
| static

Definition at line 330 of file iseq.c.

Referenced by make_compile_option().

const rb_data_type_t iseq_data_type
| static

Initial value:
= {
"iseq",
{
iseq_mark,
iseq_free,
iseq_memsize,
},
}

Definition at line 170 of file iseq.c.

VALUE rb_cISeq

Definition at line 29 of file iseq.c.

Referenced by Init_ISeq(), insn_operand_intern(), iseq_build_load_iseq(), rb_iseq_build_for_ruby2cext(), rb_iseq_clone(), rb_iseq_load(), and rb_iseq_new_with_bopt_and_opt().