debase-ruby_core_source 0.10.15 → 0.10.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +28 -0
- data/debase-ruby_core_source.gemspec +1 -1
- data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/addr2line.h +1 -1
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/ccan/build_assert/build_assert.h +40 -0
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/ccan/check_type/check_type.h +63 -0
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/ccan/container_of/container_of.h +142 -0
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/ccan/list/list.h +773 -0
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/ccan/str/str.h +16 -0
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/constant.h +51 -0
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/debug_counter.h +109 -0
- data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/dln.h +10 -9
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/encindex.h +69 -0
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/eval_intern.h +334 -0
- data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/gc.h +27 -10
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/id.h +250 -0
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/id_table.h +31 -0
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/insns.inc +217 -0
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/insns_info.inc +1570 -0
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/internal.h +2036 -0
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/iseq.h +308 -0
- data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/known_errors.inc +16 -1
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/method.h +218 -0
- data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/node.h +115 -79
- data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/node_name.inc +12 -22
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/opt_sc.inc +1601 -0
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/optinsn.inc +103 -0
- data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/optunifs.inc +28 -83
- data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/parse.h +74 -60
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/probes_helper.h +43 -0
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/regenc.h +254 -0
- data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/regint.h +299 -211
- data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/regparse.h +45 -37
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/revision.h +1 -0
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/ruby_assert.h +54 -0
- data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/ruby_atomic.h +84 -26
- data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/siphash.h +1 -1
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/symbol.h +108 -0
- data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/thread_pthread.h +14 -11
- data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/thread_win32.h +2 -6
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/timev.h +42 -0
- data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/transcode_data.h +34 -12
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/version.h +73 -0
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/vm.inc +3667 -0
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/vm_call_iseq_optimized.inc +213 -0
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/vm_core.h +1768 -0
- data/lib/debase/ruby_core_source/{ruby-1.9.3-p550/debug.h → ruby-2.5.4-p155/vm_debug.h} +4 -8
- data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/vm_exec.h +38 -30
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/vm_insnhelper.h +255 -0
- data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/vm_opts.h +14 -9
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/vmtc.inc +214 -0
- data/lib/debase/ruby_core_source/version.rb +1 -1
- metadata +52 -42
- data/lib/debase/ruby_core_source/ruby-1.9.3-p550/constant.h +0 -34
- data/lib/debase/ruby_core_source/ruby-1.9.3-p550/encdb.h +0 -167
- data/lib/debase/ruby_core_source/ruby-1.9.3-p550/eval_intern.h +0 -234
- data/lib/debase/ruby_core_source/ruby-1.9.3-p550/id.h +0 -177
- data/lib/debase/ruby_core_source/ruby-1.9.3-p550/insns.inc +0 -179
- data/lib/debase/ruby_core_source/ruby-1.9.3-p550/insns_info.inc +0 -695
- data/lib/debase/ruby_core_source/ruby-1.9.3-p550/internal.h +0 -242
- data/lib/debase/ruby_core_source/ruby-1.9.3-p550/iseq.h +0 -126
- data/lib/debase/ruby_core_source/ruby-1.9.3-p550/method.h +0 -105
- data/lib/debase/ruby_core_source/ruby-1.9.3-p550/opt_sc.inc +0 -670
- data/lib/debase/ruby_core_source/ruby-1.9.3-p550/optinsn.inc +0 -30
- data/lib/debase/ruby_core_source/ruby-1.9.3-p550/regenc.h +0 -219
- data/lib/debase/ruby_core_source/ruby-1.9.3-p550/revision.h +0 -1
- data/lib/debase/ruby_core_source/ruby-1.9.3-p550/timev.h +0 -21
- data/lib/debase/ruby_core_source/ruby-1.9.3-p550/transdb.h +0 -189
- data/lib/debase/ruby_core_source/ruby-1.9.3-p550/version.h +0 -52
- data/lib/debase/ruby_core_source/ruby-1.9.3-p550/vm.inc +0 -3054
- data/lib/debase/ruby_core_source/ruby-1.9.3-p550/vm_core.h +0 -763
- data/lib/debase/ruby_core_source/ruby-1.9.3-p550/vm_insnhelper.h +0 -220
- data/lib/debase/ruby_core_source/ruby-1.9.3-p550/vmtc.inc +0 -97
@@ -0,0 +1,308 @@
|
|
1
|
+
/**********************************************************************
|
2
|
+
|
3
|
+
iseq.h -
|
4
|
+
|
5
|
+
$Author: nagachika $
|
6
|
+
created at: 04/01/01 23:36:57 JST
|
7
|
+
|
8
|
+
Copyright (C) 2004-2008 Koichi Sasada
|
9
|
+
|
10
|
+
**********************************************************************/
|
11
|
+
|
12
|
+
#ifndef RUBY_ISEQ_H
|
13
|
+
#define RUBY_ISEQ_H 1
|
14
|
+
|
15
|
+
#include "ruby/version.h"
|
16
|
+
|
17
|
+
#define ISEQ_MAJOR_VERSION RUBY_API_VERSION_MAJOR
|
18
|
+
#define ISEQ_MINOR_VERSION RUBY_API_VERSION_MINOR
|
19
|
+
|
20
|
+
#ifndef rb_iseq_t
|
21
|
+
typedef struct rb_iseq_struct rb_iseq_t;
|
22
|
+
#define rb_iseq_t rb_iseq_t
|
23
|
+
#endif
|
24
|
+
|
25
|
+
static inline size_t
|
26
|
+
rb_call_info_kw_arg_bytes(int keyword_len)
|
27
|
+
{
|
28
|
+
return sizeof(struct rb_call_info_kw_arg) + sizeof(VALUE) * (keyword_len - 1);
|
29
|
+
}
|
30
|
+
|
31
|
+
enum iseq_mark_ary_index {
|
32
|
+
ISEQ_MARK_ARY_COVERAGE,
|
33
|
+
ISEQ_MARK_ARY_FLIP_CNT,
|
34
|
+
ISEQ_MARK_ARY_ORIGINAL_ISEQ,
|
35
|
+
ISEQ_MARK_ARY_INITIAL_SIZE
|
36
|
+
};
|
37
|
+
|
38
|
+
static inline VALUE
|
39
|
+
iseq_mark_ary_create(int flip_cnt)
|
40
|
+
{
|
41
|
+
VALUE ary = rb_ary_tmp_new(ISEQ_MARK_ARY_INITIAL_SIZE);
|
42
|
+
rb_ary_push(ary, Qnil); /* ISEQ_MARK_ARY_COVERAGE */
|
43
|
+
rb_ary_push(ary, INT2FIX(flip_cnt)); /* ISEQ_MARK_ARY_FLIP_CNT */
|
44
|
+
rb_ary_push(ary, Qnil); /* ISEQ_MARK_ARY_ORIGINAL_ISEQ */
|
45
|
+
return ary;
|
46
|
+
}
|
47
|
+
|
48
|
+
#define ISEQ_MARK_ARY(iseq) (iseq)->body->mark_ary
|
49
|
+
|
50
|
+
#define ISEQ_COVERAGE(iseq) RARRAY_AREF(ISEQ_MARK_ARY(iseq), ISEQ_MARK_ARY_COVERAGE)
|
51
|
+
#define ISEQ_COVERAGE_SET(iseq, cov) RARRAY_ASET(ISEQ_MARK_ARY(iseq), ISEQ_MARK_ARY_COVERAGE, cov)
|
52
|
+
#define ISEQ_LINE_COVERAGE(iseq) RARRAY_AREF(ISEQ_COVERAGE(iseq), COVERAGE_INDEX_LINES)
|
53
|
+
#define ISEQ_BRANCH_COVERAGE(iseq) RARRAY_AREF(ISEQ_COVERAGE(iseq), COVERAGE_INDEX_BRANCHES)
|
54
|
+
|
55
|
+
#define ISEQ_FLIP_CNT(iseq) FIX2INT(RARRAY_AREF(ISEQ_MARK_ARY(iseq), ISEQ_MARK_ARY_FLIP_CNT))
|
56
|
+
|
57
|
+
static inline int
|
58
|
+
ISEQ_FLIP_CNT_INCREMENT(const rb_iseq_t *iseq)
|
59
|
+
{
|
60
|
+
int cnt = ISEQ_FLIP_CNT(iseq);
|
61
|
+
RARRAY_ASET(ISEQ_MARK_ARY(iseq), ISEQ_MARK_ARY_FLIP_CNT, INT2FIX(cnt+1));
|
62
|
+
return cnt;
|
63
|
+
}
|
64
|
+
|
65
|
+
static inline VALUE *
|
66
|
+
ISEQ_ORIGINAL_ISEQ(const rb_iseq_t *iseq)
|
67
|
+
{
|
68
|
+
VALUE str = RARRAY_AREF(ISEQ_MARK_ARY(iseq), ISEQ_MARK_ARY_ORIGINAL_ISEQ);
|
69
|
+
if (RTEST(str)) return (VALUE *)RSTRING_PTR(str);
|
70
|
+
return NULL;
|
71
|
+
}
|
72
|
+
|
73
|
+
static inline void
|
74
|
+
ISEQ_ORIGINAL_ISEQ_CLEAR(const rb_iseq_t *iseq)
|
75
|
+
{
|
76
|
+
RARRAY_ASET(ISEQ_MARK_ARY(iseq), ISEQ_MARK_ARY_ORIGINAL_ISEQ, Qnil);
|
77
|
+
}
|
78
|
+
|
79
|
+
static inline VALUE *
|
80
|
+
ISEQ_ORIGINAL_ISEQ_ALLOC(const rb_iseq_t *iseq, long size)
|
81
|
+
{
|
82
|
+
VALUE str = rb_str_tmp_new(size * sizeof(VALUE));
|
83
|
+
RARRAY_ASET(ISEQ_MARK_ARY(iseq), ISEQ_MARK_ARY_ORIGINAL_ISEQ, str);
|
84
|
+
return (VALUE *)RSTRING_PTR(str);
|
85
|
+
}
|
86
|
+
|
87
|
+
#define ISEQ_TRACE_EVENTS (RUBY_EVENT_LINE | \
|
88
|
+
RUBY_EVENT_CLASS | \
|
89
|
+
RUBY_EVENT_END | \
|
90
|
+
RUBY_EVENT_CALL | \
|
91
|
+
RUBY_EVENT_RETURN| \
|
92
|
+
RUBY_EVENT_B_CALL| \
|
93
|
+
RUBY_EVENT_B_RETURN)
|
94
|
+
|
95
|
+
#define ISEQ_NOT_LOADED_YET IMEMO_FL_USER1
|
96
|
+
#define ISEQ_USE_COMPILE_DATA IMEMO_FL_USER2
|
97
|
+
|
98
|
+
struct iseq_compile_data {
|
99
|
+
/* GC is needed */
|
100
|
+
const VALUE err_info;
|
101
|
+
VALUE mark_ary;
|
102
|
+
const VALUE catch_table_ary; /* Array */
|
103
|
+
|
104
|
+
/* GC is not needed */
|
105
|
+
struct iseq_label_data *start_label;
|
106
|
+
struct iseq_label_data *end_label;
|
107
|
+
struct iseq_label_data *redo_label;
|
108
|
+
const rb_iseq_t *current_block;
|
109
|
+
VALUE ensure_node;
|
110
|
+
VALUE for_iseq;
|
111
|
+
struct iseq_compile_data_ensure_node_stack *ensure_node_stack;
|
112
|
+
int loopval_popped; /* used by NODE_BREAK */
|
113
|
+
int cached_const;
|
114
|
+
struct iseq_compile_data_storage *storage_head;
|
115
|
+
struct iseq_compile_data_storage *storage_current;
|
116
|
+
int last_line;
|
117
|
+
int label_no;
|
118
|
+
int node_level;
|
119
|
+
unsigned int ci_index;
|
120
|
+
unsigned int ci_kw_index;
|
121
|
+
const rb_compile_option_t *option;
|
122
|
+
struct rb_id_table *ivar_cache_table;
|
123
|
+
#if SUPPORT_JOKE
|
124
|
+
st_table *labels_table;
|
125
|
+
#endif
|
126
|
+
};
|
127
|
+
|
128
|
+
static inline struct iseq_compile_data *
|
129
|
+
ISEQ_COMPILE_DATA(const rb_iseq_t *iseq)
|
130
|
+
{
|
131
|
+
if (iseq->flags & ISEQ_USE_COMPILE_DATA) {
|
132
|
+
return iseq->aux.compile_data;
|
133
|
+
}
|
134
|
+
else {
|
135
|
+
return NULL;
|
136
|
+
}
|
137
|
+
}
|
138
|
+
|
139
|
+
static inline void
|
140
|
+
ISEQ_COMPILE_DATA_ALLOC(rb_iseq_t *iseq)
|
141
|
+
{
|
142
|
+
iseq->flags |= ISEQ_USE_COMPILE_DATA;
|
143
|
+
iseq->aux.compile_data = ZALLOC(struct iseq_compile_data);
|
144
|
+
}
|
145
|
+
|
146
|
+
static inline void
|
147
|
+
ISEQ_COMPILE_DATA_CLEAR(rb_iseq_t *iseq)
|
148
|
+
{
|
149
|
+
iseq->flags &= ~ISEQ_USE_COMPILE_DATA;
|
150
|
+
iseq->aux.compile_data = NULL;
|
151
|
+
}
|
152
|
+
|
153
|
+
static inline rb_iseq_t *
|
154
|
+
iseq_imemo_alloc(void)
|
155
|
+
{
|
156
|
+
return (rb_iseq_t *)rb_imemo_new(imemo_iseq, 0, 0, 0, 0);
|
157
|
+
}
|
158
|
+
|
159
|
+
VALUE rb_iseq_ibf_dump(const rb_iseq_t *iseq, VALUE opt);
|
160
|
+
void rb_ibf_load_iseq_complete(rb_iseq_t *iseq);
|
161
|
+
const rb_iseq_t *rb_iseq_ibf_load(VALUE str);
|
162
|
+
VALUE rb_iseq_ibf_load_extra_data(VALUE str);
|
163
|
+
void rb_iseq_init_trace(rb_iseq_t *iseq);
|
164
|
+
|
165
|
+
RUBY_SYMBOL_EXPORT_BEGIN
|
166
|
+
|
167
|
+
/* compile.c */
|
168
|
+
VALUE rb_iseq_compile_node(rb_iseq_t *iseq, const NODE *node);
|
169
|
+
int rb_iseq_translate_threaded_code(rb_iseq_t *iseq);
|
170
|
+
VALUE *rb_iseq_original_iseq(const rb_iseq_t *iseq);
|
171
|
+
void rb_iseq_build_from_ary(rb_iseq_t *iseq, VALUE misc,
|
172
|
+
VALUE locals, VALUE args,
|
173
|
+
VALUE exception, VALUE body);
|
174
|
+
|
175
|
+
/* iseq.c */
|
176
|
+
void rb_iseq_add_mark_object(const rb_iseq_t *iseq, VALUE obj);
|
177
|
+
VALUE rb_iseq_load(VALUE data, VALUE parent, VALUE opt);
|
178
|
+
VALUE rb_iseq_parameters(const rb_iseq_t *iseq, int is_proc);
|
179
|
+
struct st_table *ruby_insn_make_insn_table(void);
|
180
|
+
unsigned int rb_iseq_line_no(const rb_iseq_t *iseq, size_t pos);
|
181
|
+
void rb_iseq_trace_set(const rb_iseq_t *iseq, rb_event_flag_t turnon_events);
|
182
|
+
void rb_iseq_trace_set_all(rb_event_flag_t turnon_events);
|
183
|
+
void rb_iseq_trace_on_all(void);
|
184
|
+
|
185
|
+
VALUE rb_iseqw_new(const rb_iseq_t *iseq);
|
186
|
+
const rb_iseq_t *rb_iseqw_to_iseq(VALUE iseqw);
|
187
|
+
|
188
|
+
VALUE rb_iseq_absolute_path(const rb_iseq_t *iseq); /* obsolete */
|
189
|
+
VALUE rb_iseq_label(const rb_iseq_t *iseq);
|
190
|
+
VALUE rb_iseq_base_label(const rb_iseq_t *iseq);
|
191
|
+
VALUE rb_iseq_first_lineno(const rb_iseq_t *iseq);
|
192
|
+
VALUE rb_iseq_method_name(const rb_iseq_t *iseq);
|
193
|
+
void rb_iseq_code_range(const rb_iseq_t *iseq, int *first_lineno, int *first_column, int *last_lineno, int *last_column);
|
194
|
+
|
195
|
+
/* proc.c */
|
196
|
+
const rb_iseq_t *rb_method_iseq(VALUE body);
|
197
|
+
const rb_iseq_t *rb_proc_get_iseq(VALUE proc, int *is_proc);
|
198
|
+
|
199
|
+
struct rb_compile_option_struct {
|
200
|
+
unsigned int inline_const_cache: 1;
|
201
|
+
unsigned int peephole_optimization: 1;
|
202
|
+
unsigned int tailcall_optimization: 1;
|
203
|
+
unsigned int specialized_instruction: 1;
|
204
|
+
unsigned int operands_unification: 1;
|
205
|
+
unsigned int instructions_unification: 1;
|
206
|
+
unsigned int stack_caching: 1;
|
207
|
+
unsigned int frozen_string_literal: 1;
|
208
|
+
unsigned int debug_frozen_string_literal: 1;
|
209
|
+
unsigned int coverage_enabled: 1;
|
210
|
+
int debug_level;
|
211
|
+
};
|
212
|
+
|
213
|
+
struct iseq_insn_info_entry {
|
214
|
+
unsigned int position;
|
215
|
+
int line_no;
|
216
|
+
rb_event_flag_t events;
|
217
|
+
};
|
218
|
+
|
219
|
+
struct iseq_catch_table_entry {
|
220
|
+
enum catch_type {
|
221
|
+
CATCH_TYPE_RESCUE = INT2FIX(1),
|
222
|
+
CATCH_TYPE_ENSURE = INT2FIX(2),
|
223
|
+
CATCH_TYPE_RETRY = INT2FIX(3),
|
224
|
+
CATCH_TYPE_BREAK = INT2FIX(4),
|
225
|
+
CATCH_TYPE_REDO = INT2FIX(5),
|
226
|
+
CATCH_TYPE_NEXT = INT2FIX(6)
|
227
|
+
} type;
|
228
|
+
|
229
|
+
/*
|
230
|
+
* iseq type:
|
231
|
+
* CATCH_TYPE_RESCUE, CATCH_TYPE_ENSURE:
|
232
|
+
* use iseq as continuation.
|
233
|
+
*
|
234
|
+
* CATCH_TYPE_BREAK (iter):
|
235
|
+
* use iseq as key.
|
236
|
+
*
|
237
|
+
* CATCH_TYPE_BREAK (while), CATCH_TYPE_RETRY,
|
238
|
+
* CATCH_TYPE_REDO, CATCH_TYPE_NEXT:
|
239
|
+
* NULL.
|
240
|
+
*/
|
241
|
+
const rb_iseq_t *iseq;
|
242
|
+
|
243
|
+
unsigned int start;
|
244
|
+
unsigned int end;
|
245
|
+
unsigned int cont;
|
246
|
+
unsigned int sp;
|
247
|
+
};
|
248
|
+
|
249
|
+
PACKED_STRUCT_UNALIGNED(struct iseq_catch_table {
|
250
|
+
unsigned int size;
|
251
|
+
struct iseq_catch_table_entry entries[1]; /* flexible array */
|
252
|
+
});
|
253
|
+
|
254
|
+
static inline int
|
255
|
+
iseq_catch_table_bytes(int n)
|
256
|
+
{
|
257
|
+
enum {
|
258
|
+
catch_table_entries_max = (INT_MAX - sizeof(struct iseq_catch_table)) / sizeof(struct iseq_catch_table_entry)
|
259
|
+
};
|
260
|
+
if (n > catch_table_entries_max) rb_fatal("too large iseq_catch_table - %d", n);
|
261
|
+
return (int)(sizeof(struct iseq_catch_table) +
|
262
|
+
(n - 1) * sizeof(struct iseq_catch_table_entry));
|
263
|
+
}
|
264
|
+
|
265
|
+
#define INITIAL_ISEQ_COMPILE_DATA_STORAGE_BUFF_SIZE (512)
|
266
|
+
|
267
|
+
struct iseq_compile_data_storage {
|
268
|
+
struct iseq_compile_data_storage *next;
|
269
|
+
unsigned int pos;
|
270
|
+
unsigned int size;
|
271
|
+
char buff[1]; /* flexible array */
|
272
|
+
};
|
273
|
+
|
274
|
+
/* account for flexible array */
|
275
|
+
#define SIZEOF_ISEQ_COMPILE_DATA_STORAGE \
|
276
|
+
(sizeof(struct iseq_compile_data_storage) - 1)
|
277
|
+
|
278
|
+
/* defined? */
|
279
|
+
|
280
|
+
enum defined_type {
|
281
|
+
DEFINED_NIL = 1,
|
282
|
+
DEFINED_IVAR,
|
283
|
+
DEFINED_LVAR,
|
284
|
+
DEFINED_GVAR,
|
285
|
+
DEFINED_CVAR,
|
286
|
+
DEFINED_CONST,
|
287
|
+
DEFINED_METHOD,
|
288
|
+
DEFINED_YIELD,
|
289
|
+
DEFINED_ZSUPER,
|
290
|
+
DEFINED_SELF,
|
291
|
+
DEFINED_TRUE,
|
292
|
+
DEFINED_FALSE,
|
293
|
+
DEFINED_ASGN,
|
294
|
+
DEFINED_EXPR,
|
295
|
+
DEFINED_IVAR2,
|
296
|
+
DEFINED_REF,
|
297
|
+
DEFINED_FUNC
|
298
|
+
};
|
299
|
+
|
300
|
+
VALUE rb_iseq_defined_string(enum defined_type type);
|
301
|
+
void rb_iseq_make_compile_option(struct rb_compile_option_struct *option, VALUE opt);
|
302
|
+
|
303
|
+
/* vm.c */
|
304
|
+
VALUE rb_iseq_local_variables(const rb_iseq_t *iseq);
|
305
|
+
|
306
|
+
RUBY_SYMBOL_EXPORT_END
|
307
|
+
|
308
|
+
#endif /* RUBY_ISEQ_H */
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/** -*-c-*-
|
2
2
|
* DO NOT EDIT
|
3
|
-
* This file is automatically generated by
|
3
|
+
* This file is automatically generated by tool/generic_erb.rb from
|
4
4
|
* template/known_errors.inc.tmpl and defs/known_errors.def.
|
5
5
|
*/
|
6
6
|
|
@@ -729,3 +729,18 @@
|
|
729
729
|
#else
|
730
730
|
undefined_error("EIPSEC")
|
731
731
|
#endif
|
732
|
+
#ifdef EHWPOISON
|
733
|
+
defined_error("EHWPOISON", EHWPOISON)
|
734
|
+
#else
|
735
|
+
undefined_error("EHWPOISON")
|
736
|
+
#endif
|
737
|
+
#ifdef ECAPMODE
|
738
|
+
defined_error("ECAPMODE", ECAPMODE)
|
739
|
+
#else
|
740
|
+
undefined_error("ECAPMODE")
|
741
|
+
#endif
|
742
|
+
#ifdef ENOTCAPABLE
|
743
|
+
defined_error("ENOTCAPABLE", ENOTCAPABLE)
|
744
|
+
#else
|
745
|
+
undefined_error("ENOTCAPABLE")
|
746
|
+
#endif
|
@@ -0,0 +1,218 @@
|
|
1
|
+
/**********************************************************************
|
2
|
+
|
3
|
+
method.h -
|
4
|
+
|
5
|
+
$Author: mame $
|
6
|
+
created at: Wed Jul 15 20:02:33 2009
|
7
|
+
|
8
|
+
Copyright (C) 2009 Koichi Sasada
|
9
|
+
|
10
|
+
**********************************************************************/
|
11
|
+
#ifndef RUBY_METHOD_H
|
12
|
+
#define RUBY_METHOD_H 1
|
13
|
+
|
14
|
+
#include "internal.h"
|
15
|
+
|
16
|
+
#ifndef END_OF_ENUMERATION
|
17
|
+
# if defined(__GNUC__) &&! defined(__STRICT_ANSI__)
|
18
|
+
# define END_OF_ENUMERATION(key)
|
19
|
+
# else
|
20
|
+
# define END_OF_ENUMERATION(key) END_OF_##key##_PLACEHOLDER = 0
|
21
|
+
# endif
|
22
|
+
#endif
|
23
|
+
|
24
|
+
/* cref */
|
25
|
+
|
26
|
+
typedef enum {
|
27
|
+
METHOD_VISI_UNDEF = 0x00,
|
28
|
+
METHOD_VISI_PUBLIC = 0x01,
|
29
|
+
METHOD_VISI_PRIVATE = 0x02,
|
30
|
+
METHOD_VISI_PROTECTED = 0x03,
|
31
|
+
|
32
|
+
METHOD_VISI_MASK = 0x03
|
33
|
+
} rb_method_visibility_t;
|
34
|
+
|
35
|
+
typedef struct rb_scope_visi_struct {
|
36
|
+
rb_method_visibility_t method_visi : 3;
|
37
|
+
unsigned int module_func : 1;
|
38
|
+
} rb_scope_visibility_t;
|
39
|
+
|
40
|
+
/*! CREF (Class REFerence) */
|
41
|
+
typedef struct rb_cref_struct {
|
42
|
+
VALUE flags;
|
43
|
+
const VALUE refinements;
|
44
|
+
const VALUE klass;
|
45
|
+
struct rb_cref_struct * const next;
|
46
|
+
const rb_scope_visibility_t scope_visi;
|
47
|
+
} rb_cref_t;
|
48
|
+
|
49
|
+
/* method data type */
|
50
|
+
|
51
|
+
typedef struct rb_method_entry_struct {
|
52
|
+
VALUE flags;
|
53
|
+
const VALUE defined_class;
|
54
|
+
struct rb_method_definition_struct * const def;
|
55
|
+
ID called_id;
|
56
|
+
const VALUE owner;
|
57
|
+
} rb_method_entry_t;
|
58
|
+
|
59
|
+
typedef struct rb_callable_method_entry_struct { /* same fields with rb_method_entry_t */
|
60
|
+
VALUE flags;
|
61
|
+
const VALUE defined_class;
|
62
|
+
struct rb_method_definition_struct * const def;
|
63
|
+
ID called_id;
|
64
|
+
const VALUE owner;
|
65
|
+
} rb_callable_method_entry_t;
|
66
|
+
|
67
|
+
#define METHOD_ENTRY_VISI(me) (rb_method_visibility_t)(((me)->flags & (IMEMO_FL_USER0 | IMEMO_FL_USER1)) >> (IMEMO_FL_USHIFT+0))
|
68
|
+
#define METHOD_ENTRY_BASIC(me) (int) (((me)->flags & (IMEMO_FL_USER2 )) >> (IMEMO_FL_USHIFT+2))
|
69
|
+
#define METHOD_ENTRY_COMPLEMENTED(me) ((me)->flags & IMEMO_FL_USER3)
|
70
|
+
#define METHOD_ENTRY_COMPLEMENTED_SET(me) ((me)->flags = (me)->flags | IMEMO_FL_USER3)
|
71
|
+
|
72
|
+
static inline void
|
73
|
+
METHOD_ENTRY_VISI_SET(rb_method_entry_t *me, rb_method_visibility_t visi)
|
74
|
+
{
|
75
|
+
VM_ASSERT((int)visi >= 0 && visi <= 3);
|
76
|
+
me->flags = (me->flags & ~(IMEMO_FL_USER0 | IMEMO_FL_USER1)) | (visi << (IMEMO_FL_USHIFT+0));
|
77
|
+
}
|
78
|
+
static inline void
|
79
|
+
METHOD_ENTRY_BASIC_SET(rb_method_entry_t *me, unsigned int basic)
|
80
|
+
{
|
81
|
+
VM_ASSERT(basic <= 1);
|
82
|
+
me->flags = (me->flags & ~(IMEMO_FL_USER2 )) | (basic << (IMEMO_FL_USHIFT+2));
|
83
|
+
}
|
84
|
+
static inline void
|
85
|
+
METHOD_ENTRY_FLAGS_SET(rb_method_entry_t *me, rb_method_visibility_t visi, unsigned int basic)
|
86
|
+
{
|
87
|
+
VM_ASSERT((int)visi >= 0 && visi <= 3);
|
88
|
+
VM_ASSERT(basic <= 1);
|
89
|
+
me->flags =
|
90
|
+
(me->flags & ~(IMEMO_FL_USER0|IMEMO_FL_USER1|IMEMO_FL_USER2)) |
|
91
|
+
((visi << (IMEMO_FL_USHIFT+0)) | (basic << (IMEMO_FL_USHIFT+2)));
|
92
|
+
}
|
93
|
+
static inline void
|
94
|
+
METHOD_ENTRY_FLAGS_COPY(rb_method_entry_t *dst, const rb_method_entry_t *src)
|
95
|
+
{
|
96
|
+
dst->flags =
|
97
|
+
(dst->flags & ~(IMEMO_FL_USER0|IMEMO_FL_USER1|IMEMO_FL_USER2)) |
|
98
|
+
(src->flags & (IMEMO_FL_USER0|IMEMO_FL_USER1|IMEMO_FL_USER2));
|
99
|
+
}
|
100
|
+
|
101
|
+
typedef enum {
|
102
|
+
VM_METHOD_TYPE_ISEQ, /*!< Ruby method */
|
103
|
+
VM_METHOD_TYPE_CFUNC, /*!< C method */
|
104
|
+
VM_METHOD_TYPE_ATTRSET, /*!< attr_writer or attr_accessor */
|
105
|
+
VM_METHOD_TYPE_IVAR, /*!< attr_reader or attr_accessor */
|
106
|
+
VM_METHOD_TYPE_BMETHOD,
|
107
|
+
VM_METHOD_TYPE_ZSUPER,
|
108
|
+
VM_METHOD_TYPE_ALIAS,
|
109
|
+
VM_METHOD_TYPE_UNDEF,
|
110
|
+
VM_METHOD_TYPE_NOTIMPLEMENTED,
|
111
|
+
VM_METHOD_TYPE_OPTIMIZED, /*!< Kernel#send, Proc#call, etc */
|
112
|
+
VM_METHOD_TYPE_MISSING, /*!< wrapper for method_missing(id) */
|
113
|
+
VM_METHOD_TYPE_REFINED, /*!< refinement */
|
114
|
+
|
115
|
+
END_OF_ENUMERATION(VM_METHOD_TYPE)
|
116
|
+
} rb_method_type_t;
|
117
|
+
|
118
|
+
#ifndef rb_iseq_t
|
119
|
+
typedef struct rb_iseq_struct rb_iseq_t;
|
120
|
+
#define rb_iseq_t rb_iseq_t
|
121
|
+
#endif
|
122
|
+
|
123
|
+
typedef struct rb_method_iseq_struct {
|
124
|
+
const rb_iseq_t * const iseqptr; /*!< iseq pointer, should be separated from iseqval */
|
125
|
+
rb_cref_t * const cref; /*!< class reference, should be marked */
|
126
|
+
} rb_method_iseq_t; /* check rb_add_method_iseq() when modify the fields */
|
127
|
+
|
128
|
+
typedef struct rb_method_cfunc_struct {
|
129
|
+
VALUE (*func)(ANYARGS);
|
130
|
+
VALUE (*invoker)(VALUE (*func)(ANYARGS), VALUE recv, int argc, const VALUE *argv);
|
131
|
+
int argc;
|
132
|
+
} rb_method_cfunc_t;
|
133
|
+
|
134
|
+
typedef struct rb_method_attr_struct {
|
135
|
+
ID id;
|
136
|
+
const VALUE location; /* should be marked */
|
137
|
+
} rb_method_attr_t;
|
138
|
+
|
139
|
+
typedef struct rb_method_alias_struct {
|
140
|
+
const struct rb_method_entry_struct * const original_me; /* original_me->klass is original owner */
|
141
|
+
} rb_method_alias_t;
|
142
|
+
|
143
|
+
typedef struct rb_method_refined_struct {
|
144
|
+
const struct rb_method_entry_struct * const orig_me;
|
145
|
+
const VALUE owner;
|
146
|
+
} rb_method_refined_t;
|
147
|
+
|
148
|
+
enum method_optimized_type {
|
149
|
+
OPTIMIZED_METHOD_TYPE_SEND,
|
150
|
+
OPTIMIZED_METHOD_TYPE_CALL,
|
151
|
+
OPTIMIZED_METHOD_TYPE__MAX
|
152
|
+
};
|
153
|
+
|
154
|
+
PACKED_STRUCT_UNALIGNED(struct rb_method_definition_struct {
|
155
|
+
unsigned int type : 4; /* method type */
|
156
|
+
int alias_count : 28;
|
157
|
+
int complemented_count : 28;
|
158
|
+
|
159
|
+
union {
|
160
|
+
rb_method_iseq_t iseq;
|
161
|
+
rb_method_cfunc_t cfunc;
|
162
|
+
rb_method_attr_t attr;
|
163
|
+
rb_method_alias_t alias;
|
164
|
+
rb_method_refined_t refined;
|
165
|
+
|
166
|
+
const VALUE proc; /* should be marked */
|
167
|
+
enum method_optimized_type optimize_type;
|
168
|
+
} body;
|
169
|
+
|
170
|
+
ID original_id;
|
171
|
+
});
|
172
|
+
|
173
|
+
typedef struct rb_method_definition_struct rb_method_definition_t;
|
174
|
+
|
175
|
+
#define UNDEFINED_METHOD_ENTRY_P(me) (!(me) || !(me)->def || (me)->def->type == VM_METHOD_TYPE_UNDEF)
|
176
|
+
#define UNDEFINED_REFINED_METHOD_P(def) \
|
177
|
+
((def)->type == VM_METHOD_TYPE_REFINED && \
|
178
|
+
UNDEFINED_METHOD_ENTRY_P((def)->body.refined.orig_me))
|
179
|
+
|
180
|
+
void rb_add_method_cfunc(VALUE klass, ID mid, VALUE (*func)(ANYARGS), int argc, rb_method_visibility_t visi);
|
181
|
+
void rb_add_method_iseq(VALUE klass, ID mid, const rb_iseq_t *iseq, rb_cref_t *cref, rb_method_visibility_t visi);
|
182
|
+
void rb_add_refined_method_entry(VALUE refined_class, ID mid);
|
183
|
+
|
184
|
+
rb_method_entry_t *rb_add_method(VALUE klass, ID mid, rb_method_type_t type, void *option, rb_method_visibility_t visi);
|
185
|
+
rb_method_entry_t *rb_method_entry_set(VALUE klass, ID mid, const rb_method_entry_t *, rb_method_visibility_t noex);
|
186
|
+
rb_method_entry_t *rb_method_entry_create(ID called_id, VALUE klass, rb_method_visibility_t visi, const rb_method_definition_t *def);
|
187
|
+
|
188
|
+
const rb_method_entry_t *rb_method_entry_at(VALUE obj, ID id);
|
189
|
+
|
190
|
+
const rb_method_entry_t *rb_method_entry(VALUE klass, ID id);
|
191
|
+
const rb_method_entry_t *rb_method_entry_without_refinements(VALUE klass, ID id, VALUE *defined_class);
|
192
|
+
const rb_method_entry_t *rb_resolve_refined_method(VALUE refinements, const rb_method_entry_t *me);
|
193
|
+
RUBY_SYMBOL_EXPORT_BEGIN
|
194
|
+
const rb_method_entry_t *rb_resolve_me_location(const rb_method_entry_t *, VALUE[5]);
|
195
|
+
RUBY_SYMBOL_EXPORT_END
|
196
|
+
|
197
|
+
const rb_callable_method_entry_t *rb_callable_method_entry(VALUE klass, ID id);
|
198
|
+
const rb_callable_method_entry_t *rb_callable_method_entry_with_refinements(VALUE klass, ID id, VALUE *defined_class);
|
199
|
+
const rb_callable_method_entry_t *rb_callable_method_entry_without_refinements(VALUE klass, ID id, VALUE *defined_class);
|
200
|
+
|
201
|
+
int rb_method_entry_arity(const rb_method_entry_t *me);
|
202
|
+
int rb_method_entry_eq(const rb_method_entry_t *m1, const rb_method_entry_t *m2);
|
203
|
+
st_index_t rb_hash_method_entry(st_index_t hash, const rb_method_entry_t *me);
|
204
|
+
|
205
|
+
VALUE rb_method_entry_location(const rb_method_entry_t *me);
|
206
|
+
VALUE rb_mod_method_location(VALUE mod, ID id);
|
207
|
+
VALUE rb_obj_method_location(VALUE obj, ID id);
|
208
|
+
|
209
|
+
void rb_free_method_entry(const rb_method_entry_t *me);
|
210
|
+
void rb_sweep_method_entry(void *vm);
|
211
|
+
|
212
|
+
const rb_method_entry_t *rb_method_entry_clone(const rb_method_entry_t *me);
|
213
|
+
const rb_callable_method_entry_t *rb_method_entry_complement_defined_class(const rb_method_entry_t *src_me, ID called_id, VALUE defined_class);
|
214
|
+
void rb_method_entry_copy(rb_method_entry_t *dst, const rb_method_entry_t *src);
|
215
|
+
|
216
|
+
void rb_scope_visibility_set(rb_method_visibility_t);
|
217
|
+
|
218
|
+
#endif /* RUBY_METHOD_H */
|