Skip to main content

aver/vm/
mod.rs

1mod alloc_policy;
2mod builtin;
3mod compiler;
4mod execute;
5pub mod opcode;
6mod profile;
7pub mod runtime;
8mod symbol;
9mod types;
10
11pub use compiler::{
12    compile_program_with_loaded_modules, compile_program_with_mir_fallback,
13    compile_program_with_modules,
14};
15/// Phase 4 of #252 — MIR vertical slice for the VM. Re-exported
16/// so tests + future external consumers can reach
17/// `classify_mir_program_coverage` without making the full
18/// `vm::compiler` module public.
19pub mod mir_vm {
20    pub use super::compiler::mir::{
21        MirVmCoverage, MirVmUnsupported, classify_mir_program_coverage,
22    };
23}
24pub use execute::VM;
25pub use opcode::opcode_name;
26pub use profile::{
27    VmBuiltinProfile, VmFunctionProfile, VmOpcodeProfile, VmProfileReport, VmReturnStats,
28};
29pub use types::{CallFrame, CodeStore, FnChunk, VmError};
30
31/// Register builtin service record types (HttpResponse, HttpRequest, etc.)
32/// in the arena before compilation. These types are used by services but
33/// not declared in user code.
34pub fn register_service_types(arena: &mut crate::nan_value::Arena) {
35    arena.register_record_type(
36        "HttpResponse",
37        vec!["status".into(), "body".into(), "headers".into()],
38    );
39    arena.register_record_type(
40        "HttpRequest",
41        vec![
42            "method".into(),
43            "path".into(),
44            "body".into(),
45            "headers".into(),
46        ],
47    );
48    arena.register_record_type(
49        "Tcp.Connection",
50        vec!["id".into(), "host".into(), "port".into()],
51    );
52    // Always register Terminal.Size so record-field access works in
53    // every build (the playground wasm ships without `terminal` but
54    // the compiler still emits field reads against the stubs).
55    arena.register_record_type("Terminal.Size", vec!["width".into(), "height".into()]);
56    // Oracle: BranchPath is an opaque builtin wrapping a dewey-decimal string.
57    // Only reachable via BranchPath.root / .child / .parse constructors.
58    arena.register_record_type("BranchPath", vec!["dewey".into()]);
59    // Oracle: EffectEvent represents one recorded effect emission in a
60    // verify-trace assertion's view of a function's trace. Produced by
61    // context-sensitive elaboration of effect-method calls inside trace
62    // blocks; never constructed by user code directly.
63    crate::types::effect_event::register(arena);
64    // Oracle: Trace wraps the list of EffectEvent values emitted during a
65    // verify-trace LHS evaluation. Only materialized via the `.trace`
66    // projection on the verified function's return.
67    crate::types::trace::register(arena);
68}