Ruby 2.0.0p353(2013-11-22revision43784)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
compile.c File Reference
`#include "ruby/ruby.h"`
`#include "internal.h"`
`#include <math.h>`
`#include "vm_core.h"`
`#include "iseq.h"`
`#include "insns.inc"`
`#include "insns_info.inc"`
`#include "optinsn.inc"`
Include dependency graph for compile.c:

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

## Macros
#define | USE_INSN_STACK_INCREASE 1
#define | numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
#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) r_id(id)
#define | debugp(header, value) r_value(value)
#define | debugp_verbose(header, value) r_value(value)
#define | debugp_verbose_node(header, value) r_value(value)
#define | debugp_param(header, value) r_value(value)
#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 | NEW_LABEL(l) new_label_body(iseq, (l))
#define | iseq_path(iseq) (((rb_iseq_t*)DATA_PTR(iseq))->location.path)
#define | iseq_absolute_path(iseq) (((rb_iseq_t*)DATA_PTR(iseq))->location.absolute_path)
#define | NEW_ISEQVAL(node, name, type, line_no) new_child_iseq(iseq, (node), (name), 0, (type), (line_no))
#define | NEW_CHILD_ISEQVAL(node, name, type, line_no) new_child_iseq(iseq, (node), (name), iseq->self, (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 | ADD_INSN1(seq, line, insn, op1)
#define | ADD_INSNL(seq, line, insn, label) ADD_INSN1(seq, line, insn, 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), (VALUE)Qfalse, (VALUE)INT2FIX(0))
#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), (VALUE)Qfalse, (VALUE)INT2FIX(VM_CALL_FCALL))
#define | ADD_CALL_WITH_BLOCK(seq, line, id, argc, block) ADD_SEND_R((seq), (line), (id), (argc), (block), (VALUE)INT2FIX(VM_CALL_FCALL))
#define | ADD_SEND_R(seq, line, id, argc, block, flag)
#define | ADD_TRACE(seq, line, event)
#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 | ADD_CATCH_ENTRY(type, ls, le, iseqv, lc)
#define | COMPILE(anchor, desc, node)
#define | COMPILE_POPED(anchor, desc, node)
#define | COMPILE_(anchor, desc, node, poped)
#define | OPERAND_AT(insn, idx) (((INSN*)(insn))->operands[(idx)])
#define | INSN_OF(insn) (((INSN*)(insn))->insn_id)
#define | COMPILE_ERROR(strs)
#define | ERROR_ARGS ruby_sourcefile, nd_line(node),
#define | COMPILE_OK 1
#define | COMPILE_NG 0
#define | DECL_ANCHOR(name) LINK_ANCHOR *name, name##_body__ = {{0,},}
#define | INIT_ANCHOR(name) (name##_body__.last = &name##_body__.anchor, name = &name##_body__)
#define | hide_obj(obj) do {OBJ_FREEZE(obj); RBASIC(obj)->klass = 0;} while (0)
#define | ISEQ_ARG
#define | ISEQ_ARG_DECLARE
#define | ruby_sourcefile RSTRING_PTR(iseq->location.path)
#define | SP_INSN(opt) insn_set_specialized_instruction(iseq, iobj, BIN(opt_##opt))
#define | MEMORY(v)
#define | defined_expr defined_expr0
#define | BUFSIZE 0x100
#define | rb_intern(str) rb_intern_const(str)
#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")

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

## Enumerations
enum | compile_array_type_t { COMPILE_ARRAY_TYPE_ARRAY, COMPILE_ARRAY_TYPE_HASH, COMPILE_ARRAY_TYPE_ARGS }

## Functions
static ID | r_id (ID id)
static VALUE | r_value (VALUE value)
static void | dump_disasm_list (LINK_ELEMENT *elem)
static int | insn_data_length (INSN *iobj)
static int | insn_data_line_no (INSN *iobj)
static int | calc_sp_depth (int depth, INSN *iobj)
static INSN * | new_insn_body (rb_iseq_t *iseq, int line_no, int insn_id, int argc,...)
static LABEL * | new_label_body (rb_iseq_t *iseq, long line)
static ADJUST * | new_adjust_body (rb_iseq_t *iseq, LABEL *label, int line)
static int | iseq_compile_each (rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE *node, int poped)
| compile each node More...
static int | iseq_setup (rb_iseq_t *iseq, LINK_ANCHOR *anchor)
static int | iseq_optimize (rb_iseq_t *iseq, LINK_ANCHOR *anchor)
static int | iseq_insns_unification (rb_iseq_t *iseq, LINK_ANCHOR *anchor)
static int | iseq_set_local_table (rb_iseq_t *iseq, ID *tbl)
static int | iseq_set_exception_local_table (rb_iseq_t *iseq)
static int | iseq_set_arguments (rb_iseq_t *iseq, LINK_ANCHOR *anchor, NODE *node)
static int | iseq_set_sequence_stackcaching (rb_iseq_t *iseq, LINK_ANCHOR *anchor)
static int | iseq_set_sequence (rb_iseq_t *iseq, LINK_ANCHOR *anchor)
| ruby insn object list -> raw instruction sequence More...
static int | iseq_set_exception_table (rb_iseq_t *iseq)
static int | iseq_set_optargs_table (rb_iseq_t *iseq)
static void | verify_list (ISEQ_ARG_DECLARE const char *info, LINK_ANCHOR *anchor)
static void | ADD_ELEM (ISEQ_ARG_DECLARE LINK_ANCHOR *anchor, LINK_ELEMENT *elem)
static void | APPEND_ELEM (ISEQ_ARG_DECLARE LINK_ANCHOR *anchor, LINK_ELEMENT *before, LINK_ELEMENT *elem)
static int | iseq_add_mark_object (rb_iseq_t *iseq, VALUE v)
static int | iseq_add_mark_object_compile_time (rb_iseq_t *iseq, VALUE v)
static int | validate_label (st_data_t name, st_data_t label, st_data_t arg)
static void | validate_labels (rb_iseq_t *iseq, st_table *labels_table)
VALUE | rb_iseq_compile_node (VALUE self, NODE *node)
int | rb_iseq_translate_threaded_code (rb_iseq_t *iseq)
static void * | compile_data_alloc (rb_iseq_t *iseq, size_t size)
static INSN * | compile_data_alloc_insn (rb_iseq_t *iseq)
static LABEL * | compile_data_alloc_label (rb_iseq_t *iseq)
static ADJUST * | compile_data_alloc_adjust (rb_iseq_t *iseq)
static void | INSERT_ELEM_NEXT (LINK_ELEMENT *elem1, LINK_ELEMENT *elem2)
static void | REPLACE_ELEM (LINK_ELEMENT *elem1, LINK_ELEMENT *elem2)
static void | REMOVE_ELEM (LINK_ELEMENT *elem)
static LINK_ELEMENT * | FIRST_ELEMENT (LINK_ANCHOR *anchor)
static LINK_ELEMENT * | POP_ELEMENT (ISEQ_ARG_DECLARE LINK_ANCHOR *anchor)
static int | LIST_SIZE_ZERO (LINK_ANCHOR *anchor)
static void | APPEND_LIST (ISEQ_ARG_DECLARE LINK_ANCHOR *anc1, LINK_ANCHOR *anc2)
static void | INSERT_LIST (ISEQ_ARG_DECLARE LINK_ANCHOR *anc1, LINK_ANCHOR *anc2)
static INSN * | new_insn_core (rb_iseq_t *iseq, int line_no, int insn_id, int argc, VALUE *argv)
static rb_call_info_t * | new_callinfo (rb_iseq_t *iseq, ID mid, int argc, VALUE block, unsigned long flag)
static INSN * | new_insn_send (rb_iseq_t *iseq, int line_no, VALUE id, VALUE argc, VALUE block, VALUE flag)
static VALUE | new_child_iseq (rb_iseq_t *iseq, NODE *node, VALUE name, VALUE parent, enum iseq_type type, int line_no)
static int | get_lvar_level (rb_iseq_t *iseq)
static int | get_dyna_var_idx_at_raw (rb_iseq_t *iseq, ID id)
static int | get_local_var_idx (rb_iseq_t *iseq, ID id)
static int | get_dyna_var_idx (rb_iseq_t *iseq, ID id, int *level, int *ls)
static int | cdhash_cmp (VALUE val, VALUE lit)
static st_index_t | cdhash_hash (VALUE a)
static int | cdhash_set_label_i (VALUE key, VALUE val, void *ptr)
static int | label_get_position (LABEL *lobj)
static int | label_get_sp (LABEL *lobj)
static LINK_ELEMENT * | get_destination_insn (INSN *iobj)
static LINK_ELEMENT * | get_next_insn (INSN *iobj)
static LINK_ELEMENT * | get_prev_insn (INSN *iobj)
static int | iseq_peephole_optimize (rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcallopt)
static int | insn_set_specialized_instruction (rb_iseq_t *iseq, INSN *iobj, int insn_id)
static int | iseq_specialized_instruction (rb_iseq_t *iseq, INSN *iobj)
static int | compile_dstr_fragments (rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE *node, int *cntp)
static int | compile_dstr (rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE *node)
static int | compile_dregx (rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE *node)
static int | compile_branch_condition (rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE *cond, LABEL *then_label, LABEL *else_label)
static int | compile_array_ (rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE *node_root, enum compile_array_type_t type, int poped)
static VALUE | compile_array (rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE *node_root, enum compile_array_type_t type)
static VALUE | case_when_optimizable_literal (NODE *node)
static int | when_vals (rb_iseq_t *iseq, LINK_ANCHOR *cond_seq, NODE *vals, LABEL *l1, int only_special_literals, VALUE literals)
static int | compile_massign_lhs (rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE *node)
static void | compile_massign_opt_lhs (rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE *lhsn)
static int | compile_massign_opt (rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE *rhsn, NODE *orig_lhsn)
static int | compile_massign (rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE *node, int poped)
static int | compile_colon2 (rb_iseq_t *iseq, NODE *node, LINK_ANCHOR *pref, LINK_ANCHOR *body)
static VALUE | compile_cpath (LINK_ANCHOR *ret, rb_iseq_t *iseq, NODE *cpath)
static int | defined_expr (rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE *node, LABEL **lfinish, VALUE needstr)
static VALUE | make_name_for_block (rb_iseq_t *iseq)
static void | push_ensure_entry (rb_iseq_t *iseq, struct iseq_compile_data_ensure_node_stack *enl, struct ensure_range *er, NODE *node)
static void | add_ensure_range (rb_iseq_t *iseq, struct ensure_range *erange, LABEL *lstart, LABEL *lend)
static void | add_ensure_iseq (LINK_ANCHOR *ret, rb_iseq_t *iseq, int is_return)
static VALUE | setup_args (rb_iseq_t *iseq, LINK_ANCHOR *args, NODE *argn, VALUE *flag)
static VALUE | insn_data_to_s_detail (INSN *iobj)
const char * | rb_insns_name (int i)
VALUE | rb_insns_name_array (void)
static LABEL * | register_label (rb_iseq_t *iseq, struct st_table *labels_table, VALUE obj)
static VALUE | get_exception_sym2type (VALUE sym)
static int | iseq_build_from_ary_exception (rb_iseq_t *iseq, struct st_table *labels_table, VALUE exception)
static struct st_table * | insn_make_insn_table (void)
static VALUE | iseq_build_load_iseq (rb_iseq_t *iseq, VALUE op)
static int | iseq_build_from_ary_body (rb_iseq_t *iseq, LINK_ANCHOR *anchor, VALUE body, struct st_table *labels_table)
static VALUE | CHECK_INTEGER (VALUE v)
VALUE | rb_iseq_build_from_ary (rb_iseq_t *iseq, VALUE locals, VALUE args, VALUE exception, VALUE body)
int | rb_dvar_defined (ID id)
int | rb_local_defined (ID id)
int | rb_parse_in_eval (void)
int | rb_parse_in_main (void)

