| Ruby
    2.5.0dev(2017-10-22revision60238)
    | 
#include "internal.h"#include "ruby/re.h"#include "encindex.h"#include <math.h>#include "vm_core.h"#include "iseq.h"#include "insns.inc"#include "insns_info.inc"#include "id_table.h"#include "gc.h"#include "optinsn.inc"Go to the source code of this file.
| Data Structures | |
| struct | iseq_link_element | 
| struct | iseq_link_anchor | 
| struct | iseq_label_data | 
| struct | iseq_insn_data | 
| struct | iseq_adjust_data | 
| struct | ensure_range | 
| struct | iseq_compile_data_ensure_node_stack | 
| struct | cdhash_set_label_struct | 
| struct | accessor_args | 
| struct | ibf_header | 
| struct | ibf_id_entry | 
| struct | ibf_dump | 
| struct | ibf_load | 
| struct | ibf_dump_id_list_i_arg | 
| struct | ibf_object_header | 
| struct | ibf_object_string | 
| struct | ibf_object_regexp | 
| struct | ibf_object_array | 
| struct | ibf_object_hash | 
| struct | ibf_object_struct_range | 
| struct | ibf_object_bignum | 
| struct | ibf_object_complex_rational | 
| struct | ibf_object_symbol | 
| Macros | |
| #define | USE_INSN_STACK_INCREASE 1 | 
| #define | RUBY_UNTYPED_DATA_WARNING 0 | 
| #define | ISEQ_TYPE_ONCE_GUARD ISEQ_TYPE_DEFINED_GUARD | 
| #define | FIXNUM_INC(n, i) ((n)+(INT2FIX(i)&~FIXNUM_FLAG)) | 
| #define | FIXNUM_OR(n, i) ((n)|INT2FIX(i)) | 
| #define | CPDEBUG 0 | 
| debug function(macro) interface depend on CPDEBUG if it is less than 0, runtime option is in effect.  More... | |
| #define | compile_debug CPDEBUG | 
| #define | debugi(header, id) ((void)0) | 
| #define | debugp(header, value) ((void)0) | 
| #define | debugp_verbose(header, value) ((void)0) | 
| #define | debugp_verbose_node(header, value) ((void)0) | 
| #define | debugp_param(header, value) ((void)0) | 
| #define | debug_node_start(node) ((void)0) | 
| #define | debug_node_end() ((void)0) | 
| #define | debugs if(0)printf | 
| #define | debug_compile(msg, v) (v) | 
| #define | LVAR_ERRINFO (1) | 
| #define | NEW_LABEL(l) new_label_body(iseq, (l)) | 
| #define | LABEL_FORMAT "<L%03d>" | 
| #define | NEW_ISEQ(node, name, type, line_no) new_child_iseq(iseq, (node), rb_fstring(name), 0, (type), (line_no)) | 
| #define | NEW_CHILD_ISEQ(node, name, type, line_no) new_child_iseq(iseq, (node), rb_fstring(name), iseq, (type), (line_no)) | 
| #define | ADD_SEQ(seq1, seq2) APPEND_LIST((seq1), (seq2)) | 
| #define | ADD_INSN(seq, line, insn) ADD_ELEM((seq), (LINK_ELEMENT *) new_insn_body(iseq, (line), BIN(insn), 0)) | 
| #define | INSERT_BEFORE_INSN(prev, line, insn) INSERT_ELEM_PREV(&(prev)->link, (LINK_ELEMENT *) new_insn_body(iseq, (line), BIN(insn), 0)) | 
| #define | ADD_INSN1(seq, line, insn, op1) | 
| #define | INSERT_BEFORE_INSN1(prev, line, insn, op1) | 
| #define | LABEL_REF(label) ((label)->refcnt++) | 
| #define | ADD_INSNL(seq, line, insn, label) (ADD_INSN1(seq, line, insn, label), LABEL_REF(label)) | 
| #define | ADD_INSN2(seq, line, insn, op1, op2) | 
| #define | ADD_INSN3(seq, line, insn, op1, op2, op3) | 
| #define | ADD_SEND(seq, line, id, argc) ADD_SEND_R((seq), (line), (id), (argc), NULL, (VALUE)INT2FIX(0), NULL) | 
| #define | ADD_SEND_WITH_FLAG(seq, line, id, argc, flag) ADD_SEND_R((seq), (line), (id), (argc), NULL, (VALUE)(flag), NULL) | 
| #define | ADD_SEND_WITH_BLOCK(seq, line, id, argc, block) ADD_SEND_R((seq), (line), (id), (argc), (block), (VALUE)INT2FIX(0), NULL) | 
| #define | ADD_CALL_RECEIVER(seq, line) ADD_INSN((seq), (line), putself) | 
| #define | ADD_CALL(seq, line, id, argc) ADD_SEND_R((seq), (line), (id), (argc), NULL, (VALUE)INT2FIX(VM_CALL_FCALL), NULL) | 
| #define | ADD_CALL_WITH_BLOCK(seq, line, id, argc, block) ADD_SEND_R((seq), (line), (id), (argc), (block), (VALUE)INT2FIX(VM_CALL_FCALL), NULL) | 
| #define | ADD_SEND_R(seq, line, id, argc, block, flag, keywords) ADD_ELEM((seq), (LINK_ELEMENT *) new_insn_send(iseq, (line), (id), (VALUE)(argc), (block), (VALUE)(flag), (keywords))) | 
| #define | ADD_TRACE_LINE_COVERAGE(seq, line) | 
| #define | DECL_BRANCH_BASE(branches, line, type) | 
| #define | ADD_TRACE_BRANCH_COVERAGE(seq, line, type, branches) | 
| #define | ADD_TRACE_METHOD_COVERAGE(seq, line, method_name) | 
| #define | ADD_TRACE(seq, line, event) | 
| #define | ADD_GETLOCAL(seq, line, idx, level) | 
| #define | ADD_SETLOCAL(seq, line, idx, level) | 
| #define | ADD_LABEL(seq, label) ADD_ELEM((seq), (LINK_ELEMENT *) (label)) | 
| #define | APPEND_LABEL(seq, before, label) APPEND_ELEM((seq), (before), (LINK_ELEMENT *) (label)) | 
| #define | ADD_ADJUST(seq, line, label) ADD_ELEM((seq), (LINK_ELEMENT *) new_adjust_body(iseq, (label), (line))) | 
| #define | ADD_ADJUST_RESTORE(seq, label) ADD_ELEM((seq), (LINK_ELEMENT *) new_adjust_body(iseq, (label), -1)) | 
| #define | LABEL_UNREMOVABLE(label) ((label) ? (LABEL_REF(label), (label)->unremovable=1) : 0) | 
| #define | ADD_CATCH_ENTRY(type, ls, le, iseqv, lc) | 
| #define | COMPILE(anchor, desc, node) | 
| #define | COMPILE_POPPED(anchor, desc, node) | 
| #define | COMPILE_(anchor, desc, node, popped) | 
| #define | COMPILE_RECV(anchor, desc, node) | 
| #define | OPERAND_AT(insn, idx) (((INSN*)(insn))->operands[(idx)]) | 
| #define | INSN_OF(insn) (((INSN*)(insn))->insn_id) | 
| #define | IS_INSN(link) ((link)->type == ISEQ_ELEMENT_INSN) | 
| #define | IS_LABEL(link) ((link)->type == ISEQ_ELEMENT_LABEL) | 
| #define | IS_ADJUST(link) ((link)->type == ISEQ_ELEMENT_ADJUST) | 
| #define | IS_INSN_ID(iobj, insn) (INSN_OF(iobj) == BIN(insn)) | 
| #define | IS_NEXT_INSN_ID(link, insn) ((link)->next && IS_INSN((link)->next) && IS_INSN_ID((link)->next, insn)) | 
| #define | COMPILE_ERROR append_compile_error | 
| #define | ERROR_ARGS_AT(n) iseq, nd_line(n), | 
| #define | ERROR_ARGS ERROR_ARGS_AT(node) | 
| #define | EXPECT_NODE(prefix, node, ndtype, errval) | 
| #define | EXPECT_NODE_NONULL(prefix, parent, ndtype, errval) | 
| #define | UNKNOWN_NODE(prefix, node, errval) | 
| #define | COMPILE_OK 1 | 
| #define | COMPILE_NG 0 | 
| #define | CHECK(sub) if (!(sub)) {BEFORE_RETURN;return COMPILE_NG;} | 
| #define | BEFORE_RETURN | 
| #define | DECL_ANCHOR(name) LINK_ANCHOR name[1] = {{{0,},}} | 
| #define | INIT_ANCHOR(name) (name->last = &name->anchor) | 
| #define | ISEQ_ARG | 
| #define | ISEQ_ARG_DECLARE | 
| #define | PADDING_SIZE_MAX 0 | 
| #define | debug_list(anc) ((void)0) | 
| #define | BADINSN_DUMP(anchor, list, dest) dump_disasm_list_with_cursor(&anchor->anchor, list, dest) | 
| #define | BADINSN_ERROR | 
| #define | IS_TRACE_LINE(insn) | 
| #define | SP_INSN(opt) insn_set_specialized_instruction(iseq, iobj, BIN(opt_##opt)) | 
| #define | MEMORY(v) | 
| #define | private_recv_p(node) (nd_type((node)->nd_recv) == NODE_SELF) | 
| #define | BEFORE_RETURN debug_node_end() | 
| #define | rb_intern(str) rb_intern_const(str) | 
| #define | CHECK_ARRAY(v) rb_convert_type_with_id((v), T_ARRAY, "Array", idTo_ary) | 
| #define | CHECK_SYMBOL(v) rb_convert_type_with_id((v), T_SYMBOL, "Symbol", idTo_sym) | 
| #define | SYM(s) ID2SYM(rb_intern(#s)) | 
| #define | SYM(s) ID2SYM(rb_intern(#s)) | 
| #define | INT_PARAM(F) int_param(&iseq->body->param.F, params, SYM(F)) | 
| #define | INT_PARAM(F) F = (int_param(&x, misc, SYM(F)) ? (unsigned int)x : 0) | 
| #define | IBF_OFFSET(ptr) ((ibf_offset_t)(VALUE)(ptr)) | 
| #define | IBF_W(b, type, n) (type *)(VALUE)ibf_dump_write(dump, (b), sizeof(type) * (n)) | 
| #define | IBF_WV(variable) ibf_dump_write(dump, &(variable), sizeof(variable)) | 
| #define | IBF_WP(b, type, n) ibf_dump_write(dump, (b), sizeof(type) * (n)) | 
| #define | IBF_R(val, type, n) (type *)ibf_load_alloc(load, IBF_OFFSET(val), sizeof(type) * (n)) | 
| #define | IBF_OBJECT_INTERNAL FL_PROMOTED0 | 
| #define | IBF_OBJHEADER(offset) (struct ibf_object_header *)(load->buff + (offset)) | 
| #define | IBF_OBJBODY(type, offset) (type *)(load->buff + sizeof(struct ibf_object_header) + (offset)) | 
| Typedefs | |
| typedef struct iseq_link_element | LINK_ELEMENT | 
| typedef struct iseq_link_anchor | LINK_ANCHOR | 
| typedef struct iseq_label_data | LABEL | 
| typedef struct iseq_insn_data | INSN | 
| typedef struct iseq_adjust_data | ADJUST | 
| typedef unsigned int | ibf_offset_t | 
| typedef void(* | ibf_dump_object_function) (struct ibf_dump *dump, VALUE obj) | 
| typedef VALUE(* | ibf_load_object_function) (const struct ibf_load *load, const struct ibf_object_header *header, ibf_offset_t) | 
| Functions | |
| VALUE | rb_iseq_compile_node (rb_iseq_t *iseq, NODE *node) | 
| int | rb_iseq_translate_threaded_code (rb_iseq_t *iseq) | 
| VALUE * | rb_iseq_original_iseq (const rb_iseq_t *iseq) | 
| const char * | rb_insns_name (int i) | 
| VALUE | rb_insns_name_array (void) | 
| void | rb_iseq_build_from_ary (rb_iseq_t *iseq, VALUE misc, VALUE locals, VALUE params, VALUE exception, VALUE body) | 
| int | rb_dvar_defined (ID id, const struct rb_block *base_block) | 
| int | rb_local_defined (ID id, const struct rb_block *base_block) | 
| const rb_iseq_t * | rb_method_for_self_aref (VALUE name, VALUE arg, rb_insn_func_t func) | 
| const rb_iseq_t * | rb_method_for_self_aset (VALUE name, VALUE arg, rb_insn_func_t func) | 
| rb_iseq_t * | iseq_alloc (void) | 
| VALUE | iseq_ibf_dump (const rb_iseq_t *iseq, VALUE opt) | 
| void | ibf_load_iseq_complete (rb_iseq_t *iseq) | 
| const rb_iseq_t * | iseq_ibf_load (VALUE str) | 
| VALUE | iseq_ibf_load_extra_data (VALUE str) | 
| #define ADD_ADJUST | ( | seq, | |
| line, | |||
| label | |||
| ) | ADD_ELEM((seq), (LINK_ELEMENT *) new_adjust_body(iseq, (label), (line))) | 
| #define ADD_ADJUST_RESTORE | ( | seq, | |
| label | |||
| ) | ADD_ELEM((seq), (LINK_ELEMENT *) new_adjust_body(iseq, (label), -1)) | 
| #define ADD_CALL | ( | seq, | |
| line, | |||
| id, | |||
| argc | |||
| ) | ADD_SEND_R((seq), (line), (id), (argc), NULL, (VALUE)INT2FIX(VM_CALL_FCALL), NULL) | 
| #define ADD_CALL_RECEIVER | ( | seq, | |
| line | |||
| ) | ADD_INSN((seq), (line), putself) | 
| #define ADD_CALL_WITH_BLOCK | ( | seq, | |
| line, | |||
| id, | |||
| argc, | |||
| block | |||
| ) | ADD_SEND_R((seq), (line), (id), (argc), (block), (VALUE)INT2FIX(VM_CALL_FCALL), NULL) | 
| #define ADD_CATCH_ENTRY | ( | type, | |
| ls, | |||
| le, | |||
| iseqv, | |||
| lc | |||
| ) | 
| #define ADD_GETLOCAL | ( | seq, | |
| line, | |||
| idx, | |||
| level | |||
| ) | 
| #define ADD_INSN | ( | seq, | |
| line, | |||
| insn | |||
| ) | ADD_ELEM((seq), (LINK_ELEMENT *) new_insn_body(iseq, (line), BIN(insn), 0)) | 
| #define ADD_INSN1 | ( | seq, | |
| line, | |||
| insn, | |||
| op1 | |||
| ) | 
| #define ADD_INSN2 | ( | seq, | |
| line, | |||
| insn, | |||
| op1, | |||
| op2 | |||
| ) | 
| #define ADD_INSN3 | ( | seq, | |
| line, | |||
| insn, | |||
| op1, | |||
| op2, | |||
| op3 | |||
| ) | 
| #define ADD_LABEL | ( | seq, | |
| label | |||
| ) | ADD_ELEM((seq), (LINK_ELEMENT *) (label)) | 
| #define ADD_SEQ | ( | seq1, | |
| seq2 | |||
| ) | APPEND_LIST((seq1), (seq2)) | 
| #define ADD_SETLOCAL | ( | seq, | |
| line, | |||
| idx, | |||
| level | |||
| ) | 
| #define ADD_TRACE | ( | seq, | |
| line, | |||
| event | |||
| ) | 
| #define ADD_TRACE_BRANCH_COVERAGE | ( | seq, | |
| line, | |||
| type, | |||
| branches | |||
| ) | 
| #define ADD_TRACE_LINE_COVERAGE | ( | seq, | |
| line | |||
| ) | 
| #define ADD_TRACE_METHOD_COVERAGE | ( | seq, | |
| line, | |||
| method_name | |||
| ) | 
| #define APPEND_LABEL | ( | seq, | |
| before, | |||
| label | |||
| ) | APPEND_ELEM((seq), (before), (LINK_ELEMENT *) (label)) | 
| #define BADINSN_ERROR | 
| #define BEFORE_RETURN debug_node_end() | 
| #define CHECK | ( | sub | ) | if (!(sub)) {BEFORE_RETURN;return COMPILE_NG;} | 
| #define CHECK_ARRAY | ( | v | ) | rb_convert_type_with_id((v), T_ARRAY, "Array", idTo_ary) | 
| #define CHECK_SYMBOL | ( | v | ) | rb_convert_type_with_id((v), T_SYMBOL, "Symbol", idTo_sym) | 
Definition at line 7301 of file compile.c.
Referenced by rb_iseq_build_from_ary().
| #define COMPILE | ( | anchor, | |
| desc, | |||
| node | |||
| ) | 
Definition at line 337 of file compile.c.
Referenced by rb_iseq_compile_node().
| #define COMPILE_ | ( | anchor, | |
| desc, | |||
| node, | |||
| popped | |||
| ) | 
| #define COMPILE_OK 1 | 
Definition at line 439 of file compile.c.
Referenced by rb_iseq_translate_threaded_code().
| #define COMPILE_POPPED | ( | anchor, | |
| desc, | |||
| node | |||
| ) | 
| #define COMPILE_RECV | ( | anchor, | |
| desc, | |||
| node | |||
| ) | 
| #define CPDEBUG 0 | 
| #define DECL_ANCHOR | ( | name | ) | LINK_ANCHOR name[1] = {{{0,},}} | 
Definition at line 447 of file compile.c.
Referenced by rb_iseq_build_from_ary(), and rb_iseq_compile_node().
| #define DECL_BRANCH_BASE | ( | branches, | |
| line, | |||
| type | |||
| ) | 
| #define ERROR_ARGS ERROR_ARGS_AT(node) | 
| #define EXPECT_NODE | ( | prefix, | |
| node, | |||
| ndtype, | |||
| errval | |||
| ) | 
| #define EXPECT_NODE_NONULL | ( | prefix, | |
| parent, | |||
| ndtype, | |||
| errval | |||
| ) | 
| #define FIXNUM_INC | ( | n, | |
| i | |||
| ) | ((n)+(INT2FIX(i)&~FIXNUM_FLAG)) | 
| #define IBF_OBJBODY | ( | type, | |
| offset | |||
| ) | (type *)(load->buff + sizeof(struct ibf_object_header) + (offset)) | 
| #define IBF_OBJECT_INTERNAL FL_PROMOTED0 | 
| #define IBF_OBJHEADER | ( | offset | ) | (struct ibf_object_header *)(load->buff + (offset)) | 
| #define IBF_OFFSET | ( | ptr | ) | ((ibf_offset_t)(VALUE)(ptr)) | 
| #define IBF_R | ( | val, | |
| type, | |||
| n | |||
| ) | (type *)ibf_load_alloc(load, IBF_OFFSET(val), sizeof(type) * (n)) | 
| #define IBF_W | ( | b, | |
| type, | |||
| n | |||
| ) | (type *)(VALUE)ibf_dump_write(dump, (b), sizeof(type) * (n)) | 
| #define IBF_WP | ( | b, | |
| type, | |||
| n | |||
| ) | ibf_dump_write(dump, (b), sizeof(type) * (n)) | 
| #define IBF_WV | ( | variable | ) | ibf_dump_write(dump, &(variable), sizeof(variable)) | 
Definition at line 449 of file compile.c.
Referenced by rb_iseq_build_from_ary(), and rb_iseq_compile_node().
| #define INSERT_BEFORE_INSN | ( | prev, | |
| line, | |||
| insn | |||
| ) | INSERT_ELEM_PREV(&(prev)->link, (LINK_ELEMENT *) new_insn_body(iseq, (line), BIN(insn), 0)) | 
| #define INSERT_BEFORE_INSN1 | ( | prev, | |
| line, | |||
| insn, | |||
| op1 | |||
| ) | 
Referenced by rb_iseq_build_from_ary().
| #define IS_INSN_ID | ( | iobj, | |
| insn | |||
| ) | (INSN_OF(iobj) == BIN(insn)) | 
| #define IS_TRACE_LINE | ( | insn | ) | 
| #define LABEL_UNREMOVABLE | ( | label | ) | ((label) ? (LABEL_REF(label), (label)->unremovable=1) : 0) | 
| #define MEMORY | ( | v | ) | 
| #define NEW_CHILD_ISEQ | ( | node, | |
| name, | |||
| type, | |||
| line_no | |||
| ) | new_child_iseq(iseq, (node), rb_fstring(name), iseq, (type), (line_no)) | 
| #define NEW_ISEQ | ( | node, | |
| name, | |||
| type, | |||
| line_no | |||
| ) | new_child_iseq(iseq, (node), rb_fstring(name), 0, (type), (line_no)) | 
| #define OPERAND_AT | ( | insn, | |
| idx | |||
| ) | (((INSN*)(insn))->operands[(idx)]) | 
| #define rb_intern | ( | str | ) | rb_intern_const(str) | 
Referenced by rb_iseq_build_from_ary().
| #define SP_INSN | ( | opt | ) | insn_set_specialized_instruction(iseq, iobj, BIN(opt_##opt)) | 
Referenced by rb_iseq_build_from_ary().
| #define UNKNOWN_NODE | ( | prefix, | |
| node, | |||
| errval | |||
| ) | 
| typedef struct iseq_adjust_data ADJUST | 
| typedef VALUE(* ibf_load_object_function) (const struct ibf_load *load, const struct ibf_object_header *header, ibf_offset_t) | 
| typedef unsigned int ibf_offset_t | 
| typedef struct iseq_insn_data INSN | 
| typedef struct iseq_label_data LABEL | 
| typedef struct iseq_link_anchor LINK_ANCHOR | 
| typedef struct iseq_link_element LINK_ELEMENT | 
| enum compile_array_type_t | 
| enum ibf_object_data_type | 
| enum LABEL_RESCUE_TYPE | 
| void ibf_load_iseq_complete | ( | rb_iseq_t * | iseq | ) | 
Definition at line 8995 of file compile.c.
References rb_iseq_struct::aux, ibf_load::iseq, rb_iseq_struct::loader, and RTYPEDDATA_DATA.
| rb_iseq_t* iseq_alloc | ( | void | ) | 
Referenced by rb_iseq_new_with_opt().
Definition at line 8936 of file compile.c.
References rb_iseq_struct::body, ISEQ_COVERAGE, rb_iseq_constant_body::local_iseq, NULL, rb_iseq_constant_body::parent_iseq, rb_eRuntimeError, rb_raise(), RTEST, and TypedData_Make_Struct.
Definition at line 9112 of file compile.c.
References ibf_load::iseq, and TypedData_Make_Struct.
Definition at line 9126 of file compile.c.
References TypedData_Make_Struct.
| VALUE rb_insns_name_array | ( | void | ) | 
Definition at line 6976 of file compile.c.
References rb_ary_new(), rb_ary_push(), rb_fstring_cstr(), and rb_obj_freeze().
| void rb_iseq_build_from_ary | ( | rb_iseq_t * | iseq, | 
| VALUE | misc, | ||
| VALUE | locals, | ||
| VALUE | params, | ||
| VALUE | exception, | ||
| VALUE | body | ||
| ) | 
Definition at line 7385 of file compile.c.
References ALLOC_N, rb_iseq_struct::body, CHECK_SYMBOL, Data_Wrap_Struct, DECL_ANCHOR, FIX2LONG, FIXNUM_P, rb_iseq_constant_body::flags, ID2SYM, INIT_ANCHOR, INT_PARAM, len, rb_iseq_constant_body::local_table, rb_iseq_constant_body::local_table_size, NULL, rb_iseq_constant_body::param, RARRAY_AREF, RARRAY_LENINT, rb_hash_aref(), rb_intern, RB_TYPE_P, st_free_table, st_init_numtable, SYM, SYM2ID, T_ARRAY, and TRUE.
Definition at line 611 of file compile.c.
References COMPILE, DECL_ANCHOR, and INIT_ANCHOR.
Definition at line 753 of file compile.c.
Referenced by rb_vmdebug_debug_print_pre().
| int rb_iseq_translate_threaded_code | ( | rb_iseq_t * | iseq | ) | 
Definition at line 719 of file compile.c.
References rb_iseq_struct::body, COMPILE_OK, rb_iseq_constant_body::iseq_encoded, rb_iseq_constant_body::iseq_size, len, rb_bug(), and rb_vm_get_insns_address_table().
| const rb_iseq_t* rb_method_for_self_aref | ( | VALUE | name, | 
| VALUE | arg, | ||
| rb_insn_func_t | func | ||
| ) | 
 1.8.13
 1.8.13