debase-ruby_core_source 3.2.1 → 3.2.2

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 (128) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/darray.h +246 -0
  4. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/debug_counter.h +7 -10
  5. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/eval_intern.h +3 -1
  6. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/id.h +44 -0
  7. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/insns_info.inc +68 -94
  8. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/array.h +2 -20
  9. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/bits.h +6 -2
  10. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/class.h +7 -2
  11. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/cmdlineopt.h +3 -1
  12. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/compile.h +0 -1
  13. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/error.h +24 -2
  14. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/gc.h +28 -0
  15. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/hash.h +18 -44
  16. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/io.h +137 -0
  17. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/parse.h +133 -0
  18. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/process.h +0 -14
  19. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/range.h +2 -2
  20. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/re.h +1 -1
  21. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/ruby_parser.h +69 -0
  22. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/signal.h +4 -0
  23. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/string.h +15 -0
  24. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/struct.h +9 -34
  25. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/thread.h +13 -0
  26. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/variable.h +16 -33
  27. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/vm.h +5 -0
  28. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/iseq.h +4 -4
  29. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/method.h +1 -1
  30. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/node.h +125 -0
  31. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/parse.h +6 -4
  32. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/parser_bits.h +564 -0
  33. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/parser_node.h +133 -0
  34. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/parser_st.h +162 -0
  35. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/parser_value.h +106 -0
  36. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/ractor_core.h +3 -3
  37. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/revision.h +5 -0
  38. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/rubyparser.h +628 -0
  39. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/symbol.h +1 -1
  40. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/thread_pthread.h +11 -13
  41. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/thread_win32.h +0 -5
  42. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/version.h +1 -1
  43. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/vm.inc +303 -404
  44. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/vm_callinfo.h +50 -16
  45. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/vm_core.h +29 -47
  46. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/vm_exec.h +11 -10
  47. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/vm_insnhelper.h +20 -23
  48. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/vm_opts.h +0 -5
  49. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/yjit.h +4 -6
  50. data/lib/debase/ruby_core_source/version.rb +1 -1
  51. metadata +119 -115
  52. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/darray.h +0 -179
  53. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/io.h +0 -38
  54. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/parse.h +0 -25
  55. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/node.h +0 -514
  56. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/opt_sc.inc +0 -109
  57. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/revision.h +0 -5
  58. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/transient_heap.h +0 -65
  59. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/addr2line.h +0 -0
  60. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/builtin.h +0 -0
  61. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/ccan/build_assert/build_assert.h +0 -0
  62. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/ccan/check_type/check_type.h +0 -0
  63. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/ccan/container_of/container_of.h +0 -0
  64. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/ccan/list/list.h +0 -0
  65. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/ccan/str/str.h +0 -0
  66. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/constant.h +0 -0
  67. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/dln.h +0 -0
  68. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/encindex.h +0 -0
  69. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/hrtime.h +0 -0
  70. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/id_table.h +0 -0
  71. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/insns.inc +0 -0
  72. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/basic_operators.h +0 -0
  73. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/bignum.h +0 -0
  74. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/compar.h +0 -0
  75. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/compilers.h +0 -0
  76. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/complex.h +0 -0
  77. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/cont.h +0 -0
  78. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/dir.h +0 -0
  79. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/enc.h +0 -0
  80. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/encoding.h +0 -0
  81. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/enum.h +0 -0
  82. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/enumerator.h +0 -0
  83. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/eval.h +0 -0
  84. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/file.h +0 -0
  85. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/fixnum.h +0 -0
  86. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/imemo.h +0 -0
  87. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/inits.h +0 -0
  88. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/load.h +0 -0
  89. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/loadpath.h +0 -0
  90. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/math.h +0 -0
  91. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/missing.h +0 -0
  92. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/numeric.h +0 -0
  93. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/object.h +0 -0
  94. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/proc.h +0 -0
  95. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/ractor.h +0 -0
  96. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/random.h +0 -0
  97. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/rational.h +0 -0
  98. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/sanitizers.h +0 -0
  99. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/serial.h +0 -0
  100. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/static_assert.h +0 -0
  101. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/symbol.h +0 -0
  102. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/time.h +0 -0
  103. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/transcode.h +0 -0
  104. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/util.h +0 -0
  105. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/warnings.h +0 -0
  106. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal.h +0 -0
  107. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/known_errors.inc +0 -0
  108. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/node_name.inc +0 -0
  109. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/optinsn.inc +0 -0
  110. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/optunifs.inc +0 -0
  111. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/probes_helper.h +0 -0
  112. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/regenc.h +0 -0
  113. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/regint.h +0 -0
  114. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/regparse.h +0 -0
  115. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/rjit.h +0 -0
  116. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/rjit_c.h +0 -0
  117. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/ruby_assert.h +0 -0
  118. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/ruby_atomic.h +0 -0
  119. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/shape.h +0 -0
  120. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/siphash.h +0 -0
  121. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/thread_none.h +0 -0
  122. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/timev.h +0 -0
  123. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/transcode_data.h +0 -0
  124. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/variable.h +0 -0
  125. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/vm_call_iseq_optimized.inc +0 -0
  126. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/vm_debug.h +0 -0
  127. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/vm_sync.h +0 -0
  128. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/vmtc.inc +0 -0
