Struct test_generation::abstract_state::InstantiableModule
source · [−]pub struct InstantiableModule {
pub module: CompiledModule,
/* private fields */
}Expand description
During the generation of a bytecode sequence, specific instantiations may need to be made, that may not yet exist in the underlying module. Instead of mutating the underlying module in order to record these instantiations in the locals signature table, we instead build wrapper around the underlying module containing the type instantiations, and at the end materialize this updated signature pool into a module. We also need the ability to quickly determine if an instantiation has already been created, and if so, at which index. So this also keeps a reverse lookup table of instantiation to SignatureIndex.
Fields
module: CompiledModuleImplementations
sourceimpl InstantiableModule
impl InstantiableModule
pub fn new(module: CompiledModule) -> Self
sourcepub fn add_instantiation(
&mut self,
instantiant: Vec<SignatureToken>
) -> SignatureIndex
pub fn add_instantiation(
&mut self,
instantiant: Vec<SignatureToken>
) -> SignatureIndex
If the instantiant is not in the instantiations table, this adds the instantiant to the
instance_for_offset for table, and adds the index to the reverse lookup table. Returns
the SignatureIndex for the instantiant.
sourcepub fn add_struct_instantiation(
&mut self,
instantiant: StructDefInstantiation
) -> StructDefInstantiationIndex
pub fn add_struct_instantiation(
&mut self,
instantiant: StructDefInstantiation
) -> StructDefInstantiationIndex
If the instantiant is not in the struct_instantiations table, this adds the
instantiant to the struct_instance_for_offset for table, and adds the index to the
reverse lookup table.
Returns the SignatureIndex for the instantiant.
sourcepub fn add_function_instantiation(
&mut self,
instantiant: FunctionInstantiation
) -> FunctionInstantiationIndex
pub fn add_function_instantiation(
&mut self,
instantiant: FunctionInstantiation
) -> FunctionInstantiationIndex
If the instantiant is not in the function_instantiations table, this adds the
instantiant to the func_instance_for_offset for table, and adds the index to the
reverse lookup table.
Returns the SignatureIndex for the instantiant.
sourcepub fn add_field_instantiation(
&mut self,
instantiant: FieldInstantiation
) -> FieldInstantiationIndex
pub fn add_field_instantiation(
&mut self,
instantiant: FieldInstantiation
) -> FieldInstantiationIndex
If the instantiant is not in the field_instantiations table, this adds the
instantiant to the field_instance_for_offset for table, and adds the index to the
reverse lookup table.
Returns the SignatureIndex for the instantiant.
sourcepub fn instantiantiation_at(&self, index: SignatureIndex) -> &Vec<SignatureToken>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn instantiantiation_at(&self, index: SignatureIndex) -> &Vec<SignatureToken>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Returns the type instantiation at index. Errors if the instantiation does not exist.
sourcepub fn struct_instantiantiation_at(
&self,
index: StructDefInstantiationIndex
) -> &StructDefInstantiation
pub fn struct_instantiantiation_at(
&self,
index: StructDefInstantiationIndex
) -> &StructDefInstantiation
Returns the struct instantiation at index. Errors if the instantiation does not exist.
sourcepub fn function_instantiantiation_at(
&self,
index: FunctionInstantiationIndex
) -> &FunctionInstantiation
pub fn function_instantiantiation_at(
&self,
index: FunctionInstantiationIndex
) -> &FunctionInstantiation
Returns the struct instantiation at index. Errors if the instantiation does not exist.
sourcepub fn field_instantiantiation_at(
&self,
index: FieldInstantiationIndex
) -> &FieldInstantiation
pub fn field_instantiantiation_at(
&self,
index: FieldInstantiationIndex
) -> &FieldInstantiation
Returns the struct instantiation at index. Errors if the instantiation does not exist.
sourcepub fn instantiate(self) -> CompiledModule
pub fn instantiate(self) -> CompiledModule
Consumes self, and adds the instantiations that have been built up to the underlying module, and returns the resultant compiled module.
Trait Implementations
sourceimpl Clone for InstantiableModule
impl Clone for InstantiableModule
sourcefn clone(&self) -> InstantiableModule
fn clone(&self) -> InstantiableModule
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
Auto Trait Implementations
impl RefUnwindSafe for InstantiableModule
impl Send for InstantiableModule
impl Sync for InstantiableModule
impl Unpin for InstantiableModule
impl UnwindSafe for InstantiableModule
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more