libsnobol4 1.0.2
High-performance SNOBOL4-style pattern matching library
Loading...
Searching...
No Matches
VM Struct Reference

VM state: all mutable state for a single pattern execution. More...

#include <vm.h>

Collaboration diagram for VM:

Public Attributes

const uint8_t * bc
size_t bc_len
struct snobol_pattern * pattern
 Optional owning pattern (NULL for stateless searches). Used as the attachment point for the cached Tier-5 trie (pattern->trie_cache) so repeated searches of the same pattern reuse the prebuilt trie instead of rebuilding it each call.
const snobol_range_meta_t * range_meta
 Cached charclass range metadata (set_id -> range data). Built at compile time; index is set_id - 1. May be NULL if the pattern has no charclass ops or was created via raw bytecode.
size_t range_meta_count
const char * s
size_t len
size_t ip
size_t pos
size_t cap_start [MAX_CAPS]
size_t cap_end [MAX_CAPS]
size_t var_start [MAX_VARS]
size_t var_end [MAX_VARS]
size_t var_count
uint32_t counters [MAX_LOOPS]
uint32_t loop_min [MAX_LOOPS]
uint32_t loop_max [MAX_LOOPS]
size_t loop_last_pos [MAX_LOOPS]
bool loop_span_greedy [MAX_LOOPS]
uint8_t max_cap_used
uint8_t max_counter_used
snobol_buf * out
void * pike_thread_buf
void * pike_defer_buf
void * pike_cold_pool
struct simd_nfa * simd_nfa
struct snobol_auto_trie_t * trie_cache
emit_cb emit_fn
void * emit_udata
ChoiceArena * choices_arena
size_t choices_top
bool use_compact_choice
void * choices
size_t choices_cap
size_t choice_allocated
size_t choice_push_count
size_t choice_peak_depth
size_t choice_peak_memory
size_t choice_live_depth
UndoRecord * trail
size_t trail_cap
size_t trail_top
WriteLogEntry * write_log
size_t write_log_cap
size_t write_log_next
uint64_t write_log_bitmap
size_t write_log_compressed_count
bool write_log_dirty
bool(* eval_fn )(int fn_id, const char *s, size_t start, size_t end, void *udata)
void * eval_udata
uint16_t * label_offsets
size_t label_count
size_t label_capacity
uint16_t current_label
bool in_goto_fail
bool abort_flag
bool keep_choices
dynamic_pattern_cache_t * dyn_cache
snobol_table_t ** tables
size_t table_count
size_t table_capacity
snobol_array_t ** arrays
size_t array_count
size_t array_capacity
char * dyn_pending_source
size_t dyn_pending_source_len
uint8_t * dyn_pending_bc
size_t dyn_pending_bc_len

Detailed Description

VM state: all mutable state for a single pattern execution.

Callers initialise the bc, bc_len, s, len fields and any desired callbacks, then call vm_exec() or vm_run(). All heap allocations within the struct are managed by vm_push_choice(), vm_pop_choice(), vm_write_log_init(), and the buffer helpers.

Definition at line 450 of file vm.h.

Member Data Documentation

◆ abort_flag

bool VM::abort_flag

Definition at line 572 of file vm.h.

◆ array_capacity

size_t VM::array_capacity

Definition at line 583 of file vm.h.

◆ array_count

size_t VM::array_count

Definition at line 582 of file vm.h.

◆ arrays

snobol_array_t** VM::arrays

Definition at line 581 of file vm.h.

◆ bc

const uint8_t* VM::bc

Compiled bytecode pointer (not owned).

Definition at line 451 of file vm.h.

◆ bc_len

size_t VM::bc_len

Bytecode length in bytes.

Definition at line 452 of file vm.h.

◆ cap_end

size_t VM::cap_end[MAX_CAPS]

Definition at line 474 of file vm.h.

◆ cap_start

size_t VM::cap_start[MAX_CAPS]

Definition at line 473 of file vm.h.

◆ choice_allocated

size_t VM::choice_allocated

Definition at line 534 of file vm.h.

◆ choice_live_depth

size_t VM::choice_live_depth

Definition at line 541 of file vm.h.

◆ choice_peak_depth

size_t VM::choice_peak_depth

Definition at line 538 of file vm.h.

◆ choice_peak_memory

size_t VM::choice_peak_memory

Definition at line 539 of file vm.h.

◆ choice_push_count

size_t VM::choice_push_count

Definition at line 537 of file vm.h.

◆ choices

void* VM::choices

Definition at line 532 of file vm.h.

◆ choices_arena

ChoiceArena* VM::choices_arena

Definition at line 525 of file vm.h.

◆ choices_cap

size_t VM::choices_cap

Definition at line 533 of file vm.h.

◆ choices_top

size_t VM::choices_top

Definition at line 526 of file vm.h.

◆ counters

uint32_t VM::counters[MAX_LOOPS]

Definition at line 482 of file vm.h.

◆ current_label

uint16_t VM::current_label

Definition at line 570 of file vm.h.

◆ dyn_cache

dynamic_pattern_cache_t* VM::dyn_cache

Definition at line 577 of file vm.h.

◆ dyn_pending_bc

uint8_t* VM::dyn_pending_bc

Definition at line 588 of file vm.h.

