Skip to content

Commit fed4608

Browse files
committed
Import files from MRI 3.0.3
1 parent 9e904e7 commit fed4608

File tree

578 files changed

+11639
-6738
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

578 files changed

+11639
-6738
lines changed

lib/cext/include/internal/imemo.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -137,17 +137,9 @@ static inline enum imemo_type imemo_type(VALUE imemo);
137137
static inline int imemo_type_p(VALUE imemo, enum imemo_type imemo_type);
138138
static inline bool imemo_throw_data_p(VALUE imemo);
139139
static inline struct vm_ifunc *rb_vm_ifunc_proc_new(rb_block_call_func_t func, const void *data);
140-
#ifdef TRUFFLERUBY
141-
VALUE rb_imemo_tmpbuf_auto_free_pointer(void);
142-
#else
143140
static inline VALUE rb_imemo_tmpbuf_auto_free_pointer(void);
144-
#endif
145141
static inline void *RB_IMEMO_TMPBUF_PTR(VALUE v);
146-
#ifdef TRUFFLERUBY
147-
void *rb_imemo_tmpbuf_set_ptr(VALUE v, void *ptr);
148-
#else
149142
static inline void *rb_imemo_tmpbuf_set_ptr(VALUE v, void *ptr);
150-
#endif
151143
static inline VALUE rb_imemo_tmpbuf_auto_free_pointer_new_from_an_RString(VALUE str);
152144
static inline void MEMO_V1_SET(struct MEMO *m, VALUE v);
153145
static inline void MEMO_V2_SET(struct MEMO *m, VALUE v);
@@ -197,13 +189,11 @@ rb_vm_ifunc_proc_new(rb_block_call_func_t func, const void *data)
197189
return rb_vm_ifunc_new(func, data, 0, UNLIMITED_ARGUMENTS);
198190
}
199191

200-
#ifndef TRUFFLERUBY
201192
static inline VALUE
202193
rb_imemo_tmpbuf_auto_free_pointer(void)
203194
{
204195
return rb_imemo_new(imemo_tmpbuf, 0, 0, 0, 0);
205196
}
206-
#endif
207197

208198
static inline void *
209199
RB_IMEMO_TMPBUF_PTR(VALUE v)
@@ -212,13 +202,11 @@ RB_IMEMO_TMPBUF_PTR(VALUE v)
212202
return p->ptr;
213203
}
214204

215-
#ifndef TRUFFLERUBY
216205
static inline void *
217206
rb_imemo_tmpbuf_set_ptr(VALUE v, void *ptr)
218207
{
219208
return ((rb_imemo_tmpbuf_t *)v)->ptr = ptr;
220209
}
221-
#endif
222210

223211
static inline VALUE
224212
rb_imemo_tmpbuf_auto_free_pointer_new_from_an_RString(VALUE str)

lib/cext/include/ruby/encoding.h

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,18 @@ enum ruby_encoding_consts {
3030
#define ENCODING_SHIFT RUBY_ENCODING_SHIFT
3131
#define ENCODING_MASK RUBY_ENCODING_MASK
3232

33-
#ifdef TRUFFLERUBY
34-
#define RB_ENCODING_SET_INLINED(obj,i) RB_ENCODING_SET(obj,i)
35-
#else
3633
#define RB_ENCODING_SET_INLINED(obj,i) do {\
3734
RBASIC(obj)->flags &= ~RUBY_ENCODING_MASK;\
3835
RBASIC(obj)->flags |= (VALUE)(i) << RUBY_ENCODING_SHIFT;\
3936
} while (0)
40-
#endif
4137
#define RB_ENCODING_SET(obj,i) rb_enc_set_index((obj), (i))
4238

