39#define PM_INDEX_LOOKUP_SPECIALS 4
42#define PM_SPECIAL_CONSTANT_FLAG ((pm_constant_id_t) (1 << 31))
43#define PM_INDEX_LOOKUP_SPECIAL_MULT 0
44#define PM_INDEX_LOOKUP_SPECIAL_POW 1
45#define PM_INDEX_LOOKUP_SPECIAL_AND 2
46#define PM_INDEX_LOOKUP_SPECIAL_DOT3 3
53#define PM_CONSTANT_MULT ((pm_constant_id_t) (PM_SPECIAL_CONSTANT_FLAG | PM_INDEX_LOOKUP_SPECIAL_MULT))
54#define PM_CONSTANT_POW ((pm_constant_id_t) (PM_SPECIAL_CONSTANT_FLAG | PM_INDEX_LOOKUP_SPECIAL_POW))
55#define PM_CONSTANT_AND ((pm_constant_id_t) (PM_SPECIAL_CONSTANT_FLAG | PM_INDEX_LOOKUP_SPECIAL_AND))
56#define PM_CONSTANT_DOT3 ((pm_constant_id_t) (PM_SPECIAL_CONSTANT_FLAG | PM_INDEX_LOOKUP_SPECIAL_DOT3))
61 if (LIKELY(!(key & PM_SPECIAL_CONSTANT_FLAG))) {
64 return table->
capacity - PM_INDEX_LOOKUP_SPECIALS + (int)(key & ~PM_SPECIAL_CONSTANT_FLAG);
70 int idx = pm_index_lookup_table_index(table, key);
72 table->
values[idx] = value;
78 int idx = pm_index_lookup_table_index(table, key);
80 if (table->
values[idx] == -1)
return 0;
81 *value = table->
values[idx];
88 int cap = constants_size + PM_INDEX_LOOKUP_SPECIALS;
89 table->
values = (
int *) ruby_xmalloc(cap *
sizeof(
int));
90 memset(table->
values, -1, cap *
sizeof(
int));
130 int local_table_for_iseq_size;
143 int coverage_enabled;
188void pm_options_version_for_current_ruby_set(
pm_options_t *options);
#define RUBY_ASSERT(...)
Asserts that the given expression is truthy if and only if RUBY_DEBUG is truthy.
uint32_t pm_constant_id_t
A constant id is a unique identifier for a constant in the constant pool.
The main header file for the prism parser.
A direct-indexed lookup table mapping constant IDs to local variable indices.
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.
int * values
Array of local indices, indexed by constant_id.
A list of offsets of the start of lines in a string.
the getlocal and setlocal instructions require two parameters.
This is the base structure that represents a node in the syntax tree.
bool parsed
Whether or not this parse result has performed its parsing yet.
pm_parser_t * parser
The parser that will do the actual parsing.
pm_source_t * source
The source backing the parse (file, string, or stream).
pm_scope_node_t node
The resulting scope node that will hold the generated AST.
pm_options_t * options
The options that will be passed to the parser.
pm_arena_t * arena
The arena allocator for AST-lifetime memory.
rb_encoding * filepath_encoding
This is the encoding of the actual filepath object that will be used when a FILE node is compiled or ...
pm_index_lookup_table_t index_lookup_table
A flat lookup table mapping constant IDs (or special IDs) to local variable indices.
size_t last_line
Cached line hint for line offset list lookups.
struct iseq_link_anchor * pre_execution_anchor
This will only be set on the top-level scope node.
VALUE * script_lines
This is a pointer to the list of script lines for the ISEQs that will be associated with this scope n...
uintptr_t ID
Type that represents a Ruby identifier such as a variable name.
uintptr_t VALUE
Type that represents a Ruby object.