## Variables
static struct st_hash_type | cdhash_type

## Macro Definition Documentation

#define ADD_ADJUST | ( |  | seq,
|  |  | line,
|  |  | label
| ) |  | ADD_ELEM((seq), (LINK_ELEMENT *) new_adjust_body(iseq, (label), (line)))

Definition at line 242 of file compile.c.

Referenced by iseq_compile_each().

#define ADD_ADJUST_RESTORE | ( |  | seq,
|  |  | label
| ) |  | ADD_ELEM((seq), (LINK_ELEMENT *) new_adjust_body(iseq, (label), -1))

Definition at line 245 of file compile.c.

Referenced by iseq_compile_each().

#define ADD_CALL | ( |  | seq,
|  |  | line,
|  |  | id,
|  |  | argc
| ) |  | ADD_SEND_R((seq), (line), (id), (argc), (VALUE)Qfalse, (VALUE)INT2FIX(VM_CALL_FCALL))

Definition at line 211 of file compile.c.

Referenced by iseq_compile_each().

#define ADD_CALL_RECEIVER | ( |  | seq,
|  |  | line
| ) |  | ADD_INSN((seq), (line), putself)

Definition at line 208 of file compile.c.

Referenced by iseq_compile_each().

#define ADD_CALL_WITH_BLOCK | ( |  | seq,
|  |  | line,
|  |  | id,
|  |  | argc,
|  |  | block
| ) |  | ADD_SEND_R((seq), (line), (id), (argc), (block), (VALUE)INT2FIX(VM_CALL_FCALL))

Definition at line 214 of file compile.c.

Referenced by iseq_compile_each().

#define ADD_CATCH_ENTRY | ( |  | type,
|  |  | ls,
|  |  | le,
|  |  | iseqv,
|  |  | lc
| ) |  |

Value:
(rb_ary_push(iseq->compile_data->catch_table_ary, \
rb_ary_new3(5, (type), \
(VALUE)(ls) | 1, (VALUE)(le) | 1, \
(VALUE)(iseqv), (VALUE)(lc) | 1)))
rb_ary_push
VALUE rb_ary_push(VALUE ary, VALUE item)
Definition: array.c:822
rb_ary_new3
VALUE rb_ary_new3(long n,...)
Definition: array.c:432
le
#define le(x, y)
Definition: time.c:69
type
int type
Definition: tcltklib.c:111
VALUE
unsigned long VALUE
Definition: ripper.y:104

Definition at line 248 of file compile.c.

Referenced by iseq_build_from_ary_exception(), iseq_compile_each(), and rb_iseq_compile_node().

#define ADD_INSN | ( |  | seq,
|  |  | line,
|  |  | insn
| ) |  | ADD_ELEM((seq), (LINK_ELEMENT *) new_insn_body(iseq, (line), BIN(insn), 0))

Definition at line 185 of file compile.c.

Referenced by compile_array_(), compile_colon2(), compile_massign(), compile_massign_lhs(), compile_massign_opt(), defined_expr(), iseq_compile_each(), iseq_set_arguments(), rb_iseq_compile_node(), setup_args(), and when_vals().

#define ADD_INSN1 | ( |  | seq,
|  |  | line,
|  |  | insn,
|  |  | op1
| ) |  |

Value:
ADD_ELEM((seq), (LINK_ELEMENT *) \
new_insn_body(iseq, (line), BIN(insn), 1, (VALUE)(op1)))
ADD_ELEM
static void ADD_ELEM(ISEQ_ARG_DECLARE LINK_ANCHOR *anchor, LINK_ELEMENT *elem)
Definition: compile.c:389
new_insn_body
static INSN * new_insn_body(rb_iseq_t *iseq, int line_no, int insn_id, int argc,...)
Definition: compile.c:926
iseq_link_element
Definition: compile.c:26
VALUE
unsigned long VALUE
Definition: ripper.y:104

Definition at line 189 of file compile.c.

Referenced by compile_array_(), compile_colon2(), compile_cpath(), compile_dstr(), compile_dstr_fragments(), compile_massign_lhs(), defined_expr(), iseq_compile_each(), rb_iseq_compile_node(), setup_args(), and when_vals().

#define ADD_INSN2 | ( |  | seq,
|  |  | line,
|  |  | insn,
|  |  | op1,
|  |  | op2
| ) |  |

Value:
ADD_ELEM((seq), (LINK_ELEMENT *) \
new_insn_body(iseq, (line), BIN(insn), 2, (VALUE)(op1), (VALUE)(op2)))
ADD_ELEM
static void ADD_ELEM(ISEQ_ARG_DECLARE LINK_ANCHOR *anchor, LINK_ELEMENT *elem)
Definition: compile.c:389
new_insn_body
static INSN * new_insn_body(rb_iseq_t *iseq, int line_no, int insn_id, int argc,...)
Definition: compile.c:926
iseq_link_element
Definition: compile.c:26
VALUE
unsigned long VALUE
Definition: ripper.y:104

Definition at line 196 of file compile.c.

Referenced by compile_dregx(), compile_massign(), iseq_compile_each(), and rb_iseq_compile_node().

#define ADD_INSN3 | ( |  | seq,
|  |  | line,
|  |  | insn,
|  |  | op1,
|  |  | op2,
|  |  | op3
| ) |  |

Value:
ADD_ELEM((seq), (LINK_ELEMENT *) \
new_insn_body(iseq, (line), BIN(insn), 3, (VALUE)(op1), (VALUE)(op2), (VALUE)(op3)))
ADD_ELEM
static void ADD_ELEM(ISEQ_ARG_DECLARE LINK_ANCHOR *anchor, LINK_ELEMENT *elem)
Definition: compile.c:389
new_insn_body
static INSN * new_insn_body(rb_iseq_t *iseq, int line_no, int insn_id, int argc,...)
Definition: compile.c:926
iseq_link_element
Definition: compile.c:26
VALUE
unsigned long VALUE
Definition: ripper.y:104

Definition at line 200 of file compile.c.

Referenced by defined_expr(), and iseq_compile_each().

#define ADD_INSNL | ( |  | seq,
|  |  | line,
|  |  | insn,
|  |  | label
| ) |  | ADD_INSN1(seq, line, insn, label)

Definition at line 194 of file compile.c.

Referenced by compile_branch_condition(), defined_expr(), iseq_compile_each(), and when_vals().

#define ADD_LABEL | ( |  | seq,
|  |  | label
| ) |  | ADD_ELEM((seq), (LINK_ELEMENT *) (label))

Definition at line 236 of file compile.c.

Referenced by add_ensure_iseq(), compile_branch_condition(), iseq_build_from_ary_body(), iseq_compile_each(), iseq_set_arguments(), and rb_iseq_compile_node().

#define ADD_SEND | ( |  | seq,
|  |  | line,
|  |  | id,
|  |  | argc
| ) |  | ADD_SEND_R((seq), (line), (id), (argc), (VALUE)Qfalse, (VALUE)INT2FIX(0))

Definition at line 205 of file compile.c.

Referenced by compile_array_(), and iseq_compile_each().

#define ADD_SEND_R | ( |  | seq,
|  |  | line,
|  |  | id,
|  |  | argc,
|  |  | block,
|  |  | flag
| ) |  |

Value:
ADD_ELEM((seq), (LINK_ELEMENT *) \
new_insn_send(iseq, (line), \
(VALUE)(id), (VALUE)(argc), (VALUE)(block), (VALUE)(flag)))
block
int register char * block
Definition: crypt.c:949
new_insn_send
static INSN * new_insn_send(rb_iseq_t *iseq, int line_no, VALUE id, VALUE argc, VALUE block, VALUE flag)
Definition: compile.c:972
flag
flag
Definition: tcltklib.c:2048
ADD_ELEM
static void ADD_ELEM(ISEQ_ARG_DECLARE LINK_ANCHOR *anchor, LINK_ELEMENT *elem)
Definition: compile.c:389
argc
int argc
Definition: tcltklib.c:1970
iseq_link_element
Definition: compile.c:26
VALUE
unsigned long VALUE
Definition: ripper.y:104

Definition at line 217 of file compile.c.

Referenced by iseq_compile_each().

#define ADD_SEQ | ( |  | seq1,
|  |  | seq2
| ) |  | APPEND_LIST((seq1), (seq2))

Definition at line 181 of file compile.c.

Referenced by add_ensure_iseq(), compile_massign(), compile_massign_lhs(), iseq_compile_each(), and setup_args().

#define ADD_TRACE | ( |  | seq,
|  |  | line,
|  |  | event
| ) |  |

Value:
do { \
if ((event) == RUBY_EVENT_LINE && iseq->coverage && \
(line) != iseq->compile_data->last_coverable_line) { \
RARRAY_PTR(iseq->coverage)[(line) - 1] = INT2FIX(0); \
iseq->compile_data->last_coverable_line = (line); \
ADD_INSN1((seq), (line), trace, INT2FIX(RUBY_EVENT_COVERAGE)); \
} \
if (iseq->compile_data->option->trace_instruction) { \
ADD_INSN1((seq), (line), trace, INT2FIX(event)); \
} \
} while (0)
RARRAY_PTR
RARRAY_PTR(q->result)[0]
RUBY_EVENT_LINE
#define RUBY_EVENT_LINE
RUBY_EVENT_COVERAGE
#define RUBY_EVENT_COVERAGE
INT2FIX
#define INT2FIX(i)
if
if(RB_TYPE_P(r, T_FLOAT))
Definition: bigdecimal.c:1186
ADD_INSN1
#define ADD_INSN1(seq, line, insn, op1)
Definition: compile.c:189

Definition at line 222 of file compile.c.

Referenced by iseq_compile_each(), and rb_iseq_compile_node().

#define APPEND_LABEL | ( |  | seq,
|  |  | before,
|  |  | label
| ) |  | APPEND_ELEM((seq), (before), (LINK_ELEMENT *) (label))

Definition at line 239 of file compile.c.

