debase-ruby_core_source 3.2.1 → 3.2.3

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 (129) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -0
  3. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/addr2line.h +3 -1
  4. data/lib/debase/ruby_core_source/ruby-3.3.0-preview3/darray.h +246 -0
  5. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/debug_counter.h +7 -10
  6. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/eval_intern.h +3 -1
  7. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/id.h +44 -0
  8. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/insns_info.inc +128 -154
  9. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/array.h +9 -20
  10. data/lib/debase/ruby_core_source/ruby-3.3.0-preview3/internal/bits.h +568 -0
  11. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/class.h +11 -2
  12. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/cmdlineopt.h +5 -1
  13. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/compile.h +0 -1
  14. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/error.h +24 -2
  15. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/gc.h +29 -0
  16. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/hash.h +19 -44
  17. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/imemo.h +0 -1
  18. data/lib/debase/ruby_core_source/ruby-3.3.0-preview3/internal/io.h +137 -0
  19. data/lib/debase/ruby_core_source/ruby-3.3.0-preview3/internal/parse.h +108 -0
  20. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/process.h +0 -14
  21. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/range.h +2 -2
  22. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/re.h +1 -1
  23. data/lib/debase/ruby_core_source/ruby-3.3.0-preview3/internal/ruby_parser.h +69 -0
  24. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/signal.h +4 -0
  25. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/string.h +15 -0
  26. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/struct.h +9 -34
  27. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/thread.h +14 -0
  28. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/variable.h +17 -35
  29. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/vm.h +9 -2
  30. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/iseq.h +4 -4
  31. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/method.h +8 -7
  32. data/lib/debase/ruby_core_source/ruby-3.3.0-preview3/node.h +128 -0
  33. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/node_name.inc +4 -2
  34. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/parse.h +19 -6
  35. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1/internal/bits.h → ruby-3.3.0-preview3/parser_bits.h} +4 -4
  36. data/lib/debase/ruby_core_source/ruby-3.3.0-preview3/parser_node.h +32 -0
  37. data/lib/debase/ruby_core_source/ruby-3.3.0-preview3/parser_st.h +162 -0
  38. data/lib/debase/ruby_core_source/ruby-3.3.0-preview3/parser_value.h +106 -0
  39. data/lib/debase/ruby_core_source/ruby-3.3.0-preview3/prism_compile.h +18 -0
  40. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/ractor_core.h +10 -4
  41. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/regint.h +8 -0
  42. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/regparse.h +2 -1
  43. data/lib/debase/ruby_core_source/ruby-3.3.0-preview3/revision.h +5 -0
  44. data/lib/debase/ruby_core_source/ruby-3.3.0-preview3/rubyparser.h +1403 -0
  45. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/shape.h +32 -22
  46. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/symbol.h +2 -3
  47. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/thread_none.h +1 -0
  48. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/thread_pthread.h +66 -28
  49. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/thread_win32.h +1 -6
  50. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/variable.h +9 -2
  51. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/version.h +7 -3
  52. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/vm.inc +383 -497
  53. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/vm_callinfo.h +54 -16
  54. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/vm_core.h +92 -57
  55. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/vm_exec.h +11 -10
  56. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/vm_insnhelper.h +20 -23
  57. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/vm_opts.h +0 -5
  58. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/yjit.h +12 -12
  59. data/lib/debase/ruby_core_source/version.rb +1 -1
  60. metadata +120 -115
  61. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/darray.h +0 -179
  62. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/io.h +0 -38
  63. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/parse.h +0 -25
  64. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/node.h +0 -514
  65. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/opt_sc.inc +0 -109
  66. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/revision.h +0 -5
  67. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/transient_heap.h +0 -65
  68. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/builtin.h +0 -0
  69. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/ccan/build_assert/build_assert.h +0 -0
  70. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/ccan/check_type/check_type.h +0 -0
  71. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/ccan/container_of/container_of.h +0 -0
  72. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/ccan/list/list.h +0 -0
  73. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/ccan/str/str.h +0 -0
  74. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/constant.h +0 -0
  75. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/dln.h +0 -0
  76. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/encindex.h +0 -0
  77. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/hrtime.h +0 -0
  78. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/id_table.h +0 -0
  79. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/insns.inc +0 -0
  80. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/basic_operators.h +0 -0
  81. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/bignum.h +0 -0
  82. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/compar.h +0 -0
  83. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/compilers.h +0 -0
  84. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/complex.h +0 -0
  85. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/cont.h +0 -0
  86. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/dir.h +0 -0
  87. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/enc.h +0 -0
  88. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/encoding.h +0 -0
  89. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/enum.h +0 -0
  90. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/enumerator.h +0 -0
  91. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/eval.h +0 -0
  92. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/file.h +0 -0
  93. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/fixnum.h +0 -0
  94. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/inits.h +0 -0
  95. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/load.h +0 -0
  96. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/loadpath.h +0 -0
  97. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/math.h +0 -0
  98. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/missing.h +0 -0
  99. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/numeric.h +0 -0
  100. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/object.h +0 -0
  101. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/proc.h +0 -0
  102. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/ractor.h +0 -0
  103. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/random.h +0 -0
  104. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/rational.h +0 -0
  105. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/sanitizers.h +0 -0
  106. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/serial.h +0 -0
  107. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/static_assert.h +0 -0
  108. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/symbol.h +0 -0
  109. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/time.h +0 -0
  110. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/transcode.h +0 -0
  111. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/util.h +0 -0
  112. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal/warnings.h +0 -0
  113. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/internal.h +0 -0
  114. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/known_errors.inc +0 -0
  115. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/optinsn.inc +0 -0
  116. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/optunifs.inc +0 -0
  117. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/probes_helper.h +0 -0
  118. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/regenc.h +0 -0
  119. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/rjit.h +0 -0
  120. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/rjit_c.h +0 -0
  121. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/ruby_assert.h +0 -0
  122. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/ruby_atomic.h +0 -0
  123. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/siphash.h +0 -0
  124. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/timev.h +0 -0
  125. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/transcode_data.h +0 -0
  126. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/vm_call_iseq_optimized.inc +0 -0
  127. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/vm_debug.h +0 -0
  128. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/vm_sync.h +0 -0
  129. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview3}/vmtc.inc +0 -0