43-
#ifdef TRUFFLERUBY
44-
#define RB_ENCODING_GET_INLINED(obj) RB_ENCODING_GET(obj)
45-
#define RB_ENCODING_GET(obj) rb_enc_get_index(obj)
46-
#else
4739
#define RB_ENCODING_GET_INLINED(obj) \
4840
(int)((RBASIC(obj)->flags & RUBY_ENCODING_MASK)>>RUBY_ENCODING_SHIFT)
4941
#define RB_ENCODING_GET(obj) \
5042
(RB_ENCODING_GET_INLINED(obj) != RUBY_ENCODING_INLINE_MAX ? \
5143
RB_ENCODING_GET_INLINED(obj) : \
5244
rb_enc_get_index(obj))
53-
#endif
5445

5546
#define RB_ENCODING_IS_ASCII8BIT(obj) (RB_ENCODING_GET_INLINED(obj) == 0)
5647

@@ -63,18 +54,12 @@ enum ruby_encoding_consts {
6354

6455
enum ruby_coderange_type {
6556
RUBY_ENC_CODERANGE_UNKNOWN = 0,
66-
#ifdef TRUFFLERUBY
67-
RUBY_ENC_CODERANGE_7BIT = 1,
68-
RUBY_ENC_CODERANGE_VALID = 2,
69-
RUBY_ENC_CODERANGE_BROKEN = 4
70-
#else
7157
RUBY_ENC_CODERANGE_7BIT = ((int)RUBY_FL_USER8),
7258
RUBY_ENC_CODERANGE_VALID = ((int)RUBY_FL_USER9),
7359
RUBY_ENC_CODERANGE_BROKEN = ((int)(RUBY_FL_USER8|RUBY_FL_USER9)),
7460
RUBY_ENC_CODERANGE_MASK = (RUBY_ENC_CODERANGE_7BIT|
7561
RUBY_ENC_CODERANGE_VALID|
7662
RUBY_ENC_CODERANGE_BROKEN)
77-
#endif
7863
};
7964

8065
static inline int
@@ -83,23 +68,12 @@ rb_enc_coderange_clean_p(int cr)
8368
return (cr ^ (cr >> 1)) & RUBY_ENC_CODERANGE_7BIT;
8469
}
8570
#define RB_ENC_CODERANGE_CLEAN_P(cr) rb_enc_coderange_clean_p(cr)
86-
#ifdef TRUFFLERUBY
87-
enum ruby_coderange_type RB_ENC_CODERANGE(VALUE obj);
88-
#else
8971
#define RB_ENC_CODERANGE(obj) ((int)RBASIC(obj)->flags & RUBY_ENC_CODERANGE_MASK)
90-
#endif
9172
#define RB_ENC_CODERANGE_ASCIIONLY(obj) (RB_ENC_CODERANGE(obj) == RUBY_ENC_CODERANGE_7BIT)
92-
93-
#ifdef TRUFFLERUBY
94-
void RB_ENC_CODERANGE_SET(VALUE obj, int cr);
95-
void rb_enc_coderange_clear(VALUE);
96-
#define RB_ENC_CODERANGE_CLEAR(obj) rb_enc_coderange_clear(obj)
97-
#else
9873
#define RB_ENC_CODERANGE_SET(obj,cr) (\
9974
RBASIC(obj)->flags = \
10075
(RBASIC(obj)->flags & ~RUBY_ENC_CODERANGE_MASK) | (cr))
10176
#define RB_ENC_CODERANGE_CLEAR(obj) RB_ENC_CODERANGE_SET((obj),0)
102-
#endif
10377

10478
/* assumed ASCII compatibility */
10579
#define RB_ENC_CODERANGE_AND(a, b) \
@@ -164,9 +138,6 @@ VALUE rb_obj_encoding(VALUE);
164138
VALUE rb_enc_str_buf_cat(VALUE str, const char *ptr, long len, rb_encoding *enc);
165139
VALUE rb_enc_uint_chr(unsigned int code, rb_encoding *enc);
166140

167-
VALUE rb_external_str_with_enc(VALUE string, rb_encoding *eenc);
168-
rb_encoding *get_encoding(VALUE string);
169-
#define STR_ENC_GET(string) get_encoding(string)
170141
VALUE rb_external_str_new_with_enc(const char *ptr, long len, rb_encoding *);
171142
VALUE rb_str_export_to_enc(VALUE, rb_encoding *);
172143
VALUE rb_str_conv_enc(VALUE str, rb_encoding *from, rb_encoding *to);
@@ -197,13 +168,8 @@ rb_encoding *rb_enc_find(const char *name);
197168
#define rb_enc_name(enc) (enc)->name
198169

