Ruby 2.1.5p273(2014-11-13revision48405)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

iseq.h
Go to the documentation of this file.
1 /**********************************************************************
2
3 iseq.h -
4
5 $Author: ko1 $
6 created at: 04/01/01 23:36:57 JST
7
8 Copyright (C) 2004-2008 Koichi Sasada
9
10 **********************************************************************/
11
12 #ifndef RUBY_COMPILE_H
13 #define RUBY_COMPILE_H
14
15 RUBY_SYMBOL_EXPORT_BEGIN
16
17 /* compile.c */
18 VALUE rb_iseq_compile_node(VALUE self, NODE *node);
19 int rb_iseq_translate_threaded_code(rb_iseq_t *iseq);
20 VALUE rb_iseq_build_from_ary(rb_iseq_t *iseq, VALUE locals, VALUE args,
21 VALUE exception, VALUE body);
22
23 /* iseq.c */
24 void rb_iseq_add_mark_object(rb_iseq_t *iseq, VALUE obj);
25 VALUE rb_iseq_load(VALUE data, VALUE parent, VALUE opt);
26 VALUE rb_iseq_parameters(const rb_iseq_t *iseq, int is_proc);
27 struct st_table *ruby_insn_make_insn_table(void);
28 unsigned int rb_iseq_line_no(const rb_iseq_t *iseq, size_t pos);
29
30 int rb_iseq_line_trace_each(VALUE iseqval, int (*func)(int line, rb_event_flag_t *events_ptr, void *d), void *data);
31 VALUE rb_iseq_line_trace_all(VALUE iseqval);
32 VALUE rb_iseq_line_trace_specify(VALUE iseqval, VALUE pos, VALUE set);
33
34 /* proc.c */
35 rb_iseq_t *rb_method_get_iseq(VALUE body);
36 rb_iseq_t *rb_proc_get_iseq(VALUE proc, int *is_proc);
37
38 struct rb_compile_option_struct {
39 int inline_const_cache;
40 int peephole_optimization;
41 int tailcall_optimization;
42 int specialized_instruction;
43 int operands_unification;
44 int instructions_unification;
45 int stack_caching;
46 int trace_instruction;
47 int debug_level;
48 };
49
50 struct iseq_line_info_entry {
51 unsigned int position;
52 unsigned int line_no;
53 };
54
55 struct iseq_catch_table_entry {
56 enum catch_type {
57 CATCH_TYPE_RESCUE = INT2FIX(1),
58 CATCH_TYPE_ENSURE = INT2FIX(2),
59 CATCH_TYPE_RETRY = INT2FIX(3),
60 CATCH_TYPE_BREAK = INT2FIX(4),
61 CATCH_TYPE_REDO = INT2FIX(5),
62 CATCH_TYPE_NEXT = INT2FIX(6)
63 } type;
64 VALUE iseq;
65 unsigned long start;
66 unsigned long end;
67 unsigned long cont;
68 unsigned long sp;
69 };
70
71 #define INITIAL_ISEQ_COMPILE_DATA_STORAGE_BUFF_SIZE (512)
72
73 struct iseq_compile_data_storage {
74 struct iseq_compile_data_storage *next;
75 unsigned long pos;
76 unsigned long size;
77 char *buff;
78 };
79
80 struct iseq_compile_data {
81 /* GC is needed */
82 const VALUE err_info;
83 VALUE mark_ary;
84 const VALUE catch_table_ary; /* Array */
85
86 /* GC is not needed */
87 struct iseq_label_data *start_label;
88 struct iseq_label_data *end_label;
89 struct iseq_label_data *redo_label;
90 VALUE current_block;
91 VALUE ensure_node;
92 VALUE for_iseq;
93 struct iseq_compile_data_ensure_node_stack *ensure_node_stack;
94 int loopval_popped; /* used by NODE_BREAK */
95 int cached_const;
96 struct iseq_compile_data_storage *storage_head;
97 struct iseq_compile_data_storage *storage_current;
98 int last_line;
99 int last_coverable_line;
100 int label_no;
101 int node_level;
102 const rb_compile_option_t *option;
103 #if SUPPORT_JOKE
104 st_table *labels_table;
105 #endif
106 };
107
108 /* defined? */
109
110 enum defined_type {
111 DEFINED_NIL = 1,
112 DEFINED_IVAR,
113 DEFINED_LVAR,
114 DEFINED_GVAR,
115 DEFINED_CVAR,
116 DEFINED_CONST,
117 DEFINED_METHOD,
118 DEFINED_YIELD,
119 DEFINED_ZSUPER,
120 DEFINED_SELF,
121 DEFINED_TRUE,
122 DEFINED_FALSE,
123 DEFINED_ASGN,
124 DEFINED_EXPR,
125 DEFINED_IVAR2,
126 DEFINED_REF,
127 DEFINED_FUNC
128 };
129
130 VALUE rb_iseq_defined_string(enum defined_type type);
131
132 #define DEFAULT_SPECIAL_VAR_COUNT 2
133
134 RUBY_SYMBOL_EXPORT_END
135
136 #endif /* RUBY_COMPILE_H */
DEFINED_IVAR2
Definition: iseq.h:125
iseq_catch_table_entry::catch_type
catch_type
Definition: iseq.h:56
iseq_compile_data_storage::size
unsigned long size
Definition: iseq.h:76
st_table
Definition: st.h:69
DEFINED_ZSUPER
Definition: iseq.h:119
iseq_catch_table_entry::end
unsigned long end
Definition: iseq.h:66
rb_iseq_line_no
unsigned int rb_iseq_line_no(const rb_iseq_t *iseq, size_t pos)
Definition: iseq.c:1134
DEFINED_ASGN
Definition: iseq.h:123
iseq_catch_table_entry::CATCH_TYPE_RETRY
Definition: iseq.h:59
DEFINED_YIELD
Definition: iseq.h:118
DEFINED_METHOD
Definition: iseq.h:117
DEFINED_LVAR
Definition: iseq.h:113
rb_compile_option_struct::inline_const_cache
int inline_const_cache
Definition: iseq.h:39
iseq_compile_data::storage_head
struct iseq_compile_data_storage * storage_head
Definition: iseq.h:96
DEFINED_FALSE
Definition: iseq.h:122
rb_compile_option_struct::stack_caching
int stack_caching
Definition: iseq.h:45
ruby_insn_make_insn_table
struct st_table * ruby_insn_make_insn_table(void)
rb_compile_option_struct::operands_unification
int operands_unification
Definition: iseq.h:43
iseq_compile_data::start_label
struct iseq_label_data * start_label
Definition: iseq.h:87
iseq_compile_data_storage::next
struct iseq_compile_data_storage * next
Definition: iseq.h:74
rb_compile_option_struct::peephole_optimization
int peephole_optimization
Definition: iseq.h:40
iseq_compile_data::ensure_node_stack
struct iseq_compile_data_ensure_node_stack * ensure_node_stack
Definition: iseq.h:93
iseq_compile_data::current_block
VALUE current_block
Definition: iseq.h:90
iseq_compile_data::option
const rb_compile_option_t * option
Definition: iseq.h:102
rb_compile_option_struct::tailcall_optimization
int tailcall_optimization
Definition: iseq.h:41
iseq_compile_data::catch_table_ary
const VALUE catch_table_ary
Definition: iseq.h:84
RNode
Definition: node.h:239
iseq_catch_table_entry::type
enum iseq_catch_table_entry::catch_type type
iseq_compile_data_storage::pos
unsigned long pos
Definition: iseq.h:75
rb_iseq_parameters
VALUE rb_iseq_parameters(const rb_iseq_t *iseq, int is_proc)
Definition: iseq.c:1953
rb_compile_option_struct::specialized_instruction
int specialized_instruction
Definition: iseq.h:42
iseq_catch_table_entry::CATCH_TYPE_RESCUE
Definition: iseq.h:57
iseq_compile_data::mark_ary
VALUE mark_ary
Definition: iseq.h:83
rb_compile_option_struct::instructions_unification
int instructions_unification
Definition: iseq.h:44
rb_iseq_defined_string
VALUE rb_iseq_defined_string(enum defined_type type)
Definition: iseq.c:2039
iseq_compile_data::last_line
int last_line
Definition: iseq.h:98
iseq_compile_data::err_info
const VALUE err_info
Definition: iseq.h:82
iseq_compile_data_storage
Definition: iseq.h:73
DEFINED_CVAR
Definition: iseq.h:115
rb_iseq_load
VALUE rb_iseq_load(VALUE data, VALUE parent, VALUE opt)
Definition: iseq.c:583
iseq_catch_table_entry::start
unsigned long start
Definition: iseq.h:65
iseq_catch_table_entry::CATCH_TYPE_ENSURE
Definition: iseq.h:58
iseq_catch_table_entry::CATCH_TYPE_NEXT
Definition: iseq.h:62
DEFINED_TRUE
Definition: iseq.h:121
func
SSL_METHOD *(* func)(void)
Definition: ossl_ssl.c:113
defined_type
defined_type
Definition: iseq.h:110
DEFINED_CONST
Definition: iseq.h:116
RUBY_SYMBOL_EXPORT_END
#define RUBY_SYMBOL_EXPORT_END
Definition: missing.h:39
iseq_compile_data::redo_label
struct iseq_label_data * redo_label
Definition: iseq.h:89
rb_proc_get_iseq
rb_iseq_t * rb_proc_get_iseq(VALUE proc, int *is_proc)
Definition: proc.c:883
rb_compile_option_struct::debug_level
int debug_level
Definition: iseq.h:47
type
int type
Definition: tcltklib.c:112
VALUE
unsigned long VALUE
Definition: ruby.h:88
iseq_compile_data
Definition: iseq.h:80
iseq_catch_table_entry
Definition: iseq.h:55
RUBY_SYMBOL_EXPORT_BEGIN
#define RUBY_SYMBOL_EXPORT_BEGIN
Definition: missing.h:38
DEFINED_IVAR
Definition: iseq.h:112
iseq_catch_table_entry::CATCH_TYPE_BREAK
Definition: iseq.h:60
DEFINED_GVAR
Definition: iseq.h:114
iseq_compile_data_storage::buff
char * buff
Definition: iseq.h:77
rb_iseq_compile_node
RUBY_SYMBOL_EXPORT_BEGIN VALUE rb_iseq_compile_node(VALUE self, NODE *node)
Definition: compile.c:459
iseq_catch_table_entry::CATCH_TYPE_REDO
Definition: iseq.h:61
iseq_catch_table_entry::sp
unsigned long sp
Definition: iseq.h:68
INT2FIX
#define INT2FIX(i)
Definition: ruby.h:231
iseq_line_info_entry::position
unsigned int position
Definition: iseq.h:51
iseq_compile_data::ensure_node
VALUE ensure_node
Definition: iseq.h:91
rb_compile_option_struct::trace_instruction
int trace_instruction
Definition: iseq.h:46
rb_iseq_add_mark_object
void rb_iseq_add_mark_object(rb_iseq_t *iseq, VALUE obj)
Definition: iseq.c:245
rb_iseq_line_trace_specify
VALUE rb_iseq_line_trace_specify(VALUE iseqval, VALUE pos, VALUE set)
Definition: iseq.c:2233
rb_event_flag_t
unsigned long rb_event_flag_t
Definition: ruby.h:1740
rb_iseq_build_from_ary
VALUE rb_iseq_build_from_ary(rb_iseq_t *iseq, VALUE locals, VALUE args, VALUE exception, VALUE body)
Definition: compile.c:5885
iseq_compile_data::cached_const
int cached_const
Definition: iseq.h:95
iseq_compile_data::for_iseq
VALUE for_iseq
Definition: iseq.h:92
iseq_compile_data::storage_current
struct iseq_compile_data_storage * storage_current
Definition: iseq.h:97
DEFINED_FUNC
Definition: iseq.h:127
DEFINED_SELF
Definition: iseq.h:120
iseq_compile_data::last_coverable_line
int last_coverable_line
Definition: iseq.h:99
rb_method_get_iseq
rb_iseq_t * rb_method_get_iseq(VALUE body)
Definition: proc.c:2136
rb_iseq_translate_threaded_code
int rb_iseq_translate_threaded_code(rb_iseq_t *iseq)
Definition: compile.c:561
rb_compile_option_struct
Definition: iseq.h:38
rb_iseq_line_trace_all
VALUE rb_iseq_line_trace_all(VALUE iseqval)
Definition: iseq.c:2186
rb_iseq_struct
Definition: vm_core.h:206
iseq_catch_table_entry::cont
unsigned long cont
Definition: iseq.h:67
iseq_compile_data::end_label
struct iseq_label_data * end_label
Definition: iseq.h:88
iseq_compile_data::loopval_popped
int loopval_popped
Definition: iseq.h:94
DEFINED_NIL
Definition: iseq.h:111
iseq_catch_table_entry::iseq
VALUE iseq
Definition: iseq.h:64
rb_iseq_line_trace_each
int rb_iseq_line_trace_each(VALUE iseqval, int(*func)(int line, rb_event_flag_t *events_ptr, void *d), void *data)
Definition: iseq.c:2139
iseq_compile_data::label_no
int label_no
Definition: iseq.h:100
iseq_line_info_entry
Definition: iseq.h:50
iseq_compile_data::node_level
int node_level
Definition: iseq.h:101
iseq_line_info_entry::line_no
unsigned int line_no
Definition: iseq.h:52
DEFINED_REF
Definition: iseq.h:126
DEFINED_EXPR
Definition: iseq.h:124
iseq_compile_data_ensure_node_stack
Definition: compile.c:71
iseq_label_data
Definition: compile.c:41