@@ -29,15 +29,37 @@
29
29
  #define rb_raise_static(e, m) \
30
30
  rb_raise_cstr_i((e), rb_str_new_static((m), rb_strlen_lit(m)))
31
31
  #ifdef RUBY_FUNCTION_NAME_STRING
32
- # define rb_sys_fail_path(path) rb_sys_fail_path_in(RUBY_FUNCTION_NAME_STRING, path)
33
32
  # define rb_syserr_fail_path(err, path) rb_syserr_fail_path_in(RUBY_FUNCTION_NAME_STRING, (err), (path))
34
33
  # define rb_syserr_new_path(err, path) rb_syserr_new_path_in(RUBY_FUNCTION_NAME_STRING, (err), (path))
35
34
  #else
36
- # define rb_sys_fail_path(path) rb_sys_fail_str(path)
37
35
  # define rb_syserr_fail_path(err, path) rb_syserr_fail_str((err), (path))
38
36
  # define rb_syserr_new_path(err, path) rb_syserr_new_str((err), (path))
39
37
  #endif
40
38
 
39
+ #define rb_sys_fail(mesg) \
40
+ do { \
41
+ int errno_to_fail = errno; \
42
+ rb_syserr_fail(errno_to_fail, (mesg)); \
43
+ } while (0)
44
+
45
+ #define rb_sys_fail_str(mesg) \
46
+ do { \
47
+ int errno_to_fail = errno; \
48
+ rb_syserr_fail_str(errno_to_fail, (mesg)); \
49
+ } while (0)
50
+
51
+ #define rb_sys_fail_path(path) \
52
+ do { \
53
+ int errno_to_fail = errno; \
54
+ rb_syserr_fail_path(errno_to_fail, (path)); \
55
+ } while (0)
56
+
57
+ #define rb_sys_fail_sprintf(...) \
58
+ do { \
59
+ int errno_to_fail = errno; \
60
+ rb_syserr_fail_str(errno_to_fail, rb_sprintf("" __VA_ARGS__)); \
61
+ } while (0)
62
+
41
63
  /* error.c */
42
64
  extern long rb_backtrace_length_limit;
43
65
  extern VALUE rb_eEAGAIN;
@@ -189,6 +189,17 @@ struct rb_objspace; /* in vm_core.h */
189
189
  # define SIZE_POOL_COUNT 5
190
190
  #endif
191
191
 
