𝕣 : Register value. ℕ_{2^64}. GP eq (A.1).
9.3. Machine Model
Jar.JAVM.Reg : TypeJar.JAVM.Reg : Type
Jar.JAVM.Registers : TypeJar.JAVM.Registers : Type
Register file: 13 × 64-bit registers. ⟦𝕣⟧_13.
Jar.JAVM.PageAccess : TypeJar.JAVM.PageAccess : Type
Page access mode. GP eq (4.17).
Constructors
writable : Jar.JAVM.PageAccess
readable : Jar.JAVM.PageAccess
inaccessible : Jar.JAVM.PageAccess
Jar.JAVM.Memory : TypeJar.JAVM.Memory : Type
μ : RAM state. GP eq (4.17). μ ≡ ⟨μ_v : 𝔹_{2^32}, μ_a : ⟦{W, R, ∅}⟧_p⟩ where p = 2^32 / Z_P. Uses sparse page storage: only materialized pages are stored.
Constructor
Jar.JAVM.Memory.mk
Fields
pages : Dict Nat ByteArray
μ_v : Memory contents, sparse by page. Dict from page index to page data.
access : Array Jar.JAVM.PageAccess
μ_a : Per-page access flags.
heapTop : Nat
Heap top pointer (byte address) for sbrk.
guardZone : Nat
Guard zone size: addresses below this return .panic on access. Z_Z (65536) for standard GP layout, 0 for contiguous linear memory.
Read a byte from sparse memory. Unmaterialized pages return 0.
Write a byte to sparse memory. Materializes page if needed.
R(μ) : Set of readable addresses. GP eq (4.18). i ∈ R(μ) iff μ_a[⌊i / Z_P⌋] ≠ ∅
W(μ) : Set of writable addresses. GP eq (4.19). i ∈ W(μ) iff μ_a[⌊i / Z_P⌋] = W
Jar.JAVM.MachineState : TypeJar.JAVM.MachineState : Type
Complete PVM machine state.
Constructor
Jar.JAVM.MachineState.mk
Fields
registers : Jar.JAVM.Registers
ω : Register file. ⟦𝕣⟧_13.
memory : Jar.JAVM.Memory
μ : RAM.
gas : Jar.SignedGas
ζ : Gas remaining.
pc : Jar.JAVM.Reg
ι : Program counter.
Jar.JAVM.ExitReason : TypeJar.JAVM.ExitReason : Type
PVM exit reason. GP Appendix A.
Constructors
halt : Jar.JAVM.ExitReason
Regular termination (halt instruction).
trap : Jar.JAVM.ExitReason
Deliberate termination (trap instruction, opcode 0).
panic : Jar.JAVM.ExitReason
Runtime error (bad djump, invalid opcode, etc.).
outOfGas : Jar.JAVM.ExitReason
Gas exhaustion.
pageFault (address : Jar.JAVM.Reg) : Jar.JAVM.ExitReason
Page fault: attempt to access inaccessible address.
hostCall (id : Jar.JAVM.Reg) : Jar.JAVM.ExitReason
Host-call request: ecalli instruction with identifier.
ecall : Jar.JAVM.ExitReason
Management op / dynamic CALL: ecall instruction (opcode 3).
Jar.JAVM.InvocationResult : TypeJar.JAVM.InvocationResult : Type
Result of a PVM invocation.
Constructor
Jar.JAVM.InvocationResult.mk
Fields
exitReason : Jar.JAVM.ExitReason
Exit reason (halt/panic/oog/fault/host).
exitValue : Jar.JAVM.Reg
ω_7 : Value in register 7 at exit (status/return value).
gas : Jar.SignedGas
Gas counter at exit (may be negative for OOG).
registers : Jar.JAVM.Registers
Final register file.
memory : Jar.JAVM.Memory
Final memory state.
nextPC : Nat
Next PC (valid after hostCall, for resumption).
lastPC : Nat
Last PC before exit.
Jar.JAVM.HostCallHandler (ctx : Type) : TypeJar.JAVM.HostCallHandler (ctx : Type) : Type
Host-call handler type. Takes call id, gas, registers, memory, and returns updated state. The host context is parameterized.
Jar.JAVM.InstructionCategory : TypeJar.JAVM.InstructionCategory : Type
PVM instruction categories (for documentation; not used in execution).
Constructors
noArgs : Jar.JAVM.InstructionCategory
oneImmediate : Jar.JAVM.InstructionCategory
regImm64 : Jar.JAVM.InstructionCategory
twoImm : Jar.JAVM.InstructionCategory
offset : Jar.JAVM.InstructionCategory
regImm : Jar.JAVM.InstructionCategory
twoReg : Jar.JAVM.InstructionCategory
threeReg : Jar.JAVM.InstructionCategory