mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-22 07:33:06 +00:00
24 lines
844 B
Rust
24 lines
844 B
Rust
|
|
/// These metadata fields contain global VM state, stored in the `Segment::Metadata` segment of the
|
||
|
|
/// kernel's context (which is zero).
|
||
|
|
#[derive(Copy, Clone, Eq, PartialEq, Hash, Ord, PartialOrd, Debug)]
|
||
|
|
pub(crate) enum GlobalMetadata {
|
||
|
|
/// The larger context ID that has been used so far in this execution. Tracking this allows us
|
||
|
|
/// give each new context a unique ID, so that its memory will be zero-initialized.
|
||
|
|
LargestContext = 0,
|
||
|
|
}
|
||
|
|
|
||
|
|
impl GlobalMetadata {
|
||
|
|
pub(crate) const COUNT: usize = 1;
|
||
|
|
|
||
|
|
pub(crate) fn all() -> [Self; Self::COUNT] {
|
||
|
|
[Self::LargestContext]
|
||
|
|
}
|
||
|
|
|
||
|
|
/// The variable name that gets passed into kernel assembly code.
|
||
|
|
pub(crate) fn var_name(&self) -> &'static str {
|
||
|
|
match self {
|
||
|
|
GlobalMetadata::LargestContext => "GLOBAL_METADATA_LARGEST_CONTEXT",
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|