@@ -17,6 +17,9 @@
17
17
  #include "ruby/intern.h" /* for rb_alloc_func_t */
18
18
  #include "ruby/ruby.h" /* for struct RBasic */
19
19
  #include "shape.h"
20
+ #include "ruby_assert.h"
21
+ #include "vm_core.h"
22
+ #include "method.h" /* for rb_cref_t */
20
23
 
21
24
  #ifdef RCLASS_SUPER
22
25
  # undef RCLASS_SUPER
@@ -32,6 +35,7 @@ typedef struct rb_subclass_entry rb_subclass_entry_t;
32
35
  struct rb_cvar_class_tbl_entry {
33
36
  uint32_t index;
34
37
  rb_serial_t global_cvar_state;
38
+ const rb_cref_t * cref;
35
39
  VALUE class_value;
36
40
  };
37
41
 
@@ -115,6 +119,7 @@ VALUE rb_module_s_alloc(VALUE klass);
115
119
  void rb_module_set_initialized(VALUE module);
116
120
  void rb_module_check_initializable(VALUE module);
117
121
  VALUE rb_make_metaclass(VALUE, VALUE);
122
+ VALUE rb_iclass_alloc(VALUE klass);
118
123
  VALUE rb_include_class_new(VALUE, VALUE);
119
124
  void rb_class_foreach_subclass(VALUE klass, void (*f)(VALUE, VALUE), VALUE);
120
125
  void rb_class_detach_subclasses(VALUE);
@@ -143,7 +148,7 @@ static inline rb_alloc_func_t
143
148
  RCLASS_ALLOCATOR(VALUE klass)
144
149
  {
145
150
  if (FL_TEST_RAW(klass, FL_SINGLETON)) {
146
- return NULL;
151
+ return 0;
147
152
  }
148
153
  return RCLASS_EXT(klass)->as.class.allocator;
149
154
  }
@@ -201,7 +206,7 @@ RCLASS_SET_SUPER(VALUE klass, VALUE super)
201
206
  static inline void
202
207
  RCLASS_SET_CLASSPATH(VALUE klass, VALUE classpath, bool permanent)