192
+ /* Used in places that could malloc during, which can cause the GC to run. We
193
+ * need to temporarily disable the GC to allow the malloc to happen.
194
+ * Allocating memory during GC is a bad idea, so use this only when absolutely
195
+ * necessary. */
196
+ #define DURING_GC_COULD_MALLOC_REGION_START() \
197
+ assert(rb_during_gc()); \
198
+ VALUE _already_disabled = rb_gc_disable_no_rest()
199
+
200
+ #define DURING_GC_COULD_MALLOC_REGION_END() \
201
+ if (_already_disabled == Qfalse) rb_gc_enable()
202
+
192
203
  typedef struct ractor_newobj_size_pool_cache {
193
204
  struct RVALUE *freelist;
194
205
  struct heap_page *using_page;
@@ -204,6 +215,7 @@ extern VALUE *ruby_initial_gc_stress_ptr;
204
215
  extern int ruby_disable_gc;
205
216
  RUBY_ATTR_MALLOC void *ruby_mimmalloc(size_t size);
206
217
  void ruby_mimfree(void *ptr);
218
+ void rb_gc_prepare_heap(void);
207
219
  void rb_objspace_set_event_hook(const rb_event_flag_t event);
208
220
  VALUE rb_objspace_gc_enable(struct rb_objspace *);
209
221
  VALUE rb_objspace_gc_disable(struct rb_objspace *);
@@ -215,6 +227,7 @@ __attribute__((__alloc_align__(1)))
215
227
  RUBY_ATTR_MALLOC void *rb_aligned_malloc(size_t, size_t) RUBY_ATTR_ALLOC_SIZE((2));
216
228
  size_t rb_size_mul_or_raise(size_t, size_t, VALUE); /* used in compile.c */
217
229
  size_t rb_size_mul_add_or_raise(size_t, size_t, size_t, VALUE); /* used in iseq.h */
230
+ size_t rb_malloc_grow_capa(size_t current_capacity, size_t type_size);
218
231
  RUBY_ATTR_MALLOC void *rb_xmalloc_mul_add(size_t, size_t, size_t);
219
232
  RUBY_ATTR_MALLOC void *rb_xcalloc_mul_add(size_t, size_t, size_t);
220
233
  void *rb_xrealloc_mul_add(const void *, size_t, size_t, size_t);
@@ -234,6 +247,9 @@ VALUE rb_define_finalizer_no_check(VALUE obj, VALUE block);
234
247
 
235
248
  void rb_gc_mark_and_move(VALUE *ptr);
236
249
 
250
+ void rb_gc_mark_weak(VALUE *ptr);
251
+ void rb_gc_remove_weak(VALUE parent_obj, VALUE *ptr);
252
+
237
253
  #define rb_gc_mark_and_move_ptr(ptr) do { \
238
254
  VALUE _obj = (VALUE)*(ptr); \
239
255
  rb_gc_mark_and_move(&_obj); \
@@ -271,6 +287,7 @@ void rb_gc_verify_internal_consistency(void);
271
287
  size_t rb_obj_gc_flags(VALUE, ID[], size_t);
272
288
  void rb_gc_mark_values(long n, const VALUE *values);
273
289
  void rb_gc_mark_vm_stack_values(long n, const VALUE *values);
290
+ void rb_gc_update_values(long n, VALUE *values);
274
291
  void *ruby_sized_xrealloc(void *ptr, size_t new_size, size_t old_size) RUBY_ATTR_RETURNS_NONNULL RUBY_ATTR_ALLOC_SIZE((2));
275
292
  void *ruby_sized_xrealloc2(void *ptr, size_t new_count, size_t element_size, size_t old_count) RUBY_ATTR_RETURNS_NONNULL RUBY_ATTR_ALLOC_SIZE((2, 3));
276
293
  void ruby_sized_xfree(void *x, size_t size);
@@ -302,6 +319,12 @@ ruby_sized_xfree_inlined(void *ptr, size_t size)
302
319
 
303
320
  # define SIZED_REALLOC_N(x, y, z, w) REALLOC_N(x, y, z)
304
321
 
322
+ static inline void *
323
+ ruby_sized_realloc_n(void *ptr, size_t new_count, size_t element_size, size_t old_count)
324
+ {
325
+ return ruby_xrealloc2(ptr, new_count, element_size);
326
+ }
327
+
305
328
  #else
306
329
 
307
330
  static inline void *
@@ -325,6 +348,12 @@ ruby_sized_xfree_inlined(void *ptr, size_t size)
325
348
  # define SIZED_REALLOC_N(v, T, m, n) \
326
349
  ((v) = (T *)ruby_sized_xrealloc2((void *)(v), (m), sizeof(T), (n)))
327
350
 
351
+ static inline void *
352
+ ruby_sized_realloc_n(void *ptr, size_t new_count, size_t element_size, size_t old_count)
353
+ {
354
+ return ruby_sized_xrealloc2(ptr, new_count, element_size, old_count);
355
+ }
356
+
328
357
  #endif /* HAVE_MALLOC_USABLE_SIZE */
329
358
 
330
359
  #define ruby_sized_xrealloc ruby_sized_xrealloc_inlined
@@ -28,10 +28,6 @@ enum ruby_rhash_flags {
28
28
  RHASH_AR_TABLE_BOUND_MASK = (FL_USER8|FL_USER9|FL_USER10|FL_USER11), /* FL 8..11 */
29
29
  RHASH_AR_TABLE_BOUND_SHIFT = (FL_USHIFT+8),
30
30
 
31
- #if USE_TRANSIENT_HEAP
32
- RHASH_TRANSIENT_FLAG = FL_USER12, /* FL 12 */
33
- #endif
34
-
35
31
  // we can not put it in "enum" because it can exceed "int" range.
36
32
  #define RHASH_LEV_MASK (FL_USER13 | FL_USER14 | FL_USER15 | /* FL 13..19 */ \
37
33
  FL_USER16 | FL_USER17 | FL_USER18 | FL_USER19)
@@ -40,17 +36,23 @@ enum ruby_rhash_flags {
40
36
  RHASH_LEV_MAX = 127, /* 7 bits */
41
37
  };
42
38
 
43
- struct RHash {
44
- struct RBasic basic;
45
- union {
46
- st_table *st;
47
- struct ar_table_struct *ar; /* possibly 0 */
48
- } as;
49
- const VALUE ifnone;
39
+ typedef struct ar_table_pair_struct {
40
+ VALUE key;
41
+ VALUE val;
42
+ } ar_table_pair;
43
+
44
+ typedef struct ar_table_struct {
50
45
  union {
51
46
  ar_hint_t ary[RHASH_AR_TABLE_MAX_SIZE];
52
47
  VALUE word;
53
48
  } ar_hint;
49
+ /* 64bit CPU: 8B * 2 * 8 = 128B */
50
+ ar_table_pair pairs[RHASH_AR_TABLE_MAX_SIZE];
51
+ } ar_table;
52
+
53
+ struct RHash {
54
+ struct RBasic basic;
55
+ const VALUE ifnone;
54
56
  };
55
57
 
56
58
  #define RHASH(obj) ((struct RHash *)(obj))
@@ -85,6 +87,7 @@ int rb_hash_stlike_delete(VALUE hash, st_data_t *pkey, st_data_t *pval);
85
87
  int rb_hash_stlike_foreach_with_replace(VALUE hash, st_foreach_check_callback_func *func, st_update_callback_func *replace, st_data_t arg);
86
88
  int rb_hash_stlike_update(VALUE hash, st_data_t key, st_update_callback_func *func, st_data_t arg);
87
89
  VALUE rb_ident_hash_new_with_size(st_index_t size);
90
+ void rb_hash_free(VALUE hash);
88
91
 
89
92
  static inline unsigned RHASH_AR_TABLE_SIZE_RAW(VALUE h);
90
93
  static inline VALUE RHASH_IFNONE(VALUE h);
@@ -96,9 +99,6 @@ static inline struct ar_table_struct *RHASH_AR_TABLE(VALUE h);
96
99
  static inline st_table *RHASH_ST_TABLE(VALUE h);
97
100
  static inline size_t RHASH_ST_SIZE(VALUE h);
98
101
  static inline void RHASH_ST_CLEAR(VALUE h);
99
- static inline bool RHASH_TRANSIENT_P(VALUE h);
100
- static inline void RHASH_SET_TRANSIENT_FLAG(VALUE h);
101
- static inline void RHASH_UNSET_TRANSIENT_FLAG(VALUE h);
102
102
 
103
103
  RUBY_SYMBOL_EXPORT_BEGIN
104
104
  /* hash.c (export) */
@@ -125,16 +125,18 @@ RHASH_AR_TABLE_P(VALUE h)
125
125
  return ! FL_TEST_RAW(h, RHASH_ST_TABLE_FLAG);
126
126
  }
127
127
 
128
+ RBIMPL_ATTR_RETURNS_NONNULL()
128
129
  static inline struct ar_table_struct *
129
130
  RHASH_AR_TABLE(VALUE h)
130
131
  {
131
- return RHASH(h)->as.ar;
132
+ return (struct ar_table_struct *)((uintptr_t)h + sizeof(struct RHash));
132
133
  }
133
134
 
135
+ RBIMPL_ATTR_RETURNS_NONNULL()
134
136
  static inline st_table *
135
137
  RHASH_ST_TABLE(VALUE h)
136
138
  {
137
- return RHASH(h)->as.st;
139
+ return (st_table *)((uintptr_t)h + sizeof(struct RHash));
138
140
  }
139
141
 
140
142
  static inline VALUE
@@ -175,8 +177,7 @@ RHASH_ST_SIZE(VALUE h)
175
177
  static inline void
176
178
  RHASH_ST_CLEAR(VALUE h)
177
179
  {
178
- RHASH(h)->as.st = NULL;
179
- FL_UNSET_RAW(h, RHASH_ST_TABLE_FLAG);
180
+ memset(RHASH_ST_TABLE(h), 0, sizeof(st_table));
180
181
  }
181
182
 
182
183
  static inline unsigned
@@ -187,30 +188,4 @@ RHASH_AR_TABLE_SIZE_RAW(VALUE h)
187
188
  return (unsigned)ret;
188
189
  }
