datadog-ruby_core_source 3.5.4 → 3.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/datadog-ruby_core_source.gemspec +1 -1
  3. data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/ccan/build_assert/build_assert.h +40 -0
  4. data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/ccan/check_type/check_type.h +63 -0
  5. data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/ccan/container_of/container_of.h +142 -0
  6. data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/ccan/list/list.h +788 -0
  7. data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/ccan/str/str.h +16 -0
  8. data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/id.h +252 -0
  9. data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/internal.h +2465 -0
  10. data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/iseq.h +304 -0
  11. data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/method.h +229 -0
  12. data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/node.h +449 -0
  13. data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/ruby_assert.h +60 -0
  14. data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/ruby_atomic.h +244 -0
  15. data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/thread_pthread.h +75 -0
  16. data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/thread_win32.h +36 -0
  17. data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/vm_core.h +1902 -0
  18. data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/vm_opts.h +70 -0
  19. data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/ccan/build_assert/build_assert.h +40 -0
  20. data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/ccan/check_type/check_type.h +63 -0
  21. data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/ccan/container_of/container_of.h +142 -0
  22. data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/ccan/list/list.h +788 -0
  23. data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/ccan/str/str.h +16 -0
  24. data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/id.h +290 -0
  25. data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/internal.h +2697 -0
  26. data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/iseq.h +312 -0
  27. data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/method.h +229 -0
  28. data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/node.h +476 -0
  29. data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/ruby_assert.h +15 -0
  30. data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/ruby_atomic.h +244 -0
  31. data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/thread_pthread.h +75 -0
  32. data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/thread_win32.h +36 -0
  33. data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/vm_core.h +1968 -0
  34. data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/vm_opts.h +72 -0
  35. data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/ccan/build_assert/build_assert.h +40 -0
  36. data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/ccan/check_type/check_type.h +63 -0
  37. data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/ccan/container_of/container_of.h +142 -0
  38. data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/ccan/list/list.h +788 -0
  39. data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/ccan/str/str.h +16 -0
  40. data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/id.h +290 -0
  41. data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/id_table.h +36 -0
  42. data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/internal/array.h +119 -0
  43. data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/internal/class.h +174 -0
  44. data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/internal/compilers.h +108 -0
  45. data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/internal/gc.h +161 -0
  46. data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/internal/imemo.h +243 -0
  47. data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/internal/serial.h +24 -0
  48. data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/internal/static_assert.h +17 -0
  49. data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/internal/vm.h +136 -0
  50. data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/internal/warnings.h +17 -0
  51. data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/internal.h +107 -0
  52. data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/iseq.h +305 -0
  53. data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/method.h +245 -0
  54. data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/node.h +484 -0
  55. data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/ractor_core.h +343 -0
  56. data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/ruby_assert.h +15 -0
  57. data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/ruby_atomic.h +23 -0
  58. data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/thread_pthread.h +115 -0
  59. data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/thread_win32.h +61 -0
  60. data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/vm_core.h +2023 -0
  61. data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/vm_debug.h +116 -0
  62. data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/vm_opts.h +73 -0
  63. data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/ccan/build_assert/build_assert.h +40 -0
  64. data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/ccan/check_type/check_type.h +63 -0
  65. data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/ccan/container_of/container_of.h +142 -0
  66. data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/ccan/list/list.h +788 -0
  67. data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/ccan/str/str.h +16 -0
  68. data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/darray.h +198 -0
  69. data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/id.h +293 -0
  70. data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/id_table.h +36 -0
  71. data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/internal/array.h +113 -0
  72. data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/internal/class.h +196 -0
  73. data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/internal/compilers.h +107 -0
  74. data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/internal/gc.h +186 -0
  75. data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/internal/imemo.h +243 -0
  76. data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/internal/serial.h +23 -0
  77. data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/internal/static_assert.h +16 -0
  78. data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/internal/vm.h +133 -0
  79. data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/internal/warnings.h +16 -0
  80. data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/internal.h +109 -0
  81. data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/iseq.h +322 -0
  82. data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/method.h +253 -0
  83. data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/node.h +510 -0
  84. data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/ractor_core.h +346 -0
  85. data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/ruby_assert.h +14 -0
  86. data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/ruby_atomic.h +23 -0
  87. data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/thread_pthread.h +115 -0
  88. data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/vm_core.h +2107 -0
  89. data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/vm_debug.h +124 -0
  90. data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/vm_opts.h +73 -0
  91. data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/ccan/build_assert/build_assert.h +40 -0
  92. data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/ccan/check_type/check_type.h +63 -0
  93. data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/ccan/container_of/container_of.h +142 -0
  94. data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/ccan/list/list.h +789 -0
  95. data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/ccan/str/str.h +17 -0
  96. data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/id.h +299 -0
  97. data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/id_table.h +39 -0
  98. data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/internal/array.h +163 -0
  99. data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/internal/basic_operators.h +64 -0
  100. data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/internal/class.h +182 -0
  101. data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/internal/compilers.h +107 -0
  102. data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/internal/gc.h +192 -0
  103. data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/internal/imemo.h +242 -0
  104. data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/internal/serial.h +23 -0
  105. data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/internal/static_assert.h +16 -0
  106. data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/internal/vm.h +134 -0
  107. data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/internal/warnings.h +16 -0
  108. data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/internal.h +113 -0
  109. data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/iseq.h +329 -0
  110. data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/method.h +254 -0
  111. data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/node.h +514 -0
  112. data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/ractor_core.h +342 -0
  113. data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/ruby_assert.h +14 -0
  114. data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/ruby_atomic.h +23 -0
  115. data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/shape.h +232 -0
  116. data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/thread_none.h +20 -0
  117. data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/thread_pthread.h +133 -0
  118. data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/vm_core.h +2106 -0
  119. data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/vm_debug.h +122 -0
  120. data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/vm_opts.h +73 -0
  121. data/lib/datadog/ruby_core_source/version.rb +1 -1
  122. metadata +122 -4