#define BUFSIZE 0x100

Definition at line 2973 of file compile.c.

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

Definition at line 5752 of file compile.c.

Referenced by rb_iseq_build_from_ary().

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

Definition at line 5753 of file compile.c.

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

Definition at line 5754 of file compile.c.

Referenced by rb_iseq_build_from_ary().

#define COMPILE | ( |  | anchor,
|  |  | desc,
|  |  | node
| ) |  |

Value:
(debug_compile("== " desc "\n", \
iseq_compile_each(iseq, (anchor), (node), 0)))
debug_compile
#define debug_compile(msg, v)
Definition: compile.c:161
iseq_compile_each
static int iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *anchor, NODE *n, int)
compile each node
Definition: compile.c:3155

Definition at line 255 of file compile.c.

Referenced by compile_array_(), compile_branch_condition(), compile_colon2(), compile_cpath(), compile_dstr_fragments(), compile_massign(), compile_massign_opt(), defined_expr(), iseq_compile_each(), iseq_set_arguments(), rb_iseq_compile_node(), setup_args(), and when_vals().

#define COMPILE_ | ( |  | anchor,
|  |  | desc,
|  |  | node,
|  |  | poped
| ) |  |

Value:
(debug_compile("== " desc "\n", \
iseq_compile_each(iseq, (anchor), (node), (poped))))
debug_compile
#define debug_compile(msg, v)
Definition: compile.c:161
iseq_compile_each
static int iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *anchor, NODE *n, int)
compile each node
Definition: compile.c:3155

Definition at line 265 of file compile.c.

Referenced by compile_array_(), and iseq_compile_each().

#define compile_debug CPDEBUG

Definition at line 96 of file compile.c.

Referenced by iseq_setup(), and verify_list().

#define COMPILE_ERROR | ( |  | strs | ) |

Value:
{ \
VALUE tmp = GET_THREAD()->errinfo; \
if (compile_debug) rb_compile_bug strs; \
GET_THREAD()->errinfo = iseq->compile_data->err_info; \
rb_compile_error strs; \
iseq->compile_data->err_info = GET_THREAD()->errinfo; \
GET_THREAD()->errinfo = tmp; \
ret = 0; \
break; \
}
tmp
volatile VALUE tmp
Definition: tcltklib.c:10209
rb_compile_error
void rb_compile_error(const char *file, int line, const char *fmt,...)
Definition: error.c:138
ret
int ret
Definition: tcltklib.c:280
rb_compile_bug
void rb_compile_bug(const char *file, int line, const char *fmt,...)
Definition: error.c:358
if
if(RB_TYPE_P(r, T_FLOAT))
Definition: bigdecimal.c:1186
compile_debug
#define compile_debug
Definition: compile.c:96
VALUE
unsigned long VALUE
Definition: ripper.y:104
rb_thread_struct::errinfo
VALUE errinfo
Definition: vm_core.h:542
GET_THREAD
static rb_thread_t * GET_THREAD(void)
Definition: vm_core.h:883

Definition at line 276 of file compile.c.

Referenced by iseq_compile_each(), and validate_label().

#define COMPILE_NG 0

Definition at line 292 of file compile.c.

Referenced by iseq_compile_each().

#define COMPILE_OK 1

Definition at line 291 of file compile.c.

Referenced by compile_branch_condition(), compile_colon2(), compile_dregx(), compile_dstr(), compile_dstr_fragments(), compile_massign(), compile_massign_lhs(), insn_set_specialized_instruction(), iseq_add_mark_object(), iseq_add_mark_object_compile_time(), iseq_build_from_ary_body(), iseq_build_from_ary_exception(), iseq_compile_each(), iseq_insns_unification(), iseq_optimize(), iseq_peephole_optimize(), iseq_set_arguments(), iseq_set_exception_local_table(), iseq_set_exception_table(), iseq_set_local_table(), iseq_set_optargs_table(), iseq_set_sequence(), iseq_set_sequence_stackcaching(), iseq_specialized_instruction(), and rb_iseq_translate_threaded_code().

#define COMPILE_POPED | ( |  | anchor,
|  |  | desc,
|  |  | node
| ) |  |

Value:
(debug_compile("== " desc "\n", \
iseq_compile_each(iseq, (anchor), (node), 1)))
debug_compile
#define debug_compile(msg, v)
Definition: compile.c:161
iseq_compile_each
static int iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *anchor, NODE *n, int)
compile each node
Definition: compile.c:3155

Definition at line 260 of file compile.c.

Referenced by add_ensure_iseq(), compile_massign_lhs(), compile_massign_opt(), iseq_compile_each(), iseq_set_arguments(), and rb_iseq_compile_node().

#define CPDEBUG 0

debug function(macro) interface depend on CPDEBUG if it is less than 0, runtime option is in effect.

debug level: 0: no debug output 1: show node type 2: show node important parameters ... 5: show other parameters 10: show every AST array

Definition at line 92 of file compile.c.

Referenced by compile_array_().

#define debug_compile | ( |  | msg,
|  |  | v
| ) |  | (v)

Definition at line 161 of file compile.c.

#define debug_node_end | ( |  | ) | ((void)0)

Definition at line 153 of file compile.c.

Referenced by iseq_compile_each().

#define debug_node_start | ( |  | node | ) | ((void)0)

Definition at line 152 of file compile.c.

Referenced by iseq_compile_each().

#define debugi | ( |  | header,
|  |  | id
| ) |  | r_id(id)

Definition at line 147 of file compile.c.

Referenced by compile_colon2(), and iseq_compile_each().

#define debugp | ( |  | header,
|  |  | value
| ) |  | r_value(value)

Definition at line 148 of file compile.c.

#define debugp_param | ( |  | header,
|  |  | value
| ) |  | r_value(value)

Definition at line 151 of file compile.c.

Referenced by compile_dstr_fragments(), iseq_compile_each(), and when_vals().

#define debugp_verbose | ( |  | header,
|  |  | value
| ) |  | r_value(value)

Definition at line 149 of file compile.c.

#define debugp_verbose_node | ( |  | header,
|  |  | value
| ) |  | r_value(value)

Definition at line 150 of file compile.c.

#define debugs if(0)printf

Definition at line 160 of file compile.c.

Referenced by iseq_compile_each(), iseq_set_arguments(), iseq_set_local_table(), iseq_setup(), and new_child_iseq().

#define DECL_ANCHOR | ( |  | name | ) | LINK_ANCHOR *name, name##_body__ = {{0,},}

Definition at line 297 of file compile.c.

Referenced by add_ensure_iseq(), compile_array_(), compile_massign(), compile_massign_lhs(), iseq_compile_each(), rb_iseq_build_from_ary(), rb_iseq_compile_node(), and setup_args().

#define defined_expr defined_expr0

Definition at line 2763 of file compile.c.

Referenced by defined_expr(), and iseq_compile_each().

#define ERROR_ARGS ruby_sourcefile, nd_line(node),

Definition at line 288 of file compile.c.

Referenced by iseq_compile_each(), and rb_iseq_compile_node().

#define FIXNUM_INC | ( |  | n,
|  |  | i
| ) |  | ((n)+(INT2FIX(i)&~FIXNUM_FLAG))

Definition at line 23 of file compile.c.

Referenced by iseq_compile_each().

#define FIXNUM_OR | ( |  | n,
|  |  | i
| ) |  | ((n)|INT2FIX(i))

Definition at line 24 of file compile.c.

#define hide_obj | ( |  | obj | ) | do {OBJ_FREEZE(obj); RBASIC(obj)->klass = 0;} while (0)

Definition at line 302 of file compile.c.

Referenced by compile_dstr_fragments(), and iseq_set_sequence().

#define INIT_ANCHOR | ( |  | name | ) | (name##_body__.last = &name##_body__.anchor, name = &name##_body__)

Definition at line 299 of file compile.c.

Referenced by add_ensure_iseq(), compile_array_(), compile_massign(), compile_massign_lhs(), iseq_compile_each(), rb_iseq_build_from_ary(), rb_iseq_compile_node(), and setup_args().

#define INSN_OF | ( |  | insn | ) | (((INSN*)(insn))->insn_id)

Definition at line 272 of file compile.c.

Referenced by iseq_compile_each().

#define iseq_absolute_path | ( |  | iseq | ) | (((rb_iseq_t*)DATA_PTR(iseq))->location.absolute_path)

Definition at line 171 of file compile.c.

Referenced by new_child_iseq().

#define ISEQ_ARG

Definition at line 314 of file compile.c.

#define ISEQ_ARG_DECLARE

Definition at line 315 of file compile.c.

#define iseq_path | ( |  | iseq | ) | (((rb_iseq_t*)DATA_PTR(iseq))->location.path)

Definition at line 168 of file compile.c.

Referenced by new_child_iseq().

#define MEMORY | ( |  | v | ) |

Value:
{ \
int i; \
if (memindex == memsize) return 0; \
for (i=0; i<memindex; i++) { \
if (mem[i] == (v)) return 0; \
} \
mem[memindex++] = (v); \
}
int
VP_EXPORT int
Definition: bigdecimal.c:5050
return
return
Definition: bigdecimal.c:5800
i
ssize_t i
Definition: bigdecimal.c:5655
for
for(v/=shifter=1)
Definition: bigdecimal.c:5677
if
if(RB_TYPE_P(r, T_FLOAT))
Definition: bigdecimal.c:1186
v
BDIGIT v
Definition: bigdecimal.c:5656

Referenced by compile_massign_opt().

#define NEW_CHILD_ISEQVAL | ( |  | node,
|  |  | name,
|  |  | type,
|  |  | line_no
| ) |  | new_child_iseq(iseq, (node), (name), iseq->self, (type), (line_no))

Definition at line 177 of file compile.c.

Referenced by iseq_compile_each().

#define NEW_ISEQVAL | ( |  | node,
|  |  | name,
|  |  | type,
|  |  | line_no
| ) |  | new_child_iseq(iseq, (node), (name), 0, (type), (line_no))

Definition at line 174 of file compile.c.

Referenced by iseq_compile_each().

#define NEW_LABEL | ( |  | l | ) | new_label_body(iseq, (l))

Definition at line 166 of file compile.c.

Referenced by add_ensure_iseq(), compile_branch_condition(), defined_expr(), iseq_compile_each(), iseq_set_arguments(), rb_iseq_compile_node(), and register_label().

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

Definition at line 22 of file compile.c.

Referenced by compile_massign_opt(), and rb_insns_name_array().

#define OPERAND_AT | ( |  | insn,
|  |  | idx
| ) |  | (((INSN*)(insn))->operands[(idx)])

Definition at line 269 of file compile.c.

Referenced by get_destination_insn(), insn_data_to_s_detail(), iseq_compile_each(), iseq_peephole_optimize(), and iseq_specialized_instruction().

#define rb_intern | ( |  | str | ) | rb_intern_const(str)

#define ruby_sourcefile RSTRING_PTR(iseq->location.path)

