Skip to main content

Crate javm_cap

Crate javm_cap 

Source
Expand description

JAR v3 capability system.

Defines the four v3 cap kinds (Instance, Image, Data, CNode), their content-bearing representations, a two-tier cache for identity-keyed mutable state + content-addressed blobs, and the primitives (BMT, hash) used by upstream layers.

Cap and its inner storage use the default Global allocator (= std heap on host, talc on guest via #[global_allocator]). The cache layer’s outer storage (HashMap / Box parameters) may still be parameterised on a custom allocator for shared-memory layouts.

Cap itself is the wire form: it derives rkyv::Archive/Serialize/Deserialize so callers move caps across the host/guest boundary by writing rkyv::to_bytes(&cap)? (errors on unsettled Ref targets) and rkyv::access::<rkyv::Archived<Cap>, _>(bytes)? for zero-copy decode. See cache::CapHasRefError for the encode-time error.

See ~/jar/website/content/spec/implementation/architecture.md for the crate’s role in the overall layering.

Re-exports§

pub use cache::CacheDirectory;
pub use cache::CacheError;
pub use cache::CapHasRefError;
pub use cache::CapHashOrRef;
pub use cache::CapRef;
pub use cache::ResidentCap;
pub use cap::cnode::CNodeCap;
pub use cap::data::DataCap;
pub use cap::data::GROUP_SIZE;
pub use cap::data::PAGE_SIZE;
pub use cap::data::PageResolution;
pub use cap::data::PageSlab;
pub use cap::image::EndpointDef;
pub use cap::image::ImageCap;
pub use cap::image::ImageConvertError;
pub use cap::image::ImageSlotEntry;
pub use cap::image::MemoryMapping;
pub use cap::image::image_cap;
pub use cap::instance::InstanceCap;
pub use cap::page::PageBytes;
pub use cap::page::PageRef;
pub use cap::page::PageSlot;
pub use cap::Cap;
pub use cap::CapHash;
pub use cap::MAX_SOURCE_DEPTH;
pub use cap::NUM_REGS;
pub use error::CapError;
pub use error::OpError;
pub use hash::Blake2b256;
pub use hash::Hash;
pub use hash::Hasher;
pub use image::ArenaPageRef;
pub use image::CodeRef;
pub use image::DataDesc;
pub use image::DataDescError;
pub use image::Image;
pub use image::ImageBuilder;
pub use image::InitialDataCap;
pub use image::PinnedCap;
pub use image::chain_extend;
pub use image::chain_genesis;
pub use image::image_content_hash;
pub use kernel_image::ALL_KERNEL_IMAGES;
pub use kernel_image::KernelImage;
pub use kernel_image::kernel_image_hash;
pub use kernel_image::recognize_kernel_image;
pub use slot::Key;
pub use slot::MAX_KEY_LEN;
pub use slot::SlotPath;
pub use slot::key_from_regs;
pub use slot::key_to_regs;
pub use yield_cap::gas_handle;
pub use yield_cap::gas_meter_key;
pub use yield_cap::is_kernel_yield_key;
pub use yield_cap::merge_yield_receivers;
pub use yield_cap::quota_handle;
pub use yield_cap::quota_key;
pub use yield_cap::yield_receiver;
pub use yield_cap::yield_receiver_keys;
pub use yield_cap::yield_sender;
pub use yield_cap::yield_sender_key;

Modules§

abi
Well-known cnode slot keys the v3 chain ABI exposes at genesis. Shared between jar-kernel (which populates the slots at chain init) and consumers like the JAVM transpiler (which emit chain Images referencing them).
cache
CacheDirectory<S> — two-tier cap store.
cap
Cap — cap enum + shared constants.
error
Errors for cap operations.
hash
Hash trait and default Blake2b-256 implementation.
image
Image: the smallest unit of program specification.
kernel_image
Kernel-assisted Image registry.
layout
PVM2 guest virtual-address-space layout (ABI constants).
slot
Byte-string keys and slot addressing.
yield_cap
YieldSender / YieldReceiver kernel-assisted cap helpers + the reserved kernel:* yield-key namespace.

Enums§

MissingOr
Either a fully materialized value or a precomputed hash placeholder.