189
190
 
190
- static inline bool
191
- RHASH_TRANSIENT_P(VALUE h)
192
- {
193
- #if USE_TRANSIENT_HEAP
194
- return FL_TEST_RAW(h, RHASH_TRANSIENT_FLAG);
195
- #else
196
- return false;
197
- #endif
198
- }
199
-
200
- static inline void
201
- RHASH_SET_TRANSIENT_FLAG(VALUE h)
202
- {
203
- #if USE_TRANSIENT_HEAP
204
- FL_SET_RAW(h, RHASH_TRANSIENT_FLAG);
205
- #endif
206
- }
207
-
208
- static inline void
209
- RHASH_UNSET_TRANSIENT_FLAG(VALUE h)
210
- {
211
- #if USE_TRANSIENT_HEAP
212
- FL_UNSET_RAW(h, RHASH_TRANSIENT_FLAG);
213
- #endif
214
- }
215
-
216
191
  #endif /* INTERNAL_HASH_H */
@@ -129,7 +129,6 @@ struct MEMO {
129
129
  typedef struct rb_imemo_tmpbuf_struct rb_imemo_tmpbuf_t;
130
130
  rb_imemo_tmpbuf_t *rb_imemo_tmpbuf_parser_heap(void *buf, rb_imemo_tmpbuf_t *old_heap, size_t cnt);
131
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
132
  static inline enum imemo_type imemo_type(VALUE imemo);
134
133
  static inline int imemo_type_p(VALUE imemo, enum imemo_type imemo_type);
135
134
  static inline bool imemo_throw_data_p(VALUE imemo);
@@ -0,0 +1,137 @@
1
+ #ifndef INTERNAL_IO_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_IO_H
3
+ /**
4
+ * @author Ruby developers <ruby-core@ruby-lang.org>
5
+ * @copyright This file is a part of the programming language Ruby.
6
+ * Permission is hereby granted, to either redistribute and/or
7
+ * modify this file, provided that the conditions mentioned in the
8
+ * file COPYING are met. Consult the file for details.
9
+ * @brief Internal header for IO.
10
+ */
11
+ #include "ruby/ruby.h" /* for VALUE */
12
+
13
+ #define HAVE_RB_IO_T
14
+ struct rb_io;
15
+
16
+ #include "ruby/io.h" /* for rb_io_t */
17
+
18
+ /** Ruby's IO, metadata and buffers. */
19
+ struct rb_io {
20
+
21
+ /** The IO's Ruby level counterpart. */
22
+ VALUE self;
23
+
24
+ /** stdio ptr for read/write, if available. */
25
+ FILE *stdio_file;
26
+
27
+ /** file descriptor. */
28
+ int fd;
29
+
30
+ /** mode flags: FMODE_XXXs */
31
+ int mode;
32
+
33
+ /** child's pid (for pipes) */
34
+ rb_pid_t pid;
35
+
36
+ /** number of lines read */
37
+ int lineno;
38
+
39
+ /** pathname for file */
40
+ VALUE pathv;
41
+
42
+ /** finalize proc */
43
+ void (*finalize)(struct rb_io*,int);
44
+
45
+ /** Write buffer. */
46
+ rb_io_buffer_t wbuf;
47
+
48
+ /**
49
+ * (Byte) read buffer. Note also that there is a field called
50
+ * ::rb_io_t::cbuf, which also concerns read IO.
51
+ */
52
+ rb_io_buffer_t rbuf;
53
+
54
+ /**
55
+ * Duplex IO object, if set.
56
+ *
57
+ * @see rb_io_set_write_io()
58
+ */
59
+ VALUE tied_io_for_writing;
60
+
61
+ struct rb_io_encoding encs; /**< Decomposed encoding flags. */
62
+
63
+ /** Encoding converter used when reading from this IO. */
64
+ rb_econv_t *readconv;
65
+
66
+ /**
67
+ * rb_io_ungetc() destination. This buffer is read before checking
68
+ * ::rb_io_t::rbuf
69
+ */
70
+ rb_io_buffer_t cbuf;
71
+
72
+ /** Encoding converter used when writing to this IO. */
73
+ rb_econv_t *writeconv;
74
+
75
+ /**
76
+ * This is, when set, an instance of ::rb_cString which holds the "common"
77
+ * encoding. Write conversion can convert strings twice... In case
78
+ * conversion from encoding X to encoding Y does not exist, Ruby finds an
79
+ * encoding Z that bridges the two, so that X to Z to Y conversion happens.
80
+ */
81
+ VALUE writeconv_asciicompat;
82
+
83
+ /** Whether ::rb_io_t::writeconv is already set up. */
84
+ int writeconv_initialized;
85
+
86
+ /**
87
+ * Value of ::rb_io_t::rb_io_enc_t::ecflags stored right before
88
+ * initialising ::rb_io_t::writeconv.
89
+ */
90
+ int writeconv_pre_ecflags;
91
+
92
+ /**
93
+ * Value of ::rb_io_t::rb_io_enc_t::ecopts stored right before initialising
94
+ * ::rb_io_t::writeconv.
95
+ */
96
+ VALUE writeconv_pre_ecopts;
97
+
98
+ /**
99
+ * This is a Ruby level mutex. It avoids multiple threads to write to an
100
+ * IO at once; helps for instance rb_io_puts() to ensure newlines right
101
+ * next to its arguments.
102
+ *
103
+ * This of course doesn't help inter-process IO interleaves, though.
104
+ */
105
+ VALUE write_lock;
106
+
107
+ /**
108
+ * The timeout associated with this IO when performing blocking operations.
109
+ */
110
+ VALUE timeout;
111
+ };
112
+
113
+ /* io.c */
114
+ void ruby_set_inplace_mode(const char *);
115
+ void rb_stdio_set_default_encoding(void);
116
+ VALUE rb_io_flush_raw(VALUE, int);
117
+ size_t rb_io_memsize(const rb_io_t *);
118
+ int rb_stderr_tty_p(void);
119
+ void rb_io_fptr_finalize_internal(void *ptr);
120
+ #ifdef rb_io_fptr_finalize
121
+ # undef rb_io_fptr_finalize
122
+ #endif
123
+ #define rb_io_fptr_finalize rb_io_fptr_finalize_internal
124
+ VALUE rb_io_popen(VALUE pname, VALUE pmode, VALUE env, VALUE opt);
125
+
126
+ VALUE rb_io_prep_stdin(void);
127
+ VALUE rb_io_prep_stdout(void);
128
+ VALUE rb_io_prep_stderr(void);
129
+
130
+ RUBY_SYMBOL_EXPORT_BEGIN
131
+ /* io.c (export) */
132
+ void rb_maygvl_fd_fix_cloexec(int fd);
133
+ int rb_gc_for_fd(int err);
134
+ void rb_write_error_str(VALUE mesg);
135
+ RUBY_SYMBOL_EXPORT_END
136
+
137
+ #endif /* INTERNAL_IO_H */
@@ -0,0 +1,108 @@
1
+ #ifndef INTERNAL_PARSE_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_PARSE_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 the parser.
10
+ */
11
+ #include <limits.h>
12
+ #include "rubyparser.h"
13
+ #include "internal/static_assert.h"
14
+
15
+ #ifdef UNIVERSAL_PARSER
16
+ #define rb_encoding void
17
+ #endif
18
+
19
+ struct rb_iseq_struct; /* in vm_core.h */
20
+
21
+ #define STRTERM_HEREDOC IMEMO_FL_USER0
22
+
23
+ /* structs for managing terminator of string literal and heredocment */
24
+ typedef struct rb_strterm_literal_struct {
25
+ long nest;
26
+ int func; /* STR_FUNC_* (e.g., STR_FUNC_ESCAPE and STR_FUNC_EXPAND) */
27
+ int paren; /* '(' of `%q(...)` */
28
+ int term; /* ')' of `%q(...)` */
29
+ } rb_strterm_literal_t;
30
+
31
+ typedef struct rb_strterm_heredoc_struct {
32
+ VALUE lastline; /* the string of line that contains `<<"END"` */
33
+ long offset; /* the column of END in `<<"END"` */
34
+ int sourceline; /* lineno of the line that contains `<<"END"` */
35
+ unsigned length; /* the length of END in `<<"END"` */
36
+ uint8_t quote;
37
+ uint8_t func;
38
+ } rb_strterm_heredoc_t;
39
+
40
+ #define HERETERM_LENGTH_MAX UINT_MAX
41
+
42
+ typedef struct rb_strterm_struct {
43
+ VALUE flags;
44
+ union {
45
+ rb_strterm_literal_t literal;
46
+ rb_strterm_heredoc_t heredoc;
47
+ } u;
48
+ } rb_strterm_t;
49
+
50
+ /* parse.y */
51
+ void rb_ruby_parser_mark(void *ptr);
52
+ size_t rb_ruby_parser_memsize(const void *ptr);
53
+
54
+ void rb_ruby_parser_set_options(rb_parser_t *p, int print, int loop, int chomp, int split);
55
+ rb_parser_t *rb_ruby_parser_set_context(rb_parser_t *p, const struct rb_iseq_struct *base, int main);
56
+ void rb_ruby_parser_set_script_lines(rb_parser_t *p, VALUE lines_array);
57
+ void rb_ruby_parser_error_tolerant(rb_parser_t *p);
58
+ rb_ast_t* rb_ruby_parser_compile_file_path(rb_parser_t *p, VALUE fname, VALUE file, int start);
59
+ void rb_ruby_parser_keep_tokens(rb_parser_t *p);
60
+ rb_ast_t* rb_ruby_parser_compile_generic(rb_parser_t *p, VALUE (*lex_gets)(VALUE, int), VALUE fname, VALUE input, int start);
61
+ rb_ast_t* rb_ruby_parser_compile_string_path(rb_parser_t *p, VALUE f, VALUE s, int line);
62
+
63
+ RUBY_SYMBOL_EXPORT_BEGIN
64
+
65
+ VALUE rb_ruby_parser_encoding(rb_parser_t *p);
66
+ int rb_ruby_parser_end_seen_p(rb_parser_t *p);
67
+ int rb_ruby_parser_set_yydebug(rb_parser_t *p, int flag);
68
+
69
+ RUBY_SYMBOL_EXPORT_END
70
+
71
+ int rb_reg_named_capture_assign_iter_impl(struct parser_params *p, const char *s, long len, rb_encoding *enc, NODE **succ_block, const rb_code_location_t *loc);
72
+
73
+ #ifdef RIPPER
74
+ void ripper_parser_mark(void *ptr);
75
+ void ripper_parser_free(void *ptr);
76
+ size_t ripper_parser_memsize(const void *ptr);
77
+ void ripper_error(struct parser_params *p);
78
+ VALUE ripper_value(struct parser_params *p);
79
+ int rb_ruby_parser_get_yydebug(rb_parser_t *p);
80
+ void rb_ruby_parser_set_value(rb_parser_t *p, VALUE value);
81
+ int rb_ruby_parser_error_p(rb_parser_t *p);
82
+ VALUE rb_ruby_parser_debug_output(rb_parser_t *p);
83
+ void rb_ruby_parser_set_debug_output(rb_parser_t *p, VALUE output);
84
+ VALUE rb_ruby_parser_parsing_thread(rb_parser_t *p);
85
+ void rb_ruby_parser_set_parsing_thread(rb_parser_t *p, VALUE parsing_thread);
86
+ void rb_ruby_parser_ripper_initialize(rb_parser_t *p, VALUE (*gets)(struct parser_params*,VALUE), VALUE input, VALUE sourcefile_string, const char *sourcefile, int sourceline);
87
+ VALUE rb_ruby_parser_result(rb_parser_t *p);
88
+ rb_encoding *rb_ruby_parser_enc(rb_parser_t *p);
89
+ VALUE rb_ruby_parser_ruby_sourcefile_string(rb_parser_t *p);
90
+ int rb_ruby_parser_ruby_sourceline(rb_parser_t *p);
91
+ int rb_ruby_parser_lex_state(rb_parser_t *p);
92
+ void rb_ruby_ripper_parse0(rb_parser_t *p);
93
+ int rb_ruby_ripper_dedent_string(rb_parser_t *p, VALUE string, int width);
94
+ VALUE rb_ruby_ripper_lex_get_str(rb_parser_t *p, VALUE s);
95
+ int rb_ruby_ripper_initialized_p(rb_parser_t *p);
96
+ void rb_ruby_ripper_parser_initialize(rb_parser_t *p);
97
+ long rb_ruby_ripper_column(rb_parser_t *p);
98
+ long rb_ruby_ripper_token_len(rb_parser_t *p);
99
+ VALUE rb_ruby_ripper_lex_lastline(rb_parser_t *p);
100
+ VALUE rb_ruby_ripper_lex_state_name(struct parser_params *p, int state);
101
+ struct parser_params *rb_ruby_ripper_parser_allocate(void);
102
+ #endif
103
+
104
+ #ifdef UNIVERSAL_PARSER
105
+ #undef rb_encoding
106
+ #endif
107
+
108
+ #endif /* INTERNAL_PARSE_H */
@@ -22,7 +22,6 @@
22
22
  #include "ruby/ruby.h" /* for VALUE */
23
23
  #include "internal/compilers.h" /* for __has_warning */
24
24
  #include "internal/imemo.h" /* for RB_IMEMO_TMPBUF_PTR */
25
- #include "internal/warnings.h" /* for COMPILER_WARNING_PUSH */
26
25
 
27
26
  #define RB_MAX_GROUPS (65536)
28
27
 
@@ -122,17 +121,4 @@ ARGVSTR2ARGC(VALUE argv_str)
122
121
  return i - 1;
123
122
  }