Definition at line 424 of file compile.c.

Referenced by e_option_supplied(), gettable_gen(), parser_set_encode(), parser_set_token_info(), parser_warn(), parser_warning(), reg_compile_gen(), token_info_pop(), validate_label(), warn_unused_var(), yycompile(), and yycompile0().

#define SP_INSN | ( |  | opt | ) | insn_set_specialized_instruction(iseq, iobj, BIN(opt_##opt))

Referenced by iseq_specialized_instruction().

#define USE_INSN_STACK_INCREASE 1

Definition at line 16 of file compile.c.

## Typedef Documentation

typedef struct iseq_adjust_data ADJUST

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

## Enumeration Type Documentation

enum compile_array_type_t

Enumerator
COMPILE_ARRAY_TYPE_ARRAY |
COMPILE_ARRAY_TYPE_HASH |
COMPILE_ARRAY_TYPE_ARGS |

Definition at line 2325 of file compile.c.

## Function Documentation

static void ADD_ELEM | ( | ISEQ_ARG_DECLARE LINK_ANCHOR * | anchor,
|  | LINK_ELEMENT * | elem
| ) |  |
| static

Definition at line 389 of file compile.c.

References elem, iseq_link_element::next, iseq_link_element::prev, and verify_list().

Referenced by compile_massign_lhs(), and iseq_build_from_ary_body().

static void add_ensure_iseq | ( | LINK_ANCHOR * | ret,
|  | rb_iseq_t * | iseq,
|  | int | is_return
| ) |  |
| static

Definition at line 3028 of file compile.c.

References add_ensure_range(), ADD_LABEL, ADD_SEQ, rb_iseq_struct::compile_data, COMPILE_POPED, DECL_ANCHOR, iseq_compile_data_ensure_node_stack::ensure_node, iseq_compile_data::ensure_node_stack, iseq_compile_data_ensure_node_stack::erange, INIT_ANCHOR, NEW_LABEL, and iseq_compile_data_ensure_node_stack::prev.

Referenced by iseq_compile_each().

static void add_ensure_range | ( | rb_iseq_t * | iseq,
|  | struct ensure_range * | erange,
|  | LABEL * | lstart,
|  | LABEL * | lend
| ) |  |
| static

Definition at line 3010 of file compile.c.

References ensure_range::begin, compile_data_alloc(), ensure_range::end, ne, and ensure_range::next.

Referenced by add_ensure_iseq().

static void APPEND_ELEM | ( | ISEQ_ARG_DECLARE LINK_ANCHOR * | anchor,
|  | LINK_ELEMENT * | before,
|  | LINK_ELEMENT * | elem
| ) |  |
| static

Definition at line 401 of file compile.c.

References elem, iseq_link_element::next, iseq_link_element::prev, and verify_list().

static void APPEND_LIST | ( | ISEQ_ARG_DECLARE LINK_ANCHOR * | anc1,
|  | LINK_ANCHOR * | anc2
| ) |  |
| static

Definition at line 759 of file compile.c.

References iseq_link_anchor::anchor, iseq_link_anchor::last, iseq_link_element::next, iseq_link_element::prev, and verify_list().

Referenced by compile_array_().

static int calc_sp_depth | ( | int | depth,
|  | INSN * | iobj
| ) |  |
| static

Definition at line 5344 of file compile.c.

References iseq_insn_data::insn_id, and iseq_insn_data::operands.

Referenced by iseq_set_sequence().

static VALUE case_when_optimizable_literal | ( | NODE * | node | ) |
| static

Definition at line 2482 of file compile.c.

References FIXABLE, LONG2FIX, nd_type, NODE_LIT, NODE_STR, Qundef, rb_cNumeric, rb_dbl2big(), rb_obj_is_kind_of(), RB_TYPE_P, RFLOAT_VALUE, SYMBOL_P, T_FLOAT, and v.

Referenced by when_vals().

static int cdhash_cmp | ( | VALUE | val,
|  | VALUE | lit
| ) |  |
| static

Definition at line 1316 of file compile.c.

References BUILTIN_TYPE, rb_eql(), rb_str_hash_cmp(), SPECIAL_CONST_P, and T_STRING.

static st_index_t cdhash_hash | ( | VALUE | a | ) |
| static

Definition at line 1332 of file compile.c.

References a, FIX2LONG, hval, rb_hash(), rb_str_hash(), RB_TYPE_P, SPECIAL_CONST_P, and T_STRING.

static int cdhash_set_label_i | ( | VALUE | key,
|  | VALUE | val,
|  | void * | ptr
| ) |  |
| static

Definition at line 1354 of file compile.c.

References data, cdhash_set_label_struct::hash, INT2FIX, cdhash_set_label_struct::len, cdhash_set_label_struct::pos, iseq_label_data::position, rb_hash_aset(), and ST_CONTINUE.

Referenced by iseq_set_sequence().

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

Definition at line 5755 of file compile.c.

References NUM2LONG, v, and void.

Referenced by rb_iseq_build_from_ary().

static VALUE compile_array | ( | rb_iseq_t * | iseq,
|  | LINK_ANCHOR * | ret,
|  | NODE * | node_root,
|  | enum compile_array_type_t | type
| ) |  |
| static

Definition at line 2476 of file compile.c.

References compile_array_().

Referenced by iseq_compile_each(), and setup_args().

static int compile_array_ | ( | rb_iseq_t * | iseq,
|  | LINK_ANCHOR * | ret,
|  | NODE * | node_root,
|  | enum compile_array_type_t | type,
|  | int | poped
| ) |  |
| static

Definition at line 2332 of file compile.c.

References ADD_INSN, ADD_INSN1, ADD_SEND, APPEND_LIST(), ary, COMPILE, COMPILE_, COMPILE_ARRAY_TYPE_ARGS, COMPILE_ARRAY_TYPE_ARRAY, COMPILE_ARRAY_TYPE_HASH, CPDEBUG, DECL_ANCHOR, i, ID2SYM, id_core_hash_from_ary, id_core_hash_merge_ary, id_core_hash_merge_kwd, id_core_hash_merge_ptr, INIT_ANCHOR, int, INT2FIX, iseq_add_mark_object_compile_time(), len, max(), nd_line, nd_type, NODE_ARRAY, NODE_LIT, NODE_ZARRAY, OBJ_FREEZE, rb_ary_push(), rb_ary_tmp_new(), rb_bug(), ruby_node_name(), and VM_SPECIAL_OBJECT_VMCORE.

Referenced by compile_array(), and iseq_compile_each().

static int compile_branch_condition | ( | rb_iseq_t * | iseq,
|  | LINK_ANCHOR * | ret,
|  | NODE * | cond,
|  | LABEL * | then_label,
|  | LABEL * | else_label
| ) |  |
| static

Definition at line 2281 of file compile.c.

References ADD_INSNL, ADD_LABEL, COMPILE, COMPILE_OK, nd_line, nd_type, NEW_LABEL, NODE_AND, NODE_FALSE, NODE_LIT, NODE_NIL, NODE_OR, NODE_STR, and NODE_TRUE.

Referenced by iseq_compile_each().

static int compile_colon2 | ( | rb_iseq_t * | iseq,
|  | NODE * | node,
|  | LINK_ANCHOR * | pref,
|  | LINK_ANCHOR * | body
| ) |  |
| static

Definition at line 2716 of file compile.c.

References ADD_INSN, ADD_INSN1, COMPILE, COMPILE_OK, debugi, ID2SYM, nd_line, nd_type, NODE_COLON2, NODE_COLON3, NODE_CONST, and rb_cObject.

Referenced by iseq_compile_each().

static VALUE compile_cpath | ( | LINK_ANCHOR * | ret,
|  | rb_iseq_t * | iseq,
|  | NODE * | cpath
| ) |  |
| static

Definition at line 2743 of file compile.c.

References ADD_INSN1, COMPILE, INT2FIX, nd_line, nd_type, NODE_COLON3, Qfalse, Qtrue, rb_cObject, and VM_SPECIAL_OBJECT_CONST_BASE.

Referenced by iseq_compile_each().

static void* compile_data_alloc | ( | rb_iseq_t * | iseq,
|  | size_t | size
| ) |  |
| static

Definition at line 585 of file compile.c.

References ALLOC_N, iseq_compile_data_storage::buff, rb_iseq_struct::compile_data, iseq_compile_data_storage::next, iseq_compile_data_storage::pos, ptr, retry, iseq_compile_data_storage::size, and iseq_compile_data::storage_current.

Referenced by add_ensure_range(), compile_data_alloc_adjust(), compile_data_alloc_insn(), compile_data_alloc_label(), insn_set_specialized_instruction(), iseq_build_from_ary_body(), new_callinfo(), new_insn_body(), and new_insn_send().

static ADJUST* compile_data_alloc_adjust | ( | rb_iseq_t * | iseq | ) |
| static

Definition at line 627 of file compile.c.

References compile_data_alloc().

Referenced by new_adjust_body().

static INSN* compile_data_alloc_insn | ( | rb_iseq_t * | iseq | ) |
| static

Definition at line 615 of file compile.c.

References compile_data_alloc().

Referenced by new_insn_core().

static LABEL* compile_data_alloc_label | ( | rb_iseq_t * | iseq | ) |
| static

Definition at line 621 of file compile.c.

References compile_data_alloc().

Referenced by new_label_body().

static int compile_dregx | ( | rb_iseq_t * | iseq,
|  | LINK_ANCHOR * | ret,
|  | NODE * | node
| ) |  |
| static

Definition at line 2272 of file compile.c.

References ADD_INSN2, cnt, compile_dstr_fragments(), COMPILE_OK, INT2FIX, and nd_line.

Referenced by iseq_compile_each().

static int compile_dstr | ( | rb_iseq_t * | iseq,
|  | LINK_ANCHOR * | ret,
|  | NODE * | node
| ) |  |
| static

Definition at line 2263 of file compile.c.

References ADD_INSN1, cnt, compile_dstr_fragments(), COMPILE_OK, INT2FIX, and nd_line.

Referenced by iseq_compile_each().

static int compile_dstr_fragments | ( | rb_iseq_t * | iseq,
|  | LINK_ANCHOR * | ret,
|  | NODE * | node,
|  | int * | cntp
| ) |  |
| static

Definition at line 2232 of file compile.c.

References ADD_INSN1, cnt, COMPILE, COMPILE_OK, debugp_param, hide_obj, nd_line, nd_type, NIL_P(), and NODE_STR.

Referenced by compile_dregx(), and compile_dstr().

static int compile_massign | ( | rb_iseq_t * | iseq,
|  | LINK_ANCHOR * | ret,
|  | NODE * | node,
|  | int | poped
| ) |  |
| static

Definition at line 2658 of file compile.c.

References ADD_INSN, ADD_INSN2, ADD_SEQ, COMPILE, compile_massign_lhs(), compile_massign_opt(), COMPILE_OK, DECL_ANCHOR, flag, INIT_ANCHOR, int, INT2FIX, nd_line, nd_type, and NODE_POSTARG.