@@ -0,0 +1,243 @@
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_tmp_new_fill */
14
+ #include "internal/gc.h" /* for RB_OBJ_WRITE */
15
+ #include "ruby/internal/stdbool.h" /* for bool */
16
+ #include "ruby/ruby.h" /* for rb_block_call_func_t */
17
+
18
+ #ifndef IMEMO_DEBUG
19
+ # define IMEMO_DEBUG 0
20
+ #endif
21
+
22
+ #define IMEMO_MASK 0x0f
23
+
24
+ /* FL_USER0 to FL_USER3 is for type */
25
+ #define IMEMO_FL_USHIFT (FL_USHIFT + 4)
26
+ #define IMEMO_FL_USER0 FL_USER4
27
+ #define IMEMO_FL_USER1 FL_USER5
28
+ #define IMEMO_FL_USER2 FL_USER6
29
+ #define IMEMO_FL_USER3 FL_USER7
30
+ #define IMEMO_FL_USER4 FL_USER8
31
+ #define IMEMO_FL_USER5 FL_USER9
32
+
33
+ enum imemo_type {
34
+ imemo_env = 0,
35
+ imemo_cref = 1, /*!< class reference */
36
+ imemo_svar = 2, /*!< special variable */
37
+ imemo_throw_data = 3,
38
+ imemo_ifunc = 4, /*!< iterator function */
39
+ imemo_memo = 5,
40
+ imemo_ment = 6,
41
+ imemo_iseq = 7,
42
+ imemo_tmpbuf = 8,
43
+ imemo_ast = 9,
44
+ imemo_parser_strterm = 10,
45
+ imemo_callinfo = 11,
46
+ imemo_callcache = 12,
47
+ imemo_constcache = 13,
48
+ };
49
+
50
+ /* CREF (Class REFerence) is defined in method.h */
51
+
52
+ /*! SVAR (Special VARiable) */
53
+ struct vm_svar {
54
+ VALUE flags;
55
+ const VALUE cref_or_me; /*!< class reference or rb_method_entry_t */
56
+ const VALUE lastline;
57
+ const VALUE backref;
58
+ const VALUE others;
59
+ };
60
+
61
+ /*! THROW_DATA */
62
+ struct vm_throw_data {
63
+ VALUE flags;
64
+ VALUE reserved;
65
+ const VALUE throw_obj;
66
+ const struct rb_control_frame_struct *catch_frame;
67
+ int throw_state;
68
+ };
69
+
70
+ #define THROW_DATA_CONSUMED IMEMO_FL_USER0
71
+
72
+ /* IFUNC (Internal FUNCtion) */
73
+
74
+ struct vm_ifunc_argc {
75
+ #if SIZEOF_INT * 2 > SIZEOF_VALUE
76
+ signed int min: (SIZEOF_VALUE * CHAR_BIT) / 2;
77
+ signed int max: (SIZEOF_VALUE * CHAR_BIT) / 2;
78
+ #else
79
+ int min, max;
80
+ #endif
81
+ };
82
+
83
+ /*! IFUNC (Internal FUNCtion) */
84
+ struct vm_ifunc {
85
+ VALUE flags;
86
+ VALUE reserved;
87
+ rb_block_call_func_t func;
88
+ const void *data;
89
+ struct vm_ifunc_argc argc;
90
+ };
91
+
92
+ struct rb_imemo_tmpbuf_struct {
93
+ VALUE flags;
94
+ VALUE reserved;
95
+ VALUE *ptr; /* malloc'ed buffer */
96
+ struct rb_imemo_tmpbuf_struct *next; /* next imemo */
97
+ size_t cnt; /* buffer size in VALUE */
98
+ };
99
+
100
+ /*! MEMO
101
+ *
102
+ * @see imemo_type
103
+ * */
104
+ struct MEMO {
105
+ VALUE flags;
106
+ VALUE reserved;
107
+ const VALUE v1;
108
+ const VALUE v2;
109
+ union {
110
+ long cnt;
111
+ long state;
112
+ const VALUE value;
113
+ void (*func)(void);
114
+ } u3;
115
+ };
116
+
117
+ /* ment is in method.h */
118
+
119
+ #define THROW_DATA_P(err) imemo_throw_data_p((VALUE)err)
120
+ #define MEMO_CAST(m) ((struct MEMO *)(m))
121
+ #define MEMO_NEW(a, b, c) ((struct MEMO *)rb_imemo_new(imemo_memo, (VALUE)(a), (VALUE)(b), (VALUE)(c), 0))
122
+ #define MEMO_FOR(type, value) ((type *)RARRAY_PTR(value))
123
+ #define NEW_MEMO_FOR(type, value) \
124
+ ((value) = rb_ary_tmp_new_fill(type_roomof(type, VALUE)), MEMO_FOR(type, value))
125
+ #define NEW_PARTIAL_MEMO_FOR(type, value, member) \
126
+ ((value) = rb_ary_tmp_new_fill(type_roomof(type, VALUE)), \
127
+ rb_ary_set_len((value), offsetof(type, member) / sizeof(VALUE)), \
128
+ MEMO_FOR(type, value))
129
+
130
+ typedef struct rb_imemo_tmpbuf_struct rb_imemo_tmpbuf_t;
131
+ VALUE rb_imemo_new(enum imemo_type type, VALUE v1, VALUE v2, VALUE v3, VALUE v0);
132
+ rb_imemo_tmpbuf_t *rb_imemo_tmpbuf_parser_heap(void *buf, rb_imemo_tmpbuf_t *old_heap, size_t cnt);
133
+ struct vm_ifunc *rb_vm_ifunc_new(rb_block_call_func_t func, const void *data, int min_argc, int max_argc);
134
+ void rb_strterm_mark(VALUE obj);
135
+ static inline enum imemo_type imemo_type(VALUE imemo);
136
+ static inline int imemo_type_p(VALUE imemo, enum imemo_type imemo_type);
137
+ static inline bool imemo_throw_data_p(VALUE imemo);
138
+ static inline struct vm_ifunc *rb_vm_ifunc_proc_new(rb_block_call_func_t func, const void *data);
139
+ static inline VALUE rb_imemo_tmpbuf_auto_free_pointer(void);
140
+ static inline void *RB_IMEMO_TMPBUF_PTR(VALUE v);
141
+ static inline void *rb_imemo_tmpbuf_set_ptr(VALUE v, void *ptr);
142
+ static inline VALUE rb_imemo_tmpbuf_auto_free_pointer_new_from_an_RString(VALUE str);
143
+ static inline void MEMO_V1_SET(struct MEMO *m, VALUE v);
144
+ static inline void MEMO_V2_SET(struct MEMO *m, VALUE v);
145
+
146
+ RUBY_SYMBOL_EXPORT_BEGIN
147
+ #if IMEMO_DEBUG
148
+ VALUE rb_imemo_new_debug(enum imemo_type type, VALUE v1, VALUE v2, VALUE v3, VALUE v0, const char *file, int line);
149
+ #define rb_imemo_new(type, v1, v2, v3, v0) rb_imemo_new_debug(type, v1, v2, v3, v0, __FILE__, __LINE__)
150
+ #else
151
+ VALUE rb_imemo_new(enum imemo_type type, VALUE v1, VALUE v2, VALUE v3, VALUE v0);
152
+ #endif
153
+ const char *rb_imemo_name(enum imemo_type type);
154
+ RUBY_SYMBOL_EXPORT_END
155
+
156
+ static inline enum imemo_type
157
+ imemo_type(VALUE imemo)
158
+ {
159
+ return (RBASIC(imemo)->flags >> FL_USHIFT) & IMEMO_MASK;
160
+ }
161
+
162
+ static inline int
163
+ imemo_type_p(VALUE imemo, enum imemo_type imemo_type)
164
+ {
165
+ if (LIKELY(!RB_SPECIAL_CONST_P(imemo))) {
166
+ /* fixed at compile time if imemo_type is given. */
167
+ const VALUE mask = (IMEMO_MASK << FL_USHIFT) | RUBY_T_MASK;
168
+ const VALUE expected_type = (imemo_type << FL_USHIFT) | T_IMEMO;
169
+ /* fixed at runtime. */
170
+ return expected_type == (RBASIC(imemo)->flags & mask);
171
+ }
172
+ else {
173
+ return 0;
174
+ }
175
+ }
176
+
177
+ #define IMEMO_TYPE_P(v, t) imemo_type_p((VALUE)v, t)
178
+
179
+ static inline bool
180
+ imemo_throw_data_p(VALUE imemo)
181
+ {
182
+ return RB_TYPE_P(imemo, T_IMEMO);
183
+ }
184
+
185
+ static inline struct vm_ifunc *
186
+ rb_vm_ifunc_proc_new(rb_block_call_func_t func, const void *data)
187
+ {
188
+ return rb_vm_ifunc_new(func, data, 0, UNLIMITED_ARGUMENTS);
189
+ }
190
+
191
+ static inline VALUE
192
+ rb_imemo_tmpbuf_auto_free_pointer(void)
193
+ {
194
+ return rb_imemo_new(imemo_tmpbuf, 0, 0, 0, 0);
195
+ }
196
+
197
+ static inline void *
198
+ RB_IMEMO_TMPBUF_PTR(VALUE v)
199
+ {
200
+ const struct rb_imemo_tmpbuf_struct *p = (const void *)v;
201
+ return p->ptr;
202
+ }
203
+
204
+ static inline void *
205
+ rb_imemo_tmpbuf_set_ptr(VALUE v, void *ptr)
206
+ {
207
+ return ((rb_imemo_tmpbuf_t *)v)->ptr = ptr;
208
+ }
209
+
210
+ static inline VALUE
211
+ rb_imemo_tmpbuf_auto_free_pointer_new_from_an_RString(VALUE str)
212
+ {
213
+ const void *src;
214
+ VALUE imemo;
215
+ rb_imemo_tmpbuf_t *tmpbuf;
216
+ void *dst;
217
+ size_t len;
218
+
219
+ SafeStringValue(str);
220
+ /* create tmpbuf to keep the pointer before xmalloc */
221
+ imemo = rb_imemo_tmpbuf_auto_free_pointer();
222
+ tmpbuf = (rb_imemo_tmpbuf_t *)imemo;
223
+ len = RSTRING_LEN(str);
224
+ src = RSTRING_PTR(str);
225
+ dst = ruby_xmalloc(len);
226
+ memcpy(dst, src, len);
227
+ tmpbuf->ptr = dst;
228
+ return imemo;
229
+ }
230
+
231
+ static inline void
232
+ MEMO_V1_SET(struct MEMO *m, VALUE v)
233
+ {
234
+ RB_OBJ_WRITE(m, &m->v1, v);
235
+ }
236
+
237
+ static inline void
238
+ MEMO_V2_SET(struct MEMO *m, VALUE v)
239
+ {
240
+ RB_OBJ_WRITE(m, &m->v2, v);
241
+ }
242
+
243
+ #endif /* INTERNAL_IMEMO_H */
@@ -0,0 +1,23 @@
1
+ #ifndef INTERNAL_SERIAL_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_SERIAL_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 rb_serial_t.
10
+ */
11
+ #include "ruby/internal/config.h" /* for HAVE_LONG_LONG */
12
+ #include "ruby/defines.h" /* for LONG_LONG */
13
+
14
+ #ifndef HAVE_LONG_LONG
15
+ # error need C99+
16
+ #endif
17
+
18
+ typedef unsigned LONG_LONG rb_serial_t;
19
+ #define SERIALT2NUM ULL2NUM
20
+ #define PRI_SERIALT_PREFIX PRI_LL_PREFIX
21
+ #define SIZEOF_SERIAL_T SIZEOF_LONG_LONG
22
+
23
+ #endif /* INTERNAL_SERIAL_H */
@@ -0,0 +1,16 @@
1
+ #ifndef INTERNAL_STATIC_ASSERT_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_STATIC_ASSERT_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 C11 shim for _Static_assert.
10
+ */
11
+ #include "ruby/internal/static_assert.h"
12
+ #ifndef STATIC_ASSERT
13
+ # define STATIC_ASSERT RBIMPL_STATIC_ASSERT
14
+ #endif
15
+
16
+ #endif /* INTERNAL_STATIC_ASSERT_H */
@@ -0,0 +1,133 @@
1
+ #ifndef INTERNAL_VM_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_VM_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 RubyVM.
10
+ */
11
+ #include "ruby/internal/stdbool.h" /* for bool */
12
+ #include "internal/serial.h" /* for rb_serial_t */
13
+ #include "internal/static_assert.h" /* for STATIC_ASSERT */
14
+ #include "ruby/ruby.h" /* for ID */
15
+ #include "ruby/st.h" /* for st_table */
16
+
17
+ #ifdef rb_funcallv
18
+ # undef rb_funcallv
19
+ #endif
20
+
21
+ #ifdef rb_method_basic_definition_p
22
+ # undef rb_method_basic_definition_p
23
+ #endif
24
+
25
+ struct rb_callable_method_entry_struct; /* in method.h */
26
+ struct rb_method_definition_struct; /* in method.h */
27
+ struct rb_execution_context_struct; /* in vm_core.h */
28
+ struct rb_control_frame_struct; /* in vm_core.h */
29
+ struct rb_callinfo; /* in vm_core.h */
30
+
31
+ enum method_missing_reason {
32
+ MISSING_NOENTRY = 0x00,
33
+ MISSING_PRIVATE = 0x01,
34
+ MISSING_PROTECTED = 0x02,
35
+ MISSING_FCALL = 0x04,
36
+ MISSING_VCALL = 0x08,
37
+ MISSING_SUPER = 0x10,
38
+ MISSING_MISSING = 0x20,
39
+ MISSING_NONE = 0x40
40
+ };
41
+
42
+ /* vm_insnhelper.h */
43
+ rb_serial_t rb_next_class_serial(void);
44
+
45
+ /* vm.c */
46
+ VALUE rb_obj_is_thread(VALUE obj);
47
+ void rb_vm_mark(void *ptr);
48
+ void rb_vm_each_stack_value(void *ptr, void (*cb)(VALUE, void*), void *ctx);
49
+ PUREFUNC(VALUE rb_vm_top_self(void));
50
+ void rb_vm_inc_const_missing_count(void);
51
+ const void **rb_vm_get_insns_address_table(void);
52
+ VALUE rb_source_location(int *pline);
53
+ const char *rb_source_location_cstr(int *pline);
54
+ MJIT_STATIC void rb_vm_pop_cfunc_frame(void);
55
+ int rb_vm_add_root_module(VALUE module);
56
+ void rb_vm_check_redefinition_by_prepend(VALUE klass);
57
+ int rb_vm_check_optimizable_mid(VALUE mid);
58
+ VALUE rb_yield_refine_block(VALUE refinement, VALUE refinements);
59
+ MJIT_STATIC VALUE ruby_vm_special_exception_copy(VALUE);
60
+ PUREFUNC(st_table *rb_vm_fstring_table(void));
61
+
62
+ MJIT_SYMBOL_EXPORT_BEGIN
63
+ VALUE vm_exec(struct rb_execution_context_struct *, bool); /* used in JIT-ed code */
64
+ MJIT_SYMBOL_EXPORT_END
65
+
66
+ /* vm_eval.c */
67
+ VALUE rb_current_realfilepath(void);
68
+ VALUE rb_check_block_call(VALUE, ID, int, const VALUE *, rb_block_call_func_t, VALUE);
69
+ typedef void rb_check_funcall_hook(int, VALUE, ID, int, const VALUE *, VALUE);
70
+ VALUE rb_check_funcall_with_hook(VALUE recv, ID mid, int argc, const VALUE *argv,
71
+ rb_check_funcall_hook *hook, VALUE arg);
72
+ VALUE rb_check_funcall_with_hook_kw(VALUE recv, ID mid, int argc, const VALUE *argv,
73
+ rb_check_funcall_hook *hook, VALUE arg, int kw_splat);
74
+ const char *rb_type_str(enum ruby_value_type type);
75
+ VALUE rb_check_funcall_default(VALUE, ID, int, const VALUE *, VALUE);
76
+ VALUE rb_check_funcall_basic_kw(VALUE, ID, VALUE, int, const VALUE*, int);
77
+ VALUE rb_yield_1(VALUE val);
78
+ VALUE rb_yield_force_blockarg(VALUE values);
79
+ VALUE rb_lambda_call(VALUE obj, ID mid, int argc, const VALUE *argv,
80
+ rb_block_call_func_t bl_proc, int min_argc, int max_argc,
81
+ VALUE data2);
82
+ void rb_check_stack_overflow(void);
83
+
84
+ /* vm_insnhelper.c */
85
+ VALUE rb_equal_opt(VALUE obj1, VALUE obj2);
86
+ VALUE rb_eql_opt(VALUE obj1, VALUE obj2);
87
+
88
+ struct rb_iseq_struct;
89
+ MJIT_SYMBOL_EXPORT_BEGIN
90
+ const struct rb_callcache *rb_vm_search_method_slowpath(const struct rb_callinfo *ci, VALUE klass);
91
+ MJIT_SYMBOL_EXPORT_END
92
+
93
+ /* vm_method.c */
94
+ struct rb_execution_context_struct;
95
+ MJIT_SYMBOL_EXPORT_BEGIN
96
+ int rb_ec_obj_respond_to(struct rb_execution_context_struct *ec, VALUE obj, ID id, int priv);
97
+ MJIT_SYMBOL_EXPORT_END
98
+
99
+ /* vm_dump.c */
100
+ void rb_print_backtrace(void);
101
+
102
+ /* vm_backtrace.c */
103
+ VALUE rb_vm_thread_backtrace(int argc, const VALUE *argv, VALUE thval);
104
+ VALUE rb_vm_thread_backtrace_locations(int argc, const VALUE *argv, VALUE thval);
105
+ VALUE rb_vm_backtrace(int argc, const VALUE * argv, struct rb_execution_context_struct * ec);
106
+ VALUE rb_vm_backtrace_locations(int argc, const VALUE * argv, struct rb_execution_context_struct * ec);
107
+ VALUE rb_make_backtrace(void);
108
+ void rb_backtrace_print_as_bugreport(void);
109
+ int rb_backtrace_p(VALUE obj);
110
+ VALUE rb_backtrace_to_str_ary(VALUE obj);
111
+ VALUE rb_backtrace_to_location_ary(VALUE obj);
112
+ void rb_backtrace_each(VALUE (*iter)(VALUE recv, VALUE str), VALUE output);
113
+ int rb_frame_info_p(VALUE obj);
114
+ int rb_get_node_id_from_frame_info(VALUE obj);
115
+ const struct rb_iseq_struct *rb_get_iseq_from_frame_info(VALUE obj);
116
+
117
+ MJIT_SYMBOL_EXPORT_BEGIN
118
+ VALUE rb_ec_backtrace_object(const struct rb_execution_context_struct *ec);
119
+ void rb_backtrace_use_iseq_first_lineno_for_last_location(VALUE self);
120
+ MJIT_SYMBOL_EXPORT_END
121
+
122
+ #define RUBY_DTRACE_CREATE_HOOK(name, arg) \
123
+ RUBY_DTRACE_HOOK(name##_CREATE, arg)
124
+ #define RUBY_DTRACE_HOOK(name, arg) \
125
+ do { \
126
+ if (UNLIKELY(RUBY_DTRACE_##name##_ENABLED())) { \
127
+ int dtrace_line; \
128
+ const char *dtrace_file = rb_source_location_cstr(&dtrace_line); \
129
+ if (!dtrace_file) dtrace_file = ""; \
130
+ RUBY_DTRACE_##name(arg, dtrace_file, dtrace_line); \
131
+ } \
132
+ } while (0)
133
+ #endif /* INTERNAL_VM_H */
@@ -0,0 +1,16 @@
1
+ #ifndef INTERNAL_WARNINGS_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_WARNINGS_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 to suppress / mandate warnings.
10
+ */
11
+ #include "ruby/internal/warning_push.h"
12
+ #define COMPILER_WARNING_PUSH RBIMPL_WARNING_PUSH()
13
+ #define COMPILER_WARNING_POP RBIMPL_WARNING_POP()
14
+ #define COMPILER_WARNING_ERROR(flag) RBIMPL_WARNING_ERROR(flag)
15
+ #define COMPILER_WARNING_IGNORED(flag) RBIMPL_WARNING_IGNORED(flag)
16
+ #endif /* INTERNAL_WARNINGS_H */
@@ -0,0 +1,109 @@
1
+ #ifndef RUBY_INTERNAL_H /*-*-C-*-vi:se ft=c:*/
2
+ #define RUBY_INTERNAL_H 1
3
+ /**
4
+ * @author $Author$
5
+ * @date Tue May 17 11:42:20 JST 2011
6
+ * @copyright Copyright (C) 2011 Yukihiro Matsumoto
7
+ * @copyright This file is a part of the programming language Ruby.
8
+ * Permission is hereby granted, to either redistribute and/or
9
+ * modify this file, provided that the conditions mentioned in the
10
+ * file COPYING are met. Consult the file for details.
11
+ */
12
+ #include "ruby/internal/config.h"
13
+
14
+ #ifdef __cplusplus
15
+ # error not for C++
16
+ #endif
17
+
18
+ #define LIKELY(x) RB_LIKELY(x)
19
+ #define UNLIKELY(x) RB_UNLIKELY(x)
20
+
21
+ #define numberof(array) ((int)(sizeof(array) / sizeof((array)[0])))
22
+ #define roomof(x, y) (((x) + (y) - 1) / (y))
23
+ #define type_roomof(x, y) roomof(sizeof(x), sizeof(y))
24
+
25
+ /* Prevent compiler from reordering access */
26
+ #define ACCESS_ONCE(type,x) (*((volatile type *)&(x)))
27
+
28
+ #include "ruby/ruby.h"
29
+
30
+ /* Following macros were formerly defined in this header but moved to somewhere
31
+ * else. In order to detect them we undef here. */
32
+
33
+ /* internal/array.h */
34
+ #undef RARRAY_AREF
35
+
36
+ /* internal/class.h */
37
+ #undef RClass
38
+ #undef RCLASS_SUPER
39
+
40
+ /* internal/gc.h */
41
+ #undef NEWOBJ_OF
42
+ #undef RB_NEWOBJ_OF
43
+ #undef RB_OBJ_WRITE
44
+
45
+ /* internal/hash.h */
46
+ #undef RHASH_IFNONE
47
+ #undef RHASH_SIZE
48
+ #undef RHASH_TBL
49
+ #undef RHASH_EMPTY_P
50
+
51
+ /* internal/object.h */
52
+ #undef ROBJECT_IV_INDEX_TBL
53
+
54
+ /* internal/struct.h */
55
+ #undef RSTRUCT_LEN
56
+ #undef RSTRUCT_PTR
57
+ #undef RSTRUCT_SET
58
+ #undef RSTRUCT_GET
59
+
60
+ /* Also, we keep the following macros here. They are expected to be
61
+ * overridden in each headers. */
62
+
63
+ /* internal/array.h */
64
+ #define rb_ary_new_from_args(...) rb_nonexistent_symbol(__VA_ARGS__)
65
+
66
+ /* internal/io.h */
67
+ #define rb_io_fptr_finalize(...) rb_nonexistent_symbol(__VA_ARGS__)
68
+
69
+ /* internal/string.h */
70
+ #define rb_fstring_cstr(...) rb_nonexistent_symbol(__VA_ARGS__)
71
+
72
+ /* internal/symbol.h */
73
+ #define rb_sym_intern_ascii_cstr(...) rb_nonexistent_symbol(__VA_ARGS__)
74
+
75
+ /* internal/vm.h */
76
+ #define rb_funcallv(...) rb_nonexistent_symbol(__VA_ARGS__)
77
+ #define rb_method_basic_definition_p(...) rb_nonexistent_symbol(__VA_ARGS__)
78
+
79
+
80
+ /* MRI debug support */
81
+
82
+ /* gc.c */
83
+ void rb_obj_info_dump(VALUE obj);
84
+ void rb_obj_info_dump_loc(VALUE obj, const char *file, int line, const char *func);
85
+
86
+ /* debug.c */
87
+
88
+ RUBY_SYMBOL_EXPORT_BEGIN
89
+ void ruby_debug_breakpoint(void);
90
+ PRINTF_ARGS(void ruby_debug_printf(const char*, ...), 1, 2);
91
+ RUBY_SYMBOL_EXPORT_END
92
+
93
+ // show obj data structure without any side-effect
94
+ #define rp(obj) rb_obj_info_dump_loc((VALUE)(obj), __FILE__, __LINE__, RUBY_FUNCTION_NAME_STRING)
95
+
96
+ // same as rp, but add message header
97
+ #define rp_m(msg, obj) do { \
98
+ fputs((msg), stderr); \
99
+ rb_obj_info_dump((VALUE)(obj)); \
100
+ } while (0)
101
+
102
+ // `ruby_debug_breakpoint()` does nothing,
103
+ // but breakpoint is set in run.gdb, so `make gdb` can stop here.
104
+ #define bp() ruby_debug_breakpoint()
105
+
106
+ #define RBOOL(v) ((v) ? Qtrue : Qfalse)
107
+ #define RB_BIGNUM_TYPE_P(x) RB_TYPE_P((x), T_BIGNUM)
108
+
109
+ #endif /* RUBY_INTERNAL_H */