debase-ruby_core_source 3.2.1 → 3.2.3

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -4,42 +4,42 @@
4
4
  #include "internal/gc.h"
5
5
 
6
6
  #if (SIZEOF_UINT64_T <= SIZEOF_VALUE)
7
+
7
8
  #define SIZEOF_SHAPE_T 4
8
9
  #define SHAPE_IN_BASIC_FLAGS 1
9
10
  typedef uint32_t attr_index_t;
11
+ typedef uint32_t shape_id_t;
12
+ typedef uint32_t redblack_id_t;
13
+ # define SHAPE_ID_NUM_BITS 32
14
+
10
15
  #else
16
+
11
17
  #define SIZEOF_SHAPE_T 2
12
18
  #define SHAPE_IN_BASIC_FLAGS 0
13
19
  typedef uint16_t attr_index_t;
14
- #endif
15
-
16
- #define MAX_IVARS (attr_index_t)(-1)
17
-
18
- #if SIZEOF_SHAPE_T == 4
19
- typedef uint32_t shape_id_t;
20
- # define SHAPE_ID_NUM_BITS 32
21
- # define SHAPE_BUFFER_SIZE 0x80000
22
- #else
23
20
  typedef uint16_t shape_id_t;
21
+ typedef uint16_t redblack_id_t;
24
22
  # define SHAPE_ID_NUM_BITS 16
25
- # define SHAPE_BUFFER_SIZE 0x8000
23
+
26
24
  #endif
27
25
 
26
+ #define MAX_IVARS (attr_index_t)(-1)
27
+
28
28
  # define SHAPE_MASK (((uintptr_t)1 << SHAPE_ID_NUM_BITS) - 1)
29
29
  # define SHAPE_FLAG_MASK (((VALUE)-1) >> SHAPE_ID_NUM_BITS)
30
30
 
31
31
  # define SHAPE_FLAG_SHIFT ((SIZEOF_VALUE * 8) - SHAPE_ID_NUM_BITS)
32
32
 
33
33
  # define SHAPE_MAX_VARIATIONS 8
34
- # define SHAPE_MAX_NUM_IVS 80
35
34
 
36
- # define MAX_SHAPE_ID SHAPE_BUFFER_SIZE
37
35
  # define INVALID_SHAPE_ID SHAPE_MASK
38
36
  # define ROOT_SHAPE_ID 0x0
39
37
 
40
38
  # define SPECIAL_CONST_SHAPE_ID (SIZE_POOL_COUNT * 2)
41
39
  # define OBJ_TOO_COMPLEX_SHAPE_ID (SPECIAL_CONST_SHAPE_ID + 1)
42
40
 
41
+ typedef struct redblack_node redblack_node_t;
42
+
43
43
  struct rb_shape {
44
44
  struct rb_id_table * edges; // id_table from ID (ivar) to next shape
45
45
  ID edge_name; // ID (ivar) for transition from parent to rb_shape
@@ -48,16 +48,23 @@ struct rb_shape {
48
48
  uint8_t type;
49
49
  uint8_t size_pool_index;
50
50
  shape_id_t parent_id;
51
+ redblack_node_t * ancestor_index;
51
52
  };
52
53
 
53
54
  typedef struct rb_shape rb_shape_t;
54
55
 
56
+ struct redblack_node {
57
+ ID key;
58
+ rb_shape_t * value;
59
+ redblack_id_t l;
60
+ redblack_id_t r;
61
+ };
62
+
55
63
  enum shape_type {
56
64
  SHAPE_ROOT,
57
65
  SHAPE_IVAR,
58
66
  SHAPE_FROZEN,
59
67
  SHAPE_CAPACITY_CHANGE,
60
- SHAPE_INITIAL_CAPACITY,
61
68
  SHAPE_T_OBJECT,
62
69
  SHAPE_OBJ_TOO_COMPLEX,
63
70
  };
@@ -67,6 +74,9 @@ typedef struct {
67
74
  rb_shape_t *shape_list;
68
75
  rb_shape_t *root_shape;
69
76
  shape_id_t next_shape_id;
77
+
78
+ redblack_node_t *shape_cache;
79
+ unsigned int cache_size;
70
80
  } rb_shape_tree_t;
71
81
  RUBY_EXTERN rb_shape_tree_t *rb_shape_tree_ptr;
72
82
 
@@ -145,14 +155,14 @@ rb_shape_t* rb_shape_get_shape_by_id(shape_id_t shape_id);
145
155
  shape_id_t rb_shape_get_shape_id(VALUE obj);
146
156
  rb_shape_t * rb_shape_get_next_iv_shape(rb_shape_t * shape, ID id);
147
157
  bool rb_shape_get_iv_index(rb_shape_t * shape, ID id, attr_index_t * value);
158
+ bool rb_shape_get_iv_index_with_hint(shape_id_t shape_id, ID id, attr_index_t * value, shape_id_t *shape_id_hint);
148
159
  bool rb_shape_obj_too_complex(VALUE obj);
149
160
 
150
161
  void rb_shape_set_shape(VALUE obj, rb_shape_t* shape);
151
162
  rb_shape_t* rb_shape_get_shape(VALUE obj);
152
163
  int rb_shape_frozen_shape_p(rb_shape_t* shape);
153
- void rb_shape_transition_shape_frozen(VALUE obj);
154
- void rb_shape_transition_shape_remove_ivar(VALUE obj, ID id, rb_shape_t *shape, VALUE * removed);
155
- rb_shape_t * rb_shape_transition_shape_capa(rb_shape_t * shape, uint32_t new_capacity);
164
+ rb_shape_t* rb_shape_transition_shape_frozen(VALUE obj);
165
+ bool rb_shape_transition_shape_remove_ivar(VALUE obj, ID id, rb_shape_t *shape, VALUE * removed);
156
166
  rb_shape_t* rb_shape_get_next(rb_shape_t* shape, VALUE obj, ID id);
157
167
 
158
168
  rb_shape_t * rb_shape_rebuild_shape(rb_shape_t * initial_shape, rb_shape_t * dest_shape);
@@ -163,7 +173,7 @@ ROBJECT_IV_CAPACITY(VALUE obj)
163
173
  RBIMPL_ASSERT_TYPE(obj, RUBY_T_OBJECT);
164
174
  // Asking for capacity doesn't make sense when the object is using
165
175
  // a hash table for storing instance variables
166
- RUBY_ASSERT(ROBJECT_SHAPE_ID(obj) != OBJ_TOO_COMPLEX_SHAPE_ID);
176
+ RUBY_ASSERT(!rb_shape_obj_too_complex(obj));
167
177
  return rb_shape_get_shape_by_id(ROBJECT_SHAPE_ID(obj))->capacity;
168
178
  }