Referenced by iseq_compile_each().

static int compile_massign_lhs | ( | rb_iseq_t * | iseq,
|  | LINK_ANCHOR * | ret,
|  | NODE * | node
| ) |  |
| static

Definition at line 2541 of file compile.c.

References ADD_ELEM(), ADD_INSN, ADD_INSN1, ADD_SEQ, rb_call_info_struct::argc, COMPILE_OK, COMPILE_POPED, DECL_ANCHOR, FIRST_ELEMENT(), INIT_ANCHOR, INT2FIX, nd_line, nd_type, NODE_ATTRASGN, NODE_MASGN, iseq_insn_data::operands, rb_call_info_struct::orig_argc, POP_ELEMENT(), and REMOVE_ELEM().

Referenced by compile_massign(), and compile_massign_opt_lhs().

static int compile_massign_opt | ( | rb_iseq_t * | iseq,
|  | LINK_ANCHOR * | ret,
|  | NODE * | rhsn,
|  | NODE * | orig_lhsn
| ) |  |
| static

Definition at line 2593 of file compile.c.

References ADD_INSN, COMPILE, compile_massign_opt_lhs(), COMPILE_POPED, i, MEMORY, nd_line, nd_type, NODE_ARRAY, NODE_CVASGN, NODE_DASGN, NODE_DASGN_CURR, NODE_IASGN, NODE_IASGN2, NODE_LASGN, and numberof.

Referenced by compile_massign().

static void compile_massign_opt_lhs | ( | rb_iseq_t * | iseq,
|  | LINK_ANCHOR * | ret,
|  | NODE * | lhsn
| ) |  |
| static

Definition at line 2584 of file compile.c.

References compile_massign_lhs().

Referenced by compile_massign_opt().

static int defined_expr | ( | rb_iseq_t * | iseq,
|  | LINK_ANCHOR * | ret,
|  | NODE * | node,
|  | LABEL ** | lfinish,
|  | VALUE | needstr
| ) |  |
| static

Definition at line 2765 of file compile.c.

References ADD_INSN, ADD_INSN1, ADD_INSN3, ADD_INSNL, COMPILE, DEFINED_ASGN, DEFINED_CONST, DEFINED_CVAR, DEFINED_EXPR, defined_expr, DEFINED_FALSE, DEFINED_FUNC, DEFINED_GVAR, DEFINED_IVAR, DEFINED_LVAR, DEFINED_METHOD, DEFINED_NIL, DEFINED_REF, DEFINED_SELF, DEFINED_TRUE, DEFINED_YIELD, DEFINED_ZSUPER, FALSE, RNode::id, ID2SYM, INT2FIX, nd_line, nd_type, NEW_LABEL, NODE_AND, NODE_ARRAY, NODE_ATTRASGN, NODE_BACK_REF, NODE_CALL, NODE_CDECL, NODE_COLON2, NODE_COLON3, NODE_CONST, NODE_CVAR, NODE_CVASGN, NODE_CVDECL, NODE_DASGN, NODE_DASGN_CURR, NODE_DVAR, NODE_FALSE, NODE_FCALL, NODE_GASGN, NODE_GVAR, NODE_IASGN, NODE_IVAR, NODE_LASGN, NODE_LIT, NODE_LVAR, NODE_MASGN, NODE_NIL, NODE_NTH_REF, NODE_OP_ASGN1, NODE_OP_ASGN2, NODE_OP_ASGN_AND, NODE_OP_ASGN_OR, NODE_OR, NODE_SELF, NODE_STR, NODE_SUPER, NODE_TRUE, NODE_VCALL, NODE_YIELD, NODE_ZARRAY, NODE_ZSUPER, NULL, Qfalse, Qtrue, rb_cObject, rb_is_const_id(), rb_iseq_defined_string(), str, TRUE, and type.

static void dump_disasm_list | ( | LINK_ELEMENT * | elem | ) |
| static

Definition at line 5429 of file compile.c.

References FIX2LONG, insn_data_length(), insn_data_line_no(), insn_data_to_s_detail(), iseq_adjust_data::label, iseq_label_data::label_no, iseq_link_element::next, rb_eSyntaxError, rb_raise(), str, StringValueCStr, and iseq_link_element::type.

Referenced by iseq_set_sequence(), and iseq_setup().

static LINK_ELEMENT* FIRST_ELEMENT | ( | LINK_ANCHOR * | anchor | ) |
| static

Definition at line 688 of file compile.c.

References iseq_link_anchor::anchor, and iseq_link_element::next.

Referenced by compile_massign_lhs(), iseq_insns_unification(), iseq_optimize(), iseq_set_sequence(), iseq_set_sequence_stackcaching(), and iseq_setup().

static LINK_ELEMENT* get_destination_insn | ( | INSN * | iobj | ) |
| static

Definition at line 1726 of file compile.c.

References iseq_label_data::link, list, iseq_link_element::next, OPERAND_AT, and iseq_link_element::type.

Referenced by iseq_peephole_optimize().

static int get_dyna_var_idx | ( | rb_iseq_t * | iseq,
|  | ID | id,
|  | int * | level,
|  | int * | ls
| ) |  |
| static

Definition at line 1096 of file compile.c.

References get_dyna_var_idx_at_raw(), idx, rb_iseq_struct::local_size, rb_iseq_struct::parent_iseq, and rb_bug().

Referenced by iseq_compile_each().

static int get_dyna_var_idx_at_raw | ( | rb_iseq_t * | iseq,
|  | ID | id
| ) |  |
| static

Definition at line 1071 of file compile.c.

References i, rb_iseq_struct::local_table, and rb_iseq_struct::local_table_size.

Referenced by get_dyna_var_idx(), get_local_var_idx(), and iseq_set_arguments().

static VALUE get_exception_sym2type | ( | VALUE | sym | ) |
| static

Definition at line 5509 of file compile.c.

References ID2SYM, rb_eSyntaxError, rb_inspect(), rb_intern, rb_raise(), StringValuePtr, and sym_inspect().

Referenced by iseq_build_from_ary_exception().

static int get_local_var_idx | ( | rb_iseq_t * | iseq,
|  | ID | id
| ) |  |
| static

Definition at line 1084 of file compile.c.

References get_dyna_var_idx_at_raw(), idx, rb_iseq_struct::local_iseq, and rb_bug().

Referenced by iseq_compile_each().

static int get_lvar_level | ( | rb_iseq_t * | iseq | ) |
| static

Definition at line 1060 of file compile.c.

References rb_iseq_struct::local_iseq, and rb_iseq_struct::parent_iseq.

Referenced by iseq_compile_each().

static LINK_ELEMENT* get_next_insn | ( | INSN * | iobj | ) |
| static

Definition at line 1742 of file compile.c.

References iseq_insn_data::link, list, iseq_link_element::next, and iseq_link_element::type.

Referenced by iseq_peephole_optimize().

static LINK_ELEMENT* get_prev_insn | ( | INSN * | iobj | ) |
| static

Definition at line 1756 of file compile.c.

References iseq_insn_data::link, list, iseq_link_element::prev, and iseq_link_element::type.

Referenced by iseq_peephole_optimize().

static void INSERT_ELEM_NEXT | ( | LINK_ELEMENT * | elem1,
|  | LINK_ELEMENT * | elem2
| ) |  |
| static

Definition at line 636 of file compile.c.

References iseq_link_element::next, and iseq_link_element::prev.

Referenced by iseq_peephole_optimize().

static void INSERT_LIST | ( | ISEQ_ARG_DECLARE LINK_ANCHOR * | anc1,
|  | LINK_ANCHOR * | anc2
| ) |  |
| static

Definition at line 780 of file compile.c.

References iseq_link_anchor::anchor, iseq_link_anchor::last, iseq_link_element::next, iseq_link_element::prev, and verify_list().

Referenced by setup_args().

static int insn_data_length | ( | INSN * | iobj | ) |
| static

Definition at line 5338 of file compile.c.

References iseq_insn_data::insn_id.

Referenced by dump_disasm_list(), and iseq_set_sequence().

static int insn_data_line_no | ( | INSN * | iobj | ) |
| static

Definition at line 5350 of file compile.c.

References iseq_insn_data::line_no.

Referenced by dump_disasm_list().

static VALUE insn_data_to_s_detail | ( | INSN * | iobj | ) |
| static

Definition at line 5356 of file compile.c.

References FIX2INT, rb_global_entry::id, iseq_insn_data::insn_id, iseq_label_data::label_no, rb_call_info_struct::mid, OPERAND_AT, iseq_insn_data::operands, rb_call_info_struct::orig_argc, PRIxVALUE, Qnil, rb_eSyntaxError, rb_id2name(), rb_inspect(), rb_raise(), rb_sprintf(), rb_str_cat2(), rb_str_catf(), rb_str_concat(), rb_iseq_struct::self, str, type, v, and val.

Referenced by dump_disasm_list().

static struct st_table* insn_make_insn_table | ( | void |  | ) |
| static

Definition at line 5576 of file compile.c.

References i, ID2SYM, rb_intern, st_init_numtable(), st_insert(), and table.

Referenced by iseq_build_from_ary_body().

static int insn_set_specialized_instruction | ( | rb_iseq_t * | iseq,
|  | INSN * | iobj,
|  | int | insn_id
| ) |  |
| static

Definition at line 1888 of file compile.c.

References compile_data_alloc(), COMPILE_OK, idEq, iseq_insn_data::insn_id, new_callinfo(), iseq_insn_data::operand_size, iseq_insn_data::operands, and rb_bug().

static int iseq_add_mark_object | ( | rb_iseq_t * | iseq,
|  | VALUE | v
| ) |  |
| static

Definition at line 416 of file compile.c.

References COMPILE_OK, rb_iseq_add_mark_object(), and SPECIAL_CONST_P.

Referenced by iseq_build_from_ary_body(), iseq_build_load_iseq(), iseq_compile_each(), iseq_set_exception_table(), iseq_set_sequence(), and new_child_iseq().

static int iseq_add_mark_object_compile_time | ( | rb_iseq_t * | iseq,
|  | VALUE | v
| ) |  |
| static

Definition at line 427 of file compile.c.

References rb_iseq_struct::compile_data, COMPILE_OK, iseq_compile_data::mark_ary, rb_ary_push(), and SPECIAL_CONST_P.

Referenced by compile_array_(), and iseq_build_from_ary_body().

static int iseq_build_from_ary_body | ( | rb_iseq_t * | iseq,
|  | LINK_ANCHOR * | anchor,
|  | VALUE | body,
|  | struct st_table * | labels_table
| ) |  |
| static

Definition at line 5607 of file compile.c.

