Ruby 4.1.0dev (2026-09-15 revision 135e0f844ab316ea5258b11672bd331269ab1460)
Data Fields
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 constant_id.
 
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 (1..constants_size) index directly. 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 28 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 33 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 36 of file prism_compile.h.

◆ values

int* pm_index_lookup_table_t::values

Array of local indices, indexed by constant_id.

-1 means not present.

Definition at line 30 of file prism_compile.h.


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