124
123
 
125
- #ifdef HAVE_WORKING_FORK
126
- COMPILER_WARNING_PUSH
127
- #if __has_warning("-Wdeprecated-declarations") || RBIMPL_COMPILER_IS(GCC)
128
- COMPILER_WARNING_IGNORED(-Wdeprecated-declarations)
129
- #endif
130
- static inline rb_pid_t
131
- rb_fork(void)
132
- {
133
- return fork();
134
- }
135
- COMPILER_WARNING_POP
136
- #endif
137
-
138
124
  #endif /* INTERNAL_PROCESS_H */
@@ -24,13 +24,13 @@ RANGE_BEG(VALUE r)
24
24
  static inline VALUE
25
25
  RANGE_END(VALUE r)
26
26
  {
27
- return RSTRUCT(r)->as.ary[1];
27
+ return RSTRUCT_GET(r, 1);
28
28
  }
29
29
 
30
30
  static inline VALUE
31
31
  RANGE_EXCL(VALUE r)
32
32
  {
33
- return RSTRUCT(r)->as.ary[2];
33
+ return RSTRUCT_GET(r, 2);
34
34
  }
35
35
 
36
36
  VALUE
@@ -22,7 +22,7 @@ VALUE rb_reg_equal(VALUE re1, VALUE re2);
22
22
  void rb_backref_set_string(VALUE string, long pos, long len);
