Ruby 4.1.0dev (2026-11-28 revision afe46b7056603a24e19ca0731e6503e1d9ed4d56)
pm_index_lookup_table_t Struct Reference

A direct-indexed lookup table mapping constant IDs to local variable indices. More...

#include <prism_compile.h>

Data Fields

int * values
 Array of local indices, indexed by pm_index_lookup_table_index.
int capacity
 Total number of slots (constants_size + PM_INDEX_LOOKUP_SPECIALS).
bool owned
 Whether the values array is heap-allocated and needs explicit free.

Detailed Description

A direct-indexed lookup table mapping constant IDs to local variable indices.

Regular constant IDs occupy the first constants_size slots, at the position given by pm_constant_id_index. Special forwarding parameter IDs (idMULT|FLAG, etc.) are mapped to 4 extra slots at the end.

All lookups are O(1) — a single array dereference. The table is arena-allocated for child scopes (no explicit free needed).

Definition at line 29 of file prism_compile.h.

Field Documentation

◆ capacity

int pm_index_lookup_table_t::capacity

Total number of slots (constants_size + PM_INDEX_LOOKUP_SPECIALS).

Definition at line 34 of file prism_compile.h.

◆ owned

bool pm_index_lookup_table_t::owned

Whether the values array is heap-allocated and needs explicit free.

Definition at line 37 of file prism_compile.h.

◆ values

int* pm_index_lookup_table_t::values

Array of local indices, indexed by pm_index_lookup_table_index.

-1 means not present.

Definition at line 31 of file prism_compile.h.


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