mirror of
https://github.com/fluencelabs/parity-wasm
synced 2025-06-21 18:51:52 +00:00
instructions validator
This commit is contained in:
@ -31,7 +31,7 @@ impl ProgramInstance {
|
||||
})
|
||||
}
|
||||
|
||||
/// Instantiate module.
|
||||
/// Instantiate module with validation.
|
||||
pub fn add_module(&self, name: &str, module: Module) -> Result<Arc<ModuleInstance>, Error> {
|
||||
let module_instance = Arc::new(ModuleInstance::new(Arc::downgrade(&self.essence), module)?);
|
||||
// replace existing module with the same name with new one
|
||||
@ -39,6 +39,14 @@ impl ProgramInstance {
|
||||
Ok(module_instance)
|
||||
}
|
||||
|
||||
/// Instantiate module without validation.
|
||||
pub fn add_module_without_validation(&self, name: &str, module: Module) -> Result<Arc<ModuleInstance>, Error> {
|
||||
let module_instance = Arc::new(ModuleInstance::new_with_validation_flag(Arc::downgrade(&self.essence), module, false)?);
|
||||
// replace existing module with the same name with new one
|
||||
self.essence.modules.write().insert(name.into(), module_instance.clone());
|
||||
Ok(module_instance)
|
||||
}
|
||||
|
||||
/// Get one of the modules by name
|
||||
pub fn module(&self, name: &str) -> Option<Arc<ModuleInstanceInterface>> {
|
||||
self.essence.module(name)
|
||||
|
Reference in New Issue
Block a user