debase-ruby_core_source 3.2.0 → 3.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/CHANGELOG.md +5 -0
  4. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/addr2line.h +20 -0
  5. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/builtin.h +117 -0
  6. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/ccan/build_assert/build_assert.h +40 -0
  7. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/ccan/check_type/check_type.h +63 -0
  8. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/ccan/container_of/container_of.h +142 -0
  9. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/ccan/list/list.h +789 -0
  10. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/ccan/str/str.h +17 -0
  11. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/constant.h +53 -0
  12. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/darray.h +179 -0
  13. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/debug_counter.h +426 -0
  14. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/dln.h +31 -0
  15. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/encindex.h +70 -0
  16. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/eval_intern.h +339 -0
  17. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/hrtime.h +227 -0
  18. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/id.h +299 -0
  19. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/id_table.h +39 -0
  20. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/insns.inc +249 -0
  21. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/insns_info.inc +9159 -0
  22. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/array.h +162 -0
  23. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/basic_operators.h +63 -0
  24. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/bignum.h +244 -0
  25. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/bits.h +564 -0
  26. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/class.h +221 -0
  27. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/cmdlineopt.h +61 -0
  28. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/compar.h +29 -0
  29. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/compile.h +35 -0
  30. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/compilers.h +107 -0
  31. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/complex.h +29 -0
  32. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/cont.h +32 -0
  33. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/dir.h +16 -0
  34. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/enc.h +19 -0
  35. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/encoding.h +32 -0
  36. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/enum.h +18 -0
  37. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/enumerator.h +21 -0
  38. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/error.h +191 -0
  39. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/eval.h +32 -0
  40. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/file.h +38 -0
  41. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/fixnum.h +184 -0
  42. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/gc.h +333 -0
  43. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/hash.h +216 -0
  44. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/imemo.h +241 -0
  45. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/inits.h +50 -0
  46. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/io.h +38 -0
  47. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/load.h +18 -0
  48. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/loadpath.h +16 -0
  49. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/math.h +23 -0
  50. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/missing.h +18 -0
  51. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/numeric.h +273 -0
  52. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/object.h +59 -0
  53. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/parse.h +25 -0
  54. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/proc.h +30 -0
  55. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/process.h +138 -0
  56. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/ractor.h +6 -0
  57. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/random.h +16 -0
  58. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/range.h +40 -0
  59. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/rational.h +71 -0
  60. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/re.h +28 -0
  61. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/sanitizers.h +186 -0
  62. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/serial.h +23 -0
  63. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/signal.h +21 -0
  64. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/static_assert.h +16 -0
  65. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/string.h +145 -0
  66. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/struct.h +152 -0
  67. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/symbol.h +42 -0
  68. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/thread.h +61 -0
  69. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/time.h +34 -0
  70. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/transcode.h +20 -0
  71. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/util.h +27 -0
  72. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/variable.h +88 -0
  73. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/vm.h +124 -0
  74. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/warnings.h +16 -0
  75. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal.h +112 -0
  76. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/iseq.h +334 -0
  77. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/known_errors.inc +791 -0
  78. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/method.h +254 -0
  79. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/node.h +514 -0
  80. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/node_name.inc +210 -0
  81. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/opt_sc.inc +109 -0
  82. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/optinsn.inc +128 -0
  83. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/optunifs.inc +43 -0
  84. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/parse.h +230 -0
  85. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/probes_helper.h +42 -0
  86. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/ractor_core.h +387 -0
  87. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/regenc.h +254 -0
  88. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/regint.h +996 -0
  89. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/regparse.h +370 -0
  90. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/revision.h +5 -0
  91. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/rjit.h +103 -0
  92. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/rjit_c.h +165 -0
  93. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/ruby_assert.h +14 -0
  94. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/ruby_atomic.h +23 -0
  95. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/shape.h +232 -0
  96. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/siphash.h +48 -0
  97. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/symbol.h +119 -0
  98. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/thread_none.h +20 -0
  99. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/thread_pthread.h +128 -0
  100. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/thread_win32.h +63 -0
  101. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/timev.h +58 -0
  102. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/transcode_data.h +138 -0
  103. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/transient_heap.h +65 -0
  104. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/variable.h +30 -0
  105. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/version.h +65 -0
  106. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/vm.inc +5497 -0
  107. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/vm_call_iseq_optimized.inc +244 -0
  108. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/vm_callinfo.h +574 -0
  109. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/vm_core.h +2107 -0
  110. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/vm_debug.h +122 -0
  111. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/vm_exec.h +198 -0
  112. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/vm_insnhelper.h +274 -0
  113. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/vm_opts.h +72 -0
  114. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/vm_sync.h +137 -0
  115. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/vmtc.inc +243 -0
  116. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/yjit.h +72 -0
  117. data/lib/debase/ruby_core_source/version.rb +1 -1
  118. metadata +116 -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,38 @@
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
+ #include "ruby/io.h" /* for rb_io_t */
13
+
14
+ /* io.c */
15
+ void ruby_set_inplace_mode(const char *);
16
+ void rb_stdio_set_default_encoding(void);
17
+ VALUE rb_io_flush_raw(VALUE, int);
18
+ size_t rb_io_memsize(const rb_io_t *);
19
+ int rb_stderr_tty_p(void);
20
+ void rb_io_fptr_finalize_internal(void *ptr);
21
+ #ifdef rb_io_fptr_finalize
22
+ # undef rb_io_fptr_finalize
23
+ #endif
24
+ #define rb_io_fptr_finalize rb_io_fptr_finalize_internal
25
+ VALUE rb_io_popen(VALUE pname, VALUE pmode, VALUE env, VALUE opt);
26
+
27
+ VALUE rb_io_prep_stdin(void);
28
+ VALUE rb_io_prep_stdout(void);
29
+ VALUE rb_io_prep_stderr(void);
30
+
31
+ RUBY_SYMBOL_EXPORT_BEGIN
32
+ /* io.c (export) */
33
+ void rb_maygvl_fd_fix_cloexec(int fd);
34
+ int rb_gc_for_fd(int err);
35
+ void rb_write_error_str(VALUE mesg);
36
+ RUBY_SYMBOL_EXPORT_END
37
+
38
+ #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 */
@@ -0,0 +1,273 @@
1
+ #ifndef INTERNAL_NUMERIC_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_NUMERIC_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 Numeric.
10
+ */
11
+ #include "internal/bignum.h" /* for BIGNUM_POSITIVE_P */
12
+ #include "internal/bits.h" /* for RUBY_BIT_ROTL */
13
+ #include "internal/fixnum.h" /* for FIXNUM_POSITIVE_P */
14
+ #include "internal/vm.h" /* for rb_method_basic_definition_p */
15
+ #include "ruby/intern.h" /* for rb_cmperr */
16
+ #include "ruby/ruby.h" /* for USE_FLONUM */
17
+
18
+ #define ROUND_TO(mode, even, up, down) \
19
+ ((mode) == RUBY_NUM_ROUND_HALF_EVEN ? even : \
20
+ (mode) == RUBY_NUM_ROUND_HALF_UP ? up : down)
21
+ #define ROUND_FUNC(mode, name) \
22
+ ROUND_TO(mode, name##_half_even, name##_half_up, name##_half_down)
23
+ #define ROUND_CALL(mode, name, args) \
24
+ ROUND_TO(mode, name##_half_even args, \
25
+ name##_half_up args, name##_half_down args)
26
+
27
+ #ifndef ROUND_DEFAULT
28
+ # define ROUND_DEFAULT RUBY_NUM_ROUND_HALF_UP
29
+ #endif
30
+
31
+ enum ruby_num_rounding_mode {
32
+ RUBY_NUM_ROUND_HALF_UP,
33
+ RUBY_NUM_ROUND_HALF_EVEN,
34
+ RUBY_NUM_ROUND_HALF_DOWN,
35
+ RUBY_NUM_ROUND_DEFAULT = ROUND_DEFAULT,
36
+ };
37
+
38
+ /* same as internal.h */
39
+ #define numberof(array) ((int)(sizeof(array) / sizeof((array)[0])))
40
+ #define roomof(x, y) (((x) + (y) - 1) / (y))
41
+ #define type_roomof(x, y) roomof(sizeof(x), sizeof(y))
42
+
43
+ #if SIZEOF_DOUBLE <= SIZEOF_VALUE
44
+ typedef double rb_float_value_type;
45
+ #else
46
+ typedef struct {
47
+ VALUE values[roomof(SIZEOF_DOUBLE, SIZEOF_VALUE)];
48
+ } rb_float_value_type;
49
+ #endif
50
+
51
+ struct RFloat {
52
+ struct RBasic basic;
53
+ rb_float_value_type float_value;
54
+ };
55
+
56
+ #define RFLOAT(obj) ((struct RFloat *)(obj))
57
+
58
+ /* numeric.c */
59
+ int rb_num_to_uint(VALUE val, unsigned int *ret);
60
+ VALUE ruby_num_interval_step_size(VALUE from, VALUE to, VALUE step, int excl);
61
+ double ruby_float_step_size(double beg, double end, double unit, int excl);
62
+ int ruby_float_step(VALUE from, VALUE to, VALUE step, int excl, int allow_endless);
63
+ int rb_num_negative_p(VALUE);
64
+ VALUE rb_int_succ(VALUE num);
65
+ VALUE rb_float_uminus(VALUE num);
66
+ VALUE rb_int_plus(VALUE x, VALUE y);
67
+ VALUE rb_float_plus(VALUE x, VALUE y);
68
+ VALUE rb_int_minus(VALUE x, VALUE y);
69
+ VALUE rb_float_minus(VALUE x, VALUE y);
70
+ VALUE rb_int_mul(VALUE x, VALUE y);
71
+ VALUE rb_float_mul(VALUE x, VALUE y);
72
+ VALUE rb_float_div(VALUE x, VALUE y);
73
+ VALUE rb_int_idiv(VALUE x, VALUE y);
74
+ VALUE rb_int_modulo(VALUE x, VALUE y);
75
+ VALUE rb_int2str(VALUE num, int base);
76
+ VALUE rb_fix_plus(VALUE x, VALUE y);
77
+ VALUE rb_int_gt(VALUE x, VALUE y);
78
+ VALUE rb_float_gt(VALUE x, VALUE y);
79
+ VALUE rb_int_ge(VALUE x, VALUE y);
80
+ enum ruby_num_rounding_mode rb_num_get_rounding_option(VALUE opts);
81
+ double rb_int_fdiv_double(VALUE x, VALUE y);
82
+ VALUE rb_int_pow(VALUE x, VALUE y);
83
+ VALUE rb_float_pow(VALUE x, VALUE y);
84
+ VALUE rb_int_cmp(VALUE x, VALUE y);
85
+ VALUE rb_int_equal(VALUE x, VALUE y);
86
+ VALUE rb_int_divmod(VALUE x, VALUE y);
87
+ VALUE rb_int_and(VALUE x, VALUE y);
88
+ VALUE rb_int_lshift(VALUE x, VALUE y);
89
+ VALUE rb_int_div(VALUE x, VALUE y);
90
+ int rb_int_positive_p(VALUE num);
91
+ int rb_int_negative_p(VALUE num);
92
+ VALUE rb_check_integer_type(VALUE);
93
+ VALUE rb_num_pow(VALUE x, VALUE y);
94
+ VALUE rb_float_ceil(VALUE num, int ndigits);
95
+ VALUE rb_float_floor(VALUE x, int ndigits);
96
+ VALUE rb_float_abs(VALUE flt);
97
+ static inline VALUE rb_num_compare_with_zero(VALUE num, ID mid);
98
+ static inline int rb_num_positive_int_p(VALUE num);
99
+ static inline int rb_num_negative_int_p(VALUE num);
100
+ static inline double rb_float_flonum_value(VALUE v);
101
+ static inline double rb_float_noflonum_value(VALUE v);
102
+ static inline double rb_float_value_inline(VALUE v);
103
+ static inline VALUE rb_float_new_inline(double d);
104
+ static inline bool INT_POSITIVE_P(VALUE num);
105
+ static inline bool INT_NEGATIVE_P(VALUE num);
106
+ static inline bool FLOAT_ZERO_P(VALUE num);
107
+ #define rb_float_value rb_float_value_inline
108
+ #define rb_float_new rb_float_new_inline
109
+
110
+ RUBY_SYMBOL_EXPORT_BEGIN
111
+ /* numeric.c (export) */
112
+ RUBY_SYMBOL_EXPORT_END
113
+
114
+ VALUE rb_flo_div_flo(VALUE x, VALUE y);
115
+ double ruby_float_mod(double x, double y);
116
+ VALUE rb_float_equal(VALUE x, VALUE y);
117
+ int rb_float_cmp(VALUE x, VALUE y);
118
+ VALUE rb_float_eql(VALUE x, VALUE y);
119
+ VALUE rb_fix_aref(VALUE fix, VALUE idx);
120
+ VALUE rb_int_zero_p(VALUE num);
121
+ VALUE rb_int_even_p(VALUE num);
122
+ VALUE rb_int_odd_p(VALUE num);
123
+ VALUE rb_int_abs(VALUE num);
124
+ VALUE rb_int_bit_length(VALUE num);
125
+ VALUE rb_int_uminus(VALUE num);
126
+ VALUE rb_int_comp(VALUE num);
127
+
128
+ static inline bool
129
+ INT_POSITIVE_P(VALUE num)
130
+ {
131
+ if (FIXNUM_P(num)) {
132
+ return FIXNUM_POSITIVE_P(num);
133
+ }
134
+ else {
135
+ return BIGNUM_POSITIVE_P(num);
136
+ }
137
+ }
138
+
139
+ static inline bool
140
+ INT_NEGATIVE_P(VALUE num)
141
+ {
142
+ if (FIXNUM_P(num)) {
143
+ return FIXNUM_NEGATIVE_P(num);
144
+ }
145
+ else {
146
+ return BIGNUM_NEGATIVE_P(num);
147
+ }
148
+ }
149
+
150
+ static inline bool
151
+ FLOAT_ZERO_P(VALUE num)
152
+ {
153
+ return RFLOAT_VALUE(num) == 0.0;
154
+ }
155
+
156
+ static inline VALUE
157
+ rb_num_compare_with_zero(VALUE num, ID mid)
158
+ {
159
+ VALUE zero = INT2FIX(0);
160
+ VALUE r = rb_check_funcall(num, mid, 1, &zero);
161
+ if (r == Qundef) {
162
+ rb_cmperr(num, zero);
163
+ }
164
+ return r;
165
+ }
166
+
167
+ static inline int
168
+ rb_num_positive_int_p(VALUE num)
169
+ {
170
+ const ID mid = '>';
171
+
172
+ if (FIXNUM_P(num)) {
173
+ if (rb_method_basic_definition_p(rb_cInteger, mid))
174
+ return FIXNUM_POSITIVE_P(num);
175
+ }
176
+ else if (RB_TYPE_P(num, T_BIGNUM)) {
177
+ if (rb_method_basic_definition_p(rb_cInteger, mid))
178
+ return BIGNUM_POSITIVE_P(num);
179
+ }
180
+ return RTEST(rb_num_compare_with_zero(num, mid));
181
+ }
182
+
183
+ static inline int
184
+ rb_num_negative_int_p(VALUE num)
185
+ {
186
+ const ID mid = '<';
187
+
188
+ if (FIXNUM_P(num)) {
189
+ if (rb_method_basic_definition_p(rb_cInteger, mid))
190
+ return FIXNUM_NEGATIVE_P(num);
191
+ }
192
+ else if (RB_TYPE_P(num, T_BIGNUM)) {
193
+ if (rb_method_basic_definition_p(rb_cInteger, mid))
194
+ return BIGNUM_NEGATIVE_P(num);
195
+ }
196
+ return RTEST(rb_num_compare_with_zero(num, mid));
197
+ }
198
+
199
+ static inline double
200
+ rb_float_flonum_value(VALUE v)
201
+ {
202
+ #if USE_FLONUM
203
+ if (v != (VALUE)0x8000000000000002) { /* LIKELY */
204
+ union {
205
+ double d;
206
+ VALUE v;
207
+ } t;
208
+
209
+ VALUE b63 = (v >> 63);
210
+ /* e: xx1... -> 011... */
211
+ /* xx0... -> 100... */
212
+ /* ^b63 */
213
+ t.v = RUBY_BIT_ROTR((2 - b63) | (v & ~(VALUE)0x03), 3);
214
+ return t.d;
215
+ }
216
+ #endif
217
+ return 0.0;
218
+ }
219
+
220
+ static inline double
221
+ rb_float_noflonum_value(VALUE v)
222
+ {
223
+ #if SIZEOF_DOUBLE <= SIZEOF_VALUE
224
+ return RFLOAT(v)->float_value;
225
+ #else
226
+ union {
227
+ rb_float_value_type v;
228
+ double d;
229
+ } u = {RFLOAT(v)->float_value};
230
+ return u.d;
231
+ #endif
232
+ }
233
+
234
+ static inline double
235
+ rb_float_value_inline(VALUE v)
236
+ {
237
+ if (FLONUM_P(v)) {
238
+ return rb_float_flonum_value(v);
239
+ }
240
+ return rb_float_noflonum_value(v);
241
+ }
242
+
243
+ static inline VALUE
244
+ rb_float_new_inline(double d)
245
+ {
246
+ #if USE_FLONUM
247
+ union {
248
+ double d;
249
+ VALUE v;
250
+ } t;
251
+ int bits;
252
+
253
+ t.d = d;
254
+ bits = (int)((VALUE)(t.v >> 60) & 0x7);
255
+ /* bits contains 3 bits of b62..b60. */
256
+ /* bits - 3 = */
257
+ /* b011 -> b000 */
258
+ /* b100 -> b001 */
259
+
260
+ if (t.v != 0x3000000000000000 /* 1.72723e-77 */ &&
261
+ !((bits-3) & ~0x01)) {
262
+ return (RUBY_BIT_ROTL(t.v, 3) & ~(VALUE)0x01) | 0x02;
263
+ }
264
+ else if (t.v == (VALUE)0) {
265
+ /* +0.0 */
266
+ return 0x8000000000000002;
267
+ }
268
+ /* out of range */
269
+ #endif
270
+ return rb_float_new_in_heap(d);
271
+ }
272
+
273
+ #endif /* INTERNAL_NUMERIC_H */