debase-ruby_core_source 0.10.6 → 0.10.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/lib/debase/ruby_core_source.rb +2 -1
  4. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/addr2line.h +21 -0
  5. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/ccan/build_assert/build_assert.h +40 -0
  6. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/ccan/check_type/check_type.h +63 -0
  7. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/ccan/container_of/container_of.h +142 -0
  8. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/ccan/list/list.h +788 -0
  9. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/ccan/str/str.h +16 -0
  10. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/constant.h +54 -0
  11. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/debug_counter.h +378 -0
  12. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/dln.h +51 -0
  13. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/encindex.h +69 -0
  14. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/eval_intern.h +314 -0
  15. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/gc.h +129 -0
  16. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/hrtime.h +168 -0
  17. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/id.h +292 -0
  18. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/id_table.h +34 -0
  19. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/insns.inc +249 -0
  20. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/insns_info.inc +9614 -0
  21. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/internal.h +2682 -0
  22. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/iseq.h +312 -0
  23. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/known_errors.inc +791 -0
  24. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/method.h +232 -0
  25. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/mjit.h +179 -0
  26. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/mjit_compile.inc +7883 -0
  27. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/node.h +483 -0
  28. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/node_name.inc +210 -0
  29. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/opt_sc.inc +109 -0
  30. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/optinsn.inc +128 -0
  31. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/optunifs.inc +43 -0
  32. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/parse.h +210 -0
  33. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/probes_helper.h +42 -0
  34. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/regenc.h +254 -0
  35. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/regint.h +938 -0
  36. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/regparse.h +370 -0
  37. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/revision.h +2 -0
  38. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/ruby_assert.h +15 -0
  39. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/ruby_atomic.h +244 -0
  40. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/siphash.h +48 -0
  41. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/symbol.h +119 -0
  42. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/thread_pthread.h +75 -0
  43. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/thread_win32.h +36 -0
  44. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/timev.h +56 -0
  45. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/transcode_data.h +139 -0
  46. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/transient_heap.h +62 -0
  47. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/version.h +77 -0
  48. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/vm.inc +5269 -0
  49. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/vm_call_iseq_optimized.inc +237 -0
  50. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/vm_core.h +1955 -0
  51. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/vm_debug.h +34 -0
  52. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/vm_exec.h +193 -0
  53. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/vm_insnhelper.h +255 -0
  54. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/vm_opts.h +70 -0
  55. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/vmtc.inc +243 -0
  56. data/lib/debase/ruby_core_source/version.rb +1 -1
  57. metadata +55 -3