23
23
  void rb_match_unbusy(VALUE);
24
24
  int rb_match_count(VALUE match);
25
- int rb_match_nth_defined(int nth, VALUE match);
26
25
  VALUE rb_reg_new_ary(VALUE ary, int options);
26
+ VALUE rb_reg_last_defined(VALUE match);
27
27
 
28
28
  #endif /* INTERNAL_RE_H */
@@ -0,0 +1,69 @@
1
+ #ifndef INTERNAL_RUBY_PARSE_H
2
+ #define INTERNAL_RUBY_PARSE_H
3
+
4
+ #include "internal.h"
5
+ #include "internal/imemo.h"
6
+ #include "rubyparser.h"
7
+ #include "vm.h"
8
+
9
+ RUBY_SYMBOL_EXPORT_BEGIN
10
+ #ifdef UNIVERSAL_PARSER
11
+ void rb_parser_config_initialize(rb_parser_config_t *config);
12
+ #endif
13
+ VALUE rb_parser_set_context(VALUE, const struct rb_iseq_struct *, int);
14
+ VALUE rb_parser_new(void);
15
+ rb_ast_t *rb_parser_compile_string_path(VALUE vparser, VALUE fname, VALUE src, int line);
16
+ RUBY_SYMBOL_EXPORT_END
17
+
18
+ VALUE rb_parser_end_seen_p(VALUE);
19
+ VALUE rb_parser_encoding(VALUE);
20
+ VALUE rb_parser_set_yydebug(VALUE, VALUE);
21
+ void rb_parser_set_options(VALUE, int, int, int, int);
22
+ void *rb_parser_load_file(VALUE parser, VALUE name);
23
+ void rb_parser_set_script_lines(VALUE vparser, VALUE lines_array);
24
+ void rb_parser_error_tolerant(VALUE vparser);
25
+ void rb_parser_keep_tokens(VALUE vparser);
26
+
27
+ rb_ast_t *rb_parser_compile_string(VALUE, const char*, VALUE, int);
28
+ rb_ast_t *rb_parser_compile_file_path(VALUE vparser, VALUE fname, VALUE input, int line);
29
+ rb_ast_t *rb_parser_compile_generic(VALUE vparser, VALUE (*lex_gets)(VALUE, int), VALUE fname, VALUE input, int line);
30
+
31
+ enum lex_state_bits {
32
+ EXPR_BEG_bit, /* ignore newline, +/- is a sign. */
33
+ EXPR_END_bit, /* newline significant, +/- is an operator. */
34
+ EXPR_ENDARG_bit, /* ditto, and unbound braces. */
35
+ EXPR_ENDFN_bit, /* ditto, and unbound braces. */
36
+ EXPR_ARG_bit, /* newline significant, +/- is an operator. */
37
+ EXPR_CMDARG_bit, /* newline significant, +/- is an operator. */
38
+ EXPR_MID_bit, /* newline significant, +/- is an operator. */
39
+ EXPR_FNAME_bit, /* ignore newline, no reserved words. */
40
+ EXPR_DOT_bit, /* right after `.', `&.' or `::', no reserved words. */
41
+ EXPR_CLASS_bit, /* immediate after `class', no here document. */
42
+ EXPR_LABEL_bit, /* flag bit, label is allowed. */
43
+ EXPR_LABELED_bit, /* flag bit, just after a label. */
44
+ EXPR_FITEM_bit, /* symbol literal as FNAME. */
45
+ EXPR_MAX_STATE
46
+ };
47
+ /* examine combinations */
48
+ enum lex_state_e {
49
+ #define DEF_EXPR(n) EXPR_##n = (1 << EXPR_##n##_bit)
50
+ DEF_EXPR(BEG),
51
+ DEF_EXPR(END),
52
+ DEF_EXPR(ENDARG),
53
+ DEF_EXPR(ENDFN),
54
+ DEF_EXPR(ARG),
55
+ DEF_EXPR(CMDARG),
56
+ DEF_EXPR(MID),
57
+ DEF_EXPR(FNAME),
58
+ DEF_EXPR(DOT),
59
+ DEF_EXPR(CLASS),
60
+ DEF_EXPR(LABEL),
61
+ DEF_EXPR(LABELED),
62
+ DEF_EXPR(FITEM),
63
+ EXPR_VALUE = EXPR_BEG,
64
+ EXPR_BEG_ANY = (EXPR_BEG | EXPR_MID | EXPR_CLASS),
65
+ EXPR_ARG_ANY = (EXPR_ARG | EXPR_CMDARG),
66
+ EXPR_END_ANY = (EXPR_END | EXPR_ENDARG | EXPR_ENDFN),
67
+ EXPR_NONE = 0
68
+ };
69
+ #endif /* INTERNAL_RUBY_PARSE_H */
@@ -13,6 +13,10 @@
13
13
  extern int ruby_enable_coredump;