References ADD_ELEM(), ADD_LABEL, argc, argv, block, compile_data_alloc(), COMPILE_OK, FIX2INT, FIXNUM_P, flag, i, rb_iseq_struct::ic_size, ID2SYM, insn_make_insn_table(), iseq_add_mark_object(), iseq_add_mark_object_compile_time(), iseq_build_load_iseq(), iseq_setup(), len, rb_iseq_struct::location, new_callinfo(), new_insn_core(), NIL_P(), NUM2INT, NUM2ULONG, obj, rb_iseq_location_struct::path, ptr, Qnil, RARRAY_LEN, RARRAY_LENINT, RARRAY_PTR(), rb_ary_dup(), rb_ary_entry(), rb_ary_store(), rb_compile_error(), rb_convert_type(), rb_eSyntaxError, rb_eTypeError, RB_GC_GUARD, rb_global_entry(), rb_hash_aref(), rb_inspect(), rb_intern, rb_raise(), RB_TYPE_P, register_label(), RSTRING_PTR, st_free_table(), st_lookup(), sym, SYM2ID, SYMBOL_P, T_ARRAY, T_SYMBOL, validate_labels(), and void.

Referenced by rb_iseq_build_from_ary().

static int iseq_build_from_ary_exception | ( | rb_iseq_t * | iseq,
|  | struct st_table * | labels_table,
|  | VALUE | exception
| ) |  |
| static

Definition at line 5539 of file compile.c.

References ADD_CATCH_ENTRY, COMPILE_OK, get_exception_sym2type(), i, NUM2INT, ptr, Qnil, RARRAY_LEN, RARRAY_PTR(), rb_convert_type(), rb_eSyntaxError, RB_GC_GUARD, rb_iseq_load(), rb_raise(), register_label(), rb_iseq_struct::self, T_ARRAY, type, v, and void.

Referenced by rb_iseq_build_from_ary().

static VALUE iseq_build_load_iseq | ( | rb_iseq_t * | iseq,
|  | VALUE | op
| ) |  |
| static

Definition at line 5590 of file compile.c.

References CLASS_OF, iseq_add_mark_object(), Qnil, rb_cISeq, rb_eSyntaxError, rb_iseq_load(), rb_raise(), RB_TYPE_P, rb_iseq_struct::self, and T_ARRAY.

Referenced by iseq_build_from_ary_body().

static int iseq_compile_each | ( | rb_iseq_t * | iseq,
|  | LINK_ANCHOR * | ret,
|  | NODE * | node,
|  | int | poped
| ) |  |
| static

compile each node

self: InstructionSequence node: Ruby compiled node poped: This node will be poped

Definition at line 3155 of file compile.c.

References ADD_ADJUST, ADD_ADJUST_RESTORE, ADD_CALL, ADD_CALL_RECEIVER, ADD_CALL_WITH_BLOCK, ADD_CATCH_ENTRY, add_ensure_iseq(), ADD_INSN, ADD_INSN1, ADD_INSN2, ADD_INSN3, ADD_INSNL, ADD_LABEL, ADD_SEND, ADD_SEND_R, ADD_SEQ, ADD_TRACE, 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_simple, rb_iseq_struct::argc, argc, args, ensure_range::begin, block, cdhash_type, cnt, COMPILE, COMPILE_, compile_array(), compile_array_(), COMPILE_ARRAY_TYPE_ARRAY, COMPILE_ARRAY_TYPE_HASH, compile_branch_condition(), compile_colon2(), compile_cpath(), rb_iseq_struct::compile_data, compile_dregx(), compile_dstr(), COMPILE_ERROR, compile_massign(), COMPILE_NG, COMPILE_OK, COMPILE_POPED, CONST_ID, iseq_compile_data::current_block, data, debug_node_end, debug_node_start, debugi, debugp_param, debugs, DECL_ANCHOR, DEFAULT_SPECIAL_VAR_COUNT, DEFINED_CONST, defined_expr, DEFINED_NIL, ensure_range::end, iseq_compile_data::end_label, iseq_compile_data::ensure_node_stack, iseq_compile_data_ensure_node_stack::erange, ERROR_ARGS, FIX2INT, FIXNUM_INC, flag, RNode::flags, flags, rb_iseq_struct::flip_cnt, get_dyna_var_idx(), get_local_var_idx(), get_lvar_level(), head, i, rb_iseq_struct::ic_size, RNode::id, ID2SYM, id_core_define_method, id_core_define_singleton_method, id_core_hash_merge_ptr, id_core_set_method_alias, id_core_set_postexe, id_core_set_variable_alias, id_core_undef_method, idAREF, idASET, idBackquote, idEqTilde, idx, INIT_ANCHOR, rb_compile_option_struct::inline_const_cache, INSN_OF, int, INT2FIX, ip, iseq_add_mark_object(), key, rb_iseq_location_struct::label, iseq_compile_data::last_line, level, LIST_SIZE_ZERO(), rb_iseq_struct::local_iseq, rb_iseq_struct::local_size, rb_iseq_struct::location, LONG2FIX, iseq_compile_data::loopval_popped, make_name_for_block(), n, nd_line, nd_type, new_callinfo(), NEW_CHILD_ISEQVAL, NEW_ISEQVAL, NEW_LABEL, ensure_range::next, RNode::node, NODE_ALIAS, NODE_AND, NODE_ARGSCAT, NODE_ARGSPUSH, NODE_ARRAY, NODE_ATTRASGN, NODE_BACK_REF, NODE_BEGIN, NODE_BLOCK, NODE_BLOCK_PASS, NODE_BREAK, NODE_CALL, NODE_CASE, NODE_CDECL, NODE_CLASS, NODE_COLON2, NODE_COLON3, NODE_CONST, NODE_CVAR, NODE_CVASGN, NODE_DASGN, NODE_DASGN_CURR, NODE_DEFINED, NODE_DEFN, NODE_DEFS, NODE_DOT2, NODE_DOT3, NODE_DREGX, NODE_DREGX_ONCE, NODE_DSTR, NODE_DSYM, NODE_DVAR, NODE_DXSTR, NODE_ENSURE, NODE_ERRINFO, NODE_EVSTR, NODE_FALSE, NODE_FCALL, NODE_FL_NEWLINE, NODE_FLIP2, NODE_FLIP3, NODE_FOR, NODE_GASGN, NODE_GVAR, NODE_HASH, NODE_IASGN, NODE_IASGN2, NODE_IF, NODE_ITER, NODE_IVAR, NODE_KW_ARG, NODE_LAMBDA, NODE_LASGN, NODE_LIT, NODE_LVAR, NODE_MASGN, NODE_MATCH, NODE_MATCH2, NODE_MATCH3, NODE_MODULE, NODE_NEXT, NODE_NIL, NODE_NTH_REF, NODE_OP_ASGN1, NODE_OP_ASGN2, NODE_OP_ASGN_AND, NODE_OP_ASGN_OR, NODE_OP_CDECL, NODE_OPT_N, NODE_OR, NODE_POSTEXE, NODE_PRELUDE, NODE_REDO, NODE_RESBODY, NODE_RESCUE, NODE_RETRY, NODE_RETURN, NODE_SCLASS, NODE_SELF, NODE_SPLAT, NODE_STR, NODE_SUPER, NODE_TRUE, NODE_UNDEF, NODE_UNTIL, NODE_VALIAS, NODE_VALUES, NODE_VCALL, NODE_WHEN, NODE_WHILE, NODE_XSTR, NODE_YIELD, NODE_ZARRAY, NODE_ZSUPER, NULL, OBJ_FREEZE, OPERAND_AT, iseq_compile_data::option, rb_iseq_struct::parent_iseq, iseq_label_data::position, iseq_compile_data_ensure_node_stack::prev, push_ensure_entry(), Qfalse, Qtrue, Qundef, rb_bug(), rb_cObject, rb_eStandardError, rb_hash_new(), rb_id2name(), rb_id2str(), rb_intern, rb_is_const_id(), rb_iseq_defined_string(), rb_sprintf(), rb_str_concat(), rb_str_dup(), rb_str_new2, iseq_compile_data::redo_label, RHASH_TBL, RUBY_EVENT_LINE, RUBY_EVENT_RETURN, ruby_node_name(), setup_args(), rb_compile_option_struct::specialized_instruction, st_init_numtable(), st_insert(), st_lookup(), iseq_compile_data::start_label, str, SYM2ID, SYMBOL_P, rb_compile_option_struct::tailcall_optimization, type, rb_iseq_struct::type, RNode::u1, RNode::u2, val, VM_CALL_ARGS_BLOCKARG, VM_CALL_ARGS_SPLAT, VM_CALL_FCALL, VM_CALL_SUPER, VM_CALL_VCALL, VM_CHECKMATCH_ARRAY, VM_CHECKMATCH_TYPE_CASE, VM_CHECKMATCH_TYPE_RESCUE, VM_CHECKMATCH_TYPE_WHEN, VM_DEFINECLASS_FLAG_HAS_SUPERCLASS, VM_DEFINECLASS_FLAG_SCOPED, VM_DEFINECLASS_TYPE_CLASS, VM_DEFINECLASS_TYPE_MODULE, VM_DEFINECLASS_TYPE_SINGLETON_CLASS, VM_SPECIAL_OBJECT_CBASE, VM_SPECIAL_OBJECT_CONST_BASE, VM_SPECIAL_OBJECT_VMCORE, and when_vals().

static int iseq_insns_unification | ( | rb_iseq_t * | iseq,
|  | LINK_ANCHOR * | anchor
| ) |  |
| static

Definition at line 2022 of file compile.c.

References COMPILE_OK, FIRST_ELEMENT(), id, if(), iseq_insn_data::insn_id, iseq_insn_data::link, list, iseq_link_element::next, iseq_link_element::prev, and iseq_link_element::type.

Referenced by iseq_setup().

static int iseq_optimize | ( | rb_iseq_t * | iseq,
|  | LINK_ANCHOR * | anchor
| ) |  |
| static

Definition at line 1954 of file compile.c.

References rb_iseq_struct::compile_data, COMPILE_OK, FIRST_ELEMENT(), iseq_peephole_optimize(), iseq_specialized_instruction(), list, iseq_link_element::next, rb_compile_option_struct::operands_unification, iseq_compile_data::option, rb_compile_option_struct::peephole_optimization, rb_compile_option_struct::specialized_instruction, rb_compile_option_struct::tailcall_optimization, and iseq_link_element::type.

Referenced by iseq_setup().

static int iseq_peephole_optimize | ( | rb_iseq_t * | iseq,
|  | LINK_ELEMENT * | list,
|  | const int | do_tailcallopt
| ) |  |
| static

Definition at line 1770 of file compile.c.

References rb_call_info_struct::blockiseq, COMPILE_OK, rb_call_info_struct::flag, get_destination_insn(), get_next_insn(), get_prev_insn(), if(), INSERT_ELEM_NEXT(), iseq_insn_data::insn_id, iseq_insn_data::line_no, iseq_insn_data::link, list, new_insn_core(), OPERAND_AT, iseq_insn_data::operand_size, iseq_insn_data::operands, REMOVE_ELEM(), REPLACE_ELEM(), and VM_CALL_TAILCALL.