◆ dyn_pending_bc_len

size_t VM::dyn_pending_bc_len

Definition at line 589 of file vm.h.

◆ dyn_pending_source

char* VM::dyn_pending_source

Definition at line 584 of file vm.h.

◆ dyn_pending_source_len

size_t VM::dyn_pending_source_len

Definition at line 586 of file vm.h.

◆ emit_fn

emit_cb VM::emit_fn

Definition at line 521 of file vm.h.

◆ emit_udata

void* VM::emit_udata

Definition at line 522 of file vm.h.

◆ eval_fn

bool(* VM::eval_fn) (int fn_id, const char *s, size_t start, size_t end, void *udata)

Definition at line 562 of file vm.h.

◆ eval_udata

void* VM::eval_udata

Definition at line 564 of file vm.h.

◆ in_goto_fail

bool VM::in_goto_fail

Definition at line 571 of file vm.h.

◆ ip

size_t VM::ip

Definition at line 469 of file vm.h.

◆ keep_choices

bool VM::keep_choices

Definition at line 573 of file vm.h.

◆ label_capacity

size_t VM::label_capacity

Definition at line 569 of file vm.h.

◆ label_count

size_t VM::label_count

Definition at line 568 of file vm.h.

◆ label_offsets

uint16_t* VM::label_offsets

Definition at line 567 of file vm.h.

◆ len

size_t VM::len

Definition at line 467 of file vm.h.

◆ loop_last_pos

size_t VM::loop_last_pos[MAX_LOOPS]

Definition at line 485 of file vm.h.

◆ loop_max

uint32_t VM::loop_max[MAX_LOOPS]

Definition at line 484 of file vm.h.

◆ loop_min

uint32_t VM::loop_min[MAX_LOOPS]

Definition at line 483 of file vm.h.

◆ loop_span_greedy

bool VM::loop_span_greedy[MAX_LOOPS]

Definition at line 486 of file vm.h.

◆ max_cap_used

uint8_t VM::max_cap_used

Definition at line 489 of file vm.h.

◆ max_counter_used

uint8_t VM::max_counter_used

Definition at line 490 of file vm.h.

◆ out

snobol_buf* VM::out

Definition at line 493 of file vm.h.

◆ pattern

struct snobol_pattern* VM::pattern

Optional owning pattern (NULL for stateless searches). Used as the attachment point for the cached Tier-5 trie (pattern->trie_cache) so repeated searches of the same pattern reuse the prebuilt trie instead of rebuilding it each call.

Definition at line 458 of file vm.h.

◆ pike_cold_pool

void* VM::pike_cold_pool

Definition at line 505 of file vm.h.

◆ pike_defer_buf

void* VM::pike_defer_buf

Definition at line 499 of file vm.h.

◆ pike_thread_buf

void* VM::pike_thread_buf

Definition at line 498 of file vm.h.

◆ pos

size_t VM::pos

Definition at line 470 of file vm.h.

◆ range_meta

const snobol_range_meta_t* VM::range_meta

Cached charclass range metadata (set_id -> range data). Built at compile time; index is set_id - 1. May be NULL if the pattern has no charclass ops or was created via raw bytecode.

Definition at line 463 of file vm.h.

◆ range_meta_count

size_t VM::range_meta_count

Number of entries in range_meta array.

Definition at line 464 of file vm.h.

◆ s

const char* VM::s

Definition at line 466 of file vm.h.

◆ simd_nfa

struct simd_nfa* VM::simd_nfa

Definition at line 511 of file vm.h.

◆ table_capacity

size_t VM::table_capacity

Definition at line 580 of file vm.h.

◆ table_count

size_t VM::table_count

Definition at line 579 of file vm.h.

◆ tables

snobol_table_t** VM::tables

Definition at line 578 of file vm.h.

◆ trail

UndoRecord* VM::trail

Definition at line 548 of file vm.h.

◆ trail_cap

size_t VM::trail_cap

Definition at line 549 of file vm.h.

◆ trail_top

size_t VM::trail_top

Definition at line 550 of file vm.h.

◆ trie_cache

struct snobol_auto_trie_t* VM::trie_cache

Definition at line 518 of file vm.h.

◆ use_compact_choice

bool VM::use_compact_choice

Definition at line 527 of file vm.h.

◆ var_count

size_t VM::var_count

Definition at line 479 of file vm.h.

◆ var_end

size_t VM::var_end[MAX_VARS]

Definition at line 478 of file vm.h.

◆ var_start

size_t VM::var_start[MAX_VARS]

Definition at line 477 of file vm.h.

◆ write_log

WriteLogEntry* VM::write_log

Definition at line 553 of file vm.h.

◆ write_log_bitmap

uint64_t VM::write_log_bitmap

Definition at line 556 of file vm.h.

◆ write_log_cap

size_t VM::write_log_cap

Definition at line 554 of file vm.h.

◆ write_log_compressed_count

size_t VM::write_log_compressed_count

Definition at line 557 of file vm.h.

◆ write_log_dirty

bool VM::write_log_dirty

Definition at line 559 of file vm.h.

◆ write_log_next

size_t VM::write_log_next

Definition at line 555 of file vm.h.


The documentation for this struct was generated from the following file:
  • core/include/snobol/vm.h