debase-ruby_core_source 3.2.0 → 3.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +10 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/addr2line.h +20 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/builtin.h +117 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/ccan/build_assert/build_assert.h +40 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/ccan/check_type/check_type.h +63 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/ccan/container_of/container_of.h +142 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/ccan/list/list.h +789 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/ccan/str/str.h +17 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/constant.h +53 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/darray.h +246 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/debug_counter.h +423 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/dln.h +31 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/encindex.h +70 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/eval_intern.h +341 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/hrtime.h +227 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/id.h +343 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/id_table.h +39 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/insns.inc +249 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/insns_info.inc +9133 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/array.h +144 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/basic_operators.h +63 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/bignum.h +244 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/bits.h +568 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/class.h +226 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/cmdlineopt.h +63 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/compar.h +29 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/compile.h +34 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/compilers.h +107 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/complex.h +29 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/cont.h +32 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/dir.h +16 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/enc.h +19 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/encoding.h +32 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/enum.h +18 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/enumerator.h +21 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/error.h +213 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/eval.h +32 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/file.h +38 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/fixnum.h +184 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/gc.h +361 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/hash.h +190 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/imemo.h +241 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/inits.h +50 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/io.h +137 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/load.h +18 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/loadpath.h +16 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/math.h +23 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/missing.h +18 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/numeric.h +273 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/object.h +59 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/parse.h +133 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/proc.h +30 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/process.h +124 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/ractor.h +6 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/random.h +16 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/range.h +40 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/rational.h +71 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/re.h +28 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/ruby_parser.h +69 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/sanitizers.h +186 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/serial.h +23 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/signal.h +25 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/static_assert.h +16 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/string.h +160 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/struct.h +127 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/symbol.h +42 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/thread.h +74 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/time.h +34 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/transcode.h +20 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/util.h +27 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/variable.h +71 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/vm.h +129 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/warnings.h +16 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal.h +112 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/iseq.h +334 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/known_errors.inc +791 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/method.h +254 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/node.h +125 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/node_name.inc +210 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/optinsn.inc +128 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/optunifs.inc +43 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/parse.h +232 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/parser_bits.h +564 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/parser_node.h +133 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/parser_st.h +162 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/parser_value.h +106 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/probes_helper.h +42 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/ractor_core.h +387 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/regenc.h +254 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/regint.h +996 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/regparse.h +370 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/revision.h +5 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/rjit.h +103 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/rjit_c.h +165 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/ruby_assert.h +14 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/ruby_atomic.h +23 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/rubyparser.h +628 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/shape.h +232 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/siphash.h +48 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/symbol.h +119 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/thread_none.h +20 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/thread_pthread.h +126 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/thread_win32.h +58 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/timev.h +58 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/transcode_data.h +138 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/variable.h +30 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/version.h +65 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/vm.inc +5396 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/vm_call_iseq_optimized.inc +244 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/vm_callinfo.h +608 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/vm_core.h +2089 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/vm_debug.h +122 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/vm_exec.h +199 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/vm_insnhelper.h +271 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/vm_opts.h +67 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/vm_sync.h +137 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/vmtc.inc +243 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/yjit.h +70 -0
- data/lib/debase/ruby_core_source/version.rb +1 -1
- metadata +120 -3
@@ -0,0 +1,241 @@
|
|
1
|
+
#ifndef INTERNAL_IMEMO_H /*-*-C-*-vi:se ft=c:*/
|
2
|
+
#define INTERNAL_IMEMO_H
|
3
|
+
/**
|
4
|
+
* @author Ruby developers <ruby-core@ruby-lang.org>
|
5
|
+
* @copyright This file is a part of the programming language Ruby.
|
6
|
+
* Permission is hereby granted, to either redistribute and/or
|
7
|
+
* modify this file, provided that the conditions mentioned in the
|
8
|
+
* file COPYING are met. Consult the file for details.
|
9
|
+
* @brief IMEMO: Internal memo object.
|
10
|
+
*/
|
11
|
+
#include "ruby/internal/config.h"
|
12
|
+
#include <stddef.h> /* for size_t */
|
13
|
+
#include "internal/array.h" /* for rb_ary_hidden_new_fill */
|
14
|
+
#include "ruby/internal/stdbool.h" /* for bool */
|
15
|
+
#include "ruby/ruby.h" /* for rb_block_call_func_t */
|
16
|
+
|
17
|
+
#ifndef IMEMO_DEBUG
|
18
|
+
# define IMEMO_DEBUG 0
|
19
|
+
#endif
|
20
|
+
|
21
|
+
#define IMEMO_MASK 0x0f
|
22
|
+
|
23
|
+
/* FL_USER0 to FL_USER3 is for type */
|
24
|
+
#define IMEMO_FL_USHIFT (FL_USHIFT + 4)
|
25
|
+
#define IMEMO_FL_USER0 FL_USER4
|
26
|
+
#define IMEMO_FL_USER1 FL_USER5
|
27
|
+
#define IMEMO_FL_USER2 FL_USER6
|
28
|
+
#define IMEMO_FL_USER3 FL_USER7
|
29
|
+
#define IMEMO_FL_USER4 FL_USER8
|
30
|
+
#define IMEMO_FL_USER5 FL_USER9
|
31
|
+
|
32
|
+
enum imemo_type {
|
33
|
+
imemo_env = 0,
|
34
|
+
imemo_cref = 1, /*!< class reference */
|
35
|
+
imemo_svar = 2, /*!< special variable */
|
36
|
+
imemo_throw_data = 3,
|
37
|
+
imemo_ifunc = 4, /*!< iterator function */
|
38
|
+
imemo_memo = 5,
|
39
|
+
imemo_ment = 6,
|
40
|
+
imemo_iseq = 7,
|
41
|
+
imemo_tmpbuf = 8,
|
42
|
+
imemo_ast = 9,
|
43
|
+
imemo_parser_strterm = 10,
|
44
|
+
imemo_callinfo = 11,
|
45
|
+
imemo_callcache = 12,
|
46
|
+
imemo_constcache = 13,
|
47
|
+
};
|
48
|
+
|
49
|
+
/* CREF (Class REFerence) is defined in method.h */
|
50
|
+
|
51
|
+
/*! SVAR (Special VARiable) */
|
52
|
+
struct vm_svar {
|
53
|
+
VALUE flags;
|
54
|
+
const VALUE cref_or_me; /*!< class reference or rb_method_entry_t */
|
55
|
+
const VALUE lastline;
|
56
|
+
const VALUE backref;
|
57
|
+
const VALUE others;
|
58
|
+
};
|
59
|
+
|
60
|
+
/*! THROW_DATA */
|
61
|
+
struct vm_throw_data {
|
62
|
+
VALUE flags;
|
63
|
+
VALUE reserved;
|
64
|
+
const VALUE throw_obj;
|
65
|
+
const struct rb_control_frame_struct *catch_frame;
|
66
|
+
int throw_state;
|
67
|
+
};
|
68
|
+
|
69
|
+
#define THROW_DATA_CONSUMED IMEMO_FL_USER0
|
70
|
+
|
71
|
+
/* IFUNC (Internal FUNCtion) */
|
72
|
+
|
73
|
+
struct vm_ifunc_argc {
|
74
|
+
#if SIZEOF_INT * 2 > SIZEOF_VALUE
|
75
|
+
signed int min: (SIZEOF_VALUE * CHAR_BIT) / 2;
|
76
|
+
signed int max: (SIZEOF_VALUE * CHAR_BIT) / 2;
|
77
|
+
#else
|
78
|
+
int min, max;
|
79
|
+
#endif
|
80
|
+
};
|
81
|
+
|
82
|
+
/*! IFUNC (Internal FUNCtion) */
|
83
|
+
struct vm_ifunc {
|
84
|
+
VALUE flags;
|
85
|
+
VALUE *svar_lep;
|
86
|
+
rb_block_call_func_t func;
|
87
|
+
const void *data;
|
88
|
+
struct vm_ifunc_argc argc;
|
89
|
+
};
|
90
|
+
|
91
|
+
struct rb_imemo_tmpbuf_struct {
|
92
|
+
VALUE flags;
|
93
|
+
VALUE reserved;
|
94
|
+
VALUE *ptr; /* malloc'ed buffer */
|
95
|
+
struct rb_imemo_tmpbuf_struct *next; /* next imemo */
|
96
|
+
size_t cnt; /* buffer size in VALUE */
|
97
|
+
};
|
98
|
+
|
99
|
+
/*! MEMO
|
100
|
+
*
|
101
|
+
* @see imemo_type
|
102
|
+
* */
|
103
|
+
struct MEMO {
|
104
|
+
VALUE flags;
|
105
|
+
VALUE reserved;
|
106
|
+
const VALUE v1;
|
107
|
+
const VALUE v2;
|
108
|
+
union {
|
109
|
+
long cnt;
|
110
|
+
long state;
|
111
|
+
const VALUE value;
|
112
|
+
void (*func)(void);
|
113
|
+
} u3;
|
114
|
+
};
|
115
|
+
|
116
|
+
/* ment is in method.h */
|
117
|
+
|
118
|
+
#define THROW_DATA_P(err) imemo_throw_data_p((VALUE)err)
|
119
|
+
#define MEMO_CAST(m) ((struct MEMO *)(m))
|
120
|
+
#define MEMO_NEW(a, b, c) ((struct MEMO *)rb_imemo_new(imemo_memo, (VALUE)(a), (VALUE)(b), (VALUE)(c), 0))
|
121
|
+
#define MEMO_FOR(type, value) ((type *)RARRAY_PTR(value))
|
122
|
+
#define NEW_MEMO_FOR(type, value) \
|
123
|
+
((value) = rb_ary_hidden_new_fill(type_roomof(type, VALUE)), MEMO_FOR(type, value))
|
124
|
+
#define NEW_PARTIAL_MEMO_FOR(type, value, member) \
|
125
|
+
((value) = rb_ary_hidden_new_fill(type_roomof(type, VALUE)), \
|
126
|
+
rb_ary_set_len((value), offsetof(type, member) / sizeof(VALUE)), \
|
127
|
+
MEMO_FOR(type, value))
|
128
|
+
|
129
|
+
typedef struct rb_imemo_tmpbuf_struct rb_imemo_tmpbuf_t;
|
130
|
+
rb_imemo_tmpbuf_t *rb_imemo_tmpbuf_parser_heap(void *buf, rb_imemo_tmpbuf_t *old_heap, size_t cnt);
|
131
|
+
struct vm_ifunc *rb_vm_ifunc_new(rb_block_call_func_t func, const void *data, int min_argc, int max_argc);
|
132
|
+
void rb_strterm_mark(VALUE obj);
|
133
|
+
static inline enum imemo_type imemo_type(VALUE imemo);
|
134
|
+
static inline int imemo_type_p(VALUE imemo, enum imemo_type imemo_type);
|
135
|
+
static inline bool imemo_throw_data_p(VALUE imemo);
|
136
|
+
static inline struct vm_ifunc *rb_vm_ifunc_proc_new(rb_block_call_func_t func, const void *data);
|
137
|
+
static inline VALUE rb_imemo_tmpbuf_auto_free_pointer(void);
|
138
|
+
static inline void *RB_IMEMO_TMPBUF_PTR(VALUE v);
|
139
|
+
static inline void *rb_imemo_tmpbuf_set_ptr(VALUE v, void *ptr);
|
140
|
+
static inline VALUE rb_imemo_tmpbuf_auto_free_pointer_new_from_an_RString(VALUE str);
|
141
|
+
static inline void MEMO_V1_SET(struct MEMO *m, VALUE v);
|
142
|
+
static inline void MEMO_V2_SET(struct MEMO *m, VALUE v);
|
143
|
+
|
144
|
+
RUBY_SYMBOL_EXPORT_BEGIN
|
145
|
+
#if IMEMO_DEBUG
|
146
|
+
VALUE rb_imemo_new_debug(enum imemo_type type, VALUE v1, VALUE v2, VALUE v3, VALUE v0, const char *file, int line);
|
147
|
+
#define rb_imemo_new(type, v1, v2, v3, v0) rb_imemo_new_debug(type, v1, v2, v3, v0, __FILE__, __LINE__)
|
148
|
+
#else
|
149
|
+
VALUE rb_imemo_new(enum imemo_type type, VALUE v1, VALUE v2, VALUE v3, VALUE v0);
|
150
|
+
#endif
|
151
|
+
const char *rb_imemo_name(enum imemo_type type);
|
152
|
+
RUBY_SYMBOL_EXPORT_END
|
153
|
+
|
154
|
+
static inline enum imemo_type
|
155
|
+
imemo_type(VALUE imemo)
|
156
|
+
{
|
157
|
+
return (RBASIC(imemo)->flags >> FL_USHIFT) & IMEMO_MASK;
|
158
|
+
}
|
159
|
+
|
160
|
+
static inline int
|
161
|
+
imemo_type_p(VALUE imemo, enum imemo_type imemo_type)
|
162
|
+
{
|
163
|
+
if (LIKELY(!RB_SPECIAL_CONST_P(imemo))) {
|
164
|
+
/* fixed at compile time if imemo_type is given. */
|
165
|
+
const VALUE mask = (IMEMO_MASK << FL_USHIFT) | RUBY_T_MASK;
|
166
|
+
const VALUE expected_type = (imemo_type << FL_USHIFT) | T_IMEMO;
|
167
|
+
/* fixed at runtime. */
|
168
|
+
return expected_type == (RBASIC(imemo)->flags & mask);
|
169
|
+
}
|
170
|
+
else {
|
171
|
+
return 0;
|
172
|
+
}
|
173
|
+
}
|
174
|
+
|
175
|
+
#define IMEMO_TYPE_P(v, t) imemo_type_p((VALUE)v, t)
|
176
|
+
|
177
|
+
static inline bool
|
178
|
+
imemo_throw_data_p(VALUE imemo)
|
179
|
+
{
|
180
|
+
return RB_TYPE_P(imemo, T_IMEMO);
|
181
|
+
}
|
182
|
+
|
183
|
+
static inline struct vm_ifunc *
|
184
|
+
rb_vm_ifunc_proc_new(rb_block_call_func_t func, const void *data)
|
185
|
+
{
|
186
|
+
return rb_vm_ifunc_new(func, data, 0, UNLIMITED_ARGUMENTS);
|
187
|
+
}
|
188
|
+
|
189
|
+
static inline VALUE
|
190
|
+
rb_imemo_tmpbuf_auto_free_pointer(void)
|
191
|
+
{
|
192
|
+
return rb_imemo_new(imemo_tmpbuf, 0, 0, 0, 0);
|
193
|
+
}
|
194
|
+
|
195
|
+
static inline void *
|
196
|
+
RB_IMEMO_TMPBUF_PTR(VALUE v)
|
197
|
+
{
|
198
|
+
const struct rb_imemo_tmpbuf_struct *p = (const void *)v;
|
199
|
+
return p->ptr;
|
200
|
+
}
|
201
|
+
|
202
|
+
static inline void *
|
203
|
+
rb_imemo_tmpbuf_set_ptr(VALUE v, void *ptr)
|
204
|
+
{
|
205
|
+
return ((rb_imemo_tmpbuf_t *)v)->ptr = ptr;
|
206
|
+
}
|
207
|
+
|
208
|
+
static inline VALUE
|
209
|
+
rb_imemo_tmpbuf_auto_free_pointer_new_from_an_RString(VALUE str)
|
210
|
+
{
|
211
|
+
const void *src;
|
212
|
+
VALUE imemo;
|
213
|
+
rb_imemo_tmpbuf_t *tmpbuf;
|
214
|
+
void *dst;
|
215
|
+
size_t len;
|
216
|
+
|
217
|
+
SafeStringValue(str);
|
218
|
+
/* create tmpbuf to keep the pointer before xmalloc */
|
219
|
+
imemo = rb_imemo_tmpbuf_auto_free_pointer();
|
220
|
+
tmpbuf = (rb_imemo_tmpbuf_t *)imemo;
|
221
|
+
len = RSTRING_LEN(str);
|
222
|
+
src = RSTRING_PTR(str);
|
223
|
+
dst = ruby_xmalloc(len);
|
224
|
+
memcpy(dst, src, len);
|
225
|
+
tmpbuf->ptr = dst;
|
226
|
+
return imemo;
|
227
|
+
}
|
228
|
+
|
229
|
+
static inline void
|
230
|
+
MEMO_V1_SET(struct MEMO *m, VALUE v)
|
231
|
+
{
|
232
|
+
RB_OBJ_WRITE(m, &m->v1, v);
|
233
|
+
}
|
234
|
+
|
235
|
+
static inline void
|
236
|
+
MEMO_V2_SET(struct MEMO *m, VALUE v)
|
237
|
+
{
|
238
|
+
RB_OBJ_WRITE(m, &m->v2, v);
|
239
|
+
}
|
240
|
+
|
241
|
+
#endif /* INTERNAL_IMEMO_H */
|
@@ -0,0 +1,50 @@
|
|
1
|
+
#ifndef INTERNAL_INITS_H /*-*-C-*-vi:se ft=c:*/
|
2
|
+
#define INTERNAL_INITS_H
|
3
|
+
/**
|
4
|
+
* @author Ruby developers <ruby-core@ruby-lang.org>
|
5
|
+
* @copyright This file is a part of the programming language Ruby.
|
6
|
+
* Permission is hereby granted, to either redistribute and/or
|
7
|
+
* modify this file, provided that the conditions mentioned in the
|
8
|
+
* file COPYING are met. Consult the file for details.
|
9
|
+
* @brief Internal header aggregating init functions.
|
10
|
+
*/
|
11
|
+
|
12
|
+
/* class.c */
|
13
|
+
void Init_class_hierarchy(void);
|
14
|
+
|
15
|
+
/* dmyext.c */
|
16
|
+
void Init_enc(void);
|
17
|
+
void Init_ext(void);
|
18
|
+
|
19
|
+
/* file.c */
|
20
|
+
void Init_File(void);
|
21
|
+
|
22
|
+
/* gc.c */
|
23
|
+
void Init_heap(void);
|
24
|
+
|
25
|
+
/* localeinit.c */
|
26
|
+
int Init_enc_set_filesystem_encoding(void);
|
27
|
+
|
28
|
+
/* newline.c */
|
29
|
+
void Init_newline(void);
|
30
|
+
|
31
|
+
/* vm.c */
|
32
|
+
void Init_BareVM(void);
|
33
|
+
void Init_vm_objects(void);
|
34
|
+
|
35
|
+
/* vm_backtrace.c */
|
36
|
+
void Init_vm_backtrace(void);
|
37
|
+
|
38
|
+
/* vm_eval.c */
|
39
|
+
void Init_vm_eval(void);
|
40
|
+
|
41
|
+
/* vm_insnhelper.c */
|
42
|
+
void Init_vm_stack_canary(void);
|
43
|
+
|
44
|
+
/* vm_method.c */
|
45
|
+
void Init_eval_method(void);
|
46
|
+
|
47
|
+
/* inits.c */
|
48
|
+
void rb_call_inits(void);
|
49
|
+
|
50
|
+
#endif /* INTERNAL_INITS_H */
|
@@ -0,0 +1,137 @@
|
|
1
|
+
#ifndef INTERNAL_IO_H /*-*-C-*-vi:se ft=c:*/
|
2
|
+
#define INTERNAL_IO_H
|
3
|
+
/**
|
4
|
+
* @author Ruby developers <ruby-core@ruby-lang.org>
|
5
|
+
* @copyright This file is a part of the programming language Ruby.
|
6
|
+
* Permission is hereby granted, to either redistribute and/or
|
7
|
+
* modify this file, provided that the conditions mentioned in the
|
8
|
+
* file COPYING are met. Consult the file for details.
|
9
|
+
* @brief Internal header for IO.
|
10
|
+
*/
|
11
|
+
#include "ruby/ruby.h" /* for VALUE */
|
12
|
+
|
13
|
+
#define HAVE_RB_IO_T
|
14
|
+
struct rb_io;
|
15
|
+
|
16
|
+
#include "ruby/io.h" /* for rb_io_t */
|
17
|
+
|
18
|
+
/** Ruby's IO, metadata and buffers. */
|
19
|
+
struct rb_io {
|
20
|
+
|
21
|
+
/** The IO's Ruby level counterpart. */
|
22
|
+
VALUE self;
|
23
|
+
|
24
|
+
/** stdio ptr for read/write, if available. */
|
25
|
+
FILE *stdio_file;
|
26
|
+
|
27
|
+
/** file descriptor. */
|
28
|
+
int fd;
|
29
|
+
|
30
|
+
/** mode flags: FMODE_XXXs */
|
31
|
+
int mode;
|
32
|
+
|
33
|
+
/** child's pid (for pipes) */
|
34
|
+
rb_pid_t pid;
|
35
|
+
|
36
|
+
/** number of lines read */
|
37
|
+
int lineno;
|
38
|
+
|
39
|
+
/** pathname for file */
|
40
|
+
VALUE pathv;
|
41
|
+
|
42
|
+
/** finalize proc */
|
43
|
+
void (*finalize)(struct rb_io*,int);
|
44
|
+
|
45
|
+
/** Write buffer. */
|
46
|
+
rb_io_buffer_t wbuf;
|
47
|
+
|
48
|
+
/**
|
49
|
+
* (Byte) read buffer. Note also that there is a field called
|
50
|
+
* ::rb_io_t::cbuf, which also concerns read IO.
|
51
|
+
*/
|
52
|
+
rb_io_buffer_t rbuf;
|
53
|
+
|
54
|
+
/**
|
55
|
+
* Duplex IO object, if set.
|
56
|
+
*
|
57
|
+
* @see rb_io_set_write_io()
|
58
|
+
*/
|
59
|
+
VALUE tied_io_for_writing;
|
60
|
+
|
61
|
+
struct rb_io_encoding encs; /**< Decomposed encoding flags. */
|
62
|
+
|
63
|
+
/** Encoding converter used when reading from this IO. */
|
64
|
+
rb_econv_t *readconv;
|
65
|
+
|
66
|
+
/**
|
67
|
+
* rb_io_ungetc() destination. This buffer is read before checking
|
68
|
+
* ::rb_io_t::rbuf
|
69
|
+
*/
|
70
|
+
rb_io_buffer_t cbuf;
|
71
|
+
|
72
|
+
/** Encoding converter used when writing to this IO. */
|
73
|
+
rb_econv_t *writeconv;
|
74
|
+
|
75
|
+
/**
|
76
|
+
* This is, when set, an instance of ::rb_cString which holds the "common"
|
77
|
+
* encoding. Write conversion can convert strings twice... In case
|
78
|
+
* conversion from encoding X to encoding Y does not exist, Ruby finds an
|
79
|
+
* encoding Z that bridges the two, so that X to Z to Y conversion happens.
|
80
|
+
*/
|
81
|
+
VALUE writeconv_asciicompat;
|
82
|
+
|
83
|
+
/** Whether ::rb_io_t::writeconv is already set up. */
|
84
|
+
int writeconv_initialized;
|
85
|
+
|
86
|
+
/**
|
87
|
+
* Value of ::rb_io_t::rb_io_enc_t::ecflags stored right before
|
88
|
+
* initialising ::rb_io_t::writeconv.
|
89
|
+
*/
|
90
|
+
int writeconv_pre_ecflags;
|
91
|
+
|
92
|
+
/**
|
93
|
+
* Value of ::rb_io_t::rb_io_enc_t::ecopts stored right before initialising
|
94
|
+
* ::rb_io_t::writeconv.
|
95
|
+
*/
|
96
|
+
VALUE writeconv_pre_ecopts;
|
97
|
+
|
98
|
+
/**
|
99
|
+
* This is a Ruby level mutex. It avoids multiple threads to write to an
|
100
|
+
* IO at once; helps for instance rb_io_puts() to ensure newlines right
|
101
|
+
* next to its arguments.
|
102
|
+
*
|
103
|
+
* This of course doesn't help inter-process IO interleaves, though.
|
104
|
+
*/
|
105
|
+
VALUE write_lock;
|
106
|
+
|
107
|
+
/**
|
108
|
+
* The timeout associated with this IO when performing blocking operations.
|
109
|
+
*/
|
110
|
+
VALUE timeout;
|
111
|
+
};
|
112
|
+
|
113
|
+
/* io.c */
|
114
|
+
void ruby_set_inplace_mode(const char *);
|
115
|
+
void rb_stdio_set_default_encoding(void);
|
116
|
+
VALUE rb_io_flush_raw(VALUE, int);
|
117
|
+
size_t rb_io_memsize(const rb_io_t *);
|
118
|
+
int rb_stderr_tty_p(void);
|
119
|
+
void rb_io_fptr_finalize_internal(void *ptr);
|
120
|
+
#ifdef rb_io_fptr_finalize
|
121
|
+
# undef rb_io_fptr_finalize
|
122
|
+
#endif
|
123
|
+
#define rb_io_fptr_finalize rb_io_fptr_finalize_internal
|
124
|
+
VALUE rb_io_popen(VALUE pname, VALUE pmode, VALUE env, VALUE opt);
|
125
|
+
|
126
|
+
VALUE rb_io_prep_stdin(void);
|
127
|
+
VALUE rb_io_prep_stdout(void);
|
128
|
+
VALUE rb_io_prep_stderr(void);
|
129
|
+
|
130
|
+
RUBY_SYMBOL_EXPORT_BEGIN
|
131
|
+
/* io.c (export) */
|
132
|
+
void rb_maygvl_fd_fix_cloexec(int fd);
|
133
|
+
int rb_gc_for_fd(int err);
|
134
|
+
void rb_write_error_str(VALUE mesg);
|
135
|
+
RUBY_SYMBOL_EXPORT_END
|
136
|
+
|
137
|
+
#endif /* INTERNAL_IO_H */
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#ifndef INTERNAL_LOAD_H /*-*-C-*-vi:se ft=c:*/
|
2
|
+
#define INTERNAL_LOAD_H
|
3
|
+
/**
|
4
|
+
* @author Ruby developers <ruby-core@ruby-lang.org>
|
5
|
+
* @copyright This file is a part of the programming language Ruby.
|
6
|
+
* Permission is hereby granted, to either redistribute and/or
|
7
|
+
* modify this file, provided that the conditions mentioned in the
|
8
|
+
* file COPYING are met. Consult the file for details.
|
9
|
+
* @brief Internal header for require.
|
10
|
+
*/
|
11
|
+
#include "ruby/ruby.h" /* for VALUE */
|
12
|
+
|
13
|
+
/* load.c */
|
14
|
+
VALUE rb_get_expanded_load_path(void);
|
15
|
+
int rb_require_internal(VALUE fname);
|
16
|
+
NORETURN(void rb_load_fail(VALUE, const char*));
|
17
|
+
|
18
|
+
#endif /* INTERNAL_LOAD_H */
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#ifndef INTERNAL_LOADPATH_H /*-*-C-*-vi:se ft=c:*/
|
2
|
+
#define INTERNAL_LOADPATH_H
|
3
|
+
/**
|
4
|
+
* @author Ruby developers <ruby-core@ruby-lang.org>
|
5
|
+
* @copyright This file is a part of the programming language Ruby.
|
6
|
+
* Permission is hereby granted, to either redistribute and/or
|
7
|
+
* modify this file, provided that the conditions mentioned in the
|
8
|
+
* file COPYING are met. Consult the file for details.
|
9
|
+
* @brief Internal header for $LOAD_PATH.
|
10
|
+
*/
|
11
|
+
|
12
|
+
/* loadpath.c */
|
13
|
+
extern const char ruby_exec_prefix[];
|
14
|
+
extern const char ruby_initial_load_paths[];
|
15
|
+
|
16
|
+
#endif /* INTERNAL_LOADPATH_H */
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#ifndef INTERNAL_MATH_H /*-*-C-*-vi:se ft=c:*/
|
2
|
+
#define INTERNAL_MATH_H
|
3
|
+
/**
|
4
|
+
* @author Ruby developers <ruby-core@ruby-lang.org>
|
5
|
+
* @copyright This file is a part of the programming language Ruby.
|
6
|
+
* Permission is hereby granted, to either redistribute and/or
|
7
|
+
* modify this file, provided that the conditions mentioned in the
|
8
|
+
* file COPYING are met. Consult the file for details.
|
9
|
+
* @brief Internal header for Math.
|
10
|
+
*/
|
11
|
+
#include "ruby/ruby.h" /* for VALUE */
|
12
|
+
|
13
|
+
/* math.c */
|
14
|
+
VALUE rb_math_atan2(VALUE, VALUE);
|
15
|
+
VALUE rb_math_cos(VALUE);
|
16
|
+
VALUE rb_math_cosh(VALUE);
|
17
|
+
VALUE rb_math_exp(VALUE);
|
18
|
+
VALUE rb_math_hypot(VALUE, VALUE);
|
19
|
+
VALUE rb_math_log(int argc, const VALUE *argv);
|
20
|
+
VALUE rb_math_sin(VALUE);
|
21
|
+
VALUE rb_math_sinh(VALUE);
|
22
|
+
|
23
|
+
#endif /* INTERNAL_MATH_H */
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#ifndef INTERNAL_MISSING_H /*-*-C-*-vi:se ft=c:*/
|
2
|
+
#define INTERNAL_MISSING_H
|
3
|
+
/**
|
4
|
+
* @author Ruby developers <ruby-core@ruby-lang.org>
|
5
|
+
* @copyright This file is a part of the programming language Ruby.
|
6
|
+
* Permission is hereby granted, to either redistribute and/or
|
7
|
+
* modify this file, provided that the conditions mentioned in the
|
8
|
+
* file COPYING are met. Consult the file for details.
|
9
|
+
* @brief Internal header corresponding missing.
|
10
|
+
*/
|
11
|
+
#include "ruby/internal/config.h" /* for HAVE_SETPROCTITLE */
|
12
|
+
|
13
|
+
/* missing/setproctitle.c */
|
14
|
+
#ifndef HAVE_SETPROCTITLE
|
15
|
+
extern void ruby_init_setproctitle(int argc, char *argv[]);
|
16
|
+
#endif
|
17
|
+
|
18
|
+
#endif /* INTERNAL_MISSING_H */
|