14
14
  int rb_get_next_signal(void);
15
15
 
16
+ #ifdef POSIX_SIGNAL
17
+ void (*ruby_posix_signal(int, void (*)(int)))(int);
18
+ #endif
19
+
16
20
  RUBY_SYMBOL_EXPORT_BEGIN
17
21
  /* signal.c (export) */
18
22
  int rb_grantpt(int fd);
@@ -119,6 +119,21 @@ is_broken_string(VALUE str)
119
119
  return rb_enc_str_coderange(str) == ENC_CODERANGE_BROKEN;
120
120
  }
121
121
 
122
+ static inline bool
123
+ at_char_boundary(const char *s, const char *p, const char *e, rb_encoding *enc)
124
+ {
125
+ return rb_enc_left_char_head(s, p, e, enc) == p;
126
+ }
127
+
128
+ static inline bool
129
+ at_char_right_boundary(const char *s, const char *p, const char *e, rb_encoding *enc)
130
+ {
131
+ RUBY_ASSERT(s <= p);
132
+ RUBY_ASSERT(p <= e);
133
+
134
+ return rb_enc_right_char_head(s, p, e, enc) == p;
135
+ }
136
+
122
137
  /* expect tail call optimization */
123
138
  // YJIT needs this function to never allocate and never raise
124
139
  static inline VALUE