pub struct PreCompileProgram { /* private fields */ }
Implementations§
Source§impl PreCompileProgram
impl PreCompileProgram
Sourcepub fn merge(&mut self, other: &PreCompileProgram) -> Result<(), Error>
pub fn merge(&mut self, other: &PreCompileProgram) -> Result<(), Error>
merge the instructions from another program
Sourcepub fn set_export(&mut self, label: impl StringLike) -> Result<(), Error>
pub fn set_export(&mut self, label: impl StringLike) -> Result<(), Error>
Set an entry to be exported
pub fn delete_ent(&mut self, label: impl StringLike) -> Result<(), Error>
Sourcepub fn define_jmp(
&mut self,
label: impl StringLike,
cont: impl StringLike,
per: impl AsPermutation,
) -> Result<EntryRef, Error>
pub fn define_jmp( &mut self, label: impl StringLike, cont: impl StringLike, per: impl AsPermutation, ) -> Result<EntryRef, Error>
Define a jmp instruction
A jmp instruction performs a specific permutation on its values. Then it will jump to another entry.
label: the name of the entry cont: the entry this instruction will jump to per: how to permutate the values
Sourcepub fn define_call(
&mut self,
label: impl StringLike,
callee: impl StringLike,
callcnt: u8,
callcont: impl StringLike,
) -> Result<EntryRef, Error>
pub fn define_call( &mut self, label: impl StringLike, callee: impl StringLike, callcnt: u8, callcont: impl StringLike, ) -> Result<EntryRef, Error>
Define a call instruction
A Call instruction will seperate the current context into two. One of them will be put in a closure and add to the other as a single value. Then it will jump to another entry.
label: the name of this entry callee: the entry this entry will jump to callcnt: how many values the current context will keep callcont: an entry to keep the rest of context
Sourcepub fn define_ret(
&mut self,
label: impl StringLike,
variant: u8,
) -> Result<EntryRef, Error>
pub fn define_ret( &mut self, label: impl StringLike, variant: u8, ) -> Result<EntryRef, Error>
Define a return instruction
The first value of the context will be picked up and treat as a closure. Its captured context released and merged into the current context. Then the closure’s group entry reference will contain some variants. The specified variant will be used as the return target.
variant: which element of the group should be refer to
Sourcepub fn define_group(
&mut self,
label: impl StringLike,
elements: &[impl StringLike],
) -> Result<EntryRef, Error>
pub fn define_group( &mut self, label: impl StringLike, elements: &[impl StringLike], ) -> Result<EntryRef, Error>
Define a group of instructions
A group of entries contains zero of more variants. When called with a specific variants, it will be picked up and being used as the execution target.
label: the name of this group entry elements: the variant entries
Trait Implementations§
Source§impl<'a> Access<'a, PreCompileProgram> for EntryRef
impl<'a> Access<'a, PreCompileProgram> for EntryRef
Source§impl<'a> AccessMut<'a, PreCompileProgram> for EntryRef
impl<'a> AccessMut<'a, PreCompileProgram> for EntryRef
Source§impl Debug for PreCompileProgram
impl Debug for PreCompileProgram
Source§impl Default for PreCompileProgram
impl Default for PreCompileProgram
Source§fn default() -> PreCompileProgram
fn default() -> PreCompileProgram
Source§impl<'de> Deserialize<'de> for PreCompileProgram
impl<'de> Deserialize<'de> for PreCompileProgram
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for PreCompileProgram
impl Display for PreCompileProgram
Auto Trait Implementations§
impl Freeze for PreCompileProgram
impl RefUnwindSafe for PreCompileProgram
impl Send for PreCompileProgram
impl Sync for PreCompileProgram
impl Unpin for PreCompileProgram
impl UnwindSafe for PreCompileProgram
Blanket Implementations§
Source§impl<T> AnyDebugDisplay for T
impl<T> AnyDebugDisplay for T
Source§fn as_display(&self) -> &dyn Display
fn as_display(&self) -> &dyn Display
Display