Merge pull request #8 from fluencelabs/remove_delete

Don't deallocating while lifting record and arrays
This commit is contained in:
vms 2021-04-07 23:52:41 +03:00 committed by GitHub
commit 6f82d1010f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 2 additions and 44 deletions

2
Cargo.lock generated
View File

@ -210,7 +210,7 @@ checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed"
[[package]]
name = "wasmer-interface-types-fl"
version = "0.18.3"
version = "0.19.0"
dependencies = [
"fluence-it-types",
"it-to-bytes",

View File

@ -1,6 +1,6 @@
[package]
name = "wasmer-interface-types-fl"
version = "0.18.3"
version = "0.19.0"
description = "WebAssembly Interface Types library for Wasmer"
license = "MIT"
authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"]

View File

@ -1,4 +1,3 @@
use super::deallocate;
use super::read_from_instance_mem;
use super::write_to_instance_mem;
@ -181,8 +180,6 @@ where
}
};
deallocate(instance, instruction, offset as _, size as _)?;
Ok(result_array)
}

View File

@ -32,7 +32,6 @@ use serde::Serialize;
use std::convert::TryFrom;
pub(self) const ALLOCATE_FUNC_INDEX: u32 = 0;
pub(self) const DEALLOCATE_FUNC_INDEX: u32 = 1;
/// Represents all the possible WIT instructions.
#[derive(PartialEq, Eq, Debug, Clone, Hash, Serialize, Deserialize)]

View File

@ -12,18 +12,6 @@ use crate::{
};
use std::convert::TryInto;
/*
struct Record1 {
field1: String,
field2: i32,
}
// export
fn foo(t: Record1) {
// import
*/
/*
/// Build an `IValue::Record` based on values on the stack.
@ -249,8 +237,6 @@ where
field_id += 1;
}
super::deallocate(instance, instruction, offset as _, size as _)?;
Ok(IValue::Record(
NEVec::new(values.into_iter().collect())
.expect("Record must have at least one field, zero given"),

View File

@ -1,5 +1,4 @@
use crate::interpreter::instructions::ALLOCATE_FUNC_INDEX;
use crate::interpreter::instructions::DEALLOCATE_FUNC_INDEX;
use crate::interpreter::wasm;
use crate::interpreter::wasm::structures::{FunctionIndex, TypedIndex};
@ -130,29 +129,6 @@ where
to_native::<i32>(&values[0], instruction).map(|v| v as usize)
}
pub(super) fn deallocate<'instance, Instance, Export, LocalImport, Memory, MemoryView>(
instance: &'instance Instance,
instruction: Instruction,
mem_ptr: i32,
size: i32,
) -> Result<(), InstructionError>
where
Export: wasm::structures::Export + 'instance,
LocalImport: wasm::structures::LocalImport + 'instance,
Memory: wasm::structures::Memory<MemoryView> + 'instance,
MemoryView: wasm::structures::MemoryView,
Instance: wasm::structures::Instance<Export, LocalImport, Memory, MemoryView>,
{
let _ = call_core(
instance,
DEALLOCATE_FUNC_INDEX,
instruction,
vec![IValue::I32(mem_ptr), IValue::I32(size)],
)?;
Ok(())
}
fn call_core<'instance, Instance, Export, LocalImport, Memory, MemoryView>(
instance: &'instance Instance,
function_index: u32,