169
179
 
@@ -171,15 +181,15 @@ static inline st_table *
171
181
  ROBJECT_IV_HASH(VALUE obj)
172
182
  {
173
183
  RBIMPL_ASSERT_TYPE(obj, RUBY_T_OBJECT);
174
- RUBY_ASSERT(ROBJECT_SHAPE_ID(obj) == OBJ_TOO_COMPLEX_SHAPE_ID);
184
+ RUBY_ASSERT(rb_shape_obj_too_complex(obj));
175
185
  return (st_table *)ROBJECT(obj)->as.heap.ivptr;
176
186
  }
177
187
 
178
188
  static inline void
179
- ROBJECT_SET_IV_HASH(VALUE obj, const struct rb_id_table *tbl)
189
+ ROBJECT_SET_IV_HASH(VALUE obj, const st_table *tbl)
180
190
  {
181
191
  RBIMPL_ASSERT_TYPE(obj, RUBY_T_OBJECT);
182
- RUBY_ASSERT(ROBJECT_SHAPE_ID(obj) == OBJ_TOO_COMPLEX_SHAPE_ID);
192
+ RUBY_ASSERT(rb_shape_obj_too_complex(obj));
183
193
  ROBJECT(obj)->as.heap.ivptr = (VALUE *)tbl;
184
194
  }
185
195
 
@@ -188,12 +198,12 @@ size_t rb_id_table_size(const struct rb_id_table *tbl);
188
198
  static inline uint32_t
189
199
  ROBJECT_IV_COUNT(VALUE obj)
190
200
  {
191
- if (ROBJECT_SHAPE_ID(obj) == OBJ_TOO_COMPLEX_SHAPE_ID) {
201
+ if (rb_shape_obj_too_complex(obj)) {
192
202
  return (uint32_t)rb_st_table_size(ROBJECT_IV_HASH(obj));
193
203
  }
194
204
  else {
195
205
  RBIMPL_ASSERT_TYPE(obj, RUBY_T_OBJECT);
196
- RUBY_ASSERT(ROBJECT_SHAPE_ID(obj) != OBJ_TOO_COMPLEX_SHAPE_ID);
206
+ RUBY_ASSERT(!rb_shape_obj_too_complex(obj));
197
207
  return rb_shape_get_shape_by_id(ROBJECT_SHAPE_ID(obj))->next_iv_index;
198
208
  }
199
209
  }
@@ -100,7 +100,7 @@ sym_type(VALUE sym)
100
100
  #define is_class_sym(sym) (sym_type(sym)==ID_CLASS)
101
101
  #define is_junk_sym(sym) (sym_type(sym)==ID_JUNK)
102
102
 
103
- RUBY_FUNC_EXPORTED const unsigned int ruby_global_name_punct_bits[(0x7e - 0x20 + 31) / 32];
103
+ RUBY_FUNC_EXPORTED const uint_least32_t ruby_global_name_punct_bits[(0x7e - 0x20 + 31) / 32];
104
104
 
105
105
  static inline int
106
106
  is_global_name_punct(const int c)
@@ -109,10 +109,9 @@ is_global_name_punct(const int c)
109
109
  return (ruby_global_name_punct_bits[(c - 0x20) / 32] >> (c % 32)) & 1;
110
110
  }
