1 #ifndef INTERNAL_ARRAY_H
2 #define INTERNAL_ARRAY_H
11 #include "ruby/internal/config.h"
13 #include "internal/static_assert.h"
18 # define ARRAY_DEBUG (0+RUBY_DEBUG)
21 #define RARRAY_PTR_IN_USE_FLAG FL_USER14
25 void rb_ary_set_len(
VALUE,
long);
27 VALUE rb_ary_tmp_new_fill(
long capa);
29 size_t rb_ary_memsize(
VALUE);
32 void rb_ary_cancel_sharing(
VALUE ary);
34 static inline VALUE rb_ary_entry_internal(
VALUE ary,
long offset);
35 static inline bool ARY_PTR_USING_P(
VALUE ary);
36 static inline void RARY_TRANSIENT_SET(
VALUE ary);
37 static inline void RARY_TRANSIENT_UNSET(
VALUE ary);
39 MJIT_SYMBOL_EXPORT_BEGIN
47 MJIT_SYMBOL_EXPORT_END
51 rb_ary_entry_internal(
VALUE ary,
long offset)
55 if (len == 0)
return Qnil;
58 if (offset < 0)
return Qnil;
60 else if (len <= offset) {
67 ARY_PTR_USING_P(
VALUE ary)
73 RARY_TRANSIENT_SET(
VALUE ary)
75 #if USE_TRANSIENT_HEAP
81 RARY_TRANSIENT_UNSET(
VALUE ary)
83 #if USE_TRANSIENT_HEAP
88 #undef rb_ary_new_from_args
89 #if RBIMPL_HAS_WARNING("-Wgnu-zero-variadic-macro-arguments")
91 #elif defined(__GNUC__) && defined(HAVE_VA_ARGS_MACRO)
92 #define rb_ary_new_from_args(n, ...) \
94 const VALUE args_to_new_ary[] = {__VA_ARGS__}; \
95 if (__builtin_constant_p(n)) { \
96 STATIC_ASSERT(rb_ary_new_from_args, numberof(args_to_new_ary) == (n)); \
98 rb_ary_new_from_values(numberof(args_to_new_ary), args_to_new_ary); \
#define RBIMPL_ATTR_ARTIFICIAL()
Wraps (or simulates) __attribute__((artificial))
#define FL_UNSET_RAW
Old name of RB_FL_UNSET_RAW.
#define FL_TEST_RAW
Old name of RB_FL_TEST_RAW.
#define Qnil
Old name of RUBY_Qnil.
#define FL_SET_RAW
Old name of RB_FL_SET_RAW.
#define RBIMPL_ATTR_PURE_UNLESS_DEBUG()
Enables RBIMPL_ATTR_PURE if and only if.
#define RARRAY_LEN
Just another name of rb_array_len.
#define RARRAY_CONST_PTR_TRANSIENT
Just another name of rb_array_const_ptr_transient.
#define RARRAY_AREF(a, i)
uintptr_t VALUE
Type that represents a Ruby object.