Referenced by iseq_optimize().

static int iseq_set_arguments | ( | rb_iseq_t * | iseq,
|  | LINK_ANCHOR * | anchor,
|  | NODE * | node
| ) |  |
| static

Definition at line 1119 of file compile.c.

References ADD_INSN, ADD_LABEL, ALLOC_N, rb_iseq_struct::arg_block, rb_iseq_struct::arg_keyword, rb_iseq_struct::arg_keyword_check, rb_iseq_struct::arg_keyword_table, rb_iseq_struct::arg_keywords, 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_args_info::block_arg, COMPILE, COMPILE_OK, COMPILE_POPED, debugs, rb_args_info::first_post_arg, FIX2INT, get_dyna_var_idx_at_raw(), i, ID_JUNK, ID_SCOPE_MASK, int, INT2FIX, rb_args_info::kw_args, rb_args_info::kw_rest_arg, MEMCPY, nd_line, nd_type, NEW_LABEL, NODE_ARGS, rb_args_info::opt_args, rb_args_info::post_args_num, rb_args_info::post_init, rb_args_info::pre_args_num, rb_args_info::pre_init, RARRAY_PTR(), rb_ary_clear(), rb_ary_push(), rb_ary_tmp_new(), rb_bug(), rb_args_info::rest_arg, ruby_node_name(), and rb_iseq_struct::type.

Referenced by rb_iseq_compile_node().

static int iseq_set_exception_local_table | ( | rb_iseq_t * | iseq | ) |
| static

Definition at line 1047 of file compile.c.

References ALLOC_N, COMPILE_OK, CONST_ID, rb_iseq_struct::local_size, rb_iseq_struct::local_table, and rb_iseq_struct::local_table_size.

Referenced by rb_iseq_compile_node().

static int iseq_set_exception_table | ( | rb_iseq_t * | iseq | ) |
| static

Definition at line 1655 of file compile.c.

References ALLOC_N, rb_iseq_struct::catch_table, iseq_compile_data::catch_table_ary, rb_iseq_struct::catch_table_size, catch_type(), iseq_catch_table_entry::CATCH_TYPE_BREAK, iseq_catch_table_entry::CATCH_TYPE_NEXT, iseq_catch_table_entry::CATCH_TYPE_RESCUE, rb_iseq_struct::compile_data, COMPILE_OK, iseq_catch_table_entry::cont, iseq_catch_table_entry::end, i, int, iseq_catch_table_entry::iseq, iseq_add_mark_object(), label_get_position(), label_get_sp(), ptr, RARRAY_LEN, RARRAY_PTR(), iseq_catch_table_entry::sp, iseq_catch_table_entry::start, and iseq_catch_table_entry::type.

Referenced by iseq_setup().

static int iseq_set_local_table | ( | rb_iseq_t * | iseq,
|  | ID * | tbl
| ) |  |
| static

Definition at line 1284 of file compile.c.

References ALLOC_N, COMPILE_OK, debugs, int, rb_iseq_struct::local_size, rb_iseq_struct::local_table, rb_iseq_struct::local_table_size, MEMCPY, and size.

Referenced by rb_iseq_compile_node().

static int iseq_set_optargs_table | ( | rb_iseq_t * | iseq | ) |
| static

Definition at line 1712 of file compile.c.

References rb_iseq_struct::arg_opt_table, rb_iseq_struct::arg_opts, COMPILE_OK, i, and label_get_position().

Referenced by iseq_setup().

static int iseq_set_sequence | ( | rb_iseq_t * | iseq,
|  | LINK_ANCHOR * | anchor
| ) |  |
| static

ruby insn object list -> raw instruction sequence

Definition at line 1366 of file compile.c.

References ALLOC_N, rb_call_info_struct::argc, rb_call_info_struct::aux, block, calc_sp_depth(), rb_iseq_struct::callinfo_entries, rb_iseq_struct::callinfo_size, cdhash_set_label_i(), COMPILE_OK, dump_disasm_list(), FIRST_ELEMENT(), FIX2INT, GetISeqPtr, cdhash_set_label_struct::hash, hide_obj, rb_iseq_struct::ic_entries, rb_iseq_struct::ic_size, rb_call_info_struct::index, insn_data_length(), iseq_insn_data::insn_id, rb_iseq_struct::iseq, iseq_add_mark_object(), rb_iseq_struct::iseq_size, iseq_adjust_data::label, cdhash_set_label_struct::len, len, rb_iseq_struct::line_info_size, rb_iseq_struct::line_info_table, iseq_insn_data::line_no, iseq_line_info_entry::line_no, iseq_adjust_data::line_no, list, rb_iseq_struct::location, MEMZERO, iseq_link_element::next, iseq_insn_data::operand_size, iseq_insn_data::operands, rb_iseq_location_struct::path, cdhash_set_label_struct::pos, iseq_label_data::position, iseq_line_info_entry::position, rb_bug(), rb_compile_error(), rb_hash_foreach(), RSTRING_PTR, ruby_xrealloc(), iseq_label_data::set, iseq_label_data::sp, rb_iseq_struct::stack_max, SYM2ID, TRUE, iseq_link_element::type, type, UNLIKELY, v, and xfree.

Referenced by iseq_setup().

static int iseq_set_sequence_stackcaching | ( | rb_iseq_t * | iseq,
|  | LINK_ANCHOR * | anchor
| ) |  |
| static

Definition at line 2136 of file compile.c.

References COMPILE_OK, FIRST_ELEMENT(), iseq_insn_data::insn_id, iseq_insn_data::line_no, list, rb_iseq_struct::location, new_insn_body(), iseq_link_element::next, rb_iseq_location_struct::path, rb_compile_error(), REMOVE_ELEM(), REPLACE_ELEM(), RSTRING_PTR, state, and iseq_link_element::type.

Referenced by iseq_setup().

static int iseq_setup | ( | rb_iseq_t * | iseq,
|  | LINK_ANCHOR * | anchor
| ) |  |
| static

Definition at line 995 of file compile.c.

References rb_iseq_struct::compile_data, compile_debug, debugs, dump_disasm_list(), FIRST_ELEMENT(), rb_compile_option_struct::instructions_unification, iseq_insns_unification(), iseq_optimize(), iseq_set_exception_table(), iseq_set_optargs_table(), iseq_set_sequence(), iseq_set_sequence_stackcaching(), iseq_compile_data::option, rb_iseq_disasm(), rb_iseq_translate_threaded_code(), rb_iseq_struct::self, rb_compile_option_struct::stack_caching, str, and StringValueCStr.

Referenced by iseq_build_from_ary_body(), and rb_iseq_compile_node().

static int iseq_specialized_instruction | ( | rb_iseq_t * | iseq,
|  | INSN * | iobj
| ) |  |
| static

Definition at line 1908 of file compile.c.

References rb_call_info_struct::blockiseq, COMPILE_OK, div, eq(), rb_call_info_struct::flag, ge, gt, idAREF, idDIV, idEmptyP, idEq, idGE, idGT, idLE, idLT, idLTLT, idMINUS, idMOD, idMULT, idNeq, idNot, idPLUS, iseq_insn_data::insn_id, le, length, lt, rb_call_info_struct::mid, mod, mult(), OPERAND_AT, rb_call_info_struct::orig_argc, SP_INSN, and VM_CALL_ARGS_SKIP_SETUP.

Referenced by iseq_optimize().

static int label_get_position | ( | LABEL * | lobj | ) |
| static

Definition at line 1643 of file compile.c.

References iseq_label_data::position.

Referenced by iseq_set_exception_table(), and iseq_set_optargs_table().

static int label_get_sp | ( | LABEL * | lobj | ) |
| static

Definition at line 1649 of file compile.c.

References iseq_label_data::sp.

Referenced by iseq_set_exception_table().

static int LIST_SIZE_ZERO | ( | LINK_ANCHOR * | anchor | ) |
| static

Definition at line 741 of file compile.c.

References iseq_link_anchor::anchor, and iseq_link_element::next.

Referenced by iseq_compile_each(), and setup_args().

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

Definition at line 2976 of file compile.c.

References ip, iseq_catch_table_entry::iseq, rb_iseq_location_struct::label, level, rb_iseq_struct::local_iseq, rb_iseq_struct::location, rb_iseq_struct::parent_iseq, rb_sprintf(), RSTRING_PTR, and rb_iseq_struct::type.

Referenced by iseq_compile_each().

static ADJUST * new_adjust_body | ( | rb_iseq_t * | iseq,
|  | LABEL * | label,
|  | int | line
| ) |  |
| static

Definition at line 898 of file compile.c.

References compile_data_alloc_adjust(), iseq_adjust_data::label, iseq_adjust_data::line_no, iseq_adjust_data::link, iseq_link_element::next, and iseq_link_element::type.

static rb_call_info_t* new_callinfo | ( | rb_iseq_t * | iseq,
|  | ID | mid,
|  | int | argc,
|  | VALUE | block,
|  | unsigned long | flag
| ) |  |
| static

Definition at line 944 of file compile.c.

References rb_call_info_struct::argc, argc, rb_call_info_struct::aux, rb_call_info_struct::blockiseq, rb_call_info_struct::blockptr, rb_call_info_struct::call, rb_iseq_struct::callinfo_size, compile_data_alloc(), rb_call_info_struct::flag, flag, GetISeqPtr, rb_call_info_struct::index, rb_call_info_struct::mid, rb_call_info_struct::orig_argc, Qundef, rb_call_info_struct::recv, VM_CALL_ARGS_BLOCKARG, VM_CALL_ARGS_SKIP_SETUP, VM_CALL_ARGS_SPLAT, and rb_call_info_struct::vmstat.

Referenced by insn_set_specialized_instruction(), iseq_build_from_ary_body(), iseq_compile_each(), and new_insn_send().

static VALUE new_child_iseq | ( | rb_iseq_t * | iseq,
|  | NODE * | node,
|  | VALUE | name,
|  | VALUE | parent,
|  | enum iseq_type | type,
|  | int | line_no
| ) |  |
| static

Definition at line 980 of file compile.c.

References rb_iseq_struct::compile_data, debugs, INT2FIX, iseq_absolute_path, iseq_add_mark_object(), iseq_path, iseq_compile_data::option, rb_iseq_new_with_opt(), ret, and rb_iseq_struct::self.

static INSN * new_insn_body | ( | rb_iseq_t * | iseq,
|  | int | line_no,
|  | int | insn_id,
|  | int | argc,
|  |  | ...
| ) |  |
| static

Definition at line 926 of file compile.c.

References argc, argv, compile_data_alloc(), i, new_insn_core(), v, va_end(), and va_init_list.

Referenced by iseq_set_sequence_stackcaching().

static INSN* new_insn_core | ( | rb_iseq_t * | iseq,
|  | int | line_no,
|  | int | insn_id,
|  | int | argc,
|  | VALUE * | argv
| ) |  |
| static

