feat!: decouple wasmer from Marine, replace it with generic backend interface (#219)

This commit is contained in:
Valery Antopol
2023-03-15 00:43:51 +03:00
committed by GitHub
parent b0e9b2c104
commit d3a773df4f
157 changed files with 5375 additions and 2179 deletions

View File

@ -22,6 +22,6 @@ pub enum InterfaceError {
#[error("record type with type id {0} not found")]
NotFoundRecordTypeId(u64),
#[error("{0}")]
#[error(transparent)]
ITInterfaceError(#[from] ITInterfaceError),
}

View File

@ -24,7 +24,7 @@ use wasmer_it::IRecordType;
use wasmer_it::IType;
use std::collections::HashSet;
use std::rc::Rc;
use std::sync::Arc;
use itertools::Itertools;
pub(crate) struct RecordsTransformer {
@ -60,7 +60,7 @@ impl RecordsTransformer {
fn dfs(
&mut self,
record_id: u64,
record: &Rc<IRecordType>,
record: &Arc<IRecordType>,
exported_records: &IRecordTypes,
) -> InterfaceResult<()> {
if !self.used.insert(record_id) {
@ -107,7 +107,7 @@ impl RecordsTransformer {
fn convert_record(
id: u64,
record: &Rc<IRecordType>,
record: &Arc<IRecordType>,
record_types: &IRecordTypes,
) -> RecordType {
use super::itype_text_view;

View File

@ -28,6 +28,6 @@ pub enum ITInterfaceError {
#[error("mailformed module: a record contains more recursion level then allowed")]
TooManyRecursionLevels,
#[error("{0}")]
#[error(transparent)]
MITInterfacesError(#[from] MITInterfacesError),
}

View File

@ -20,7 +20,7 @@ use super::RIResult;
use marine_it_interfaces::MITInterfaces;
use std::rc::Rc;
use std::sync::Arc;
pub struct ITExportFuncDescriptor<'n> {
pub adapter_function_type: u32,
@ -69,7 +69,7 @@ pub fn get_export_funcs(mit: &MITInterfaces<'_>) -> RIResult<Vec<IFunctionSignat
output_types,
} => {
let signature = IFunctionSignature {
name: Rc::new(descriptor.name.to_string()),
name: Arc::new(descriptor.name.to_string()),
arguments: arguments.clone(),
outputs: output_types.clone(),
adapter_function_type: descriptor.adapter_function_type,

View File

@ -22,16 +22,16 @@ use serde::Serialize;
use serde::Deserialize;
use std::collections::HashMap;
use std::rc::Rc;
use std::sync::Arc;
pub type IRecordTypes = HashMap<u64, Rc<IRecordType>>;
pub type IRecordTypes = HashMap<u64, Arc<IRecordType>>;
/// Represent a function type inside Marine module.
#[derive(PartialEq, Eq, Debug, Clone, Hash, Serialize, Deserialize)]
pub struct IFunctionSignature {
pub name: Rc<String>,
pub arguments: Rc<Vec<IFunctionArg>>,
pub outputs: Rc<Vec<IType>>,
pub name: Arc<String>,
pub arguments: Arc<Vec<IFunctionArg>>,
pub outputs: Arc<Vec<IType>>,
pub adapter_function_type: u32,
}