plotnik_lib/bytecode/constants.rs
1//! Bytecode format constants.
2
3/// Magic bytes identifying a Plotnik bytecode file.
4pub const MAGIC: [u8; 4] = *b"PTKQ";
5
6/// Current bytecode format version.
7pub const VERSION: u32 = 1;
8
9/// Section alignment in bytes.
10pub const SECTION_ALIGN: usize = 64;
11
12/// Step size in bytes (all instructions are 8-byte aligned).
13pub const STEP_SIZE: usize = 8;
14
15/// Maximum payload slots for Match instructions.
16///
17/// Match64 (the largest variant) supports up to 28 u16 slots for
18/// effects, neg_fields, and successors combined. When an epsilon
19/// transition needs more successors, it must be split into a cascade.
20pub const MAX_MATCH_PAYLOAD_SLOTS: usize = 28;
21
22/// Maximum pre-effects per Match instruction.
23///
24/// Pre-effect count is stored in 3 bits (max 7). When exceeded,
25/// overflow effects must be emitted in leading epsilon transitions.
26pub const MAX_PRE_EFFECTS: usize = 7;