Ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e0ba6b95ab71a441357ed5484e33498)
Data Fields
RArray Struct Reference

Ruby's array. More...

#include <rarray.h>

Data Fields

struct RBasic basic
 Basic part, including flags and class. More...
 
union {
   struct {
      long   len
 
      union {
         long   capa
 
         const VALUE   shared_root
 
      }   aux
 
      const VALUE *   ptr
 
   }   heap
 
   const VALUE   ary [RARRAY_EMBED_LEN_MAX]
 
as
 
union {
   struct {
      long   len
 Number of elements of the array. More...
 
      union {
         long   capa
 Capacity of *ptr. More...
 
         const VALUE   shared_root
 Parent of the array. More...
 
      }   aux
 Auxiliary info. More...
 
      const VALUE *   ptr
 Pointer to the C array that holds the elements of the array. More...
 
   }   heap
 Arrays that use separated memory region for elements use this pattern. More...
 
   const VALUE   ary [RARRAY_EMBED_LEN_MAX]
 Embedded elements. More...
 
as
 Array's specific fields. More...
 

Detailed Description

Ruby's array.

Definition at line 3488 of file rb_mjit_min_header-3.1.3.h.

Field Documentation

◆ ary

const VALUE RArray::ary[RARRAY_EMBED_LEN_MAX]

Embedded elements.

When an array is short enough, it uses this area to store its elements. In this case the length is encoded into the flags.

Definition at line 3500 of file rb_mjit_min_header-3.1.3.h.

◆ 

union { ... } RArray::as

Array's specific fields.

◆ 

union { ... } RArray::aux

Auxiliary info.

◆ basic

struct RBasic RArray::basic

Basic part, including flags and class.

Definition at line 3489 of file rb_mjit_min_header-3.1.3.h.

◆ capa

long RArray::capa

Capacity of *ptr.

A continuous memory region of at least capa elements is expected to exist at *ptr. This can be bigger than len.

Definition at line 3494 of file rb_mjit_min_header-3.1.3.h.

◆ 

struct { ... } RArray::heap

Arrays that use separated memory region for elements use this pattern.

◆ len

long RArray::len

Number of elements of the array.

Definition at line 3492 of file rb_mjit_min_header-3.1.3.h.

◆ ptr

const VALUE* RArray::ptr

Pointer to the C array that holds the elements of the array.

In the old days each array had dedicated memory regions. That is no longer true today, but there still are arrays of such properties. This field could be used to point such things.

Definition at line 3498 of file rb_mjit_min_header-3.1.3.h.

◆ shared_root

const VALUE RArray::shared_root

Parent of the array.

Nowadays arrays can share their backend memory regions each other, constructing gigantic nest of objects. This situation is called "shared", and this is the field to control such properties.

Definition at line 3496 of file rb_mjit_min_header-3.1.3.h.


The documentation for this struct was generated from the following files: