datadog-ruby_core_source 3.5.1 → 3.5.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/datadog-ruby_core_source.gemspec +1 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/id.h +3 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/id_table.h +10 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/array.h +1 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/basic_operators.h +1 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/bignum.h +21 -10
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/bits.h +14 -17
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/box.h +18 -3
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/class.h +39 -95
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/cont.h +0 -1
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/eval.h +2 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/gc.h +7 -5
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/imemo.h +1 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/inits.h +1 -1
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/load.h +1 -1
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/numeric.h +48 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/rational.h +3 -1
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/thread.h +2 -2
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/time.h +2 -5
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/variable.h +2 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/vm.h +2 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/iseq.h +3 -1
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/method.h +7 -2
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/prism/ast.h +38 -17
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/prism/diagnostic.h +2 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/prism/extension.h +1 -1
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/prism/options.h +4 -1
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/prism/prism.h +1 -1
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/prism/version.h +3 -3
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/ractor_core.h +25 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/ruby_atomic.h +7 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/rubyparser.h +0 -1
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/shape.h +30 -10
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/thread_pthread.h +11 -1
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/vm_core.h +70 -12
- data/lib/datadog/ruby_core_source/version.rb +1 -1
- data/lib/datadog/ruby_core_source.rb +2 -2
- metadata +108 -110
- data/spec/datadog/ruby_core_source_spec.rb +0 -85
- data/spec/spec_helper.rb +0 -94
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/ccan/build_assert/build_assert.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/ccan/check_type/check_type.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/ccan/container_of/container_of.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/ccan/list/list.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/ccan/str/str.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/cmdlineopt.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/compar.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/compile.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/compilers.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/complex.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/concurrent_set.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/dir.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/enc.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/encoding.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/enum.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/enumerator.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/error.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/file.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/fixnum.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/hash.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/io.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/loadpath.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/math.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/missing.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/object.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/parse.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/proc.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/process.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/ractor.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/random.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/range.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/re.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/ruby_parser.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/sanitizers.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/serial.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/set_table.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/signal.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/st.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/static_assert.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/string.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/struct.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/symbol.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/transcode.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/util.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal/warnings.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/internal.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/node.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/parser_st.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/parser_value.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/prism/defines.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/prism/encoding.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/prism/node.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/prism/pack.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/prism/parser.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/prism/prettyprint.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/prism/regexp.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/prism/static_literals.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/prism/util/pm_buffer.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/prism/util/pm_char.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/prism/util/pm_constant_pool.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/prism/util/pm_integer.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/prism/util/pm_list.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/prism/util/pm_memchr.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/prism/util/pm_newline_list.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/prism/util/pm_string.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/prism/util/pm_strncasecmp.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/prism/util/pm_strpbrk.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/prism_compile.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/ruby_assert.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/thread_none.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/vm_debug.h +4 -4
- /data/lib/datadog/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.6-p0}/vm_opts.h +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4ddda3216e9e2df336d43e4ead1944a58324fd0044abdbac2c281cbdf0fc9b5c
|
|
4
|
+
data.tar.gz: 1b6ed3757b230901e7b8dbdc1bfe0d3bea04c0fb50ebd2280bdb141ca940b6d4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 456241058e3ef1b2ccb823fa196c05526f4b665f10a0f76254a7b17a99c572b58a77d10f765cd0082d44508d5877f749de782b7559655c073bbd2319a4cb61a0
|
|
7
|
+
data.tar.gz: 8e3787e8408c3bae05bc1618919fb76fd0f9729cf4383be0b1ef10ce7756745da9affb3f6beddfe18b40757c6fec667a1ebda8f30af7d199a99d541bce5db268
|
|
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
|
|
|
20
20
|
.reject { |fn| fn.include?('Rakefile') }
|
|
21
21
|
.reject { |fn| fn.include?('.github/') }
|
|
22
22
|
.reject { |fn| fn.include?('.gitignore') }
|
|
23
|
+
.reject { |fn| fn.include?('spec/') }
|
|
23
24
|
s.add_development_dependency "archive-tar-minitar", ">= 0.5.2"
|
|
24
25
|
s.add_development_dependency 'rake', '>= 0.9.2'
|
|
25
26
|
s.add_development_dependency 'minitar-cli'
|
|
@@ -109,6 +109,7 @@ enum ruby_method_ids {
|
|
|
109
109
|
tPRESERVED_ID_BEGIN = 150,
|
|
110
110
|
idNilP,
|
|
111
111
|
idIncludeP,
|
|
112
|
+
idItImplicit,
|
|
112
113
|
idNULL,
|
|
113
114
|
idEmptyP,
|
|
114
115
|
idEqlP,
|
|
@@ -204,6 +205,7 @@ enum ruby_method_ids {
|
|
|
204
205
|
tNUMPARAM_7,
|
|
205
206
|
tNUMPARAM_8,
|
|
206
207
|
tNUMPARAM_9,
|
|
208
|
+
tIt,
|
|
207
209
|
tDefault,
|
|
208
210
|
tTOKEN_LOCAL_END,
|
|
209
211
|
/* LOCAL tokens }}} */
|
|
@@ -314,6 +316,7 @@ enum ruby_method_ids {
|
|
|
314
316
|
DEFINE_LOCALID_FROM_TOKEN(NUMPARAM_7),
|
|
315
317
|
DEFINE_LOCALID_FROM_TOKEN(NUMPARAM_8),
|
|
316
318
|
DEFINE_LOCALID_FROM_TOKEN(NUMPARAM_9),
|
|
319
|
+
DEFINE_LOCALID_FROM_TOKEN(It),
|
|
317
320
|
DEFINE_LOCALID_FROM_TOKEN(Default),
|
|
318
321
|
#undef DEFINE_LOCALID_FROM_TOKEN
|
|
319
322
|
/* LOCAL IDs }}} */
|
|
@@ -47,6 +47,16 @@ int rb_managed_id_table_delete(VALUE table, ID id);
|
|
|
47
47
|
|
|
48
48
|
extern const rb_data_type_t rb_managed_id_table_type;
|
|
49
49
|
|
|
50
|
+
VALUE rb_marked_id_table_new(size_t capa);
|
|
51
|
+
int rb_marked_id_table_insert(VALUE table, ID id, VALUE val);
|
|
52
|
+
VALUE rb_marked_id_table_dup(VALUE table);
|
|
53
|
+
|
|
54
|
+
// alisases
|
|
55
|
+
#define rb_marked_id_table_size rb_managed_id_table_size
|
|
56
|
+
#define rb_marked_id_table_lookup rb_managed_id_table_lookup
|
|
57
|
+
#define rb_marked_id_table_foreach rb_managed_id_table_foreach
|
|
58
|
+
#define rb_marked_id_table_foreach_values rb_managed_id_table_foreach_values
|
|
59
|
+
|
|
50
60
|
RUBY_SYMBOL_EXPORT_BEGIN
|
|
51
61
|
size_t rb_id_table_size(const struct rb_id_table *tbl);
|
|
52
62
|
RUBY_SYMBOL_EXPORT_END
|
|
@@ -37,6 +37,7 @@ size_t rb_ary_size_as_embedded(VALUE ary);
|
|
|
37
37
|
void rb_ary_make_embedded(VALUE ary);
|
|
38
38
|
bool rb_ary_embeddable_p(VALUE ary);
|
|
39
39
|
VALUE rb_ary_diff(VALUE ary1, VALUE ary2);
|
|
40
|
+
VALUE rb_ary_compact_bang(VALUE ary);
|
|
40
41
|
RUBY_EXTERN VALUE rb_cArray_empty_frozen;
|
|
41
42
|
|
|
42
43
|
static inline VALUE rb_ary_entry_internal(VALUE ary, long offset);
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* @brief Internal header for Bignums.
|
|
10
10
|
*/
|
|
11
11
|
#include "ruby/internal/config.h" /* for HAVE_LIBGMP */
|
|
12
|
+
#include "internal/compilers.h" /* for FLEX_ARY_LEN */
|
|
12
13
|
#include <stddef.h> /* for size_t */
|
|
13
14
|
|
|
14
15
|
#ifdef HAVE_SYS_TYPES_H
|
|
@@ -76,18 +77,17 @@
|
|
|
76
77
|
#define RBIGNUM(obj) ((struct RBignum *)(obj))
|
|
77
78
|
#define BIGNUM_SIGN_BIT FL_USER1
|
|
78
79
|
#define BIGNUM_EMBED_FLAG ((VALUE)FL_USER2)
|
|
79
|
-
|
|
80
|
+
|
|
81
|
+
/* This is likely more bits than we need today and will also need adjustment if
|
|
82
|
+
* we change GC slot sizes.
|
|
83
|
+
*/
|
|
84
|
+
#define BIGNUM_EMBED_LEN_NUMBITS 9
|
|
80
85
|
#define BIGNUM_EMBED_LEN_MASK \
|
|
81
|
-
(
|
|
86
|
+
(RUBY_FL_USER11 | RUBY_FL_USER10 | RUBY_FL_USER9 | RUBY_FL_USER8 | RUBY_FL_USER7 | \
|
|
87
|
+
RUBY_FL_USER6 | RUBY_FL_USER5 | RUBY_FL_USER4 | RUBY_FL_USER3)
|
|
82
88
|
#define BIGNUM_EMBED_LEN_SHIFT \
|
|
83
89
|
(FL_USHIFT+3) /* bit offset of BIGNUM_EMBED_LEN_MASK */
|
|
84
|
-
#
|
|
85
|
-
# if (SIZEOF_VALUE*RBIMPL_RVALUE_EMBED_LEN_MAX/SIZEOF_ACTUAL_BDIGIT) < (1 << BIGNUM_EMBED_LEN_NUMBITS)-1
|
|
86
|
-
# define BIGNUM_EMBED_LEN_MAX (SIZEOF_VALUE*RBIMPL_RVALUE_EMBED_LEN_MAX/SIZEOF_ACTUAL_BDIGIT)
|
|
87
|
-
# else
|
|
88
|
-
# define BIGNUM_EMBED_LEN_MAX ((1 << BIGNUM_EMBED_LEN_NUMBITS)-1)
|
|
89
|
-
# endif
|
|
90
|
-
#endif
|
|
90
|
+
#define BIGNUM_EMBED_LEN_MAX (BIGNUM_EMBED_LEN_MASK >> BIGNUM_EMBED_LEN_SHIFT)
|
|
91
91
|
|
|
92
92
|
enum rb_int_parse_flags {
|
|
93
93
|
RB_INT_PARSE_SIGN = 0x01,
|
|
@@ -104,7 +104,12 @@ struct RBignum {
|
|
|
104
104
|
size_t len;
|
|
105
105
|
BDIGIT *digits;
|
|
106
106
|
} heap;
|
|
107
|
-
|
|
107
|
+
/* This is a length 1 array because:
|
|
108
|
+
* 1. GCC has a bug that does not optimize C flexible array members
|
|
109
|
+
* (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102452)
|
|
110
|
+
* 2. Zero length arrays are not supported by all compilers
|
|
111
|
+
*/
|
|
112
|
+
BDIGIT ary[1];
|
|
108
113
|
} as;
|
|
109
114
|
};
|
|
110
115
|
|
|
@@ -164,7 +169,13 @@ VALUE rb_str2big_gmp(VALUE arg, int base, int badcheck);
|
|
|
164
169
|
VALUE rb_int_parse_cstr(const char *str, ssize_t len, char **endp, size_t *ndigits, int base, int flags);
|
|
165
170
|
RUBY_SYMBOL_EXPORT_END
|
|
166
171
|
|
|
172
|
+
#if HAVE_LONG_LONG
|
|
173
|
+
VALUE rb_ull2big(unsigned LONG_LONG n);
|
|
174
|
+
VALUE rb_ll2big(LONG_LONG n);
|
|
175
|
+
#endif
|
|
176
|
+
|
|
167
177
|
#if defined(HAVE_INT128_T)
|
|
178
|
+
VALUE rb_uint128t2big(uint128_t n);
|
|
168
179
|
VALUE rb_int128t2big(int128_t n);
|
|
169
180
|
#endif
|
|
170
181
|
|
|
@@ -30,13 +30,13 @@
|
|
|
30
30
|
#include <stdint.h> /* for uintptr_t */
|
|
31
31
|
#include "internal/compilers.h" /* for MSC_VERSION_SINCE */
|
|
32
32
|
|
|
33
|
-
#
|
|
33
|
+
#ifdef _MSC_VER
|
|
34
34
|
# include <stdlib.h> /* for _byteswap_uint64 */
|
|
35
35
|
#endif
|
|
36
36
|
|
|
37
37
|
#if defined(HAVE_X86INTRIN_H)
|
|
38
38
|
# include <x86intrin.h> /* for _lzcnt_u64 */
|
|
39
|
-
#elif
|
|
39
|
+
#elif defined(_MSC_VER)
|
|
40
40
|
# include <intrin.h> /* for the following intrinsics */
|
|
41
41
|
#endif
|
|
42
42
|
|
|
@@ -50,16 +50,13 @@
|
|
|
50
50
|
# pragma intrinsic(__lzcnt64)
|
|
51
51
|
#endif
|
|
52
52
|
|
|
53
|
-
#if
|
|
53
|
+
#if defined(_MSC_VER)
|
|
54
54
|
# pragma intrinsic(_rotl)
|
|
55
55
|
# pragma intrinsic(_rotr)
|
|
56
56
|
# ifdef _WIN64
|
|
57
57
|
# pragma intrinsic(_rotl64)
|
|
58
58
|
# pragma intrinsic(_rotr64)
|
|
59
59
|
# endif
|
|
60
|
-
#endif
|
|
61
|
-
|
|
62
|
-
#if MSC_VERSION_SINCE(1400)
|
|
63
60
|
# pragma intrinsic(_BitScanForward)
|
|
64
61
|
# pragma intrinsic(_BitScanReverse)
|
|
65
62
|
# ifdef _WIN64
|
|
@@ -266,7 +263,7 @@ ruby_swap16(uint16_t x)
|
|
|
266
263
|
#if __has_builtin(__builtin_bswap16)
|
|
267
264
|
return __builtin_bswap16(x);
|
|
268
265
|
|
|
269
|
-
#elif
|
|
266
|
+
#elif defined(_MSC_VER)
|
|
270
267
|
return _byteswap_ushort(x);
|
|
271
268
|
|
|
272
269
|
#else
|
|
@@ -281,7 +278,7 @@ ruby_swap32(uint32_t x)
|
|
|
281
278
|
#if __has_builtin(__builtin_bswap32)
|
|
282
279
|
return __builtin_bswap32(x);
|
|
283
280
|
|
|
284
|
-
#elif
|
|
281
|
+
#elif defined(_MSC_VER)
|
|
285
282
|
return _byteswap_ulong(x);
|
|
286
283
|
|
|
287
284
|
#else
|
|
@@ -298,7 +295,7 @@ ruby_swap64(uint64_t x)
|
|
|
298
295
|
#if __has_builtin(__builtin_bswap64)
|
|
299
296
|
return __builtin_bswap64(x);
|
|
300
297
|
|
|
301
|
-
#elif
|
|
298
|
+
#elif defined(_MSC_VER)
|
|
302
299
|
return _byteswap_uint64(x);
|
|
303
300
|
|
|
304
301
|
#else
|
|
@@ -323,7 +320,7 @@ nlz_int32(uint32_t x)
|
|
|
323
320
|
#elif defined(__x86_64__) && defined(__LZCNT__)
|
|
324
321
|
return (unsigned int)_lzcnt_u32(x);
|
|
325
322
|
|
|
326
|
-
#elif
|
|
323
|
+
#elif defined(_MSC_VER) /* &&! defined(__AVX2__) */
|
|
327
324
|
unsigned long r;
|
|
328
325
|
return _BitScanReverse(&r, x) ? (31 - (int)r) : 32;
|
|
329
326
|
|
|
@@ -352,7 +349,7 @@ nlz_int64(uint64_t x)
|
|
|
352
349
|
#elif defined(__x86_64__) && defined(__LZCNT__)
|
|
353
350
|
return (unsigned int)_lzcnt_u64(x);
|
|
354
351
|
|
|
355
|
-
#elif defined(_WIN64) &&
|
|
352
|
+
#elif defined(_WIN64) && defined(_MSC_VER) /* &&! defined(__AVX2__) */
|
|
356
353
|
unsigned long r;
|
|
357
354
|
return _BitScanReverse64(&r, x) ? (63u - (unsigned int)r) : 64;
|
|
358
355
|
|
|
@@ -538,7 +535,7 @@ ntz_int32(uint32_t x)
|
|
|
538
535
|
#if defined(__x86_64__) && defined(__BMI__)
|
|
539
536
|
return (unsigned)_tzcnt_u32(x);
|
|
540
537
|
|
|
541
|
-
#elif
|
|
538
|
+
#elif defined(_MSC_VER)
|
|
542
539
|
/* :FIXME: Is there any way to issue TZCNT instead of BSF, apart from using
|
|
543
540
|
* assembly? Because issuing LZCNT seems possible (see nlz.h). */
|
|
544
541
|
unsigned long r;
|
|
@@ -560,7 +557,7 @@ ntz_int64(uint64_t x)
|
|
|
560
557
|
#if defined(__x86_64__) && defined(__BMI__)
|
|
561
558
|
return (unsigned)_tzcnt_u64(x);
|
|
562
559
|
|
|
563
|
-
#elif defined(_WIN64) &&
|
|
560
|
+
#elif defined(_WIN64) && defined(_MSC_VER)
|
|
564
561
|
unsigned long r;
|
|
565
562
|
return _BitScanForward64(&r, x) ? (int)r : 64;
|
|
566
563
|
|
|
@@ -608,10 +605,10 @@ RUBY_BIT_ROTL(VALUE v, int n)
|
|
|
608
605
|
#elif __has_builtin(__builtin_rotateleft64) && (SIZEOF_VALUE * CHAR_BIT == 64)
|
|
609
606
|
return __builtin_rotateleft64(v, n);
|
|
610
607
|
|
|
611
|
-
#elif
|
|
608
|
+
#elif defined(_MSC_VER) && (SIZEOF_VALUE * CHAR_BIT == 32)
|
|
612
609
|
return _rotl(v, n);
|
|
613
610
|
|
|
614
|
-
#elif
|
|
611
|
+
#elif defined(_MSC_VER) && (SIZEOF_VALUE * CHAR_BIT == 64)
|
|
615
612
|
return _rotl64(v, n);
|
|
616
613
|
|
|
617
614
|
#elif defined(_lrotl) && (SIZEOF_VALUE == SIZEOF_LONG)
|
|
@@ -632,10 +629,10 @@ RUBY_BIT_ROTR(VALUE v, int n)
|
|
|
632
629
|
#elif __has_builtin(__builtin_rotateright64) && (SIZEOF_VALUE * CHAR_BIT == 64)
|
|
633
630
|
return __builtin_rotateright64(v, n);
|
|
634
631
|
|
|
635
|
-
#elif
|
|
632
|
+
#elif defined(_MSC_VER) && (SIZEOF_VALUE * CHAR_BIT == 32)
|
|
636
633
|
return _rotr(v, n);
|
|
637
634
|
|
|
638
|
-
#elif
|
|
635
|
+
#elif defined(_MSC_VER) && (SIZEOF_VALUE * CHAR_BIT == 64)
|
|
639
636
|
return _rotr64(v, n);
|
|
640
637
|
|
|
641
638
|
#elif defined(_lrotr) && (SIZEOF_VALUE == SIZEOF_LONG)
|
|
@@ -34,15 +34,27 @@ struct rb_box_struct {
|
|
|
34
34
|
VALUE ruby_dln_libmap;
|
|
35
35
|
|
|
36
36
|
VALUE gvar_tbl;
|
|
37
|
+
struct st_table *classext_cow_classes;
|
|
37
38
|
|
|
39
|
+
bool is_root;
|
|
38
40
|
bool is_user;
|
|
39
41
|
bool is_optional;
|
|
40
42
|
};
|
|
41
43
|
typedef struct rb_box_struct rb_box_t;
|
|
42
44
|
|
|
45
|
+
struct rb_box_gem_flags {
|
|
46
|
+
bool gem;
|
|
47
|
+
bool error_highlight;
|
|
48
|
+
bool did_you_mean;
|
|
49
|
+
bool syntax_suggest;
|
|
50
|
+
};
|
|
51
|
+
typedef struct rb_box_gem_flags rb_box_gem_flags_t;
|
|
52
|
+
|
|
43
53
|
#define BOX_OBJ_P(obj) (rb_obj_class(obj) == rb_cBox)
|
|
44
54
|
|
|
45
|
-
#define
|
|
55
|
+
#define BOX_MASTER_P(box) (box && !box->is_root && !box->is_user)
|
|
56
|
+
#define BOX_MUTABLE_P(box) (box && (box->is_root || box->is_user))
|
|
57
|
+
#define BOX_ROOT_P(box) (box && box->is_root)
|
|
46
58
|
#define BOX_USER_P(box) (box && box->is_user)
|
|
47
59
|
#define BOX_OPTIONAL_P(box) (box && box->is_optional)
|
|
48
60
|
#define BOX_MAIN_P(box) (box && box->is_user && !box->is_optional)
|
|
@@ -62,6 +74,7 @@ rb_box_available(void)
|
|
|
62
74
|
return ruby_box_enabled;
|
|
63
75
|
}
|
|
64
76
|
|
|
77
|
+
const rb_box_t * rb_master_box(void);
|
|
65
78
|
const rb_box_t * rb_root_box(void);
|
|
66
79
|
const rb_box_t * rb_main_box(void);
|
|
67
80
|
const rb_box_t * rb_current_box(void);
|
|
@@ -74,8 +87,10 @@ void rb_box_gc_update_references(void *ptr);
|
|
|
74
87
|
rb_box_t * rb_get_box_t(VALUE ns);
|
|
75
88
|
VALUE rb_get_box_object(rb_box_t *ns);
|
|
76
89
|
|
|
77
|
-
VALUE rb_box_local_extension(VALUE box, VALUE fname, VALUE path);
|
|
90
|
+
VALUE rb_box_local_extension(VALUE box, VALUE fname, VALUE path, VALUE *cleanup);
|
|
91
|
+
void rb_box_cleanup_local_extension(VALUE cleanup);
|
|
78
92
|
|
|
79
|
-
void
|
|
93
|
+
void rb_initialize_mandatory_boxes(void);
|
|
80
94
|
void rb_box_init_done(void);
|
|
95
|
+
void rb_box_set_gem_flags(rb_box_gem_flags_t *);
|
|
81
96
|
#endif /* INTERNAL_BOX_H */
|
|
@@ -27,41 +27,6 @@
|
|
|
27
27
|
# undef RCLASS_SUPER
|
|
28
28
|
#endif
|
|
29
29
|
|
|
30
|
-
struct rb_box_subclasses {
|
|
31
|
-
long refcount;
|
|
32
|
-
struct st_table *tbl;
|
|
33
|
-
};
|
|
34
|
-
typedef struct rb_box_subclasses rb_box_subclasses_t;
|
|
35
|
-
|
|
36
|
-
static inline long
|
|
37
|
-
rb_box_subclasses_ref_count(rb_box_subclasses_t *box_sub)
|
|
38
|
-
{
|
|
39
|
-
return box_sub->refcount;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
static inline rb_box_subclasses_t *
|
|
43
|
-
rb_box_subclasses_ref_inc(rb_box_subclasses_t *box_sub)
|
|
44
|
-
{
|
|
45
|
-
box_sub->refcount++;
|
|
46
|
-
return box_sub;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
static inline void
|
|
50
|
-
rb_box_subclasses_ref_dec(rb_box_subclasses_t *box_sub)
|
|
51
|
-
{
|
|
52
|
-
box_sub->refcount--;
|
|
53
|
-
if (box_sub->refcount == 0) {
|
|
54
|
-
st_free_table(box_sub->tbl);
|
|
55
|
-
xfree(box_sub);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
struct rb_subclass_anchor {
|
|
60
|
-
rb_box_subclasses_t *box_subclasses;
|
|
61
|
-
struct rb_subclass_entry *head;
|
|
62
|
-
};
|
|
63
|
-
typedef struct rb_subclass_anchor rb_subclass_anchor_t;
|
|
64
|
-
|
|
65
30
|
struct rb_subclass_entry {
|
|
66
31
|
VALUE klass;
|
|
67
32
|
struct rb_subclass_entry *next;
|
|
@@ -70,9 +35,10 @@ struct rb_subclass_entry {
|
|
|
70
35
|
typedef struct rb_subclass_entry rb_subclass_entry_t;
|
|
71
36
|
|
|
72
37
|
struct rb_cvar_class_tbl_entry {
|
|
38
|
+
VALUE imemo_flags;
|
|
73
39
|
uint32_t index;
|
|
74
40
|
rb_serial_t global_cvar_state;
|
|
75
|
-
const rb_cref_t *
|
|
41
|
+
const rb_cref_t *cref;
|
|
76
42
|
VALUE class_value;
|
|
77
43
|
};
|
|
78
44
|
|
|
@@ -84,27 +50,24 @@ struct rb_classext_struct {
|
|
|
84
50
|
struct rb_id_table *const_tbl;
|
|
85
51
|
struct rb_id_table *callable_m_tbl;
|
|
86
52
|
VALUE cc_tbl; /* { ID => { cme, [cc1, cc2, ...] }, ... } */
|
|
87
|
-
|
|
53
|
+
VALUE cvc_tbl;
|
|
88
54
|
VALUE *superclasses;
|
|
89
55
|
/**
|
|
90
|
-
* The head of subclasses is a
|
|
91
|
-
*
|
|
56
|
+
* The head of the subclasses linked list. This is a dummy entry (klass == 0)
|
|
57
|
+
* whose `next` points to the first real entry. Only used in prime classext.
|
|
92
58
|
*/
|
|
93
|
-
struct
|
|
59
|
+
struct rb_subclass_entry *subclasses;
|
|
94
60
|
/**
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
* In compaction GCs, collecting a classext should trigger the deletion of a rb_subclass_entry
|
|
98
|
-
* from the super's subclasses. But it may be prevented by the read barrier.
|
|
99
|
-
* Fetching the super's subclasses for a ns is to avoid the read barrier in that process.
|
|
61
|
+
* Back-pointer to this class's entry in its superclass's subclasses list.
|
|
62
|
+
* Used for O(1) removal when the class is freed.
|
|
100
63
|
*/
|
|
101
|
-
|
|
64
|
+
struct rb_subclass_entry *subclass_entry;
|
|
102
65
|
/**
|
|
103
|
-
* In the case that this is an `ICLASS`, `
|
|
104
|
-
* in the module's `subclasses` list that indicates that the klass has been
|
|
105
|
-
* included.
|
|
66
|
+
* In the case that this is an `ICLASS`, `module_subclass_entry` points to the
|
|
67
|
+
* entry in the module's `subclasses` list that indicates that the klass has been
|
|
68
|
+
* included. Used for O(1) removal.
|
|
106
69
|
*/
|
|
107
|
-
|
|
70
|
+
struct rb_subclass_entry *module_subclass_entry;
|
|
108
71
|
|
|
109
72
|
const VALUE origin_;
|
|
110
73
|
const VALUE refined_class;
|
|
@@ -188,8 +151,8 @@ static inline rb_classext_t * RCLASS_EXT_WRITABLE(VALUE obj);
|
|
|
188
151
|
#define RCLASSEXT_SUPERCLASS_DEPTH(ext) (ext->superclass_depth)
|
|
189
152
|
#define RCLASSEXT_SUPERCLASSES(ext) (ext->superclasses)
|
|
190
153
|
#define RCLASSEXT_SUBCLASSES(ext) (ext->subclasses)
|
|
191
|
-
#define
|
|
192
|
-
#define
|
|
154
|
+
#define RCLASSEXT_SUBCLASS_ENTRY(ext) (ext->subclass_entry)
|
|
155
|
+
#define RCLASSEXT_MODULE_SUBCLASS_ENTRY(ext) (ext->module_subclass_entry)
|
|
193
156
|
#define RCLASSEXT_ORIGIN(ext) (ext->origin_)
|
|
194
157
|
#define RCLASSEXT_REFINED_CLASS(ext) (ext->refined_class)
|
|
195
158
|
// class.allocator/singleton_class.attached_object are not accessed directly via RCLASSEXT_*
|
|
@@ -227,8 +190,8 @@ static inline void RCLASSEXT_SET_INCLUDER(rb_classext_t *ext, VALUE klass, VALUE
|
|
|
227
190
|
* so always those should be writable.
|
|
228
191
|
*/
|
|
229
192
|
#define RCLASS_CVC_TBL(c) (RCLASS_EXT_READABLE(c)->cvc_tbl)
|
|
230
|
-
#define
|
|
231
|
-
#define RCLASS_SUBCLASSES_FIRST(c) (
|
|
193
|
+
#define RCLASS_SUBCLASSES(c) (RCLASS_EXT_PRIME(c)->subclasses)
|
|
194
|
+
#define RCLASS_SUBCLASSES_FIRST(c) (RCLASS_EXT_PRIME(c)->subclasses ? RCLASS_EXT_PRIME(c)->subclasses->next : NULL)
|
|
232
195
|
#define RCLASS_ORIGIN(c) (RCLASS_EXT_READABLE(c)->origin_)
|
|
233
196
|
#define RICLASS_IS_ORIGIN_P(c) (RCLASS_EXT_READABLE(c)->iclass_is_origin)
|
|
234
197
|
#define RCLASS_PERMANENT_CLASSPATH_P(c) (RCLASS_EXT_READABLE(c)->permanent_classpath)
|
|
@@ -255,7 +218,8 @@ static inline void RCLASSEXT_SET_INCLUDER(rb_classext_t *ext, VALUE klass, VALUE
|
|
|
255
218
|
#define RCLASS_WRITABLE_CALLABLE_M_TBL(c) (RCLASS_EXT_WRITABLE(c)->callable_m_tbl)
|
|
256
219
|
#define RCLASS_WRITABLE_CC_TBL(c) (RCLASS_EXT_WRITABLE(c)->cc_tbl)
|
|
257
220
|
#define RCLASS_WRITABLE_CVC_TBL(c) (RCLASS_EXT_WRITABLE(c)->cvc_tbl)
|
|
258
|
-
|
|
221
|
+
// Subclasses are only in the prime classext (box-invariant)
|
|
222
|
+
#define RCLASS_WRITABLE_SUBCLASSES(c) (RCLASS_EXT_PRIME(c)->subclasses)
|
|
259
223
|
|
|
260
224
|
static inline void RCLASS_SET_SUPER(VALUE klass, VALUE super);
|
|
261
225
|
static inline void RCLASS_WRITE_SUPER(VALUE klass, VALUE super);
|
|
@@ -263,13 +227,11 @@ static inline void RCLASS_SET_CONST_TBL(VALUE klass, struct rb_id_table *table,
|
|
|
263
227
|
static inline void RCLASS_WRITE_CONST_TBL(VALUE klass, struct rb_id_table *table, bool shared);
|
|
264
228
|
static inline void RCLASS_WRITE_CALLABLE_M_TBL(VALUE klass, struct rb_id_table *table);
|
|
265
229
|
static inline void RCLASS_WRITE_CC_TBL(VALUE klass, VALUE table);
|
|
266
|
-
static inline void RCLASS_SET_CVC_TBL(VALUE klass,
|
|
267
|
-
static inline void RCLASS_WRITE_CVC_TBL(VALUE klass,
|
|
230
|
+
static inline void RCLASS_SET_CVC_TBL(VALUE klass, VALUE table);
|
|
231
|
+
static inline void RCLASS_WRITE_CVC_TBL(VALUE klass, VALUE table);
|
|
268
232
|
|
|
269
233
|
static inline void RCLASS_WRITE_SUPERCLASSES(VALUE klass, size_t depth, VALUE *superclasses, bool with_self);
|
|
270
|
-
static inline void RCLASS_SET_SUBCLASSES(VALUE klass,
|
|
271
|
-
static inline void RCLASS_WRITE_BOX_SUPER_SUBCLASSES(VALUE klass, rb_box_subclasses_t *box_subclasses);
|
|
272
|
-
static inline void RCLASS_WRITE_BOX_MODULE_SUBCLASSES(VALUE klass, rb_box_subclasses_t *box_subclasses);
|
|
234
|
+
static inline void RCLASS_SET_SUBCLASSES(VALUE klass, rb_subclass_entry_t *head);
|
|
273
235
|
|
|
274
236
|
static inline void RCLASS_SET_ORIGIN(VALUE klass, VALUE origin);
|
|
275
237
|
static inline void RCLASS_WRITE_ORIGIN(VALUE klass, VALUE origin);
|
|
@@ -324,7 +286,7 @@ RCLASS_SET_BOX_CLASSEXT(VALUE obj, const rb_box_t *box, rb_classext_t *ext)
|
|
|
324
286
|
{
|
|
325
287
|
int first_set = 0;
|
|
326
288
|
st_table *tbl = RCLASS_CLASSEXT_TBL(obj);
|
|
327
|
-
VM_ASSERT(
|
|
289
|
+
VM_ASSERT(BOX_MUTABLE_P(box)); // Setting non-prime classext never happens on the master box
|
|
328
290
|
VM_ASSERT(box->box_object);
|
|
329
291
|
VM_ASSERT(RCLASSEXT_BOX(ext) == box);
|
|
330
292
|
if (!tbl) {
|
|
@@ -357,7 +319,7 @@ RCLASS_PRIME_CLASSEXT_WRITABLE_P(VALUE klass)
|
|
|
357
319
|
{
|
|
358
320
|
VM_ASSERT(klass != 0, "klass should be a valid object");
|
|
359
321
|
VM_ASSERT_BOXABLE_TYPE(klass);
|
|
360
|
-
return
|
|
322
|
+
return FL_TEST_RAW(klass, RCLASS_PRIME_CLASSEXT_WRITABLE);
|
|
361
323
|
}
|
|
362
324
|
|
|
363
325
|
static inline void
|
|
@@ -366,10 +328,10 @@ RCLASS_SET_PRIME_CLASSEXT_WRITABLE(VALUE klass, bool writable)
|
|
|
366
328
|
VM_ASSERT(klass != 0, "klass should be a valid object");
|
|
367
329
|
VM_ASSERT_BOXABLE_TYPE(klass);
|
|
368
330
|
if (writable) {
|
|
369
|
-
|
|
331
|
+
FL_SET_RAW(klass, RCLASS_PRIME_CLASSEXT_WRITABLE);
|
|
370
332
|
}
|
|
371
333
|
else {
|
|
372
|
-
|
|
334
|
+
FL_UNSET_RAW(klass, RCLASS_PRIME_CLASSEXT_WRITABLE);
|
|
373
335
|
}
|
|
374
336
|
}
|
|
375
337
|
|
|
@@ -399,7 +361,7 @@ RCLASS_EXT_READABLE_LOOKUP(VALUE obj, const rb_box_t *box)
|
|
|
399
361
|
static inline rb_classext_t *
|
|
400
362
|
RCLASS_EXT_READABLE_IN_BOX(VALUE obj, const rb_box_t *box)
|
|
401
363
|
{
|
|
402
|
-
if (
|
|
364
|
+
if (BOX_MASTER_P(box)
|
|
403
365
|
|| RCLASS_PRIME_CLASSEXT_READABLE_P(obj)) {
|
|
404
366
|
return RCLASS_EXT_PRIME(obj);
|
|
405
367
|
}
|
|
@@ -415,7 +377,7 @@ RCLASS_EXT_READABLE(VALUE obj)
|
|
|
415
377
|
}
|
|
416
378
|
// delay determining the current box to optimize for unmodified classes
|
|
417
379
|
box = rb_current_box();
|
|
418
|
-
if (
|
|
380
|
+
if (BOX_MASTER_P(box)) {
|
|
419
381
|
return RCLASS_EXT_PRIME(obj);
|
|
420
382
|
}
|
|
421
383
|
return RCLASS_EXT_READABLE_LOOKUP(obj, box);
|
|
@@ -449,7 +411,7 @@ RCLASS_EXT_WRITABLE_LOOKUP(VALUE obj, const rb_box_t *box)
|
|
|
449
411
|
static inline rb_classext_t *
|
|
450
412
|
RCLASS_EXT_WRITABLE_IN_BOX(VALUE obj, const rb_box_t *box)
|
|
451
413
|
{
|
|
452
|
-
if (
|
|
414
|
+
if (BOX_MASTER_P(box)
|
|
453
415
|
|| RCLASS_PRIME_CLASSEXT_WRITABLE_P(obj)) {
|
|
454
416
|
return RCLASS_EXT_PRIME(obj);
|
|
455
417
|
}
|
|
@@ -465,7 +427,7 @@ RCLASS_EXT_WRITABLE(VALUE obj)
|
|
|
465
427
|
}
|
|
466
428
|
// delay determining the current box to optimize for unmodified classes
|
|
467
429
|
box = rb_current_box();
|
|
468
|
-
if (
|
|
430
|
+
if (BOX_MASTER_P(box)) {
|
|
469
431
|
return RCLASS_EXT_PRIME(obj);
|
|
470
432
|
}
|
|
471
433
|
return RCLASS_EXT_WRITABLE_LOOKUP(obj, box);
|
|
@@ -488,7 +450,6 @@ RCLASSEXT_SET_INCLUDER(rb_classext_t *ext, VALUE klass, VALUE includer)
|
|
|
488
450
|
typedef void rb_class_classext_foreach_callback_func(rb_classext_t *classext, bool is_prime, VALUE box_value, void *arg);
|
|
489
451
|
void rb_class_classext_foreach(VALUE klass, rb_class_classext_foreach_callback_func *func, void *arg);
|
|
490
452
|
void rb_class_subclass_add(VALUE super, VALUE klass);
|
|
491
|
-
void rb_class_classext_free_subclasses(rb_classext_t *, VALUE, bool);
|
|
492
453
|
void rb_class_foreach_subclass(VALUE klass, void (*f)(VALUE, VALUE), VALUE);
|
|
493
454
|
void rb_class_update_superclasses(VALUE);
|
|
494
455
|
int rb_singleton_class_internal_p(VALUE sklass);
|
|
@@ -513,6 +474,7 @@ void rb_undef_methods_from(VALUE klass, VALUE super);
|
|
|
513
474
|
VALUE rb_class_inherited(VALUE, VALUE);
|
|
514
475
|
VALUE rb_keyword_error_new(const char *, VALUE);
|
|
515
476
|
|
|
477
|
+
rb_classext_t *rb_class_unlink_classext(VALUE klass, const rb_box_t *box);
|
|
516
478
|
void rb_class_classext_free(VALUE klass, rb_classext_t *ext, bool is_prime);
|
|
517
479
|
void rb_iclass_classext_free(VALUE klass, rb_classext_t *ext, bool is_prime);
|
|
518
480
|
|
|
@@ -637,15 +599,15 @@ RCLASS_WRITE_CC_TBL(VALUE klass, VALUE table)
|
|
|
637
599
|
}
|
|
638
600
|
|
|
639
601
|
static inline void
|
|
640
|
-
RCLASS_SET_CVC_TBL(VALUE klass,
|
|
602
|
+
RCLASS_SET_CVC_TBL(VALUE klass, VALUE table)
|
|
641
603
|
{
|
|
642
|
-
RCLASSEXT_CVC_TBL(RCLASS_EXT_PRIME(klass))
|
|
604
|
+
RB_OBJ_ATOMIC_WRITE(klass, &RCLASSEXT_CVC_TBL(RCLASS_EXT_PRIME(klass)), table);
|
|
643
605
|
}
|
|
644
606
|
|
|
645
607
|
static inline void
|
|
646
|
-
RCLASS_WRITE_CVC_TBL(VALUE klass,
|
|
608
|
+
RCLASS_WRITE_CVC_TBL(VALUE klass, VALUE table)
|
|
647
609
|
{
|
|
648
|
-
RCLASSEXT_CVC_TBL(RCLASS_EXT_WRITABLE(klass))
|
|
610
|
+
RB_OBJ_ATOMIC_WRITE(klass, &RCLASSEXT_CVC_TBL(RCLASS_EXT_WRITABLE(klass)), table);
|
|
649
611
|
}
|
|
650
612
|
|
|
651
613
|
static inline void
|
|
@@ -657,8 +619,8 @@ RCLASS_SET_REFINED_CLASS(VALUE klass, VALUE refined)
|
|
|
657
619
|
static inline rb_alloc_func_t
|
|
658
620
|
RCLASS_ALLOCATOR(VALUE klass)
|
|
659
621
|
{
|
|
660
|
-
|
|
661
|
-
if (RCLASS_SINGLETON_P(klass)
|
|
622
|
+
RBIMPL_ASSERT_TYPE(klass, T_CLASS);
|
|
623
|
+
if (RCLASS_SINGLETON_P(klass)) {
|
|
662
624
|
return 0;
|
|
663
625
|
}
|
|
664
626
|
return RCLASS_EXT_PRIME(klass)->as.class.allocator;
|
|
@@ -726,28 +688,10 @@ RCLASS_WRITE_SUPERCLASSES(VALUE klass, size_t depth, VALUE *superclasses, bool w
|
|
|
726
688
|
}
|
|
727
689
|
|
|
728
690
|
static inline void
|
|
729
|
-
RCLASS_SET_SUBCLASSES(VALUE klass,
|
|
691
|
+
RCLASS_SET_SUBCLASSES(VALUE klass, rb_subclass_entry_t *head)
|
|
730
692
|
{
|
|
731
693
|
rb_classext_t *ext = RCLASS_EXT_PRIME(klass);
|
|
732
|
-
RCLASSEXT_SUBCLASSES(ext) =
|
|
733
|
-
}
|
|
734
|
-
|
|
735
|
-
static inline void
|
|
736
|
-
RCLASS_WRITE_BOX_SUPER_SUBCLASSES(VALUE klass, rb_box_subclasses_t *box_subclasses)
|
|
737
|
-
{
|
|
738
|
-
rb_classext_t *ext = RCLASS_EXT_WRITABLE(klass);
|
|
739
|
-
if (RCLASSEXT_BOX_SUPER_SUBCLASSES(ext))
|
|
740
|
-
rb_box_subclasses_ref_dec(RCLASSEXT_BOX_SUPER_SUBCLASSES(ext));
|
|
741
|
-
RCLASSEXT_BOX_SUPER_SUBCLASSES(ext) = rb_box_subclasses_ref_inc(box_subclasses);
|
|
742
|
-
}
|
|
743
|
-
|
|
744
|
-
static inline void
|
|
745
|
-
RCLASS_WRITE_BOX_MODULE_SUBCLASSES(VALUE klass, rb_box_subclasses_t *box_subclasses)
|
|
746
|
-
{
|
|
747
|
-
rb_classext_t *ext = RCLASS_EXT_WRITABLE(klass);
|
|
748
|
-
if (RCLASSEXT_BOX_MODULE_SUBCLASSES(ext))
|
|
749
|
-
rb_box_subclasses_ref_dec(RCLASSEXT_BOX_MODULE_SUBCLASSES(ext));
|
|
750
|
-
RCLASSEXT_BOX_MODULE_SUBCLASSES(ext) = rb_box_subclasses_ref_inc(box_subclasses);
|
|
694
|
+
RCLASSEXT_SUBCLASSES(ext) = head;
|
|
751
695
|
}
|
|
752
696
|
|
|
753
697
|
static inline void
|
|
@@ -31,5 +31,4 @@ VALUE rb_fiber_inherit_storage(struct rb_execution_context_struct *ec, struct rb
|
|
|
31
31
|
VALUE rb_fiberptr_self(struct rb_fiber_struct *fiber);
|
|
32
32
|
unsigned int rb_fiberptr_blocking(struct rb_fiber_struct *fiber);
|
|
33
33
|
struct rb_execution_context_struct * rb_fiberptr_get_ec(struct rb_fiber_struct *fiber);
|
|
34
|
-
|
|
35
34
|
#endif /* INTERNAL_CONT_H */
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* header (related to this file, but not the same role).
|
|
12
12
|
*/
|
|
13
13
|
#include "ruby/ruby.h" /* for ID */
|
|
14
|
+
#include "vm_core.h" /* for ID */
|
|
14
15
|
|
|
15
16
|
#define id_signo ruby_static_id_signo
|
|
16
17
|
#define id_status ruby_static_id_status
|
|
@@ -30,6 +31,7 @@ VALUE rb_exception_setup(int argc, VALUE *argv);
|
|
|
30
31
|
void rb_refinement_setup(struct rb_refinements_data *data, VALUE module, VALUE klass);
|
|
31
32
|
void rb_vm_using_module(VALUE module);
|
|
32
33
|
VALUE rb_top_main_class(const char *method);
|
|
34
|
+
VALUE rb_ec_ensure(rb_execution_context_t *ec, VALUE (*b_proc)(VALUE), VALUE data1, VALUE (*e_proc)(VALUE), VALUE data2);
|
|
33
35
|
|
|
34
36
|
/* eval_error.c */
|
|
35
37
|
VALUE rb_get_backtrace(VALUE info);
|
|
@@ -122,10 +122,12 @@ const char *rb_raw_obj_info(char *const buff, const size_t buff_size, VALUE obj)
|
|
|
122
122
|
struct rb_execution_context_struct; /* in vm_core.h */
|
|
123
123
|
struct rb_objspace; /* in vm_core.h */
|
|
124
124
|
|
|
125
|
-
#define
|
|
125
|
+
#define NEWOBJ_OF_WITH_SHAPE(var, T, c, f, shape_id, s, ec) \
|
|
126
126
|
T *(var) = (T *)(((f) & FL_WB_PROTECTED) ? \
|
|
127
|
-
rb_wb_protected_newobj_of((ec ? ec : GET_EC()), (c), (f) & ~FL_WB_PROTECTED, s) : \
|
|
128
|
-
rb_wb_unprotected_newobj_of((c), (f), s))
|
|
127
|
+
rb_wb_protected_newobj_of((ec ? ec : GET_EC()), (c), (f) & ~FL_WB_PROTECTED, shape_id, s) : \
|
|
128
|
+
rb_wb_unprotected_newobj_of((c), (f), shape_id, s))
|
|
129
|
+
|
|
130
|
+
#define NEWOBJ_OF(var, T, c, f, s, ec) NEWOBJ_OF_WITH_SHAPE(var, T, c, f, 0 /* ROOT_SHAPE_ID */, s, ec)
|
|
129
131
|
|
|
130
132
|
#ifndef RB_GC_OBJECT_METADATA_ENTRY_DEFINED
|
|
131
133
|
# define RB_GC_OBJECT_METADATA_ENTRY_DEFINED
|
|
@@ -248,8 +250,8 @@ VALUE rb_gc_disable_no_rest(void);
|
|
|
248
250
|
|
|
249
251
|
/* gc.c (export) */
|
|
250
252
|
const char *rb_objspace_data_type_name(VALUE obj);
|
|
251
|
-
VALUE rb_wb_protected_newobj_of(struct rb_execution_context_struct *, VALUE, VALUE, size_t);
|
|
252
|
-
VALUE rb_wb_unprotected_newobj_of(VALUE, VALUE, size_t);
|
|
253
|
+
VALUE rb_wb_protected_newobj_of(struct rb_execution_context_struct *, VALUE, VALUE, uint32_t /* shape_id_t */, size_t);
|
|
254
|
+
VALUE rb_wb_unprotected_newobj_of(VALUE, VALUE, uint32_t /* shape_id_t */, size_t);
|
|
253
255
|
size_t rb_obj_memsize_of(VALUE);
|
|
254
256
|
struct rb_gc_object_metadata_entry *rb_gc_object_metadata(VALUE obj);
|
|
255
257
|
void rb_gc_mark_values(long n, const VALUE *values);
|