debase-ruby_core_source 3.2.2 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/addr2line.h +3 -1
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/ccan/list/list.h +4 -2
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/dln.h +1 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/eval_intern.h +4 -2
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/insns.inc +2 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/insns_info.inc +280 -198
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/array.h +8 -1
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/bits.h +6 -6
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/class.h +53 -3
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/cmdlineopt.h +2 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/cont.h +3 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/encoding.h +3 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/error.h +3 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/gc.h +3 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/hash.h +1 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/imemo.h +0 -1
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/object.h +1 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/parse.h +7 -32
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/random.h +1 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/string.h +0 -1
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/symbol.h +3 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/thread.h +4 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/transcode.h +3 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/variable.h +5 -4
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/vm.h +9 -2
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/iseq.h +5 -1
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/method.h +7 -7
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/node.h +22 -19
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/node_name.inc +4 -2
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/optunifs.inc +1 -1
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/parse.h +16 -5
- data/lib/debase/ruby_core_source/ruby-3.3.0-p0/parser_node.h +32 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-p0/prism_compile.h +29 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/ractor_core.h +7 -1
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/regint.h +8 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/regparse.h +2 -1
- data/lib/debase/ruby_core_source/ruby-3.3.0-p0/revision.h +5 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/rjit.h +6 -8
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/rjit_c.h +0 -1
- data/lib/debase/ruby_core_source/ruby-3.3.0-p0/rubyparser.h +1403 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/shape.h +32 -32
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/symbol.h +1 -2
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/thread_none.h +1 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-p0/thread_pthread.h +166 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/thread_win32.h +1 -1
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/variable.h +11 -2
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/version.h +8 -4
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/vm.inc +225 -185
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/vm_callinfo.h +12 -1
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/vm_core.h +128 -16
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/vm_insnhelper.h +4 -14
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/vmtc.inc +2 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/yjit.h +10 -8
- data/lib/debase/ruby_core_source/version.rb +1 -1
- metadata +121 -120
- 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-p0}/builtin.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/ccan/build_assert/build_assert.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/ccan/check_type/check_type.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/ccan/container_of/container_of.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/ccan/str/str.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/constant.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/darray.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/debug_counter.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/encindex.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/hrtime.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/id.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/id_table.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/basic_operators.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/bignum.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/compar.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/compile.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/compilers.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/complex.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/dir.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/enc.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/enum.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/enumerator.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/eval.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/file.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/fixnum.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/inits.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/io.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/load.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/loadpath.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/math.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/missing.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/numeric.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/proc.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/process.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/ractor.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/range.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/rational.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/re.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/ruby_parser.h +2 -2
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/sanitizers.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/serial.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/signal.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/static_assert.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/struct.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/time.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/util.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/warnings.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/known_errors.inc +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/optinsn.inc +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/parser_bits.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/parser_st.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/parser_value.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/probes_helper.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/regenc.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/ruby_assert.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/ruby_atomic.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/siphash.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/timev.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/transcode_data.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/vm_call_iseq_optimized.inc +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/vm_debug.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/vm_exec.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/vm_opts.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/vm_sync.h +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
|
+
# define SHAPE_ID_NUM_BITS 32
|
13
|
+
|
10
14
|
#else
|
15
|
+
|
11
16
|
#define SIZEOF_SHAPE_T 2
|
12
17
|
#define SHAPE_IN_BASIC_FLAGS 0
|
13
18
|
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
19
|
typedef uint16_t shape_id_t;
|
24
20
|
# define SHAPE_ID_NUM_BITS 16
|
25
|
-
|
21
|
+
|
26
22
|
#endif
|
27
23
|
|
24
|
+
typedef uint32_t redblack_id_t;
|
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,22 @@ 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
|
-
SHAPE_CAPACITY_CHANGE,
|
60
|
-
SHAPE_INITIAL_CAPACITY,
|
61
67
|
SHAPE_T_OBJECT,
|
62
68
|
SHAPE_OBJ_TOO_COMPLEX,
|
63
69
|
};
|
@@ -67,6 +73,9 @@ typedef struct {
|
|
67
73
|
rb_shape_t *shape_list;
|
68
74
|
rb_shape_t *root_shape;
|
69
75
|
shape_id_t next_shape_id;
|
76
|
+
|
77
|
+
redblack_node_t *shape_cache;
|
78
|
+
unsigned int cache_size;
|
70
79
|
} rb_shape_tree_t;
|
71
80
|
RUBY_EXTERN rb_shape_tree_t *rb_shape_tree_ptr;
|
72
81
|
|
@@ -145,14 +154,14 @@ rb_shape_t* rb_shape_get_shape_by_id(shape_id_t shape_id);
|
|
145
154
|
shape_id_t rb_shape_get_shape_id(VALUE obj);
|
146
155
|
rb_shape_t * rb_shape_get_next_iv_shape(rb_shape_t * shape, ID id);
|
147
156
|
bool rb_shape_get_iv_index(rb_shape_t * shape, ID id, attr_index_t * value);
|
157
|
+
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
158
|
bool rb_shape_obj_too_complex(VALUE obj);
|
149
159
|
|
150
160
|
void rb_shape_set_shape(VALUE obj, rb_shape_t* shape);
|
151
161
|
rb_shape_t* rb_shape_get_shape(VALUE obj);
|
152
162
|
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);
|
163
|
+
rb_shape_t* rb_shape_transition_shape_frozen(VALUE obj);
|
164
|
+
bool rb_shape_transition_shape_remove_ivar(VALUE obj, ID id, rb_shape_t *shape, VALUE * removed);
|
156
165
|
rb_shape_t* rb_shape_get_next(rb_shape_t* shape, VALUE obj, ID id);
|
157
166
|
|
158
167
|
rb_shape_t * rb_shape_rebuild_shape(rb_shape_t * initial_shape, rb_shape_t * dest_shape);
|
@@ -163,7 +172,7 @@ ROBJECT_IV_CAPACITY(VALUE obj)
|
|
163
172
|
RBIMPL_ASSERT_TYPE(obj, RUBY_T_OBJECT);
|
164
173
|
// Asking for capacity doesn't make sense when the object is using
|
165
174
|
// a hash table for storing instance variables
|
166
|
-
RUBY_ASSERT(
|
175
|
+
RUBY_ASSERT(!rb_shape_obj_too_complex(obj));
|
167
176
|
return rb_shape_get_shape_by_id(ROBJECT_SHAPE_ID(obj))->capacity;
|
168
177
|
}
|
169
178
|
|
@@ -171,15 +180,15 @@ static inline st_table *
|
|
171
180
|
ROBJECT_IV_HASH(VALUE obj)
|
172
181
|
{
|
173
182
|
RBIMPL_ASSERT_TYPE(obj, RUBY_T_OBJECT);
|
174
|
-
RUBY_ASSERT(
|
183
|
+
RUBY_ASSERT(rb_shape_obj_too_complex(obj));
|
175
184
|
return (st_table *)ROBJECT(obj)->as.heap.ivptr;
|
176
185
|
}
|
177
186
|
|
178
187
|
static inline void
|
179
|
-
ROBJECT_SET_IV_HASH(VALUE obj, const
|
188
|
+
ROBJECT_SET_IV_HASH(VALUE obj, const st_table *tbl)
|
180
189
|
{
|
181
190
|
RBIMPL_ASSERT_TYPE(obj, RUBY_T_OBJECT);
|
182
|
-
RUBY_ASSERT(
|
191
|
+
RUBY_ASSERT(rb_shape_obj_too_complex(obj));
|
183
192
|
ROBJECT(obj)->as.heap.ivptr = (VALUE *)tbl;
|
184
193
|
}
|
185
194
|
|
@@ -188,12 +197,12 @@ size_t rb_id_table_size(const struct rb_id_table *tbl);
|
|
188
197
|
static inline uint32_t
|
189
198
|
ROBJECT_IV_COUNT(VALUE obj)
|
190
199
|
{
|
191
|
-
if (
|
200
|
+
if (rb_shape_obj_too_complex(obj)) {
|
192
201
|
return (uint32_t)rb_st_table_size(ROBJECT_IV_HASH(obj));
|
193
202
|
}
|
194
203
|
else {
|
195
204
|
RBIMPL_ASSERT_TYPE(obj, RUBY_T_OBJECT);
|
196
|
-
RUBY_ASSERT(
|
205
|
+
RUBY_ASSERT(!rb_shape_obj_too_complex(obj));
|
197
206
|
return rb_shape_get_shape_by_id(ROBJECT_SHAPE_ID(obj))->next_iv_index;
|
198
207
|
}
|
199
208
|
}
|
@@ -204,20 +213,11 @@ RBASIC_IV_COUNT(VALUE obj)
|
|
204
213
|
return rb_shape_get_shape_by_id(rb_shape_get_shape_id(obj))->next_iv_index;
|
205
214
|
}
|
206
215
|
|
207
|
-
static inline uint32_t
|
208
|
-
RCLASS_IV_COUNT(VALUE obj)
|
209
|
-
{
|
210
|
-
RUBY_ASSERT(RB_TYPE_P(obj, RUBY_T_CLASS) || RB_TYPE_P(obj, RUBY_T_MODULE));
|
211
|
-
uint32_t ivc = rb_shape_get_shape_by_id(RCLASS_SHAPE_ID(obj))->next_iv_index;
|
212
|
-
return ivc;
|
213
|
-
}
|
214
|
-
|
215
216
|
rb_shape_t *rb_shape_traverse_from_new_root(rb_shape_t *initial_shape, rb_shape_t *orig_shape);
|
216
217
|
|
217
218
|
bool rb_shape_set_shape_id(VALUE obj, shape_id_t shape_id);
|
218
219
|
|
219
220
|
VALUE rb_obj_debug_shape(VALUE self, VALUE obj);
|
220
|
-
void rb_shape_set_too_complex(VALUE obj);
|
221
221
|
|
222
222
|
// For ext/objspace
|
223
223
|
RUBY_SYMBOL_EXPORT_BEGIN
|
@@ -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
|
+
NOINLINE(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 **);
|
@@ -26,5 +33,7 @@ int rb_ivar_generic_ivtbl_lookup(VALUE obj, struct gen_ivtbl **);
|
|
26
33
|
shape_id_t rb_generic_shape_id(VALUE obj);
|
27
34
|
#endif
|
28
35
|
|
36
|
+
void rb_free_rb_global_tbl(void);
|
37
|
+
void rb_free_generic_iv_tbl_(void);
|
29
38
|
|
30
39
|
#endif /* RUBY_TOPLEVEL_VARIABLE_H */
|
@@ -11,7 +11,7 @@
|
|
11
11
|
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
|
12
12
|
#define RUBY_VERSION_TEENY 0
|
13
13
|
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
|
14
|
-
#define RUBY_PATCHLEVEL
|
14
|
+
#define RUBY_PATCHLEVEL 0
|
15
15
|
|
16
16
|
#include "ruby/version.h"
|
17
17
|
#include "ruby/internal/abi.h"
|
@@ -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 */
|