203
208
  {
204
- assert(BUILTIN_TYPE(klass) == T_CLASS || BUILTIN_TYPE(klass) == T_MODULE);
209
+ assert(BUILTIN_TYPE(klass) == T_CLASS || BUILTIN_TYPE(klass) == T_MODULE || klass == rb_mRubyVMFrozenCore);
205
210
  assert(classpath == 0 || BUILTIN_TYPE(classpath) == T_STRING);
206
211
 
207
212
  RB_OBJ_WRITE(klass, &(RCLASS_EXT(klass)->classpath), classpath);
@@ -23,11 +23,13 @@ typedef struct ruby_cmdline_options {
23
23
  ruby_features_t features;
24
24
  ruby_features_t warn;
25
25
  unsigned int dump;
26
+ long backtrace_length_limit;
26
27
  #if USE_RJIT
27
28
  struct rb_rjit_options rjit;
28
29
  #endif
29
30
 
30
- int sflag, xflag;
31
+ signed int sflag: 2;
32
+ unsigned int xflag: 1;
31
33
  unsigned int warning: 1;
32
34
  unsigned int verbose: 1;
33
35
  unsigned int do_loop: 1;
@@ -17,7 +17,6 @@ struct rb_iseq_struct; /* in vm_core.h */
17
17
  /* compile.c */
18
18
  int rb_dvar_defined(ID, const struct rb_iseq_struct *);
19
19
  int rb_local_defined(ID, const struct rb_iseq_struct *);
20
- bool rb_insns_leaf_p(int i);
21
20
  int rb_insn_len(VALUE insn);
22
21
  const char *rb_insns_name(int i);
23
22
  VALUE rb_insns_name_array(void);
@@ -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 *);
@@ -234,6 +246,9 @@ VALUE rb_define_finalizer_no_check(VALUE obj, VALUE block);
234
246
 
235
247
  void rb_gc_mark_and_move(VALUE *ptr);
236
248
 
249
+ void rb_gc_mark_weak(VALUE *ptr);
250
+ void rb_gc_remove_weak(VALUE parent_obj, VALUE *ptr);
251
+
237
252
  #define rb_gc_mark_and_move_ptr(ptr) do { \
238
253
  VALUE _obj = (VALUE)*(ptr); \
239
254
  rb_gc_mark_and_move(&_obj); \
@@ -271,6 +286,7 @@ void rb_gc_verify_internal_consistency(void);
271
286
  size_t rb_obj_gc_flags(VALUE, ID[], size_t);
272
287
  void rb_gc_mark_values(long n, const VALUE *values);
273
288
  void rb_gc_mark_vm_stack_values(long n, const VALUE *values);
289
+ void rb_gc_update_values(long n, VALUE *values);
274
290
  void *ruby_sized_xrealloc(void *ptr, size_t new_size, size_t old_size) RUBY_ATTR_RETURNS_NONNULL RUBY_ATTR_ALLOC_SIZE((2));
275
291
  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
292
  void ruby_sized_xfree(void *x, size_t size);
@@ -302,6 +318,12 @@ ruby_sized_xfree_inlined(void *ptr, size_t size)
302
318
 
303
319
  # define SIZED_REALLOC_N(x, y, z, w) REALLOC_N(x, y, z)
304
320
 
321
+ static inline void *
322
+ ruby_sized_realloc_n(void *ptr, size_t new_count, size_t element_size, size_t old_count)
323
+ {
324
+ return ruby_xrealloc2(ptr, new_count, element_size);
325
+ }
326
+
305
327
  #else
306
328
 
307
329
  static inline void *
@@ -325,6 +347,12 @@ ruby_sized_xfree_inlined(void *ptr, size_t size)
325
347
  # define SIZED_REALLOC_N(v, T, m, n) \
326
348
  ((v) = (T *)ruby_sized_xrealloc2((void *)(v), (m), sizeof(T), (n)))
327
349
 
350
+ static inline void *
351
+ ruby_sized_realloc_n(void *ptr, size_t new_count, size_t element_size, size_t old_count)
352
+ {
353
+ return ruby_sized_xrealloc2(ptr, new_count, element_size, old_count);
354
+ }
355
+
328
356
  #endif /* HAVE_MALLOC_USABLE_SIZE */
329
357
 
330
358
  #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))
@@ -96,9 +98,6 @@ static inline struct ar_table_struct *RHASH_AR_TABLE(VALUE h);
96
98
  static inline st_table *RHASH_ST_TABLE(VALUE h);
97
99
  static inline size_t RHASH_ST_SIZE(VALUE h);
98
100
  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
101
 
103
102
  RUBY_SYMBOL_EXPORT_BEGIN
104
103
  /* hash.c (export) */
@@ -125,16 +124,18 @@ RHASH_AR_TABLE_P(VALUE h)
125
124
  return ! FL_TEST_RAW(h, RHASH_ST_TABLE_FLAG);
126
125
  }
127
126
 
127
+ RBIMPL_ATTR_RETURNS_NONNULL()
128
128
  static inline struct ar_table_struct *
129
129
  RHASH_AR_TABLE(VALUE h)
130
130
  {
131
- return RHASH(h)->as.ar;
131
+ return (struct ar_table_struct *)((uintptr_t)h + sizeof(struct RHash));
132
132
  }