@@ -0,0 +1,51 @@
1
+ /**********************************************************************
2
+
3
+ dln.h -
4
+
5
+ $Author$
6
+ created at: Wed Jan 19 16:53:09 JST 1994
7
+
8
+ Copyright (C) 1993-2007 Yukihiro Matsumoto
9
+
10
+ **********************************************************************/
11
+
12
+ #ifndef DLN_H
13
+ #define DLN_H
14
+
15
+ #ifdef __cplusplus
16
+ # ifndef HAVE_PROTOTYPES
17
+ # define HAVE_PROTOTYPES 1
18
+ # endif
19
+ # ifndef HAVE_STDARG_PROTOTYPES
20
+ # define HAVE_STDARG_PROTOTYPES 1
21
+ # endif
22
+ #endif
23
+
24
+ #undef _
25
+ #ifdef HAVE_PROTOTYPES
26
+ # define _(args) args
27
+ #else
28
+ # define _(args) ()
29
+ #endif
30
+
31
+ RUBY_SYMBOL_EXPORT_BEGIN
32
+
33
+ #ifndef DLN_FIND_EXTRA_ARG
34
+ #define DLN_FIND_EXTRA_ARG
35
+ #endif
36
+ #ifndef DLN_FIND_EXTRA_ARG_DECL
37
+ #define DLN_FIND_EXTRA_ARG_DECL
38
+ #endif
39
+
40
+ char *dln_find_exe_r(const char*,const char*,char*,size_t DLN_FIND_EXTRA_ARG_DECL);
41
+ char *dln_find_file_r(const char*,const char*,char*,size_t DLN_FIND_EXTRA_ARG_DECL);
42
+
43
+ #ifdef USE_DLN_A_OUT
44
+ extern char *dln_argv0;
45
+ #endif
46
+
47
+ void *dln_load(const char*);
48
+
49
+ RUBY_SYMBOL_EXPORT_END
50
+
51
+ #endif
@@ -0,0 +1,69 @@
1
+ /**********************************************************************
2
+
3
+ encindex.h -
4
+
5
+ $Author$
6
+ created at: Tue Sep 15 13:21:14 JST 2015
7
+
8
+ Copyright (C) 2015 Yukihiro Matsumoto
9
+
10
+ **********************************************************************/
11
+
12
+ #ifndef RUBY_ENCINDEX_H
13
+ #define RUBY_ENCINDEX_H 1
14
+ #if defined(__cplusplus)
15
+ extern "C" {
16
+ #if 0
17
+ } /* satisfy cc-mode */
18
+ #endif
19
+ #endif
20
+
21
+ enum ruby_preserved_encindex {
22
+ RUBY_ENCINDEX_ASCII,
23
+ RUBY_ENCINDEX_UTF_8,
24
+ RUBY_ENCINDEX_US_ASCII,
25
+
26
+ /* preserved indexes */
27
+ RUBY_ENCINDEX_UTF_16BE,
28
+ RUBY_ENCINDEX_UTF_16LE,
29
+ RUBY_ENCINDEX_UTF_32BE,
30
+ RUBY_ENCINDEX_UTF_32LE,
31
+ RUBY_ENCINDEX_UTF_16,
32
+ RUBY_ENCINDEX_UTF_32,
33
+ RUBY_ENCINDEX_UTF8_MAC,
34
+
35
+ /* for old options of regexp */
36
+ RUBY_ENCINDEX_EUC_JP,
37
+ RUBY_ENCINDEX_Windows_31J,
38
+
39
+ RUBY_ENCINDEX_BUILTIN_MAX
40
+ };
41
+
42
+ #define ENCINDEX_ASCII RUBY_ENCINDEX_ASCII
43
+ #define ENCINDEX_UTF_8 RUBY_ENCINDEX_UTF_8
44
+ #define ENCINDEX_US_ASCII RUBY_ENCINDEX_US_ASCII
45
+ #define ENCINDEX_UTF_16BE RUBY_ENCINDEX_UTF_16BE
46
+ #define ENCINDEX_UTF_16LE RUBY_ENCINDEX_UTF_16LE
47
+ #define ENCINDEX_UTF_32BE RUBY_ENCINDEX_UTF_32BE
48
+ #define ENCINDEX_UTF_32LE RUBY_ENCINDEX_UTF_32LE
49
+ #define ENCINDEX_UTF_16 RUBY_ENCINDEX_UTF_16
50
+ #define ENCINDEX_UTF_32 RUBY_ENCINDEX_UTF_32
51
+ #define ENCINDEX_UTF8_MAC RUBY_ENCINDEX_UTF8_MAC
52
+ #define ENCINDEX_EUC_JP RUBY_ENCINDEX_EUC_JP
53
+ #define ENCINDEX_Windows_31J RUBY_ENCINDEX_Windows_31J
54
+ #define ENCINDEX_BUILTIN_MAX RUBY_ENCINDEX_BUILTIN_MAX
55
+
56
+ #define rb_ascii8bit_encindex() RUBY_ENCINDEX_ASCII
57
+ #define rb_utf8_encindex() RUBY_ENCINDEX_UTF_8
58
+ #define rb_usascii_encindex() RUBY_ENCINDEX_US_ASCII
59
+
60
+ int rb_enc_find_index2(const char *name, long len);
61
+
62
+ #if defined(__cplusplus)
63
+ #if 0
64
+ { /* satisfy cc-mode */
65
+ #endif
66
+ } /* extern "C" { */
67
+ #endif
68
+
69
+ #endif /* RUBY_ENCINDEX_H */
@@ -0,0 +1,314 @@
1
+ #ifndef RUBY_EVAL_INTERN_H
2
+ #define RUBY_EVAL_INTERN_H
3
+
4
+ #include "ruby/ruby.h"
5
+ #include "vm_core.h"
6
+
7
+ static inline void
8
+ vm_passed_block_handler_set(rb_execution_context_t *ec, VALUE block_handler)
9
+ {
10
+ vm_block_handler_verify(block_handler);
11
+ ec->passed_block_handler = block_handler;
12
+ }
13
+
14
+ static inline void
15
+ pass_passed_block_handler(rb_execution_context_t *ec)
16
+ {
17
+ VALUE block_handler = rb_vm_frame_block_handler(ec->cfp);
18
+ vm_passed_block_handler_set(ec, block_handler);
19
+ VM_ENV_FLAGS_SET(ec->cfp->ep, VM_FRAME_FLAG_PASSED);
20
+ }
21
+
22
+ #define PASS_PASSED_BLOCK_HANDLER_EC(ec) pass_passed_block_handler(ec)
23
+ #define PASS_PASSED_BLOCK_HANDLER() pass_passed_block_handler(GET_EC())
24
+
25
+ #ifdef HAVE_STDLIB_H
26
+ #include <stdlib.h>
27
+ #endif
28
+ #ifndef EXIT_SUCCESS
29
+ #define EXIT_SUCCESS 0
30
+ #endif
31
+ #ifndef EXIT_FAILURE
32
+ #define EXIT_FAILURE 1
33
+ #endif
34
+
35
+ #include <stdio.h>
36
+ #include <setjmp.h>
37
+
38
+ #ifdef __APPLE__
39
+ # ifdef HAVE_CRT_EXTERNS_H
40
+ # include <crt_externs.h>
41
+ # else
42
+ # include "missing/crt_externs.h"
43
+ # endif
44
+ #endif
45
+
46
+ #ifndef HAVE_STRING_H
47
+ char *strrchr(const char *, const char);
48
+ #endif
49
+
50
+ #ifdef HAVE_UNISTD_H
51
+ #include <unistd.h>
52
+ #endif
53
+
54
+ #ifdef HAVE_NET_SOCKET_H
55
+ #include <net/socket.h>
56
+ #endif
57
+
58
+ #define ruby_setjmp(env) RUBY_SETJMP(env)
59
+ #define ruby_longjmp(env,val) RUBY_LONGJMP((env),(val))
60
+ #ifdef __CYGWIN__
61
+ # ifndef _setjmp
62
+ int _setjmp(jmp_buf);
63
+ # endif
64
+ # ifndef _longjmp
65
+ NORETURN(void _longjmp(jmp_buf, int));
66
+ # endif
67
+ #endif
68
+
69
+ #include <sys/types.h>
70
+ #include <signal.h>
71
+ #include <errno.h>
72
+
73
+ #ifdef HAVE_SYS_SELECT_H
74
+ #include <sys/select.h>
75
+ #endif
76
+
77
+ /*
78
+ Solaris sys/select.h switches select to select_large_fdset to support larger
79
+ file descriptors if FD_SETSIZE is larger than 1024 on 32bit environment.
80
+ But Ruby doesn't change FD_SETSIZE because fd_set is allocated dynamically.
81
+ So following definition is required to use select_large_fdset.
82
+ */
83
+ #ifdef HAVE_SELECT_LARGE_FDSET
84
+ #define select(n, r, w, e, t) select_large_fdset((n), (r), (w), (e), (t))
85
+ extern int select_large_fdset(int, fd_set *, fd_set *, fd_set *, struct timeval *);
86
+ #endif
87
+
88
+ #ifdef HAVE_SYS_PARAM_H
89
+ #include <sys/param.h>
90
+ #endif
91
+
92
+ #include <sys/stat.h>
93
+
94
+ #ifdef _MSC_VER
95
+ #define SAVE_ROOT_JMPBUF_BEFORE_STMT \
96
+ __try {
97
+ #define SAVE_ROOT_JMPBUF_AFTER_STMT \
98
+ } \
99
+ __except (GetExceptionCode() == EXCEPTION_STACK_OVERFLOW ? \
100
+ (rb_ec_raised_set(GET_EC(), RAISED_STACKOVERFLOW), \
101
+ raise(SIGSEGV), \
102
+ EXCEPTION_EXECUTE_HANDLER) : \
103
+ EXCEPTION_CONTINUE_SEARCH) { \
104
+ /* never reaches here */ \
105
+ }
106
+ #elif defined(__MINGW32__)
107
+ LONG WINAPI rb_w32_stack_overflow_handler(struct _EXCEPTION_POINTERS *);
108
+ #define SAVE_ROOT_JMPBUF_BEFORE_STMT \
109
+ do { \
110
+ PVOID _handler = AddVectoredExceptionHandler(1, rb_w32_stack_overflow_handler);
111
+
112
+ #define SAVE_ROOT_JMPBUF_AFTER_STMT \
113
+ RemoveVectoredExceptionHandler(_handler); \
114
+ } while (0);
115
+ #else
116
+ #define SAVE_ROOT_JMPBUF_BEFORE_STMT
117
+ #define SAVE_ROOT_JMPBUF_AFTER_STMT
118
+ #endif
119
+
120
+ #define SAVE_ROOT_JMPBUF(th, stmt) do \
121
+ if (ruby_setjmp((th)->root_jmpbuf) == 0) { \
122
+ SAVE_ROOT_JMPBUF_BEFORE_STMT \
123
+ stmt; \
124
+ SAVE_ROOT_JMPBUF_AFTER_STMT \
125
+ } \
126
+ else { \
127
+ rb_fiber_start(); \
128
+ } while (0)
129
+
130
+ #define EC_PUSH_TAG(ec) do { \
131
+ rb_execution_context_t * const _ec = (ec); \
132
+ struct rb_vm_tag _tag; \
133
+ _tag.state = TAG_NONE; \
134
+ _tag.tag = Qundef; \
135
+ _tag.prev = _ec->tag;
136
+
137
+ #define EC_POP_TAG() \
138
+ _ec->tag = _tag.prev; \
139
+ } while (0)
140
+
141
+ #define EC_TMPPOP_TAG() \
142
+ _ec->tag = _tag.prev
143
+
144
+ #define EC_REPUSH_TAG() (void)(_ec->tag = &_tag)
145
+
146
+ #if defined __GNUC__ && __GNUC__ == 4 && (__GNUC_MINOR__ >= 6 && __GNUC_MINOR__ <= 8) || __clang__
147
+ /* This macro prevents GCC 4.6--4.8 from emitting maybe-uninitialized warnings.
148
+ * This macro also prevents Clang from dumping core in EC_EXEC_TAG().
149
+ * (I confirmed Clang 4.0.1 and 5.0.0.)
150
+ */
151
+ # define VAR_FROM_MEMORY(var) __extension__(*(__typeof__(var) volatile *)&(var))
152
+ # define VAR_INITIALIZED(var) ((var) = VAR_FROM_MEMORY(var))
153
+ # define VAR_NOCLOBBERED(var) volatile var
154
+ #else
155
+ # define VAR_FROM_MEMORY(var) (var)
156
+ # define VAR_INITIALIZED(var) ((void)&(var))
157
+ # define VAR_NOCLOBBERED(var) var
158
+ #endif
159
+
160
+ /* clear ec->tag->state, and return the value */
161
+ static inline int
162
+ rb_ec_tag_state(const rb_execution_context_t *ec)
163
+ {
164
+ enum ruby_tag_type state = ec->tag->state;
165
+ ec->tag->state = TAG_NONE;
166
+ return state;
167
+ }
168
+
169
+ NORETURN(static inline void rb_ec_tag_jump(const rb_execution_context_t *ec, enum ruby_tag_type st));
170
+ static inline void
171
+ rb_ec_tag_jump(const rb_execution_context_t *ec, enum ruby_tag_type st)
172
+ {
173
+ ec->tag->state = st;
174
+ ruby_longjmp(ec->tag->buf, 1);
175
+ }
176
+
177
+ /*
178
+ setjmp() in assignment expression rhs is undefined behavior
179
+ [ISO/IEC 9899:1999] 7.13.1.1
180
+ */
181
+ #define EC_EXEC_TAG() \
182
+ (ruby_setjmp(_tag.buf) ? rb_ec_tag_state(VAR_FROM_MEMORY(_ec)) : (EC_REPUSH_TAG(), 0))
183
+
184
+ #define EC_JUMP_TAG(ec, st) rb_ec_tag_jump(ec, st)
185
+
186
+ #define INTERNAL_EXCEPTION_P(exc) FIXNUM_P(exc)
187
+
188
+ /* CREF operators */
189
+
190
+ #define CREF_FL_PUSHED_BY_EVAL IMEMO_FL_USER1
191
+ #define CREF_FL_OMOD_SHARED IMEMO_FL_USER2
192
+
193
+ static inline VALUE
194
+ CREF_CLASS(const rb_cref_t *cref)
195
+ {
196
+ return cref->klass;
197
+ }
198
+
199
+ static inline rb_cref_t *
200
+ CREF_NEXT(const rb_cref_t *cref)
201
+ {
202
+ return cref->next;
203
+ }
204
+
205
+ static inline const rb_scope_visibility_t *
206
+ CREF_SCOPE_VISI(const rb_cref_t *cref)
207
+ {
208
+ return &cref->scope_visi;
209
+ }
210
+
211
+ static inline VALUE
212
+ CREF_REFINEMENTS(const rb_cref_t *cref)
213
+ {
214
+ return cref->refinements;
215
+ }
216
+
217
+ static inline void
218
+ CREF_REFINEMENTS_SET(rb_cref_t *cref, VALUE refs)
219
+ {
220
+ RB_OBJ_WRITE(cref, &cref->refinements, refs);
221
+ }
222
+
223
+ static inline int
224
+ CREF_PUSHED_BY_EVAL(const rb_cref_t *cref)
225
+ {
226
+ return cref->flags & CREF_FL_PUSHED_BY_EVAL;
227
+ }
228
+
229
+ static inline void
230
+ CREF_PUSHED_BY_EVAL_SET(rb_cref_t *cref)
231
+ {
232
+ cref->flags |= CREF_FL_PUSHED_BY_EVAL;
233
+ }
234
+
235
+ static inline int
236
+ CREF_OMOD_SHARED(const rb_cref_t *cref)
237
+ {
238
+ return cref->flags & CREF_FL_OMOD_SHARED;
239
+ }
240
+
241
+ static inline void
242
+ CREF_OMOD_SHARED_SET(rb_cref_t *cref)
243
+ {
244
+ cref->flags |= CREF_FL_OMOD_SHARED;
245
+ }
246
+
247
+ static inline void
248
+ CREF_OMOD_SHARED_UNSET(rb_cref_t *cref)
249
+ {
250
+ cref->flags &= ~CREF_FL_OMOD_SHARED;
251
+ }
252
+
253
+ void rb_thread_cleanup(void);
254
+ void rb_thread_wait_other_threads(void);
255
+
256
+ enum {
257
+ RAISED_EXCEPTION = 1,
258
+ RAISED_STACKOVERFLOW = 2,
259
+ RAISED_NOMEMORY = 4
260
+ };
261
+ #define rb_ec_raised_set(ec, f) ((ec)->raised_flag |= (f))
262
+ #define rb_ec_raised_reset(ec, f) ((ec)->raised_flag &= ~(f))
263
+ #define rb_ec_raised_p(ec, f) (((ec)->raised_flag & (f)) != 0)
264
+ #define rb_ec_raised_clear(ec) ((ec)->raised_flag = 0)
265
+ int rb_ec_set_raised(rb_execution_context_t *ec);
266
+ int rb_ec_reset_raised(rb_execution_context_t *ec);
267
+ int rb_ec_stack_check(rb_execution_context_t *ec);
268
+
269
+ VALUE rb_f_eval(int argc, const VALUE *argv, VALUE self);
270
+ VALUE rb_make_exception(int argc, const VALUE *argv);
271
+
272
+ NORETURN(void rb_method_name_error(VALUE, VALUE));
273
+
274
+ NORETURN(void rb_fiber_start(void));
275
+
276
+ NORETURN(void rb_print_undef(VALUE, ID, rb_method_visibility_t));
277
+ NORETURN(void rb_print_undef_str(VALUE, VALUE));
278
+ NORETURN(void rb_print_inaccessible(VALUE, ID, rb_method_visibility_t));
279
+ NORETURN(void rb_vm_localjump_error(const char *,VALUE, int));
280
+ NORETURN(void rb_vm_jump_tag_but_local_jump(int));
281
+
282
+ VALUE rb_vm_make_jump_tag_but_local_jump(int state, VALUE val);
283
+ rb_cref_t *rb_vm_cref(void);
284
+ rb_cref_t *rb_vm_cref_replace_with_duplicated_cref(void);
285
+ VALUE rb_vm_call_cfunc(VALUE recv, VALUE (*func)(VALUE), VALUE arg, VALUE block_handler, VALUE filename);
286
+ void rb_vm_set_progname(VALUE filename);
287
+ void rb_thread_terminate_all(void);
288
+ VALUE rb_vm_cbase(void);
289
+
290
+ /* vm_backtrace.c */
291
+ VALUE rb_ec_backtrace_object(const rb_execution_context_t *ec);
292
+ VALUE rb_ec_backtrace_str_ary(const rb_execution_context_t *ec, long lev, long n);
293
+
294
+ #ifndef CharNext /* defined as CharNext[AW] on Windows. */
295
+ # ifdef HAVE_MBLEN
296
+ # define CharNext(p) ((p) + mblen((p), RUBY_MBCHAR_MAXSIZE))
297
+ # else
298
+ # define CharNext(p) ((p) + 1)
299
+ # endif
300
+ #endif
301
+
302
+ #if defined DOSISH || defined __CYGWIN__
303
+ static inline void
304
+ translit_char(char *p, int from, int to)
305
+ {
306
+ while (*p) {
307
+ if ((unsigned char)*p == from)
308
+ *p = to;
309
+ p = CharNext(p);
310
+ }
311
+ }
312
+ #endif
313
+
314
+ #endif /* RUBY_EVAL_INTERN_H */
@@ -0,0 +1,129 @@
1
+
2
+ #ifndef RUBY_GC_H
3
+ #define RUBY_GC_H 1
4
+
5
+ #if defined(__x86_64__) && !defined(_ILP32) && defined(__GNUC__)
6
+ #define SET_MACHINE_STACK_END(p) __asm__ __volatile__ ("movq\t%%rsp, %0" : "=r" (*(p)))
7
+ #elif defined(__i386) && defined(__GNUC__)
8
+ #define SET_MACHINE_STACK_END(p) __asm__ __volatile__ ("movl\t%%esp, %0" : "=r" (*(p)))
9
+ #else
10
+ NOINLINE(void rb_gc_set_stack_end(VALUE **stack_end_p));
11
+ #define SET_MACHINE_STACK_END(p) rb_gc_set_stack_end(p)
12
+ #define USE_CONSERVATIVE_STACK_END
13
+ #endif
14
+
15
+ /* for GC debug */
16
+
17
+ #ifndef RUBY_MARK_FREE_DEBUG
18
+ #define RUBY_MARK_FREE_DEBUG 0
19
+ #endif
20
+
21
+ #if RUBY_MARK_FREE_DEBUG
22
+ extern int ruby_gc_debug_indent;
23
+
24
+ static inline void
25
+ rb_gc_debug_indent(void)
26
+ {
27
+ printf("%*s", ruby_gc_debug_indent, "");
28
+ }
29
+
30
+ static inline void
31
+ rb_gc_debug_body(const char *mode, const char *msg, int st, void *ptr)
32
+ {
33
+ if (st == 0) {
34
+ ruby_gc_debug_indent--;
35
+ }
36
+ rb_gc_debug_indent();
37
+ printf("%s: %s %s (%p)\n", mode, st ? "->" : "<-", msg, ptr);
38
+
39
+ if (st) {
40
+ ruby_gc_debug_indent++;
41
+ }
42
+
43
+ fflush(stdout);
44
+ }
45
+
46
+ #define RUBY_MARK_ENTER(msg) rb_gc_debug_body("mark", (msg), 1, ptr)
47
+ #define RUBY_MARK_LEAVE(msg) rb_gc_debug_body("mark", (msg), 0, ptr)
48
+ #define RUBY_FREE_ENTER(msg) rb_gc_debug_body("free", (msg), 1, ptr)
49
+ #define RUBY_FREE_LEAVE(msg) rb_gc_debug_body("free", (msg), 0, ptr)
50
+ #define RUBY_GC_INFO rb_gc_debug_indent(); printf
51
+
52
+ #else
53
+ #define RUBY_MARK_ENTER(msg)
54
+ #define RUBY_MARK_LEAVE(msg)
55
+ #define RUBY_FREE_ENTER(msg)
56
+ #define RUBY_FREE_LEAVE(msg)
57
+ #define RUBY_GC_INFO if(0)printf
58
+ #endif
59
+
60
+ #define RUBY_MARK_NO_PIN_UNLESS_NULL(ptr) do { \
61
+ VALUE markobj = (ptr); \
62
+ if (RTEST(markobj)) {rb_gc_mark_movable(markobj);} \
63
+ } while (0)
64
+ #define RUBY_MARK_UNLESS_NULL(ptr) do { \
65
+ VALUE markobj = (ptr); \
66
+ if (RTEST(markobj)) {rb_gc_mark(markobj);} \
67
+ } while (0)
68
+ #define RUBY_FREE_UNLESS_NULL(ptr) if(ptr){ruby_xfree(ptr);(ptr)=NULL;}
69
+
70
+ #if STACK_GROW_DIRECTION > 0
71
+ # define STACK_UPPER(x, a, b) (a)
72
+ #elif STACK_GROW_DIRECTION < 0
73
+ # define STACK_UPPER(x, a, b) (b)
74
+ #else
75
+ RUBY_EXTERN int ruby_stack_grow_direction;
76
+ int ruby_get_stack_grow_direction(volatile VALUE *addr);
77
+ # define stack_growup_p(x) ( \
78
+ (ruby_stack_grow_direction ? \
79
+ ruby_stack_grow_direction : \
80
+ ruby_get_stack_grow_direction(x)) > 0)
81
+ # define STACK_UPPER(x, a, b) (stack_growup_p(x) ? (a) : (b))
82
+ #endif
83
+
84
+ /*
85
+ STACK_GROW_DIR_DETECTION is used with STACK_DIR_UPPER.
86
+
87
+ On most normal systems, stacks grow from high address to lower address. In
88
+ this case, STACK_DIR_UPPER(a, b) will return (b), but on exotic systems where
89
+ the stack grows UP (from low address to high address), it will return (a).
90
+ */
91
+
92
+ #if STACK_GROW_DIRECTION
93
+ #define STACK_GROW_DIR_DETECTION
94
+ #define STACK_DIR_UPPER(a,b) STACK_UPPER(0, (a), (b))
95
+ #else
96
+ #define STACK_GROW_DIR_DETECTION VALUE stack_grow_dir_detection
97
+ #define STACK_DIR_UPPER(a,b) STACK_UPPER(&stack_grow_dir_detection, (a), (b))
98
+ #endif
99
+ #define IS_STACK_DIR_UPPER() STACK_DIR_UPPER(1,0)
100
+
101
+ const char *rb_obj_info(VALUE obj);
102
+ const char *rb_raw_obj_info(char *buff, const int buff_size, VALUE obj);
103
+
104
+ VALUE rb_gc_disable_no_rest(void);
105
+
106
+ struct rb_thread_struct;
107
+
108
+ RUBY_SYMBOL_EXPORT_BEGIN
109
+
110
+ /* exports for objspace module */
111
+ size_t rb_objspace_data_type_memsize(VALUE obj);
112
+ void rb_objspace_reachable_objects_from(VALUE obj, void (func)(VALUE, void *), void *data);
113
+ void rb_objspace_reachable_objects_from_root(void (func)(const char *category, VALUE, void *), void *data);
114
+ int rb_objspace_markable_object_p(VALUE obj);
115
+ int rb_objspace_internal_object_p(VALUE obj);
116
+ int rb_objspace_marked_object_p(VALUE obj);
117
+ int rb_objspace_garbage_object_p(VALUE obj);
118
+
119
+ void rb_objspace_each_objects(
120
+ int (*callback)(void *start, void *end, size_t stride, void *data),
121
+ void *data);
122
+
123
+ void rb_objspace_each_objects_without_setup(
124
+ int (*callback)(void *, void *, size_t, void *),
125
+ void *data);
126
+
127
+ RUBY_SYMBOL_EXPORT_END
128
+
129
+ #endif /* RUBY_GC_H */