datadog-ruby_core_source 3.5.4 → 3.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/datadog-ruby_core_source.gemspec +1 -1
- data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/ccan/build_assert/build_assert.h +40 -0
- data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/ccan/check_type/check_type.h +63 -0
- data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/ccan/container_of/container_of.h +142 -0
- data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/ccan/list/list.h +788 -0
- data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/ccan/str/str.h +16 -0
- data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/id.h +252 -0
- data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/internal.h +2465 -0
- data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/iseq.h +304 -0
- data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/method.h +229 -0
- data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/node.h +449 -0
- data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/ruby_assert.h +60 -0
- data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/ruby_atomic.h +244 -0
- data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/thread_pthread.h +75 -0
- data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/thread_win32.h +36 -0
- data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/vm_core.h +1902 -0
- data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/vm_opts.h +70 -0
- data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/ccan/build_assert/build_assert.h +40 -0
- data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/ccan/check_type/check_type.h +63 -0
- data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/ccan/container_of/container_of.h +142 -0
- data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/ccan/list/list.h +788 -0
- data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/ccan/str/str.h +16 -0
- data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/id.h +290 -0
- data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/internal.h +2697 -0
- data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/iseq.h +312 -0
- data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/method.h +229 -0
- data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/node.h +476 -0
- data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/ruby_assert.h +15 -0
- data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/ruby_atomic.h +244 -0
- data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/thread_pthread.h +75 -0
- data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/thread_win32.h +36 -0
- data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/vm_core.h +1968 -0
- data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/vm_opts.h +72 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/ccan/build_assert/build_assert.h +40 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/ccan/check_type/check_type.h +63 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/ccan/container_of/container_of.h +142 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/ccan/list/list.h +788 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/ccan/str/str.h +16 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/id.h +290 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/id_table.h +36 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/internal/array.h +119 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/internal/class.h +174 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/internal/compilers.h +108 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/internal/gc.h +161 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/internal/imemo.h +243 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/internal/serial.h +24 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/internal/static_assert.h +17 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/internal/vm.h +136 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/internal/warnings.h +17 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/internal.h +107 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/iseq.h +305 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/method.h +245 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/node.h +484 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/ractor_core.h +343 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/ruby_assert.h +15 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/ruby_atomic.h +23 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/thread_pthread.h +115 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/thread_win32.h +61 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/vm_core.h +2023 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/vm_debug.h +116 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/vm_opts.h +73 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/ccan/build_assert/build_assert.h +40 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/ccan/check_type/check_type.h +63 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/ccan/container_of/container_of.h +142 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/ccan/list/list.h +788 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/ccan/str/str.h +16 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/darray.h +198 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/id.h +293 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/id_table.h +36 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/internal/array.h +113 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/internal/class.h +196 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/internal/compilers.h +107 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/internal/gc.h +186 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/internal/imemo.h +243 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/internal/serial.h +23 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/internal/static_assert.h +16 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/internal/vm.h +133 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/internal/warnings.h +16 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/internal.h +109 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/iseq.h +322 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/method.h +253 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/node.h +510 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/ractor_core.h +346 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/ruby_assert.h +14 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/ruby_atomic.h +23 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/thread_pthread.h +115 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/vm_core.h +2107 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/vm_debug.h +124 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/vm_opts.h +73 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/ccan/build_assert/build_assert.h +40 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/ccan/check_type/check_type.h +63 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/ccan/container_of/container_of.h +142 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/ccan/list/list.h +789 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/ccan/str/str.h +17 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/id.h +299 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/id_table.h +39 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/internal/array.h +163 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/internal/basic_operators.h +64 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/internal/class.h +182 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/internal/compilers.h +107 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/internal/gc.h +192 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/internal/imemo.h +242 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/internal/serial.h +23 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/internal/static_assert.h +16 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/internal/vm.h +134 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/internal/warnings.h +16 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/internal.h +113 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/iseq.h +329 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/method.h +254 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/node.h +514 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/ractor_core.h +342 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/ruby_assert.h +14 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/ruby_atomic.h +23 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/shape.h +232 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/thread_none.h +20 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/thread_pthread.h +133 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/vm_core.h +2106 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/vm_debug.h +122 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/vm_opts.h +73 -0
- data/lib/datadog/ruby_core_source/version.rb +1 -1
- metadata +122 -4
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
/**********************************************************************
|
|
2
|
+
|
|
3
|
+
iseq.h -
|
|
4
|
+
|
|
5
|
+
$Author$
|
|
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
|
+
RUBY_EXTERN const int ruby_api_version[];
|
|
16
|
+
#define ISEQ_MAJOR_VERSION ((unsigned int)ruby_api_version[0])
|
|
17
|
+
#define ISEQ_MINOR_VERSION ((unsigned int)ruby_api_version[1])
|
|
18
|
+
|
|
19
|
+
#ifndef rb_iseq_t
|
|
20
|
+
typedef struct rb_iseq_struct rb_iseq_t;
|
|
21
|
+
#define rb_iseq_t rb_iseq_t
|
|
22
|
+
#endif
|
|
23
|
+
|
|
24
|
+
extern const ID rb_iseq_shared_exc_local_tbl[];
|
|
25
|
+
|
|
26
|
+
static inline size_t
|
|
27
|
+
rb_call_info_kw_arg_bytes(int keyword_len)
|
|
28
|
+
{
|
|
29
|
+
return rb_size_mul_add_or_raise(
|
|
30
|
+
keyword_len - 1, sizeof(VALUE), sizeof(struct rb_call_info_kw_arg),
|
|
31
|
+
rb_eRuntimeError);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
#define ISEQ_COVERAGE(iseq) iseq->body->variable.coverage
|
|
35
|
+
#define ISEQ_COVERAGE_SET(iseq, cov) RB_OBJ_WRITE(iseq, &iseq->body->variable.coverage, cov)
|
|
36
|
+
#define ISEQ_LINE_COVERAGE(iseq) RARRAY_AREF(ISEQ_COVERAGE(iseq), COVERAGE_INDEX_LINES)
|
|
37
|
+
#define ISEQ_BRANCH_COVERAGE(iseq) RARRAY_AREF(ISEQ_COVERAGE(iseq), COVERAGE_INDEX_BRANCHES)
|
|
38
|
+
|
|
39
|
+
#define ISEQ_PC2BRANCHINDEX(iseq) iseq->body->variable.pc2branchindex
|
|
40
|
+
#define ISEQ_PC2BRANCHINDEX_SET(iseq, h) RB_OBJ_WRITE(iseq, &iseq->body->variable.pc2branchindex, h)
|
|
41
|
+
|
|
42
|
+
#define ISEQ_FLIP_CNT(iseq) (iseq)->body->variable.flip_count
|
|
43
|
+
|
|
44
|
+
static inline rb_snum_t
|
|
45
|
+
ISEQ_FLIP_CNT_INCREMENT(const rb_iseq_t *iseq)
|
|
46
|
+
{
|
|
47
|
+
rb_snum_t cnt = iseq->body->variable.flip_count;
|
|
48
|
+
iseq->body->variable.flip_count += 1;
|
|
49
|
+
return cnt;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
static inline VALUE *
|
|
53
|
+
ISEQ_ORIGINAL_ISEQ(const rb_iseq_t *iseq)
|
|
54
|
+
{
|
|
55
|
+
return iseq->body->variable.original_iseq;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
static inline void
|
|
59
|
+
ISEQ_ORIGINAL_ISEQ_CLEAR(const rb_iseq_t *iseq)
|
|
60
|
+
{
|
|
61
|
+
void *ptr = iseq->body->variable.original_iseq;
|
|
62
|
+
iseq->body->variable.original_iseq = NULL;
|
|
63
|
+
if (ptr) {
|
|
64
|
+
ruby_xfree(ptr);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
static inline VALUE *
|
|
69
|
+
ISEQ_ORIGINAL_ISEQ_ALLOC(const rb_iseq_t *iseq, long size)
|
|
70
|
+
{
|
|
71
|
+
return iseq->body->variable.original_iseq =
|
|
72
|
+
ALLOC_N(VALUE, size);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
#define ISEQ_TRACE_EVENTS (RUBY_EVENT_LINE | \
|
|
76
|
+
RUBY_EVENT_CLASS | \
|
|
77
|
+
RUBY_EVENT_END | \
|
|
78
|
+
RUBY_EVENT_CALL | \
|
|
79
|
+
RUBY_EVENT_RETURN| \
|
|
80
|
+
RUBY_EVENT_B_CALL| \
|
|
81
|
+
RUBY_EVENT_B_RETURN| \
|
|
82
|
+
RUBY_EVENT_COVERAGE_LINE| \
|
|
83
|
+
RUBY_EVENT_COVERAGE_BRANCH)
|
|
84
|
+
|
|
85
|
+
#define ISEQ_NOT_LOADED_YET IMEMO_FL_USER1
|
|
86
|
+
#define ISEQ_USE_COMPILE_DATA IMEMO_FL_USER2
|
|
87
|
+
#define ISEQ_TRANSLATED IMEMO_FL_USER3
|
|
88
|
+
#define ISEQ_MARKABLE_ISEQ IMEMO_FL_USER4
|
|
89
|
+
|
|
90
|
+
#define ISEQ_EXECUTABLE_P(iseq) (FL_TEST_RAW((iseq), ISEQ_NOT_LOADED_YET | ISEQ_USE_COMPILE_DATA) == 0)
|
|
91
|
+
|
|
92
|
+
struct iseq_compile_data {
|
|
93
|
+
/* GC is needed */
|
|
94
|
+
const VALUE err_info;
|
|
95
|
+
const VALUE catch_table_ary; /* Array */
|
|
96
|
+
|
|
97
|
+
/* GC is not needed */
|
|
98
|
+
struct iseq_label_data *start_label;
|
|
99
|
+
struct iseq_label_data *end_label;
|
|
100
|
+
struct iseq_label_data *redo_label;
|
|
101
|
+
const rb_iseq_t *current_block;
|
|
102
|
+
struct iseq_compile_data_ensure_node_stack *ensure_node_stack;
|
|
103
|
+
struct {
|
|
104
|
+
struct iseq_compile_data_storage *storage_head;
|
|
105
|
+
struct iseq_compile_data_storage *storage_current;
|
|
106
|
+
} node;
|
|
107
|
+
struct {
|
|
108
|
+
struct iseq_compile_data_storage *storage_head;
|
|
109
|
+
struct iseq_compile_data_storage *storage_current;
|
|
110
|
+
} insn;
|
|
111
|
+
int loopval_popped; /* used by NODE_BREAK */
|
|
112
|
+
int last_line;
|
|
113
|
+
int label_no;
|
|
114
|
+
int node_level;
|
|
115
|
+
unsigned int ci_index;
|
|
116
|
+
unsigned int ci_kw_index;
|
|
117
|
+
const rb_compile_option_t *option;
|
|
118
|
+
struct rb_id_table *ivar_cache_table;
|
|
119
|
+
const struct rb_builtin_function *builtin_function_table;
|
|
120
|
+
#if OPT_SUPPORT_JOKE
|
|
121
|
+
st_table *labels_table;
|
|
122
|
+
#endif
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
static inline struct iseq_compile_data *
|
|
126
|
+
ISEQ_COMPILE_DATA(const rb_iseq_t *iseq)
|
|
127
|
+
{
|
|
128
|
+
if (iseq->flags & ISEQ_USE_COMPILE_DATA) {
|
|
129
|
+
return iseq->aux.compile_data;
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
return NULL;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
static inline void
|
|
137
|
+
ISEQ_COMPILE_DATA_ALLOC(rb_iseq_t *iseq)
|
|
138
|
+
{
|
|
139
|
+
iseq->aux.compile_data = ZALLOC(struct iseq_compile_data);
|
|
140
|
+
iseq->flags |= ISEQ_USE_COMPILE_DATA;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
static inline void
|
|
144
|
+
ISEQ_COMPILE_DATA_CLEAR(rb_iseq_t *iseq)
|
|
145
|
+
{
|
|
146
|
+
iseq->flags &= ~ISEQ_USE_COMPILE_DATA;
|
|
147
|
+
iseq->aux.compile_data = NULL;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
static inline rb_iseq_t *
|
|
151
|
+
iseq_imemo_alloc(void)
|
|
152
|
+
{
|
|
153
|
+
return (rb_iseq_t *)rb_imemo_new(imemo_iseq, 0, 0, 0, 0);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
VALUE rb_iseq_ibf_dump(const rb_iseq_t *iseq, VALUE opt);
|
|
157
|
+
void rb_ibf_load_iseq_complete(rb_iseq_t *iseq);
|
|
158
|
+
const rb_iseq_t *rb_iseq_ibf_load(VALUE str);
|
|
159
|
+
const rb_iseq_t *rb_iseq_ibf_load_bytes(const char *cstr, size_t);
|
|
160
|
+
VALUE rb_iseq_ibf_load_extra_data(VALUE str);
|
|
161
|
+
void rb_iseq_init_trace(rb_iseq_t *iseq);
|
|
162
|
+
int rb_iseq_add_local_tracepoint_recursively(const rb_iseq_t *iseq, rb_event_flag_t turnon_events, VALUE tpval, unsigned int target_line);
|
|
163
|
+
int rb_iseq_remove_local_tracepoint_recursively(const rb_iseq_t *iseq, VALUE tpval);
|
|
164
|
+
const rb_iseq_t *rb_iseq_load_iseq(VALUE fname);
|
|
165
|
+
|
|
166
|
+
#if VM_INSN_INFO_TABLE_IMPL == 2
|
|
167
|
+
unsigned int *rb_iseq_insns_info_decode_positions(const struct rb_iseq_constant_body *body);
|
|
168
|
+
#endif
|
|
169
|
+
|
|
170
|
+
RUBY_SYMBOL_EXPORT_BEGIN
|
|
171
|
+
|
|
172
|
+
/* compile.c */
|
|
173
|
+
VALUE rb_iseq_compile_node(rb_iseq_t *iseq, const NODE *node);
|
|
174
|
+
VALUE rb_iseq_compile_callback(rb_iseq_t *iseq, const struct rb_iseq_new_with_callback_callback_func * ifunc);
|
|
175
|
+
VALUE *rb_iseq_original_iseq(const rb_iseq_t *iseq);
|
|
176
|
+
void rb_iseq_build_from_ary(rb_iseq_t *iseq, VALUE misc,
|
|
177
|
+
VALUE locals, VALUE args,
|
|
178
|
+
VALUE exception, VALUE body);
|
|
179
|
+
void rb_iseq_mark_insn_storage(struct iseq_compile_data_storage *arena);
|
|
180
|
+
|
|
181
|
+
/* iseq.c */
|
|
182
|
+
VALUE rb_iseq_load(VALUE data, VALUE parent, VALUE opt);
|
|
183
|
+
VALUE rb_iseq_parameters(const rb_iseq_t *iseq, int is_proc);
|
|
184
|
+
unsigned int rb_iseq_line_no(const rb_iseq_t *iseq, size_t pos);
|
|
185
|
+
void rb_iseq_trace_set(const rb_iseq_t *iseq, rb_event_flag_t turnon_events);
|
|
186
|
+
void rb_iseq_trace_set_all(rb_event_flag_t turnon_events);
|
|
187
|
+
void rb_iseq_insns_info_encode_positions(const rb_iseq_t *iseq);
|
|
188
|
+
|
|
189
|
+
struct rb_iseq_constant_body *rb_iseq_constant_body_alloc(void);
|
|
190
|
+
VALUE rb_iseqw_new(const rb_iseq_t *iseq);
|
|
191
|
+
const rb_iseq_t *rb_iseqw_to_iseq(VALUE iseqw);
|
|
192
|
+
|
|
193
|
+
VALUE rb_iseq_absolute_path(const rb_iseq_t *iseq); /* obsolete */
|
|
194
|
+
VALUE rb_iseq_label(const rb_iseq_t *iseq);
|
|
195
|
+
VALUE rb_iseq_base_label(const rb_iseq_t *iseq);
|
|
196
|
+
VALUE rb_iseq_first_lineno(const rb_iseq_t *iseq);
|
|
197
|
+
VALUE rb_iseq_method_name(const rb_iseq_t *iseq);
|
|
198
|
+
void rb_iseq_code_location(const rb_iseq_t *iseq, int *first_lineno, int *first_column, int *last_lineno, int *last_column);
|
|
199
|
+
|
|
200
|
+
void rb_iseq_remove_coverage_all(void);
|
|
201
|
+
|
|
202
|
+
/* proc.c */
|
|
203
|
+
const rb_iseq_t *rb_method_iseq(VALUE body);
|
|
204
|
+
const rb_iseq_t *rb_proc_get_iseq(VALUE proc, int *is_proc);
|
|
205
|
+
|
|
206
|
+
struct rb_compile_option_struct {
|
|
207
|
+
unsigned int inline_const_cache: 1;
|
|
208
|
+
unsigned int peephole_optimization: 1;
|
|
209
|
+
unsigned int tailcall_optimization: 1;
|
|
210
|
+
unsigned int specialized_instruction: 1;
|
|
211
|
+
unsigned int operands_unification: 1;
|
|
212
|
+
unsigned int instructions_unification: 1;
|
|
213
|
+
unsigned int stack_caching: 1;
|
|
214
|
+
unsigned int frozen_string_literal: 1;
|
|
215
|
+
unsigned int debug_frozen_string_literal: 1;
|
|
216
|
+
unsigned int coverage_enabled: 1;
|
|
217
|
+
int debug_level;
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
struct iseq_insn_info_entry {
|
|
221
|
+
int line_no;
|
|
222
|
+
rb_event_flag_t events;
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
struct iseq_catch_table_entry {
|
|
226
|
+
enum catch_type {
|
|
227
|
+
CATCH_TYPE_RESCUE = INT2FIX(1),
|
|
228
|
+
CATCH_TYPE_ENSURE = INT2FIX(2),
|
|
229
|
+
CATCH_TYPE_RETRY = INT2FIX(3),
|
|
230
|
+
CATCH_TYPE_BREAK = INT2FIX(4),
|
|
231
|
+
CATCH_TYPE_REDO = INT2FIX(5),
|
|
232
|
+
CATCH_TYPE_NEXT = INT2FIX(6)
|
|
233
|
+
} type;
|
|
234
|
+
|
|
235
|
+
/*
|
|
236
|
+
* iseq type:
|
|
237
|
+
* CATCH_TYPE_RESCUE, CATCH_TYPE_ENSURE:
|
|
238
|
+
* use iseq as continuation.
|
|
239
|
+
*
|
|
240
|
+
* CATCH_TYPE_BREAK (iter):
|
|
241
|
+
* use iseq as key.
|
|
242
|
+
*
|
|
243
|
+
* CATCH_TYPE_BREAK (while), CATCH_TYPE_RETRY,
|
|
244
|
+
* CATCH_TYPE_REDO, CATCH_TYPE_NEXT:
|
|
245
|
+
* NULL.
|
|
246
|
+
*/
|
|
247
|
+
rb_iseq_t *iseq;
|
|
248
|
+
|
|
249
|
+
unsigned int start;
|
|
250
|
+
unsigned int end;
|
|
251
|
+
unsigned int cont;
|
|
252
|
+
unsigned int sp;
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
PACKED_STRUCT_UNALIGNED(struct iseq_catch_table {
|
|
256
|
+
unsigned int size;
|
|
257
|
+
struct iseq_catch_table_entry entries[FLEX_ARY_LEN];
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
static inline int
|
|
261
|
+
iseq_catch_table_bytes(int n)
|
|
262
|
+
{
|
|
263
|
+
enum {
|
|
264
|
+
catch_table_entry_size = sizeof(struct iseq_catch_table_entry),
|
|
265
|
+
catch_table_entries_max = (INT_MAX - offsetof(struct iseq_catch_table, entries)) / catch_table_entry_size
|
|
266
|
+
};
|
|
267
|
+
if (n > catch_table_entries_max) rb_fatal("too large iseq_catch_table - %d", n);
|
|
268
|
+
return (int)(offsetof(struct iseq_catch_table, entries) +
|
|
269
|
+
n * catch_table_entry_size);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
#define INITIAL_ISEQ_COMPILE_DATA_STORAGE_BUFF_SIZE (512)
|
|
273
|
+
|
|
274
|
+
struct iseq_compile_data_storage {
|
|
275
|
+
struct iseq_compile_data_storage *next;
|
|
276
|
+
unsigned int pos;
|
|
277
|
+
unsigned int size;
|
|
278
|
+
char buff[FLEX_ARY_LEN];
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
/* defined? */
|
|
282
|
+
|
|
283
|
+
enum defined_type {
|
|
284
|
+
DEFINED_NOT_DEFINED,
|
|
285
|
+
DEFINED_NIL = 1,
|
|
286
|
+
DEFINED_IVAR,
|
|
287
|
+
DEFINED_LVAR,
|
|
288
|
+
DEFINED_GVAR,
|
|
289
|
+
DEFINED_CVAR,
|
|
290
|
+
DEFINED_CONST,
|
|
291
|
+
DEFINED_METHOD,
|
|
292
|
+
DEFINED_YIELD,
|
|
293
|
+
DEFINED_ZSUPER,
|
|
294
|
+
DEFINED_SELF,
|
|
295
|
+
DEFINED_TRUE,
|
|
296
|
+
DEFINED_FALSE,
|
|
297
|
+
DEFINED_ASGN,
|
|
298
|
+
DEFINED_EXPR,
|
|
299
|
+
DEFINED_IVAR2,
|
|
300
|
+
DEFINED_REF,
|
|
301
|
+
DEFINED_FUNC,
|
|
302
|
+
DEFINED_CONST_FROM
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
VALUE rb_iseq_defined_string(enum defined_type type);
|
|
306
|
+
|
|
307
|
+
/* vm.c */
|
|
308
|
+
VALUE rb_iseq_local_variables(const rb_iseq_t *iseq);
|
|
309
|
+
|
|
310
|
+
RUBY_SYMBOL_EXPORT_END
|
|
311
|
+
|
|
312
|
+
#endif /* RUBY_ISEQ_H */
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/**********************************************************************
|
|
2
|
+
|
|
3
|
+
method.h -
|
|
4
|
+
|
|
5
|
+
$Author$
|
|
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
|
+
BITFIELD(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
|
+
VALUE refinements;
|
|
44
|
+
VALUE klass;
|
|
45
|
+
struct rb_cref_struct * 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
|
+
VALUE defined_class;
|
|
54
|
+
struct rb_method_definition_struct * const def;
|
|
55
|
+
ID called_id;
|
|
56
|
+
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
|
+
#define VM_METHOD_TYPE_MINIMUM_BITS 4
|
|
118
|
+
STATIC_ASSERT(VM_METHOD_TYPE_MINIMUM_BITS,
|
|
119
|
+
VM_METHOD_TYPE_REFINED <= (1<<VM_METHOD_TYPE_MINIMUM_BITS));
|
|
120
|
+
|
|
121
|
+
#ifndef rb_iseq_t
|
|
122
|
+
typedef struct rb_iseq_struct rb_iseq_t;
|
|
123
|
+
#define rb_iseq_t rb_iseq_t
|
|
124
|
+
#endif
|
|
125
|
+
|
|
126
|
+
typedef struct rb_method_iseq_struct {
|
|
127
|
+
rb_iseq_t * iseqptr; /*!< iseq pointer, should be separated from iseqval */
|
|
128
|
+
rb_cref_t * cref; /*!< class reference, should be marked */
|
|
129
|
+
} rb_method_iseq_t; /* check rb_add_method_iseq() when modify the fields */
|
|
130
|
+
|
|
131
|
+
typedef struct rb_method_cfunc_struct {
|
|
132
|
+
VALUE (*func)(ANYARGS);
|
|
133
|
+
VALUE (*invoker)(VALUE recv, int argc, const VALUE *argv, VALUE (*func)(ANYARGS));
|
|
134
|
+
int argc;
|
|
135
|
+
} rb_method_cfunc_t;
|
|
136
|
+
|
|
137
|
+
typedef struct rb_method_attr_struct {
|
|
138
|
+
ID id;
|
|
139
|
+
VALUE location; /* should be marked */
|
|
140
|
+
} rb_method_attr_t;
|
|
141
|
+
|
|
142
|
+
typedef struct rb_method_alias_struct {
|
|
143
|
+
struct rb_method_entry_struct * original_me; /* original_me->klass is original owner */
|
|
144
|
+
} rb_method_alias_t;
|
|
145
|
+
|
|
146
|
+
typedef struct rb_method_refined_struct {
|
|
147
|
+
struct rb_method_entry_struct * orig_me;
|
|
148
|
+
VALUE owner;
|
|
149
|
+
} rb_method_refined_t;
|
|
150
|
+
|
|
151
|
+
typedef struct rb_method_bmethod_struct {
|
|
152
|
+
VALUE proc; /* should be marked */
|
|
153
|
+
struct rb_hook_list_struct *hooks;
|
|
154
|
+
} rb_method_bmethod_t;
|
|
155
|
+
|
|
156
|
+
enum method_optimized_type {
|
|
157
|
+
OPTIMIZED_METHOD_TYPE_SEND,
|
|
158
|
+
OPTIMIZED_METHOD_TYPE_CALL,
|
|
159
|
+
OPTIMIZED_METHOD_TYPE_BLOCK_CALL,
|
|
160
|
+
OPTIMIZED_METHOD_TYPE__MAX
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
struct rb_method_definition_struct {
|
|
164
|
+
BITFIELD(rb_method_type_t, type, VM_METHOD_TYPE_MINIMUM_BITS);
|
|
165
|
+
int alias_count : 28;
|
|
166
|
+
int complemented_count : 28;
|
|
167
|
+
|
|
168
|
+
union {
|
|
169
|
+
rb_method_iseq_t iseq;
|
|
170
|
+
rb_method_cfunc_t cfunc;
|
|
171
|
+
rb_method_attr_t attr;
|
|
172
|
+
rb_method_alias_t alias;
|
|
173
|
+
rb_method_refined_t refined;
|
|
174
|
+
rb_method_bmethod_t bmethod;
|
|
175
|
+
|
|
176
|
+
enum method_optimized_type optimize_type;
|
|
177
|
+
} body;
|
|
178
|
+
|
|
179
|
+
ID original_id;
|
|
180
|
+
uintptr_t method_serial;
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
typedef struct rb_method_definition_struct rb_method_definition_t;
|
|
184
|
+
STATIC_ASSERT(sizeof_method_def, offsetof(rb_method_definition_t, body)==8);
|
|
185
|
+
|
|
186
|
+
#define UNDEFINED_METHOD_ENTRY_P(me) (!(me) || !(me)->def || (me)->def->type == VM_METHOD_TYPE_UNDEF)
|
|
187
|
+
#define UNDEFINED_REFINED_METHOD_P(def) \
|
|
188
|
+
((def)->type == VM_METHOD_TYPE_REFINED && \
|
|
189
|
+
UNDEFINED_METHOD_ENTRY_P((def)->body.refined.orig_me))
|
|
190
|
+
|
|
191
|
+
void rb_add_method_cfunc(VALUE klass, ID mid, VALUE (*func)(ANYARGS), int argc, rb_method_visibility_t visi);
|
|
192
|
+
void rb_add_method_iseq(VALUE klass, ID mid, const rb_iseq_t *iseq, rb_cref_t *cref, rb_method_visibility_t visi);
|
|
193
|
+
void rb_add_refined_method_entry(VALUE refined_class, ID mid);
|
|
194
|
+
void rb_add_method(VALUE klass, ID mid, rb_method_type_t type, void *option, rb_method_visibility_t visi);
|
|
195
|
+
|
|
196
|
+
rb_method_entry_t *rb_method_entry_set(VALUE klass, ID mid, const rb_method_entry_t *, rb_method_visibility_t noex);
|
|
197
|
+
rb_method_entry_t *rb_method_entry_create(ID called_id, VALUE klass, rb_method_visibility_t visi, const rb_method_definition_t *def);
|
|
198
|
+
|
|
199
|
+
const rb_method_entry_t *rb_method_entry_at(VALUE obj, ID id);
|
|
200
|
+
|
|
201
|
+
const rb_method_entry_t *rb_method_entry(VALUE klass, ID id);
|
|
202
|
+
const rb_method_entry_t *rb_method_entry_with_refinements(VALUE klass, ID id, VALUE *defined_class);
|
|
203
|
+
const rb_method_entry_t *rb_method_entry_without_refinements(VALUE klass, ID id, VALUE *defined_class);
|
|
204
|
+
const rb_method_entry_t *rb_resolve_refined_method(VALUE refinements, const rb_method_entry_t *me);
|
|
205
|
+
RUBY_SYMBOL_EXPORT_BEGIN
|
|
206
|
+
const rb_method_entry_t *rb_resolve_me_location(const rb_method_entry_t *, VALUE[5]);
|
|
207
|
+
RUBY_SYMBOL_EXPORT_END
|
|
208
|
+
|
|
209
|
+
const rb_callable_method_entry_t *rb_callable_method_entry(VALUE klass, ID id);
|
|
210
|
+
const rb_callable_method_entry_t *rb_callable_method_entry_with_refinements(VALUE klass, ID id, VALUE *defined_class);
|
|
211
|
+
const rb_callable_method_entry_t *rb_callable_method_entry_without_refinements(VALUE klass, ID id, VALUE *defined_class);
|
|
212
|
+
|
|
213
|
+
int rb_method_entry_arity(const rb_method_entry_t *me);
|
|
214
|
+
int rb_method_entry_eq(const rb_method_entry_t *m1, const rb_method_entry_t *m2);
|
|
215
|
+
st_index_t rb_hash_method_entry(st_index_t hash, const rb_method_entry_t *me);
|
|
216
|
+
|
|
217
|
+
VALUE rb_method_entry_location(const rb_method_entry_t *me);
|
|
218
|
+
|
|
219
|
+
void rb_free_method_entry(const rb_method_entry_t *me);
|
|
220
|
+
|
|
221
|
+
const rb_method_entry_t *rb_method_entry_clone(const rb_method_entry_t *me);
|
|
222
|
+
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);
|
|
223
|
+
void rb_method_entry_copy(rb_method_entry_t *dst, const rb_method_entry_t *src);
|
|
224
|
+
|
|
225
|
+
void rb_scope_visibility_set(rb_method_visibility_t);
|
|
226
|
+
|
|
227
|
+
VALUE rb_unnamed_parameters(int arity);
|
|
228
|
+
|
|
229
|
+
#endif /* RUBY_METHOD_H */
|