133
133
 
134
+ RBIMPL_ATTR_RETURNS_NONNULL()
134
135
  static inline st_table *
135
136
  RHASH_ST_TABLE(VALUE h)
136
137
  {
137
- return RHASH(h)->as.st;
138
+ return (st_table *)((uintptr_t)h + sizeof(struct RHash));
138
139
  }
139
140
 
140
141
  static inline VALUE
@@ -175,8 +176,7 @@ RHASH_ST_SIZE(VALUE h)
175
176
  static inline void
176
177
  RHASH_ST_CLEAR(VALUE h)
177
178
  {
178
- RHASH(h)->as.st = NULL;
179
- FL_UNSET_RAW(h, RHASH_ST_TABLE_FLAG);
179
+ memset(RHASH_ST_TABLE(h), 0, sizeof(st_table));
180
180
  }
181
181
 
182
182
  static inline unsigned
@@ -187,30 +187,4 @@ RHASH_AR_TABLE_SIZE_RAW(VALUE h)
187
187
  return (unsigned)ret;
188
188
  }
189
189
 
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
190
  #endif /* INTERNAL_HASH_H */
@@ -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,133 @@
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
+ union {
26
+ VALUE dummy;
27
+ long nest;
28
+ } u0;
29
+ union {
30
+ VALUE dummy;
31
+ long func; /* STR_FUNC_* (e.g., STR_FUNC_ESCAPE and STR_FUNC_EXPAND) */
32
+ } u1;
33
+ union {
34
+ VALUE dummy;
35
+ long paren; /* '(' of `%q(...)` */
36
+ } u2;
37
+ union {
38
+ VALUE dummy;
39
+ long term; /* ')' of `%q(...)` */
40
+ } u3;
41
+ } rb_strterm_literal_t;
42
+
43
+ #define HERETERM_LENGTH_BITS ((SIZEOF_VALUE - 1) * CHAR_BIT - 1)
44
+
45
+ typedef struct rb_strterm_heredoc_struct {
46
+ VALUE lastline; /* the string of line that contains `<<"END"` */
47
+ long offset; /* the column of END in `<<"END"` */
48
+ int sourceline; /* lineno of the line that contains `<<"END"` */
49
+ unsigned length /* the length of END in `<<"END"` */
50
+ #if HERETERM_LENGTH_BITS < SIZEOF_INT * CHAR_BIT
51
+ : HERETERM_LENGTH_BITS
52
+ # define HERETERM_LENGTH_MAX ((1U << HERETERM_LENGTH_BITS) - 1)
53
+ #else
54
+ # define HERETERM_LENGTH_MAX UINT_MAX
55
+ #endif
56
+ ;
57
+ #if HERETERM_LENGTH_BITS < SIZEOF_INT * CHAR_BIT
58
+ unsigned quote: 1;
59
+ unsigned func: 8;
60
+ #else
61
+ uint8_t quote;
62
+ uint8_t func;
63
+ #endif
64
+ } rb_strterm_heredoc_t;
65
+ STATIC_ASSERT(rb_strterm_heredoc_t, sizeof(rb_strterm_heredoc_t) <= 4 * SIZEOF_VALUE);
66
+
67
+ typedef struct rb_strterm_struct {
68
+ VALUE flags;
69
+ union {
70
+ rb_strterm_literal_t literal;
71
+ rb_strterm_heredoc_t heredoc;
72
+ } u;
73
+ } rb_strterm_t;
74
+
75
+ /* parse.y */
76
+ void rb_ruby_parser_mark(void *ptr);
77
+ size_t rb_ruby_parser_memsize(const void *ptr);
78
+
79
+ void rb_ruby_parser_set_options(rb_parser_t *p, int print, int loop, int chomp, int split);
80
+ rb_parser_t *rb_ruby_parser_set_context(rb_parser_t *p, const struct rb_iseq_struct *base, int main);
81
+ void rb_ruby_parser_set_script_lines(rb_parser_t *p, VALUE lines_array);
82
+ void rb_ruby_parser_error_tolerant(rb_parser_t *p);
83
+ rb_ast_t* rb_ruby_parser_compile_file_path(rb_parser_t *p, VALUE fname, VALUE file, int start);
84
+ void rb_ruby_parser_keep_tokens(rb_parser_t *p);
85
+ rb_ast_t* rb_ruby_parser_compile_generic(rb_parser_t *p, VALUE (*lex_gets)(VALUE, int), VALUE fname, VALUE input, int start);
86
+ rb_ast_t* rb_ruby_parser_compile_string_path(rb_parser_t *p, VALUE f, VALUE s, int line);
87
+
88
+ RUBY_SYMBOL_EXPORT_BEGIN
89
+
90
+ VALUE rb_ruby_parser_encoding(rb_parser_t *p);
91
+ int rb_ruby_parser_end_seen_p(rb_parser_t *p);
92
+ int rb_ruby_parser_set_yydebug(rb_parser_t *p, int flag);
93
+
94
+ RUBY_SYMBOL_EXPORT_END
95
+
96
+ 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);
97
+
98
+ #ifdef RIPPER
99
+ void ripper_parser_mark(void *ptr);
100
+ void ripper_parser_free(void *ptr);
101
+ size_t ripper_parser_memsize(const void *ptr);
102
+ void ripper_error(struct parser_params *p);
103
+ VALUE ripper_value(struct parser_params *p);
104
+ int rb_ruby_parser_get_yydebug(rb_parser_t *p);
105
+ void rb_ruby_parser_set_value(rb_parser_t *p, VALUE value);
106
+ int rb_ruby_parser_error_p(rb_parser_t *p);
107
+ VALUE rb_ruby_parser_debug_output(rb_parser_t *p);
108
+ void rb_ruby_parser_set_debug_output(rb_parser_t *p, VALUE output);
109
+ VALUE rb_ruby_parser_parsing_thread(rb_parser_t *p);
110
+ void rb_ruby_parser_set_parsing_thread(rb_parser_t *p, VALUE parsing_thread);
111
+ 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);
112
+ VALUE rb_ruby_parser_result(rb_parser_t *p);
113
+ rb_encoding *rb_ruby_parser_enc(rb_parser_t *p);
114
+ VALUE rb_ruby_parser_ruby_sourcefile_string(rb_parser_t *p);
115
+ int rb_ruby_parser_ruby_sourceline(rb_parser_t *p);
116
+ int rb_ruby_parser_lex_state(rb_parser_t *p);
117
+ void rb_ruby_ripper_parse0(rb_parser_t *p);
118
+ int rb_ruby_ripper_dedent_string(rb_parser_t *p, VALUE string, int width);
119
+ VALUE rb_ruby_ripper_lex_get_str(rb_parser_t *p, VALUE s);
120
+ int rb_ruby_ripper_initialized_p(rb_parser_t *p);
121
+ void rb_ruby_ripper_parser_initialize(rb_parser_t *p);
122
+ long rb_ruby_ripper_column(rb_parser_t *p);
123
+ long rb_ruby_ripper_token_len(rb_parser_t *p);
124
+ VALUE rb_ruby_ripper_lex_lastline(rb_parser_t *p);
125
+ VALUE rb_ruby_ripper_lex_state_name(struct parser_params *p, int state);
126
+ struct parser_params *rb_ruby_ripper_parser_allocate(void);
127
+ #endif
128
+
129
+ #ifdef UNIVERSAL_PARSER
130
+ #undef rb_encoding
131
+ #endif
132
+
133
+ #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
+ RUBY_SYMBOL_EXPORT_END
15
+
16
+ VALUE rb_parser_new(void);
17
+ VALUE rb_parser_end_seen_p(VALUE);
18
+ VALUE rb_parser_encoding(VALUE);
19
+ VALUE rb_parser_set_yydebug(VALUE, VALUE);
20
+ void rb_parser_set_options(VALUE, int, int, int, int);
21
+ void *rb_parser_load_file(VALUE parser, VALUE name);
22
+ void rb_parser_set_script_lines(VALUE vparser, VALUE lines_array);
23
+ void rb_parser_error_tolerant(VALUE vparser);
24
+ void rb_parser_keep_tokens(VALUE vparser);
25
+
26
+ rb_ast_t *rb_parser_compile_string(VALUE, const char*, VALUE, int);
27
+ rb_ast_t *rb_parser_compile_string_path(VALUE vparser, VALUE fname, VALUE src, int line);
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);