Ruby 4.1.0dev (2026-08-16 revision 973c45fcb3eb56df4f13d6aa54499e6ccb02809a)
robject.h
Go to the documentation of this file.
1#ifndef RBIMPL_ROBJECT_H /*-*-C++-*-vi:se ft=cpp:*/
2#define RBIMPL_ROBJECT_H
23#include "ruby/internal/config.h"
24
25#ifdef HAVE_STDINT_H
26# include <stdint.h>
27#endif
28
32#include "ruby/internal/cast.h"
34#include "ruby/internal/value.h"
36
43#define ROBJECT(obj) RBIMPL_CAST((struct RObject *)(obj))
45#define ROBJECT_EMBED_LEN_MAX ROBJECT_EMBED_LEN_MAX
46#define ROBJECT_FIELDS_CAPACITY ROBJECT_FIELDS_CAPACITY
47#define ROBJECT_FIELDS ROBJECT_FIELDS
50struct st_table;
51
56struct RObject {
57
59 struct RBasic basic;
60
62 union {
63 /* Embedded instance variables. When an object slot is large enough, it
64 * uses this area to store the instance variables embedded.
65 *
66 * This is a length 1 array because:
67 * 1. GCC has a bug that does not optimize C flexible array members
68 * (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102452)
69 * 2. Zero length arrays are not supported by all compilers
70 */
71 VALUE ary[1];
72
79 } as;
80};
81
82#endif /* RBIMPL_ROBJECT_H */
Defines RBIMPL_ATTR_ARTIFICIAL.
Defines RBIMPL_ATTR_DEPRECATED.
Defines enum ruby_fl_type.
Defines RBIMPL_ATTR_PURE.
Ruby object's base components.
Definition rbasic.h:69
Ruby's ordinal objects.
Definition robject.h:56
struct RBasic basic
Basic part, including flags and class.
Definition robject.h:59
union RObject::@59 as
Object's specific fields.
VALUE extended
When an object slot is too small or too complex to store instance variables inline,...
Definition robject.h:78
Definition st.h:79
Defines VALUE and ID.
uintptr_t VALUE
Type that represents a Ruby object.
Definition value.h:40
Defines enum ruby_value_type.