199170
/* rb_encoding * -> minlen/maxlen */
200-
#ifdef TRUFFLERUBY
201-
int rb_enc_mbminlen(rb_encoding *enc);
202-
int rb_enc_mbmaxlen(rb_encoding *enc);
203-
#else
204171
#define rb_enc_mbminlen(enc) (enc)->min_enc_len
205172
#define rb_enc_mbmaxlen(enc) (enc)->max_enc_len
206-
#endif
207173

208174
/* -> mbclen (no error notification: 0 < ret <= e-p, no exception) */
209175
int rb_enc_mbclen(const char *p, const char *e, rb_encoding *enc);
@@ -230,12 +196,7 @@ unsigned int rb_enc_codepoint_len(const char *p, const char *e, int *len, rb_enc
230196
unsigned int rb_enc_codepoint(const char *p, const char *e, rb_encoding *enc);
231197
/* overriding macro */
232198
#define rb_enc_codepoint(p,e,enc) rb_enc_codepoint_len((p),(e),0,(enc))
233-
#ifdef TRUFFLERUBY
234-
int rb_enc_mbc_to_codepoint(char *p, char *e, rb_encoding *enc);
235-
#define rb_enc_mbc_to_codepoint(p, e, enc) rb_enc_mbc_to_codepoint(p, e, enc)
236-
#else
237199
#define rb_enc_mbc_to_codepoint(p, e, enc) ONIGENC_MBC_TO_CODE((enc),(UChar*)(p),(UChar*)(e))
238-
#endif
239200

240201
/* -> codelen>0 or raise exception */
241202
int rb_enc_codelen(int code, rb_encoding *enc);
@@ -249,11 +210,7 @@ int rb_enc_code_to_mbclen(int code, rb_encoding *enc);
249210
/* start, ptr, end, encoding -> prev_char */
250211
#define rb_enc_prev_char(s,p,e,enc) ((char *)onigenc_get_prev_char_head((enc),(UChar*)(s),(UChar*)(p),(UChar*)(e)))
251212
/* start, ptr, end, encoding -> next_char */
252-
#ifdef TRUFFLERUBY
253-
char* rb_enc_left_char_head(char *start, char *p, char *end, rb_encoding *enc);
254-
#else
255213
#define rb_enc_left_char_head(s,p,e,enc) ((char *)onigenc_get_left_adjust_char_head((enc),(UChar*)(s),(UChar*)(p),(UChar*)(e)))
256-
#endif
257214
#define rb_enc_right_char_head(s,p,e,enc) ((char *)onigenc_get_right_adjust_char_head((enc),(UChar*)(s),(UChar*)(p),(UChar*)(e)))
258215
#define rb_enc_step_back(s,p,e,n,enc) ((char *)onigenc_step_back((enc),(UChar*)(s),(UChar*)(p),(UChar*)(e),(int)(n)))
259216

@@ -266,31 +223,17 @@ char* rb_enc_left_char_head(char *start, char *p, char *end, rb_encoding *enc);
266223
#define rb_enc_islower(c,enc) ONIGENC_IS_CODE_LOWER((enc),(c))
267224
#define rb_enc_isupper(c,enc) ONIGENC_IS_CODE_UPPER((enc),(c))
268225
#define rb_enc_ispunct(c,enc) ONIGENC_IS_CODE_PUNCT((enc),(c))
269-
#ifdef TRUFFLERUBY
270-
int rb_enc_isalnum(unsigned char c, rb_encoding *enc);
271-
#define rb_enc_isalnum(c,enc) rb_enc_isalnum(c,enc)
272-
#else
273226
#define rb_enc_isalnum(c,enc) ONIGENC_IS_CODE_ALNUM((enc),(c))
274-
#endif
275227
#define rb_enc_isprint(c,enc) ONIGENC_IS_CODE_PRINT((enc),(c))
276-
#ifdef TRUFFLERUBY
277-
int rb_enc_isspace(unsigned char c, rb_encoding *enc);
278-
#define rb_enc_isspace(c,enc) rb_enc_isspace(c,enc)
279-
#else
280228
#define rb_enc_isspace(c,enc) ONIGENC_IS_CODE_SPACE((enc),(c))
281-
#endif
282229
#define rb_enc_isdigit(c,enc) ONIGENC_IS_CODE_DIGIT((enc),(c))
283230

284-
#ifdef TRUFFLERUBY
285-
int rb_enc_asciicompat(rb_encoding *enc);
286-
#else
287231
static inline int
288232
rb_enc_asciicompat_inline(rb_encoding *enc)
289233
{
290234
return rb_enc_mbminlen(enc)==1 && !rb_enc_dummy_p(enc);
291235
}
292236
#define rb_enc_asciicompat(enc) rb_enc_asciicompat_inline(enc)
293-
#endif
294237

295238
int rb_enc_casefold(char *to, const char *p, const char *e, rb_encoding *enc);
296239
CONSTFUNC(int rb_enc_toupper(int c, rb_encoding *enc));
@@ -341,9 +284,6 @@ VALUE rb_check_symbol_cstr(const char *ptr, long len, rb_encoding *enc);
341284
RUBY_EXTERN VALUE rb_cEncoding;
342285

343286
/* econv stuff */
344-
#ifdef TRUFFLERUBY
345-
struct rb_econv_t {};
346-
#endif
347287

348288
typedef enum {
349289
econv_invalid_byte_sequence,

lib/cext/include/ruby/internal/arithmetic/fixnum.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,10 @@
3535
* represent is 4,611,686,018,427,387,904, which is not fixable. The
3636
* seemingly-stragne "< FIXNUM_MAX + 1" expression below is due to this.
3737
*/
38-
#ifdef TRUFFLERUBY
39-
#define RB_POSFIXABLE(f) ((f) <= RUBY_FIXNUM_MAX)
40-
#else
4138
#define RB_POSFIXABLE(_) ((_) < RUBY_FIXNUM_MAX + 1)
42-
#endif
4339
#define RB_NEGFIXABLE(_) ((_) >= RUBY_FIXNUM_MIN)
4440
#define RB_FIXABLE(_) (RB_POSFIXABLE(_) && RB_NEGFIXABLE(_))
45-
#ifdef TRUFFLERUBY
46-
#define RUBY_FIXNUM_MAX LONG_MAX
47-
#define RUBY_FIXNUM_MIN LONG_MIN
48-
#else
4941
#define RUBY_FIXNUM_MAX (LONG_MAX / 2)
5042
#define RUBY_FIXNUM_MIN (LONG_MIN / 2)
51-
#endif
5243

5344
#endif /* RBIMPL_ARITHMETIC_FIXNUM_H */

lib/cext/include/ruby/internal/arithmetic/long.h

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -50,28 +50,16 @@
5050
#define LONG2NUM RB_LONG2NUM
5151
#define NUM2LONG RB_NUM2LONG
5252
#define NUM2ULONG RB_NUM2ULONG
53-
#ifdef TRUFFLERUBY
54-
#define RB_FIX2LONG(x) ((long)polyglot_as_i64(rb_tr_unwrap(x)))
55-
#else
5653
#define RB_FIX2LONG rb_fix2long
57-
#endif
5854
#define RB_FIX2ULONG rb_fix2ulong
59-
#ifdef TRUFFLERUBY
60-
#define RB_LONG2FIX(i) (VALUE)rb_tr_longwrap((long)(i))
61-
#else
6255
#define RB_LONG2FIX RB_INT2FIX
63-
#endif
6456
#define RB_LONG2NUM rb_long2num_inline
6557
#define RB_NUM2LONG rb_num2long_inline
6658
#define RB_NUM2ULONG rb_num2ulong_inline
6759
#define RB_ULONG2NUM rb_ulong2num_inline
6860
#define ULONG2NUM RB_ULONG2NUM
6961
#define rb_fix_new RB_INT2FIX
70-
#ifdef TRUFFLERUBY
71-
#define rb_long2int rb_long2int
72-
#else
7362
#define rb_long2int rb_long2int_inline
74-
#endif
7563

7664
/** @cond INTERNAL_MACRO */
7765
#define RB_INT2FIX RB_INT2FIX
@@ -85,9 +73,6 @@ void rb_out_of_int(SIGNED_VALUE num);
8573

8674
long rb_num2long(VALUE num);
8775
unsigned long rb_num2ulong(VALUE num);
88-
#ifdef TRUFFLERUBY
89-
int rb_long2int(long value);
90-
#endif
9176
RBIMPL_SYMBOL_EXPORT_END()
9277

9378
RBIMPL_ATTR_CONST_UNLESS_DEBUG()
@@ -110,7 +95,6 @@ RB_INT2FIX(long i)
11095
return n;
11196
}
11297

113-
#ifndef TRUFFLERUBY
11498
static inline int
11599
rb_long2int_inline(long n)
116100
{
@@ -125,7 +109,6 @@ rb_long2int_inline(long n)
125109

126110
return i;
127111
}
128-
#endif
129112

130113
RBIMPL_ATTR_CONST_UNLESS_DEBUG()
131114
RBIMPL_ATTR_CONSTEXPR_UNLESS_DEBUG(CXX14)
@@ -171,22 +154,16 @@ rbimpl_right_shift_is_arithmetic_p(void)
171154
}
172155

