Skip to content

Commit 6fec9c7

Browse files
Use obj flag to differentiate RTypedData and RData
1 parent 6fbe2dd commit 6fec9c7

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

gc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,7 @@ typed_data_alloc(VALUE klass, VALUE typed_flag, void *datap, const rb_data_type_
10621062
RBIMPL_NONNULL_ARG(type);
10631063
if (klass) rb_data_object_check(klass);
10641064
bool wb_protected = (type->flags & RUBY_FL_WB_PROTECTED) || !type->function.dmark;
1065-
return newobj_of(GET_RACTOR(), klass, T_DATA, 0, ((VALUE)type) | IS_TYPED_DATA | typed_flag, (VALUE)datap, wb_protected, size);
1065+
return newobj_of(GET_RACTOR(), klass, T_DATA | RUBY_FL_TYPED_DATA, 0, ((VALUE)type) | typed_flag, (VALUE)datap, wb_protected, size);
10661066
}
10671067

10681068
VALUE

include/ruby/internal/core/rtypeddata.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@
115115
#define RUBY_TYPED_PROMOTED1 RUBY_TYPED_PROMOTED1
116116
/** @endcond */
117117

118-
#define IS_TYPED_DATA ((VALUE)1)
119118
#define TYPED_DATA_EMBEDDED ((VALUE)2)
120119
#define TYPED_DATA_PTR_FLAGS ((VALUE)3)
121120
#define TYPED_DATA_PTR_MASK (~TYPED_DATA_PTR_FLAGS)
@@ -569,7 +568,7 @@ RBIMPL_ATTR_ARTIFICIAL()
569568
static inline bool
570569
rbimpl_rtypeddata_p(VALUE obj)
571570
{
572-
return RTYPEDDATA(obj)->type & IS_TYPED_DATA;
571+
return RBASIC(obj)->flags & RUBY_FL_TYPED_DATA;
573572
}
574573

575574
RBIMPL_ATTR_PURE_UNLESS_DEBUG()

include/ruby/internal/fl_type.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,11 +302,12 @@ ruby_fl_type {
302302
RUBY_FL_UNUSED9 = (1<<9),
303303

304304
/**
305-
* This flag is no longer in use
305+
* This flag is used to differentiate between RTypedData and RData. The flag
306+
* is only set for RTypedData.
306307
*
307308
* @internal
308309
*/
309-
RUBY_FL_UNUSED10 = (1<<10),
310+
RUBY_FL_TYPED_DATA = (1<<10),
310311

311312
/**
312313
* This flag has something to do with data immutability. When this flag is

yjit/src/cruby_bindings.inc.rs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

zjit/src/cruby_bindings.inc.rs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)