debase-ruby_core_source 3.2.2 → 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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/addr2line.h +3 -1
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/insns_info.inc +60 -60
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/array.h +8 -1
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/bits.h +6 -6
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/class.h +7 -3
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/cmdlineopt.h +2 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/gc.h +1 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/hash.h +1 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/imemo.h +0 -1
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/parse.h +7 -32
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/thread.h +1 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/variable.h +1 -2
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/vm.h +4 -2
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/method.h +7 -6
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/node.h +22 -19
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/node_name.inc +4 -2
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/parse.h +16 -5
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview3/parser_node.h +32 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview3/prism_compile.h +18 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/ractor_core.h +7 -1
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/regint.h +8 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/regparse.h +2 -1
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview3/revision.h +5 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview3/rubyparser.h +1403 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/shape.h +32 -22
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/symbol.h +1 -2
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/thread_none.h +1 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview3/thread_pthread.h +166 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/thread_win32.h +1 -1
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/variable.h +9 -2
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/version.h +7 -3
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/vm.inc +170 -183
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/vm_callinfo.h +4 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/vm_core.h +64 -11
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/yjit.h +10 -8
- data/lib/debase/ruby_core_source/version.rb +1 -1
- metadata +120 -119
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/parser_node.h +0 -133
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/revision.h +0 -5
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/rubyparser.h +0 -628
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/thread_pthread.h +0 -126
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/builtin.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/ccan/build_assert/build_assert.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/ccan/check_type/check_type.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/ccan/container_of/container_of.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/ccan/list/list.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/ccan/str/str.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/constant.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/darray.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/debug_counter.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/dln.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/encindex.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/eval_intern.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/hrtime.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/id.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/id_table.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/insns.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/basic_operators.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/bignum.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/compar.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/compile.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/compilers.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/complex.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/cont.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/dir.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/enc.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/encoding.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/enum.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/enumerator.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/error.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/eval.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/file.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/fixnum.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/inits.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/io.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/load.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/loadpath.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/math.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/missing.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/numeric.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/object.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/proc.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/process.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/ractor.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/random.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/range.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/rational.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/re.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/ruby_parser.h +2 -2
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/sanitizers.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/serial.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/signal.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/static_assert.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/string.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/struct.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/symbol.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/time.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/transcode.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/util.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal/warnings.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/internal.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/iseq.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/known_errors.inc +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/optinsn.inc +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/optunifs.inc +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/parser_bits.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/parser_st.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/parser_value.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/probes_helper.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/regenc.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/rjit.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/rjit_c.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/ruby_assert.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/ruby_atomic.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/siphash.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/timev.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/transcode_data.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/vm_call_iseq_optimized.inc +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/vm_debug.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/vm_exec.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/vm_insnhelper.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/vm_opts.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-preview3}/vm_sync.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → 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
|
-
|
|
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
|
-
|
|
154
|
-
|
|
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(
|
|
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(
|
|
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
|
|
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(
|
|
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 (
|
|
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(
|
|
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
|
}
|
|
@@ -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 */
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
#ifndef RUBY_THREAD_PTHREAD_H
|
|
2
|
+
#define RUBY_THREAD_PTHREAD_H
|
|
3
|
+
/**********************************************************************
|
|
4
|
+
|
|
5
|
+
thread_pthread.h -
|
|
6
|
+
|
|
7
|
+
$Author$
|
|
8
|
+
|
|
9
|
+
Copyright (C) 2004-2007 Koichi Sasada
|
|
10
|
+
|
|
11
|
+
**********************************************************************/
|
|
12
|
+
|
|
13
|
+
#ifdef HAVE_PTHREAD_NP_H
|
|
14
|
+
#include <pthread_np.h>
|
|
15
|
+
#endif
|
|
16
|
+
|
|
17
|
+
#define RB_NATIVETHREAD_LOCK_INIT PTHREAD_MUTEX_INITIALIZER
|
|
18
|
+
#define RB_NATIVETHREAD_COND_INIT PTHREAD_COND_INITIALIZER
|
|
19
|
+
|
|
20
|
+
// per-Thead scheduler helper data
|
|
21
|
+
struct rb_thread_sched_item {
|
|
22
|
+
struct {
|
|
23
|
+
struct ccan_list_node ubf;
|
|
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;
|
|
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;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
struct rb_native_thread {
|
|
73
|
+
rb_atomic_t serial;
|
|
74
|
+
struct rb_vm_struct *vm;
|
|
75
|
+
|
|
76
|
+
rb_nativethread_id_t thread_id;
|
|
77
|
+
|
|
78
|
+
#ifdef RB_THREAD_T_HAS_NATIVE_ID
|
|
79
|
+
int tid;
|
|
80
|
+
#endif
|
|
81
|
+
|
|
82
|
+
struct rb_thread_struct *running_thread;
|
|
83
|
+
|
|
84
|
+
// to control native thread
|
|
85
|
+
#if defined(__GLIBC__) || defined(__FreeBSD__)
|
|
86
|
+
union
|
|
87
|
+
#else
|
|
88
|
+
/*
|
|
89
|
+
* assume the platform condvars are badly implemented and have a
|
|
90
|
+
* "memory" of which mutex they're associated with
|
|
91
|
+
*/
|
|
92
|
+
struct
|
|
93
|
+
#endif
|
|
94
|
+
{
|
|
95
|
+
rb_nativethread_cond_t intr; /* th->interrupt_lock */
|
|
96
|
+
rb_nativethread_cond_t readyq; /* use sched->lock */
|
|
97
|
+
} cond;
|
|
98
|
+
|
|
99
|
+
#ifdef USE_SIGALTSTACK
|
|
100
|
+
void *altstack;
|
|
101
|
+
#endif
|
|
102
|
+
|
|
103
|
+
struct coroutine_context *nt_context;
|
|
104
|
+
int dedicated;
|
|
105
|
+
|
|
106
|
+
size_t machine_stack_maxsize;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
#undef except
|
|
110
|
+
#undef try
|
|
111
|
+
#undef leave
|
|
112
|
+
#undef finally
|
|
113
|
+
|
|
114
|
+
// per-Ractor
|
|
115
|
+
struct rb_thread_sched {
|
|
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;
|
|
124
|
+
|
|
125
|
+
struct ccan_list_head readyq;
|
|
126
|
+
int readyq_cnt;
|
|
127
|
+
// ractor scheduling
|
|
128
|
+
struct ccan_list_node grq_node;
|
|
129
|
+
};
|
|
130
|
+
|
|
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
|
+
|
|
135
|
+
# ifdef __APPLE__
|
|
136
|
+
// on Darwin, TLS can not be accessed across .so
|
|
137
|
+
struct rb_execution_context_struct *rb_current_ec(void);
|
|
138
|
+
# else
|
|
139
|
+
RUBY_EXTERN RB_THREAD_LOCAL_SPECIFIER struct rb_execution_context_struct *ruby_current_ec;
|
|
140
|
+
|
|
141
|
+
// for RUBY_DEBUG_LOG()
|
|
142
|
+
RUBY_EXTERN RB_THREAD_LOCAL_SPECIFIER rb_atomic_t ruby_nt_serial;
|
|
143
|
+
#define RUBY_NT_SERIAL 1
|
|
144
|
+
# endif
|
|
145
|
+
#else
|
|
146
|
+
typedef pthread_key_t native_tls_key_t;
|
|
147
|
+
|
|
148
|
+
static inline void *
|
|
149
|
+
native_tls_get(native_tls_key_t key)
|
|
150
|
+
{
|
|
151
|
+
// return value should be checked by caller
|
|
152
|
+
return pthread_getspecific(key);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
static inline void
|
|
156
|
+
native_tls_set(native_tls_key_t key, void *ptr)
|
|
157
|
+
{
|
|
158
|
+
if (UNLIKELY(pthread_setspecific(key, ptr) != 0)) {
|
|
159
|
+
rb_bug("pthread_setspecific error");
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
RUBY_EXTERN native_tls_key_t ruby_current_ec_key;
|
|
164
|
+
#endif
|
|
165
|
+
|
|
166
|
+
#endif /* RUBY_THREAD_PTHREAD_H */
|
|
@@ -16,8 +16,15 @@ struct gen_ivtbl {
|
|
|
16
16
|
#if !SHAPE_IN_BASIC_FLAGS
|
|
17
17
|
uint16_t shape_id;
|
|
18
18
|
#endif
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
#
|
|
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 */
|