173156
RBIMPL_ATTR_CONST_UNLESS_DEBUG()
174-
#ifndef TRUFFLERUBY
175157
RBIMPL_ATTR_CONSTEXPR_UNLESS_DEBUG(CXX14)
176-
#endif
177158
static inline long
178159
rb_fix2long(VALUE x)
179160
{
180-
#ifdef TRUFFLERUBY
181-
return ((long)polyglot_as_i64(rb_tr_unwrap(x)));
182-
#else
183161
if /* constexpr */ (rbimpl_right_shift_is_arithmetic_p()) {
184162
return rbimpl_fix2long_by_shift(x);
185163
}
186164
else {
187165
return rbimpl_fix2long_by_idiv(x);
188166
}
189-
#endif
190167
}
191168

192169
RBIMPL_ATTR_CONST_UNLESS_DEBUG()
@@ -236,11 +213,7 @@ rb_ulong2num_inline(unsigned long v)
236213
if (RB_POSFIXABLE(v))
237214
return RB_LONG2FIX(v);
238215
else
239-
#ifdef TRUFFLERUBY
240-
return rb_tr_wrap(polyglot_invoke(RUBY_CEXT, "rb_ulong2num", (long) v));
241-
#else
242216
return rb_uint2big(v);
243-
#endif
244217
}
245218

246219
/**

lib/cext/include/ruby/internal/attr/const.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include "ruby/internal/compiler_since.h"
2424
#include "ruby/internal/has/attribute.h"
2525
#include "ruby/internal/has/declspec_attribute.h"
26-
#include "ruby/assert.h"
2726

2827
/** Wraps (or simulates) `__attribute__((const))` */
2928
#if RBIMPL_HAS_ATTRIBUTE(const)

lib/cext/include/ruby/internal/config.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
* extension libraries. They could be written in C++98.
2121
* @brief Thin wrapper to ruby/config.h
2222
*/
23-
// Must be first, as it defines feature test macros like _GNU_SOURCE,
24-
// which influences the definitions exposed by system header files.
2523
#include "ruby/config.h"
2624

2725
#ifdef RUBY_EXTCONF_H
@@ -143,7 +141,4 @@
143141
# undef RBIMPL_TEST3
144142
#endif /* HAVE_VA_ARGS_MACRO */
145143

146-
// Loaded at the end of config.h, included from defines.h. Needs STRINGIZE().
147-
#include <truffleruby/truffleruby-pre.h>
148-
149144
#endif /* RBIMPL_CONFIG_H */

0 commit comments

Comments
 (0)