mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-17 01:28:44 +00:00
doc(deprecated) Document more API between the old and the new one.
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
struct ExportDescriptor {
|
||||
name: String,
|
||||
ty: ExternDescriptor,
|
||||
}
|
||||
7
lib/deprecated/runtime-core/doc/new-api/func_sig.rs
Normal file
7
lib/deprecated/runtime-core/doc/new-api/func_sig.rs
Normal file
@@ -0,0 +1,7 @@
|
||||
struct FuncSig {}
|
||||
|
||||
impl FuncSig {
|
||||
fn new<Params, Returns>(params: Params, returns: Returns) -> Self;
|
||||
fn params(&self) -> &[Type];
|
||||
fn results(&self) -> &[Type];
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
struct GlobalDescriptor {
|
||||
mutable: bool,
|
||||
ty: Type,
|
||||
}
|
||||
15
lib/deprecated/runtime-core/doc/new-api/global_init.rs
Normal file
15
lib/deprecated/runtime-core/doc/new-api/global_init.rs
Normal file
@@ -0,0 +1,15 @@
|
||||
enum GlobalInit {
|
||||
I32Const(i32),
|
||||
I64Const(i64),
|
||||
F32Const(f32),
|
||||
F64Const(f64),
|
||||
V128Const(V128),
|
||||
GetGlobal(GlobalIndex),
|
||||
RefNullConst,
|
||||
RefFunc(FunctionIndex),
|
||||
}
|
||||
|
||||
impl GlobalInit {
|
||||
fn from_value<T>(value: Value<T>) -> Self;
|
||||
fn to_value<T>(&self) -> Value<T>;
|
||||
}
|
||||
3
lib/deprecated/runtime-core/doc/new-api/host_function.rs
Normal file
3
lib/deprecated/runtime-core/doc/new-api/host_function.rs
Normal file
@@ -0,0 +1,3 @@
|
||||
trait HostFunction<Args, Rets, Kind, T> {
|
||||
fn function_body_ptr(self) -> *const VMFunctionBody;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
struct ImportDescriptor {
|
||||
module: String,
|
||||
name: String,
|
||||
ty: ExternDescriptor,
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
struct MemoryDescriptor {
|
||||
minimum: Pages,
|
||||
maximum: Option<Pages>,
|
||||
shared: bool,
|
||||
}
|
||||
4
lib/deprecated/runtime-core/doc/new-api/memory_type.rs
Normal file
4
lib/deprecated/runtime-core/doc/new-api/memory_type.rs
Normal file
@@ -0,0 +1,4 @@
|
||||
enum MemoryType {
|
||||
Dynamic,
|
||||
Static { bound: Pages },
|
||||
}
|
||||
23
lib/deprecated/runtime-core/doc/new-api/module_info.rs
Normal file
23
lib/deprecated/runtime-core/doc/new-api/module_info.rs
Normal file
@@ -0,0 +1,23 @@
|
||||
struct ModuleInfo {
|
||||
custom_sections: IndexMap<String, CustomSectionIndex>,
|
||||
custom_sections_data: PrimaryMap<CustomSectionIndex, Arc<[u8]>>,
|
||||
exports: IndexMap<String, ExportIndex>,
|
||||
func_names: HashMap<FunctionIndex, String>,
|
||||
functions: PrimaryMap<FunctionIndex, SignatureIndex>,
|
||||
global_initializers: PrimaryMap<LocalGlobalIndex, GlobalInit>,
|
||||
globals: PrimaryMap<GlobalIndex, GlobalType>,
|
||||
id: ModuleId,
|
||||
imports: IndexMap<(String, String, u32), ImportIndex>,
|
||||
memories: PrimaryMap<MemoryIndex, MemoryType>,
|
||||
name: Option<String>,
|
||||
num_imported_funcs: usize,
|
||||
num_imported_globals: usize,
|
||||
num_imported_memories: usize,
|
||||
num_imported_tables: usize,
|
||||
passive_data: HashMap<DataIndex, Arc<[u8]>>,
|
||||
passive_elements: HashMap<ElemIndex, Box<[FunctionIndex]>>,
|
||||
signatures: PrimaryMap<SignatureIndex, FunctionType>,
|
||||
start_func: Option<FunctionIndex>,
|
||||
table_elements: Vec<TableElements>,
|
||||
tables: PrimaryMap<TableIndex, TableType>,
|
||||
}
|
||||
10
lib/deprecated/runtime-core/doc/new-api/native_wasm_type.rs
Normal file
10
lib/deprecated/runtime-core/doc/new-api/native_wasm_type.rs
Normal file
@@ -0,0 +1,10 @@
|
||||
trait NativeWasmType {
|
||||
type Abi: Copy + std::fmt::Debug;
|
||||
const WASM_TYPE: Type;
|
||||
|
||||
fn from_binary(binary: i128) -> Self;
|
||||
fn to_binary(self) -> i128;
|
||||
fn into_abi(self) -> Self::Abi;
|
||||
fn from_abi(abi: Self::Abi) -> Self;
|
||||
fn to_value<T>(self) -> Value<T>;
|
||||
}
|
||||
10
lib/deprecated/runtime-core/doc/new-api/table.rs
Normal file
10
lib/deprecated/runtime-core/doc/new-api/table.rs
Normal file
@@ -0,0 +1,10 @@
|
||||
struct Table {}
|
||||
|
||||
impl Table {
|
||||
fn new(desc: TableDescriptor, initial_value: Value) -> Result<Self, RuntimeError>;
|
||||
fn descriptor(&self) -> TableDescriptor;
|
||||
fn set(&self, index: u32, element: Value) -> Result<(), RuntimeError>;
|
||||
fn get(&self, index: u32) -> Option<Value>;
|
||||
fn size(&self) -> u32;
|
||||
fn grow(&self, delta: u32, initial_value: Value) -> Result<u32, RuntimeError>;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
struct TableDescriptor {
|
||||
ty: Type,
|
||||
minimum: u32,
|
||||
maximum: Option<u32>,
|
||||
}
|
||||
|
||||
impl TableDescriptor {
|
||||
fn new(ty: Type, minimum: u32, maximum: Option<u32>) -> Self;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
trait WasmExternType {
|
||||
type Native: NativeWasmType;
|
||||
|
||||
fn from_native(native: Self::Native) -> Self;
|
||||
fn to_native(self) -> Self::Native;
|
||||
}
|
||||
12
lib/deprecated/runtime-core/doc/new-api/wasm_type_list.rs
Normal file
12
lib/deprecated/runtime-core/doc/new-api/wasm_type_list.rs
Normal file
@@ -0,0 +1,12 @@
|
||||
trait WasmTypeList {
|
||||
type CStruct;
|
||||
type Array: AsMut<[i128]>;
|
||||
|
||||
fn from_array(array: Self::Array) -> Self;
|
||||
fn empty_array(self) -> Self::Array;
|
||||
fn from_c_struct(c_struct: Self::CStruct) -> Self;
|
||||
fn into_c_struct(self) -> Self::CStruct;
|
||||
fn wasm_types() -> &'static [Type];
|
||||
fn from_slice(slice: &[i128]) -> Result<Self, TryFromSliceError>;
|
||||
fn into_array(self) -> Self::Array;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
struct ExportDescriptor<'a> {
|
||||
name: &'a str,
|
||||
ty: ExternDescriptor,
|
||||
}
|
||||
8
lib/deprecated/runtime-core/doc/old-api/func_sig.rs
Normal file
8
lib/deprecated/runtime-core/doc/old-api/func_sig.rs
Normal file
@@ -0,0 +1,8 @@
|
||||
struct FuncSig {}
|
||||
|
||||
impl FuncSig {
|
||||
fn new<Params, Returns>(params: Params, returns: Returns) -> Self;
|
||||
fn params(&self) -> &[Type];
|
||||
fn returns(&self) -> &[Type];
|
||||
fn check_param_value_types(&self, params: &[Value]) -> bool;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
struct GlobalDescriptor {
|
||||
mutable: bool,
|
||||
ty: Type,
|
||||
}
|
||||
4
lib/deprecated/runtime-core/doc/old-api/global_init.rs
Normal file
4
lib/deprecated/runtime-core/doc/old-api/global_init.rs
Normal file
@@ -0,0 +1,4 @@
|
||||
struct GlobalInit {
|
||||
desc: GlobalDescriptor,
|
||||
init: Initializer,
|
||||
}
|
||||
3
lib/deprecated/runtime-core/doc/old-api/host_function.rs
Normal file
3
lib/deprecated/runtime-core/doc/old-api/host_function.rs
Normal file
@@ -0,0 +1,3 @@
|
||||
trait HostFunction<Kind, Args, Rets> {
|
||||
fn to_raw(self) -> (NonNull<Func>, Option<NonNull<FuncEnv>>);
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
struct ImportDescriptor {
|
||||
namespace: String,
|
||||
name: String,
|
||||
ty: ExternDescriptor,
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
struct MemoryDescriptor {
|
||||
minimum: Pages,
|
||||
maximum: Option<Pages>,
|
||||
shared: bool,
|
||||
memory_type: MemoryType,
|
||||
}
|
||||
5
lib/deprecated/runtime-core/doc/old-api/memory_type.rs
Normal file
5
lib/deprecated/runtime-core/doc/old-api/memory_type.rs
Normal file
@@ -0,0 +1,5 @@
|
||||
enum MemoryType {
|
||||
Dynamic,
|
||||
Static,
|
||||
SharedStatic,
|
||||
}
|
||||
21
lib/deprecated/runtime-core/doc/old-api/module_info.rs
Normal file
21
lib/deprecated/runtime-core/doc/old-api/module_info.rs
Normal file
@@ -0,0 +1,21 @@
|
||||
struct ModuleInfo {
|
||||
backend: String,
|
||||
custom_sections: HashMap<String, Vec<Vec<u8>>>,
|
||||
data_initializers: Vec<DataInitializer>,
|
||||
elem_initializers: Vec<TableInitializer>,
|
||||
em_symbol_map: Option<HashMap<u32, String>>,
|
||||
exports: IndexMap<String, ExportIndex>,
|
||||
func_assoc: Map<FuncIndex, SigIndex>,
|
||||
generate_debug_info: bool,
|
||||
globals: Map<LocalGlobalIndex, GlobalInit>,
|
||||
imported_functions: Map<ImportedFuncIndex, ImportName>,
|
||||
imported_globals: Map<ImportedGlobalIndex, (ImportName, GlobalDescriptor)>,
|
||||
imported_memories: Map<ImportedMemoryIndex, (ImportName, MemoryDescriptor)>,
|
||||
imported_tables: Map<ImportedTableIndex, (ImportName, TableDescriptor)>,
|
||||
memories: Map<LocalMemoryIndex, MemoryDescripto>,
|
||||
name_table: StringTable<NameIndex>,
|
||||
namespace_table: StringTable<NamespaceIndex>,
|
||||
signatures: Map<SigIndex, FuncSig>,
|
||||
start_func: Option<FuncIndex>,
|
||||
tables: Map<LocalTableIndex, TableDescriptor>,
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
trait NativeWasmType {
|
||||
const TYPE: Type;
|
||||
|
||||
fn from_binary(bits: u64) -> Self;
|
||||
fn to_binary(self) -> u64;
|
||||
}
|
||||
10
lib/deprecated/runtime-core/doc/old-api/table.rs
Normal file
10
lib/deprecated/runtime-core/doc/old-api/table.rs
Normal file
@@ -0,0 +1,10 @@
|
||||
struct Table {}
|
||||
|
||||
impl Table {
|
||||
fn new(desc: TableDescriptor) -> Result<Self, CreationError>;
|
||||
fn descriptor(&self) -> TableDescriptor;
|
||||
fn set<T: StorableInTable>(&self, index: u32, element: T) -> Result<(), TableAccessError>;
|
||||
fn size(&self) -> u32;
|
||||
fn grow(&self, delta: u32) -> Result<u32, GrowError>;
|
||||
fn vm_local_table(&mut self) -> *mut LocalTable;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
struct TableDescriptor {
|
||||
element: ElementType,
|
||||
minimum: u32,
|
||||
maximum: Option<u32>,
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
trait WasmExternType {
|
||||
type Native: NativeWasmType;
|
||||
|
||||
fn from_native(native: Self::Native) -> Self;
|
||||
fn to_native(self) -> Self::Native;
|
||||
}
|
||||
11
lib/deprecated/runtime-core/doc/old-api/wasm_type_list.rs
Normal file
11
lib/deprecated/runtime-core/doc/old-api/wasm_type_list.rs
Normal file
@@ -0,0 +1,11 @@
|
||||
trait WasmTypeList {
|
||||
type CStruct;
|
||||
type RetArray: AsMut<[u64]>;
|
||||
|
||||
fn from_ret_array(array: Self::RetArray) -> Self;
|
||||
fn empty_ret_array() -> Self::RetArray;
|
||||
fn from_c_struct(c_struct: Self::CStruct) -> Self;
|
||||
fn into_c_struct(self) -> Self::CStruct;
|
||||
fn types() -> &'static [Type];
|
||||
fn call<Rets>(self, f: NonNull<Func>, wasm: Wasm, ctx: *mut Ctx) -> Result<Rets, RuntimeError>;
|
||||
}
|
||||
Reference in New Issue
Block a user