mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 08:47:57 +00:00
Update wasmtime to 0.29.0 (#9552)
* Start
* Move to ctx
* Make it compile for now
* More work
* Get rid off state-holder
* Use less Refcells
* 🤦
* Don't use RefCell
* Use names for parameters
* Fixes after merge
* Fixes after merge
* Review feedback
* FMT
This commit is contained in:
@@ -34,14 +34,14 @@ pub trait InstanceGlobals {
|
||||
/// Get a handle to a global by it's export name.
|
||||
///
|
||||
/// The requested export is must exist in the exported list, and it should be a mutable global.
|
||||
fn get_global(&self, export_name: &str) -> Self::Global;
|
||||
fn get_global(&mut self, export_name: &str) -> Self::Global;
|
||||
/// Get the current value of the global.
|
||||
fn get_global_value(&self, global: &Self::Global) -> sp_wasm_interface::Value;
|
||||
fn get_global_value(&mut self, global: &Self::Global) -> sp_wasm_interface::Value;
|
||||
/// Update the current value of the global.
|
||||
///
|
||||
/// The global behind the handle is guaranteed to be mutable and the value to be the same type
|
||||
/// as the global.
|
||||
fn set_global_value(&self, global: &Self::Global, value: sp_wasm_interface::Value);
|
||||
fn set_global_value(&mut self, global: &Self::Global, value: sp_wasm_interface::Value);
|
||||
}
|
||||
|
||||
/// A set of exposed mutable globals.
|
||||
@@ -79,7 +79,10 @@ impl<Global> GlobalsSnapshot<Global> {
|
||||
///
|
||||
/// This function panics if the instance doesn't correspond to the module from which the
|
||||
/// [`ExposedMutableGlobalsSet`] was collected.
|
||||
pub fn take<Instance>(mutable_globals: &ExposedMutableGlobalsSet, instance: &Instance) -> Self
|
||||
pub fn take<Instance>(
|
||||
mutable_globals: &ExposedMutableGlobalsSet,
|
||||
instance: &mut Instance,
|
||||
) -> Self
|
||||
where
|
||||
Instance: InstanceGlobals<Global = Global>,
|
||||
{
|
||||
@@ -98,7 +101,7 @@ impl<Global> GlobalsSnapshot<Global> {
|
||||
/// Apply the snapshot to the given instance.
|
||||
///
|
||||
/// This instance must be the same that was used for creation of this snapshot.
|
||||
pub fn apply<Instance>(&self, instance: &Instance)
|
||||
pub fn apply<Instance>(&self, instance: &mut Instance)
|
||||
where
|
||||
Instance: InstanceGlobals<Global = Global>,
|
||||
{
|
||||
|
||||
@@ -233,7 +233,7 @@ pub mod wasmer {
|
||||
let range = checked_range(dest_addr.into(), source.len(), destination.len())
|
||||
.ok_or_else(|| Error::Other("memory write is out of bounds".into()))?;
|
||||
|
||||
&mut destination[range].copy_from_slice(source);
|
||||
destination[range].copy_from_slice(source);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,21 +78,21 @@ pub trait WasmInstance: Send {
|
||||
/// Before execution, instance is reset.
|
||||
///
|
||||
/// Returns the encoded result on success.
|
||||
fn call(&self, method: InvokeMethod, data: &[u8]) -> Result<Vec<u8>, Error>;
|
||||
fn call(&mut self, method: InvokeMethod, data: &[u8]) -> Result<Vec<u8>, Error>;
|
||||
|
||||
/// Call an exported method on this WASM instance.
|
||||
///
|
||||
/// Before execution, instance is reset.
|
||||
///
|
||||
/// Returns the encoded result on success.
|
||||
fn call_export(&self, method: &str, data: &[u8]) -> Result<Vec<u8>, Error> {
|
||||
fn call_export(&mut self, method: &str, data: &[u8]) -> Result<Vec<u8>, Error> {
|
||||
self.call(method.into(), data)
|
||||
}
|
||||
|
||||
/// Get the value from a global with the given `name`.
|
||||
///
|
||||
/// This method is only suitable for getting immutable globals.
|
||||
fn get_global_const(&self, name: &str) -> Result<Option<Value>, Error>;
|
||||
fn get_global_const(&mut self, name: &str) -> Result<Option<Value>, Error>;
|
||||
|
||||
/// **Testing Only**. This function returns the base address of the linear memory.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user