Definition at line 909 of file compile.c.

References argc, argv, compile_data_alloc_insn(), iseq_insn_data::insn_id, iseq_insn_data::line_no, iseq_insn_data::link, iseq_link_element::next, iseq_insn_data::operand_size, iseq_insn_data::operands, iseq_insn_data::sc_state, and iseq_link_element::type.

Referenced by iseq_build_from_ary_body(), iseq_peephole_optimize(), new_insn_body(), and new_insn_send().

static INSN* new_insn_send | ( | rb_iseq_t * | iseq,
|  | int | line_no,
|  | VALUE | id,
|  | VALUE | argc,
|  | VALUE | block,
|  | VALUE | flag
| ) |  |
| static

Definition at line 972 of file compile.c.

References block, compile_data_alloc(), FIX2INT, new_callinfo(), new_insn_core(), and SYM2ID.

static LABEL * new_label_body | ( | rb_iseq_t * | iseq,
|  | long | line
| ) |  |
| static

Definition at line 884 of file compile.c.

References rb_iseq_struct::compile_data, compile_data_alloc_label(), iseq_label_data::label_no, iseq_compile_data::label_no, iseq_label_data::link, iseq_link_element::next, iseq_label_data::sc_state, iseq_label_data::sp, and iseq_link_element::type.

static LINK_ELEMENT* POP_ELEMENT | ( | ISEQ_ARG_DECLARE LINK_ANCHOR * | anchor | ) |
| static

Definition at line 702 of file compile.c.

References elem, and verify_list().

Referenced by compile_massign_lhs().

static void push_ensure_entry | ( | rb_iseq_t * | iseq,
|  | struct iseq_compile_data_ensure_node_stack * | enl,
|  | struct ensure_range * | er,
|  | NODE * | node
| ) |  |
| static

Definition at line 2999 of file compile.c.

References rb_iseq_struct::compile_data, iseq_compile_data_ensure_node_stack::ensure_node, iseq_compile_data::ensure_node_stack, iseq_compile_data_ensure_node_stack::erange, and iseq_compile_data_ensure_node_stack::prev.

Referenced by iseq_compile_each().

static ID r_id | ( | ID | id | ) |
| inline static

Definition at line 136 of file compile.c.

References id.

static VALUE r_value | ( | VALUE | value | ) |
| inline static

Definition at line 142 of file compile.c.

References value.

int rb_dvar_defined | ( | ID | id | ) |

Definition at line 5832 of file compile.c.

References rb_thread_struct::base_block, GET_THREAD(), i, rb_block_struct::iseq, rb_iseq_struct::local_table, rb_iseq_struct::local_table_size, rb_iseq_struct::parent_iseq, th, and rb_iseq_struct::type.

Referenced by dvar_defined_gen().

const char* rb_insns_name | ( | int | i | ) |

Definition at line 5475 of file compile.c.

References i.

VALUE rb_insns_name_array | ( | void |  | ) |

Definition at line 5481 of file compile.c.

References ary, i, numberof, rb_ary_new(), rb_ary_push(), rb_obj_freeze(), and rb_str_new2.

Referenced by Init_VM().

VALUE rb_iseq_build_from_ary | ( | rb_iseq_t * | iseq,
|  | VALUE | locals,
|  | VALUE | args,
|  | VALUE | exception,
|  | VALUE | body
| ) |  |

Definition at line 5758 of file compile.c.

References ALLOC_N, 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, CHECK_ARRAY, CHECK_INTEGER(), CHECK_SYMBOL, DECL_ANCHOR, FIX2INT, FIX2LONG, FIXNUM_P, i, INIT_ANCHOR, iseq_build_from_ary_body(), iseq_build_from_ary_exception(), rb_iseq_struct::local_size, rb_iseq_struct::local_table, rb_iseq_struct::local_table_size, NUM2INT, RARRAY_LEN, RARRAY_LENINT, RARRAY_PTR(), rb_ary_entry(), register_label(), rb_iseq_struct::self, st_init_numtable(), SYM2ID, and tbl.

Referenced by iseq_load().

VALUE rb_iseq_compile_node | ( | VALUE | self,
|  | NODE * | node
| ) |  |

Definition at line 461 of file compile.c.

References ADD_CATCH_ENTRY, ADD_INSN, ADD_INSN1, ADD_INSN2, ADD_LABEL, ADD_TRACE, COMPILE, rb_iseq_struct::compile_data, COMPILE_POPED, DECL_ANCHOR, end, iseq_compile_data::end_label, ERROR_ARGS, rb_iseq_location_struct::first_lineno, FIX2INT, GetISeqPtr, INIT_ANCHOR, INT2FIX, iseq_set_arguments(), iseq_set_exception_local_table(), iseq_set_local_table(), iseq_setup(), iseq_compile_data::last_line, rb_iseq_struct::location, nd_line, nd_type, NEW_LABEL, NODE_SCOPE, rb_bug(), rb_compile_error(), ret, RUBY_EVENT_B_CALL, RUBY_EVENT_B_RETURN, RUBY_EVENT_CALL, RUBY_EVENT_CLASS, RUBY_EVENT_END, RUBY_EVENT_RETURN, iseq_compile_data::start_label, rb_iseq_struct::type, and validate_labels().

Referenced by rb_iseq_new_with_bopt_and_opt().

int rb_iseq_translate_threaded_code | ( | rb_iseq_t * | iseq | ) |

Definition at line 559 of file compile.c.

References ALLOC_N, COMPILE_OK, i, int, rb_iseq_struct::iseq, rb_iseq_struct::iseq_encoded, rb_iseq_struct::iseq_size, len, MEMCPY, rb_vm_get_insns_address_table(), and table.

Referenced by iseq_setup(), and rb_iseq_build_for_ruby2cext().

int rb_local_defined | ( | ID | id | ) |

Definition at line 5857 of file compile.c.

References rb_thread_struct::base_block, GET_THREAD(), i, rb_block_struct::iseq, rb_iseq_struct::local_iseq, rb_iseq_struct::local_table, rb_iseq_struct::local_table_size, and th.

Referenced by local_id_gen().

int rb_parse_in_eval | ( | void |  | ) |

Definition at line 5876 of file compile.c.

References GET_THREAD(), and rb_thread_struct::parse_in_eval.

Referenced by parser_compile_string(), and rb_parser_compile_file().

int rb_parse_in_main | ( | void |  | ) |

Definition at line 5882 of file compile.c.

References GET_THREAD(), and rb_thread_struct::parse_in_eval.

Referenced by switch().

static LABEL* register_label | ( | rb_iseq_t * | iseq,
|  | struct st_table * | labels_table,
|  | VALUE | obj
| ) |  |
| static

Definition at line 5492 of file compile.c.

References NEW_LABEL, rb_convert_type(), st_insert(), st_lookup(), T_SYMBOL, and tmp.

Referenced by iseq_build_from_ary_body(), iseq_build_from_ary_exception(), and rb_iseq_build_from_ary().

static void REMOVE_ELEM | ( | LINK_ELEMENT * | elem | ) |
| static

Definition at line 679 of file compile.c.

References iseq_link_element::next, and iseq_link_element::prev.

Referenced by compile_massign_lhs(), iseq_peephole_optimize(), and iseq_set_sequence_stackcaching().

static void REPLACE_ELEM | ( | LINK_ELEMENT * | elem1,
|  | LINK_ELEMENT * | elem2
| ) |  |
| static

Definition at line 666 of file compile.c.

References iseq_link_element::next, and iseq_link_element::prev.

Referenced by iseq_peephole_optimize(), and iseq_set_sequence_stackcaching().

static VALUE setup_args | ( | rb_iseq_t * | iseq,
|  | LINK_ANCHOR * | args,
|  | NODE * | argn,
|  | VALUE * | flag
| ) |  |
| static

Definition at line 3063 of file compile.c.

References ADD_INSN, ADD_INSN1, ADD_SEQ, argc, COMPILE, compile_array(), COMPILE_ARRAY_TYPE_ARGS, DECL_ANCHOR, i, INIT_ANCHOR, INSERT_LIST(), INT2FIX, LIST_SIZE_ZERO(), nd_line, nd_type, NODE_ARGSCAT, NODE_ARGSPUSH, NODE_ARRAY, NODE_BLOCK_PASS, NODE_SPLAT, Qfalse, rb_bug(), ruby_node_name(), tmp, VM_CALL_ARGS_BLOCKARG, and VM_CALL_ARGS_SPLAT.

Referenced by iseq_compile_each().

static int validate_label | ( | st_data_t | name,
|  | st_data_t | label,
|  | st_data_t | arg
| ) |  |
| static

Definition at line 436 of file compile.c.

References COMPILE_ERROR, iseq_label_data::link, iseq_link_element::next, iseq_label_data::position, rb_id2name(), ret, ruby_sourcefile, and ST_CONTINUE.

Referenced by validate_labels().

static void validate_labels | ( | rb_iseq_t * | iseq,
|  | st_table * | labels_table
| ) |  |
| static

Definition at line 452 of file compile.c.

References NIL_P(), rb_exc_raise(), st_foreach(), and validate_label().

Referenced by iseq_build_from_ary_body(), and rb_iseq_compile_node().

static void verify_list | ( | ISEQ_ARG_DECLARE const char * | info,
|  | LINK_ANCHOR * | anchor
| ) |  |
| static

Definition at line 354 of file compile.c.

References iseq_link_anchor::anchor, compile_debug, flag, iseq_link_anchor::last, list, iseq_link_element::next, iseq_link_element::prev, and rb_bug().

Referenced by ADD_ELEM(), APPEND_ELEM(), APPEND_LIST(), INSERT_LIST(), and POP_ELEMENT().

static int when_vals | ( | rb_iseq_t * | iseq,
|  | LINK_ANCHOR * | cond_seq,
|  | NODE * | vals,
|  | LABEL * | l1,
|  | int | only_special_literals,
|  | VALUE | literals
| ) |  |
| static

Definition at line 2504 of file compile.c.

References ADD_INSN, ADD_INSN1, ADD_INSNL, case_when_optimizable_literal(), COMPILE, debugp_param, INT2FIX, rb_iseq_struct::location, nd_line, nd_type, NODE_STR, OBJ_FREEZE, rb_iseq_location_struct::path, Qnil, Qundef, rb_compile_warning(), rb_hash_aset(), rb_hash_lookup, RSTRING_PTR, val, and VM_CHECKMATCH_TYPE_CASE.

Referenced by iseq_compile_each().

## Variable Documentation

struct st_hash_type cdhash_type
| static

Initial value:
= {
cdhash_cmp,
cdhash_hash,
}
cdhash_cmp
static int cdhash_cmp(VALUE val, VALUE lit)
Definition: compile.c:1316
cdhash_hash
static st_index_t cdhash_hash(VALUE a)
Definition: compile.c:1332

Definition at line 1342 of file compile.c.

Referenced by iseq_compile_each().