111
111
 
112
- int rb_enc_symname_type(const char *name, long len, rb_encoding *enc, unsigned int allowed_attrset);
113
-
114
112
  RUBY_SYMBOL_EXPORT_BEGIN
115
113
 
114
+ int rb_enc_symname_type(const char *name, long len, rb_encoding *enc, unsigned int allowed_attrset);
116
115
  size_t rb_sym_immortal_count(void);
117
116
 
118
117
  RUBY_SYMBOL_EXPORT_END
@@ -16,5 +16,6 @@ struct rb_thread_sched_item {};
16
16
  struct rb_thread_sched {};
17
17
 
18
18
  RUBY_EXTERN struct rb_execution_context_struct *ruby_current_ec;
19
+ NOINLINE(struct rb_execution_context_struct *rb_current_ec_noinline(void)); // for assertions
19
20
 
20
21
  #endif /* RUBY_THREAD_NONE_H */
@@ -19,14 +19,59 @@
19
19
 
20
20
  // per-Thead scheduler helper data
21
21
  struct rb_thread_sched_item {
22
- union {
22
+ struct {
23
23
  struct ccan_list_node ubf;
24
- struct ccan_list_node readyq; // protected by sched->lock
24
+
25
+ // connected to ractor->threads.sched.reqdyq
26
+ // locked by ractor->threads.sched.lock
27
+ struct ccan_list_node readyq;
28
+
29
+ // connected to vm->ractor.sched.timeslice_threads
30
+ // locked by vm->ractor.sched.lock
31
+ struct ccan_list_node timeslice_threads;
32
+
33
+ // connected to vm->ractor.sched.running_threads
34
+ // locked by vm->ractor.sched.lock
35
+ struct ccan_list_node running_threads;
36
+
37
+ // connected to vm->ractor.sched.zombie_threads
38
+ struct ccan_list_node zombie_threads;
25
39
  } node;
40
+
41
+ // this data should be protected by timer_th.waiting_lock
42
+ struct {
43
+ enum thread_sched_waiting_flag {
44
+ thread_sched_waiting_none = 0x00,
45
+ thread_sched_waiting_timeout = 0x01,
46
+ thread_sched_waiting_io_read = 0x02,
47
+ thread_sched_waiting_io_write = 0x08,
48
+ thread_sched_waiting_io_force = 0x40, // ignore readable
49
+ } flags;
50
+
51
+ struct {
52
+ // should be compat with hrtime.h
53
+ #ifdef MY_RUBY_BUILD_MAY_TIME_TRAVEL
54
+ int128_t timeout;
55
+ #else
56
+ uint64_t timeout;
57
+ #endif
58
+ int fd; // -1 for timeout only
59
+ int result;
60
+ } data;
61
+
62
+ // connected to timer_th.waiting
63
+ struct ccan_list_node node;
64
+ } waiting_reason;
65
+
66
+ bool finished;
67
+ bool malloc_stack;
68
+ void *context_stack;
69
+ struct coroutine_context *context;
26
70
  };
27
71
 
28
72
  struct rb_native_thread {
29
73
  rb_atomic_t serial;
74
+ struct rb_vm_struct *vm;
30
75
 
31
76
  rb_nativethread_id_t thread_id;
32
77
 
@@ -54,6 +99,11 @@ struct rb_native_thread {
54
99
  #ifdef USE_SIGALTSTACK
55
100
  void *altstack;
56
101
  #endif
102
+
103
+ struct coroutine_context *nt_context;
104
+ int dedicated;
105
+
106
+ size_t machine_stack_maxsize;
57
107
  };
58
108
 
59
109
  #undef except
@@ -63,39 +113,28 @@ struct rb_native_thread {
63
113
 
64
114
  // per-Ractor
65
115
  struct rb_thread_sched {
66
- /* fast path */
67
-
68
- const struct rb_thread_struct *running; // running thread or NULL
69
- rb_nativethread_lock_t lock;
116
+ rb_nativethread_lock_t lock_;
117
+ #if VM_CHECK_MODE
118
+ struct rb_thread_struct *lock_owner;
119
+ #endif
120
+ struct rb_thread_struct *running; // running thread or NULL
121
+ bool is_running;
122
+ bool is_running_timeslice;
123
+ bool enable_mn_threads;
70
124
 
71
- /*
72
- * slow path, protected by ractor->thread_sched->lock
73
- * - @readyq - FIFO queue of threads waiting for running
74
- * - @timer - it handles timeslices for @current. It is any one thread
75
- * in @waitq, there is no @timer if @waitq is empty, but always
76
- * a @timer if @waitq has entries
77
- * - @timer_err tracks timeslice limit, the timeslice only resets
78
- * when pthread_cond_timedwait returns ETIMEDOUT, so frequent
79
- * switching between contended/uncontended GVL won't reset the
80
- * timer.
81
- */
82
125
  struct ccan_list_head readyq;
83
- const struct rb_thread_struct *timer;
84
- int timer_err;
85
-
86
- /* yield */
87
- rb_nativethread_cond_t switch_cond;
88
- rb_nativethread_cond_t switch_wait_cond;
89
- int need_yield;
90
- int wait_yield;
126
+ int readyq_cnt;
127
+ // ractor scheduling
128
+ struct ccan_list_node grq_node;
91
129
  };
92
130
 
93
- RUBY_SYMBOL_EXPORT_BEGIN
94
131
  #ifdef RB_THREAD_LOCAL_SPECIFIER
132
+ NOINLINE(void rb_current_ec_set(struct rb_execution_context_struct *));
133
+ NOINLINE(struct rb_execution_context_struct *rb_current_ec_noinline(void));
134
+
95
135
  # ifdef __APPLE__
96
136
  // on Darwin, TLS can not be accessed across .so
97
137
  struct rb_execution_context_struct *rb_current_ec(void);
98
- void rb_current_ec_set(struct rb_execution_context_struct *);
99
138
  # else
100
139
  RUBY_EXTERN RB_THREAD_LOCAL_SPECIFIER struct rb_execution_context_struct *ruby_current_ec;
101
140
 
@@ -123,6 +162,5 @@ native_tls_set(native_tls_key_t key, void *ptr)
123
162
 
124
163
  RUBY_EXTERN native_tls_key_t ruby_current_ec_key;
125
164
  #endif
126
- RUBY_SYMBOL_EXPORT_END
127
165
 
128
166
  #endif /* RUBY_THREAD_PTHREAD_H */
@@ -21,18 +21,13 @@
21
21
  WINBASEAPI BOOL WINAPI
22
22
  TryEnterCriticalSection(IN OUT LPCRITICAL_SECTION lpCriticalSection);
23
23
 
24
- struct rb_thread_cond_struct {
25
- struct cond_event_entry *next;
26
- struct cond_event_entry *prev;
27
- };
28
-
29
24
  struct rb_native_thread {
30
25
  HANDLE thread_id;
31
26
  HANDLE interrupt_event;
32
27
  };
33
28
 
34
29
  struct rb_thread_sched_item {
35
- char dmy;
30
+ void *vm_stack;
36
31
  };
37
32
 
38
33
  struct rb_thread_sched {
@@ -16,8 +16,15 @@ struct gen_ivtbl {
16
16
  #if !SHAPE_IN_BASIC_FLAGS
17
17
  uint16_t shape_id;
18
18
  #endif
19
- uint32_t numiv;
20
- VALUE ivptr[FLEX_ARY_LEN];
19
+ union {
20
+ struct {
21
+ uint32_t numiv;
22
+ VALUE ivptr[1];
23
+ } shape;
24
+ struct {
25
+ st_table *table;
26
+ } complex;
27
+ } as;
21
28
  };
22
29
 
23
30
  int rb_ivar_generic_ivtbl_lookup(VALUE obj, struct gen_ivtbl **);
@@ -55,11 +55,15 @@
55
55
  #endif
56
56
 
57
57
  #if RUBY_PATCHLEVEL == -1
58
- #define RUBY_PATCHLEVEL_STR "preview1"
58
+ # ifdef RUBY_PATCHLEVEL_NAME
59
+ # define RUBY_PATCHLEVEL_STR STRINGIZE(RUBY_PATCHLEVEL_NAME)
60
+ # else
61
+ # define RUBY_PATCHLEVEL_STR "dev"
62
+ # endif
59
63
  #elif defined RUBY_ABI_VERSION
60
- #error RUBY_ABI_VERSION is defined in non-development branch
64
+ # error RUBY_ABI_VERSION is defined in non-development branch
61
65
  #else
62
- #define RUBY_PATCHLEVEL_STR ""
66
+ # define RUBY_PATCHLEVEL_STR ""
63
67
  #endif
64
68
 
65
69
  #endif /* RUBY_TOPLEVEL_VERSION_H */