зеркало из https://github.com/github/ruby.git
Add RARRAY_SHARED_FLAG
This commit is contained in:
Родитель
1c9acb6bb1
Коммит
d67fcdcc9f
6
array.c
6
array.c
|
@ -66,7 +66,7 @@ should_be_T_ARRAY(VALUE ary)
|
|||
#define ARY_HEAP_SIZE(a) (assert(!ARY_EMBED_P(a)), assert(ARY_OWNS_HEAP_P(a)), ARY_CAPA(a) * sizeof(VALUE))
|
||||
|
||||
#define ARY_OWNS_HEAP_P(a) (assert(should_be_T_ARRAY((VALUE)(a))), \
|
||||
!FL_TEST_RAW((a), ELTS_SHARED|RARRAY_EMBED_FLAG))
|
||||
!FL_TEST_RAW((a), RARRAY_SHARED_FLAG|RARRAY_EMBED_FLAG))
|
||||
|
||||
#define FL_SET_EMBED(a) do { \
|
||||
assert(!ARY_SHARED_P(a)); \
|
||||
|
@ -78,9 +78,9 @@ should_be_T_ARRAY(VALUE ary)
|
|||
#define FL_UNSET_EMBED(ary) FL_UNSET((ary), RARRAY_EMBED_FLAG|RARRAY_EMBED_LEN_MASK)
|
||||
#define FL_SET_SHARED(ary) do { \
|
||||
assert(!ARY_EMBED_P(ary)); \
|
||||
FL_SET((ary), ELTS_SHARED); \
|
||||
FL_SET((ary), RARRAY_SHARED_FLAG); \
|
||||
} while (0)
|
||||
#define FL_UNSET_SHARED(ary) FL_UNSET((ary), ELTS_SHARED)
|
||||
#define FL_UNSET_SHARED(ary) FL_UNSET((ary), RARRAY_SHARED_FLAG)
|
||||
|
||||
#define ARY_SET_PTR(ary, p) do { \
|
||||
assert(!ARY_EMBED_P(ary)); \
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
# define ARRAY_DEBUG (0+RUBY_DEBUG)
|
||||
#endif
|
||||
|
||||
#define RARRAY_SHARED_FLAG ELTS_SHARED
|
||||
#define RARRAY_SHARED_ROOT_FLAG FL_USER12
|
||||
#define RARRAY_PTR_IN_USE_FLAG FL_USER14
|
||||
#define RARRAY_LITERAL_FLAG FL_USER15
|
||||
|
@ -79,7 +80,7 @@ RBIMPL_ATTR_MAYBE_UNUSED()
|
|||
static inline int
|
||||
ary_should_not_be_shared_and_embedded(VALUE ary)
|
||||
{
|
||||
return !FL_ALL_RAW(ary, ELTS_SHARED|RARRAY_EMBED_FLAG);
|
||||
return !FL_ALL_RAW(ary, RARRAY_SHARED_FLAG|RARRAY_EMBED_FLAG);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
|
@ -87,7 +88,7 @@ ARY_SHARED_P(VALUE ary)
|
|||
{
|
||||
assert(RB_TYPE_P(ary, T_ARRAY));
|
||||
assert(ary_should_not_be_shared_and_embedded(ary));
|
||||
return FL_TEST_RAW(ary, ELTS_SHARED);
|
||||
return FL_TEST_RAW(ary, RARRAY_SHARED_FLAG);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
|
|
Загрузка…
Ссылка в новой задаче