Ruby 4.1.0dev (2026-11-18 revision 9de06831e37534f8a163e598cc0c6903c7687430)
constant_pool.h
Go to the documentation of this file.
1
10#ifndef PRISM_CONSTANT_POOL_H
11#define PRISM_CONSTANT_POOL_H
12
17
18#include "prism/arena.h"
19
20#include <stddef.h>
21#include <stdint.h>
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
30typedef uint32_t pm_constant_id_t;
31
43static PRISM_INLINE size_t
45 return (size_t) constant_id - 1;
46}
47
51typedef struct {
57 uint32_t size;
58
62
65
70
78
86
95
107
108#ifdef __cplusplus
109}
110#endif
111
112#endif
A bump allocator for the prism parser.
PRISM_EXPORTED_FUNCTION const uint8_t * pm_constant_start(const pm_constant_t *constant) PRISM_NONNULL(1)
Return a raw pointer to the start of a constant.
uint32_t pm_constant_id_t
A constant id is a unique identifier for a constant in the constant pool.
PRISM_EXPORTED_FUNCTION void PRISM_EXPORTED_FUNCTION void pm_constant_id_list_append(pm_arena_t *arena, pm_constant_id_list_t *list, pm_constant_id_t id) PRISM_NONNULL(1
Append a constant id to a list of constant ids.
PRISM_EXPORTED_FUNCTION void pm_constant_id_list_init(pm_arena_t *arena, pm_constant_id_list_t *list, uint32_t size) PRISM_NONNULL(1
Initialize a list of constant ids.
static PRISM_INLINE size_t pm_constant_id_index(pm_constant_id_t constant_id)
Returns the index of the constant with the given id among the constants of the parser that produced i...
PRISM_EXPORTED_FUNCTION size_t pm_constant_length(const pm_constant_t *constant) PRISM_NONNULL(1)
Return the length of a constant.
#define PRISM_EXPORTED_FUNCTION
By default, we compile with -fvisibility=hidden.
Definition exported.h:20
#define PRISM_INLINE
Old Visual Studio versions do not support the inline keyword, so we need to define it to be __inline.
Definition inline.h:12
#define PRISM_NONNULL(...)
Mark the parameters of a function as non-null.
Definition nonnull.h:13
A list of constant IDs.
pm_constant_id_t * ids
The constant ids in the list.
uint32_t size
The number of constant ids in the list.