Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix differences between -sys and -js API #3129

Merged
merged 38 commits into from
Sep 2, 2022
Merged

Conversation

fschutt
Copy link
Contributor

@fschutt fschutt commented Aug 23, 2022

Fixes #3054

Review

  • Add a short description of the change to the CHANGELOG.md file

@fschutt fschutt requested a review from syrusakbary as a code owner August 23, 2022 10:25
@fschutt fschutt marked this pull request as draft August 23, 2022 10:25
@fschutt
Copy link
Contributor Author

fschutt commented Aug 23, 2022

current progress

// UNFIXABLE:
#[repr(transparent)] pub struct wasmer::sys::ExternRef
pub const wasmer::sys::ExternRef::WASM_TYPE: Type
pub fn wasmer::sys::BaseTunables // (BaseTunables do not exist)
pub struct wasmer::sys::BaseTunables
pub struct field wasmer::sys::BaseTunables::dynamic_memory_offset_guard_size: u64
pub struct field wasmer::sys::BaseTunables::static_memory_bound: Pages
pub struct field wasmer::sys::BaseTunables::static_memory_offset_guard_size: u64
pub fn wasmer::sys::BaseTunables::clone(&self) -> BaseTunables
pub fn wasmer::sys::BaseTunables::create_host_memory(&self, ty: &MemoryType, style: &MemoryStyle) -> Result<VMMemory, MemoryError>
pub fn wasmer::sys::BaseTunables::create_host_table(&self, ty: &TableType, style: &TableStyle) -> Result<VMTable, String>
pub fn wasmer::sys::BaseTunables::for_target(target: &Target) -> Self
pub fn wasmer::sys::BaseTunables::memory_style(&self, memory: &MemoryType) -> MemoryStyle
pub fn wasmer::sys::BaseTunables::table_style(&self, _table: &TableType) -> TableStyle
pub unsafe fn wasmer::sys::BaseTunables::create_vm_memory(&self, ty: &MemoryType, style: &MemoryStyle, vm_definition_location: NonNull<VMMemoryDefinition>) -> Result<VMMemory, MemoryError>
pub unsafe fn wasmer::sys::BaseTunables::create_vm_table(&self, ty: &TableType, style: &TableStyle, vm_definition_location: NonNull<VMTableDefinition>) -> Result<VMTable, String>

// FIXED:
// pub enum variant wasmer::sys::Value::V128(u128)
// pub fn wasmer::sys::Memory::eq(&self, other: &Self) -> bool
// pub fn wasmer::sys::Exports::get_typed_function<Args, Rets>(&self, store: &impl AsStoreRef, name: &str) -> Result<TypedFunction<Args, Rets>, ExportError> where Args: WasmTypeList, Rets: WasmTypeList
// pub unsafe fn wasmer::sys::Module::deserialize_from_file(store: &impl AsStoreRef, path: impl AsRef<Path>) -> Result<Self, DeserializeError>
// pub unsafe fn wasmer::sys::WasmTypeList::from_slice(store: &mut impl AsStoreMut, slice: &[RawValue]) -> Result<Self, TryFromSliceError>
// pub unsafe fn wasmer::sys::WasmTypeList::write_c_struct_to_ptr(c_struct: <Self as >::CStruct, ptr: *mut RawValue)
// pub unsafe fn wasmer::sys::Value::from_raw(store: &mut impl AsStoreMut, ty: Type, raw: RawValue) -> Self
// pub unsafe fn wasmer::sys::NativeWasmTypeInto::from_raw(store: &mut impl AsStoreMut, raw: RawValue) -> Self

// UNCHECKED:
pub const wasmer::sys::Function::WASM_TYPE: Type (type Abi => f64 / usize)
pub enum variant wasmer::sys::InstantiationError::*
pub enum variant wasmer::sys::Value::ExternRef(Option<ExternRef>)
pub enum variant wasmer::sys::Value::FuncRef(Option<Function>)
pub fn wasmer::sys::Exports::get_with_generics<'a, T, Args, Rets>(&'a self, name: &str) -> Result<T, ExportError> where Args: WasmTypeList, Rets: WasmTypeList, T: ExportableWithGenerics<'a, Args, Rets>
pub fn wasmer::sys::Extern::from_vm_extern(store: &mut impl AsStoreMut, vm_extern: VMExtern) -> Self
pub fn wasmer::sys::Extern::to_vm_extern(&self) -> VMExtern
pub fn wasmer::sys::ExternRef::clone(&self) -> ExternRef
pub fn wasmer::sys::ExternRef::downcast<'a, T>(&self, store: &'a impl AsStoreRef) -> Option<&'a T> where T: Any + Send + Sync + 'static + Sized
pub fn wasmer::sys::ExternRef::fmt(&self, f: &mut $crate::fmt::Formatter<'_>) -> $crate::fmt::Result
pub fn wasmer::sys::ExternRef::is_from_store(&self, store: &impl AsStoreRef) -> bool
pub fn wasmer::sys::ExternRef::new<T>(store: &mut impl AsStoreMut, value: T) -> Self where T: Any + Send + Sync + 'static + Sized
pub fn wasmer::sys::FromToNativeWasmType::is_from_store(&self, _store: &impl AsStoreRef) -> bool
pub fn wasmer::sys::Function::from(other: TypedFunction<Args, Rets>) -> Self
pub fn wasmer::sys::Function::new<FT, F>(store: &mut impl AsStoreMut, ty: FT, func: F) -> Self where FT: Into<FunctionType>, F: Fn(&[Value]) -> Result<Vec<Value>, RuntimeError> + 'static + Send + Sync
pub fn wasmer::sys::Function::new_native_with_env<T: Send + 'static, F, Args, Rets>(store: &mut impl AsStoreMut, env: &FunctionEnv<T>, func: F) -> Self where F: HostFunction<T, Args, Rets, WithEnv> + 'static + Send + Sync, Args: WasmTypeList, Rets: WasmTypeList
pub fn wasmer::sys::Function::new_typed_with_env<T: Send + 'static, F, Args, Rets>(store: &mut impl AsStoreMut, env: &FunctionEnv<T>, func: F) -> Self where F: HostFunction<T, Args, Rets, WithEnv> + 'static + Send + Sync, Args: WasmTypeList, Rets: WasmTypeList
pub fn wasmer::sys::Function::ty(&self, store: &impl AsStoreRef) -> FunctionType
pub fn wasmer::sys::HostFunction::call_trampoline_address() -> VMTrampoline
pub fn wasmer::sys::HostFunction::function_body_ptr() -> *const VMFunctionBody
pub fn wasmer::sys::Imports::imports_for_module(&self, module: &Module) -> Result<Vec<Extern>, LinkError>
pub fn wasmer::sys::Instance::new_by_index(store: &mut impl AsStoreMut, module: &Module, externs: &[Extern]) -> Result<Self, InstantiationError>
pub fn wasmer::sys::InstantiationError::source(&self) -> std::option::Option<&(dyn std::error::Error + 'static)>
pub fn wasmer::sys::Module::custom_sections<'a>(&'a self, name: &'a str) -> impl Iterator<Item = Box<[u8]>> + 'a
pub fn wasmer::sys::Module::from_file(store: &impl AsStoreRef, file: impl AsRef<Path>) -> Result<Self, IoCompileError>
pub fn wasmer::sys::Module::serialize_to_file(&self, path: impl AsRef<Path>) -> Result<(), SerializeError>
pub fn wasmer::sys::NativeWasmTypeInto::into_raw(self, store: &mut impl AsStoreMut) -> RawValue
pub fn wasmer::sys::Store::custom_trap_handler(&self, call: &dyn Fn(&TrapHandlerFn<'_>) -> bool) -> bool
pub fn wasmer::sys::Store::engine(&self) -> &Engine
pub fn wasmer::sys::Store::new(engine: impl Into<Engine>) -> Self
pub fn wasmer::sys::Store::new_with_engine(engine: impl Into<Engine>) -> Self
pub fn wasmer::sys::Store::new_with_tunables(engine: impl Into<Engine>, tunables: impl Tunables + Send + Sync + 'static) -> Self
pub fn wasmer::sys::Store::set_trap_handler(&mut self, handler: Option<Box<TrapHandlerFn<'static>>>)
pub fn wasmer::sys::Store::tunables(&self) -> &dyn Tunables
pub fn wasmer::sys::StoreMut::engine(&self) -> &Engine
pub fn wasmer::sys::StoreMut::tunables(&self) -> &dyn Tunables
pub fn wasmer::sys::StoreRef::engine(&self) -> &Engine
pub fn wasmer::sys::StoreRef::signal_handler(&self) -> Option<*const TrapHandlerFn<'static>>
pub fn wasmer::sys::StoreRef::tunables(&self) -> &dyn Tunables
pub fn wasmer::sys::Table::copy(store: &mut impl AsStoreMut, dst_table: &Self, dst_index: u32, src_table: &Self, src_index: u32, len: u32) -> Result<(), RuntimeError>
pub fn wasmer::sys::Value::as_raw(&self, store: &impl AsStoreRef) -> RawValue
pub fn wasmer::sys::Value::externref(&self) -> Option<&Option<ExternRef>>
pub fn wasmer::sys::Value::from(val: ExternRef) -> Self
pub fn wasmer::sys::Value::from(val: Option<ExternRef>) -> Self
pub fn wasmer::sys::Value::unwrap_externref(&self) -> &Option<ExternRef>
pub fn wasmer::sys::Value::unwrap_v128(&self) -> u128
pub fn wasmer::sys::Value::v128(&self) -> Option<u128>
pub fn wasmer::sys::WasmSlice::is_empty(self) -> bool
pub mod wasmer::sys::vm
pub trait wasmer::sys::CompilerConfig
pub trait wasmer::sys::FunctionMiddleware
pub trait wasmer::sys::HostFunction<T, Args, Rets, Kind> where Args: WasmTypeList, Rets: WasmTypeList, Kind: HostFunctionKind
pub trait wasmer::sys::ModuleMiddleware
pub trait wasmer::sys::Tunables
pub type wasmer::sys::ExternRef::Abi = usize
pub use wasmer::sys::Architecture
pub use wasmer::sys::Artifact
pub use wasmer::sys::CpuFeature
pub use wasmer::sys::CallingConvention
pub use wasmer::sys::Cranelift
pub use wasmer::sys::CraneliftOptLevel
pub use wasmer::sys::FrameInfo
pub use wasmer::sys::LinkError
pub use wasmer::sys::Engine
pub use wasmer::sys::EngineBuilder
pub use wasmer::sys::Features
pub use wasmer::sys::MiddlewareError
pub use wasmer::sys::raise_user_trap
pub use wasmer::sys::MiddlewareReaderState
pub unsafe trait wasmer::sys::ValueTypeq
pub type wasmer::sys::WasmTypeList::ArrayAsMut<[RawValue]>
pub use wasmer::sys::OperatingSystem
pub use wasmer::sys::Target
pub use wasmer::sys::Triple
pub use wasmer::sys::ParseCpuFeatureError
pub type wasmer::sys::Function::Abi = usize
pub use wasmer::sys::HOST
pub use wasmer::sys::vm::VMExtern
pub use wasmer::sys::vm::VMMemory
pub use wasmer::sys::vm::VMMemoryDefinition
pub use wasmer::sys::vm::VMTable
pub use wasmer::sys::vm::VMTableDefinition
pub use wasmer::sys::wasmparser
pub use wasmer::sys::wat2wasm

@fschutt
Copy link
Contributor Author

fschutt commented Aug 23, 2022

// UNFIXABLE:
pub fn wasmer::sys::BaseTunables // (BaseTunables do not exist)
pub struct wasmer::sys::BaseTunables
pub struct field wasmer::sys::BaseTunables::dynamic_memory_offset_guard_size: u64
pub struct field wasmer::sys::BaseTunables::static_memory_bound: Pages
pub struct field wasmer::sys::BaseTunables::static_memory_offset_guard_size: u64
pub fn wasmer::sys::BaseTunables::clone(&self) -> BaseTunables
pub fn wasmer::sys::BaseTunables::create_host_memory(&self, ty: &MemoryType, style: &MemoryStyle) -> Result<VMMemory, MemoryError>
pub fn wasmer::sys::BaseTunables::create_host_table(&self, ty: &TableType, style: &TableStyle) -> Result<VMTable, String>
pub fn wasmer::sys::BaseTunables::for_target(target: &Target) -> Self
pub fn wasmer::sys::BaseTunables::memory_style(&self, memory: &MemoryType) -> MemoryStyle
pub fn wasmer::sys::BaseTunables::table_style(&self, _table: &TableType) -> TableStyle
pub unsafe fn wasmer::sys::BaseTunables::create_vm_memory(&self, ty: &MemoryType, style: &MemoryStyle, vm_definition_location: NonNull<VMMemoryDefinition>) -> Result<VMMemory, MemoryError>
pub unsafe fn wasmer::sys::BaseTunables::create_vm_table(&self, ty: &TableType, style: &TableStyle, vm_definition_location: NonNull<VMTableDefinition>) -> Result<VMTable, String>
#[repr(transparent)] pub struct wasmer::sys::ExternRef
pub const wasmer::sys::ExternRef::WASM_TYPE: Type
pub enum variant wasmer::sys::Value::ExternRef(Option<ExternRef>)
pub fn wasmer::sys::ExternRef::clone(&self) -> ExternRef
pub fn wasmer::sys::ExternRef::downcast<'a, T>(&self, store: &'a impl AsStoreRef) -> Option<&'a T> where T: Any + Send + Sync + 'static + Sized
pub fn wasmer::sys::ExternRef::fmt(&self, f: &mut $crate::fmt::Formatter<'_>) -> $crate::fmt::Result
pub fn wasmer::sys::ExternRef::is_from_store(&self, store: &impl AsStoreRef) -> bool
pub fn wasmer::sys::ExternRef::new<T>(store: &mut impl AsStoreMut, value: T) -> Self where T: Any + Send + Sync + 'static + Sized
pub fn wasmer::sys::Value::externref(&self) -> Option<&Option<ExternRef>>
pub fn wasmer::sys::Value::from(val: ExternRef) -> Self
pub fn wasmer::sys::Value::from(val: Option<ExternRef>) -> Self
pub fn wasmer::sys::Value::unwrap_externref(&self) -> &Option<ExternRef>
pub type wasmer::sys::ExternRef::Abi = usize

// FIXED:
// pub enum variant wasmer::sys::Value::V128(u128)
// pub fn wasmer::sys::Memory::eq(&self, other: &Self) -> bool
// pub fn wasmer::sys::Exports::get_typed_function<Args, Rets>(&self, store: &impl AsStoreRef, name: &str) -> Result<TypedFunction<Args, Rets>, ExportError> where Args: WasmTypeList, Rets: WasmTypeList
// pub unsafe fn wasmer::sys::Module::deserialize_from_file(store: &impl AsStoreRef, path: impl AsRef<Path>) -> Result<Self, DeserializeError>
// pub unsafe fn wasmer::sys::WasmTypeList::from_slice(store: &mut impl AsStoreMut, slice: &[RawValue]) -> Result<Self, TryFromSliceError>
// pub unsafe fn wasmer::sys::WasmTypeList::write_c_struct_to_ptr(c_struct: <Self as >::CStruct, ptr: *mut RawValue)
// pub unsafe fn wasmer::sys::Value::from_raw(store: &mut impl AsStoreMut, ty: Type, raw: RawValue) -> Self
// pub unsafe fn wasmer::sys::NativeWasmTypeInto::from_raw(store: &mut impl AsStoreMut, raw: RawValue) -> Self
// pub fn wasmer::sys::HostFunction::function_body_ptr() -> *const VMFunctionBody
// pub fn wasmer::sys::WasmSlice::is_empty(self) -> bool

// UNCHECKED:
pub const wasmer::sys::Function::WASM_TYPE: Type (type Abi => f64 / usize)
pub enum variant wasmer::sys::InstantiationError::*
pub enum variant wasmer::sys::Value::FuncRef(Option<Function>)
pub fn wasmer::sys::Exports::get_with_generics<'a, T, Args, Rets>(&'a self, name: &str) -> Result<T, ExportError> where Args: WasmTypeList, Rets: WasmTypeList, T: ExportableWithGenerics<'a, Args, Rets>
pub fn wasmer::sys::Extern::from_vm_extern(store: &mut impl AsStoreMut, vm_extern: VMExtern) -> Self
pub fn wasmer::sys::Extern::to_vm_extern(&self) -> VMExtern
pub fn wasmer::sys::FromToNativeWasmType::is_from_store(&self, _store: &impl AsStoreRef) -> bool
pub fn wasmer::sys::Function::from(other: TypedFunction<Args, Rets>) -> Self
pub fn wasmer::sys::Function::new<FT, F>(store: &mut impl AsStoreMut, ty: FT, func: F) -> Self where FT: Into<FunctionType>, F: Fn(&[Value]) -> Result<Vec<Value>, RuntimeError> + 'static + Send + Sync
pub fn wasmer::sys::Function::new_native_with_env<T: Send + 'static, F, Args, Rets>(store: &mut impl AsStoreMut, env: &FunctionEnv<T>, func: F) -> Self where F: HostFunction<T, Args, Rets, WithEnv> + 'static + Send + Sync, Args: WasmTypeList, Rets: WasmTypeList
pub fn wasmer::sys::Function::new_typed_with_env<T: Send + 'static, F, Args, Rets>(store: &mut impl AsStoreMut, env: &FunctionEnv<T>, func: F) -> Self where F: HostFunction<T, Args, Rets, WithEnv> + 'static + Send + Sync, Args: WasmTypeList, Rets: WasmTypeList
pub fn wasmer::sys::Function::ty(&self, store: &impl AsStoreRef) -> FunctionType
pub fn wasmer::sys::HostFunction::call_trampoline_address() -> VMTrampoline
pub fn wasmer::sys::Imports::imports_for_module(&self, module: &Module) -> Result<Vec<Extern>, LinkError>
pub fn wasmer::sys::Instance::new_by_index(store: &mut impl AsStoreMut, module: &Module, externs: &[Extern]) -> Result<Self, InstantiationError>
pub fn wasmer::sys::InstantiationError::source(&self) -> std::option::Option<&(dyn std::error::Error + 'static)>
pub fn wasmer::sys::Module::custom_sections<'a>(&'a self, name: &'a str) -> impl Iterator<Item = Box<[u8]>> + 'a
pub fn wasmer::sys::Module::from_file(store: &impl AsStoreRef, file: impl AsRef<Path>) -> Result<Self, IoCompileError>
pub fn wasmer::sys::Module::serialize_to_file(&self, path: impl AsRef<Path>) -> Result<(), SerializeError>
pub fn wasmer::sys::NativeWasmTypeInto::into_raw(self, store: &mut impl AsStoreMut) -> RawValue
pub fn wasmer::sys::Store::custom_trap_handler(&self, call: &dyn Fn(&TrapHandlerFn<'_>) -> bool) -> bool
pub fn wasmer::sys::Store::engine(&self) -> &Engine
pub fn wasmer::sys::Store::new(engine: impl Into<Engine>) -> Self
pub fn wasmer::sys::Store::new_with_engine(engine: impl Into<Engine>) -> Self
pub fn wasmer::sys::Store::new_with_tunables(engine: impl Into<Engine>, tunables: impl Tunables + Send + Sync + 'static) -> Self
pub fn wasmer::sys::Store::set_trap_handler(&mut self, handler: Option<Box<TrapHandlerFn<'static>>>)
pub fn wasmer::sys::Store::tunables(&self) -> &dyn Tunables
pub fn wasmer::sys::StoreMut::engine(&self) -> &Engine
pub fn wasmer::sys::StoreMut::tunables(&self) -> &dyn Tunables
pub fn wasmer::sys::StoreRef::engine(&self) -> &Engine
pub fn wasmer::sys::StoreRef::signal_handler(&self) -> Option<*const TrapHandlerFn<'static>>
pub fn wasmer::sys::StoreRef::tunables(&self) -> &dyn Tunables
pub fn wasmer::sys::Table::copy(store: &mut impl AsStoreMut, dst_table: &Self, dst_index: u32, src_table: &Self, src_index: u32, len: u32) -> Result<(), RuntimeError>
pub fn wasmer::sys::Value::as_raw(&self, store: &impl AsStoreRef) -> RawValue
pub fn wasmer::sys::Value::unwrap_v128(&self) -> u128
pub fn wasmer::sys::Value::v128(&self) -> Option<u128>
pub mod wasmer::sys::vm
pub trait wasmer::sys::CompilerConfig
pub trait wasmer::sys::FunctionMiddleware
pub trait wasmer::sys::HostFunction<T, Args, Rets, Kind> where Args: WasmTypeList, Rets: WasmTypeList, Kind: HostFunctionKind
pub trait wasmer::sys::ModuleMiddleware
pub trait wasmer::sys::Tunables
pub use wasmer::sys::Architecture
pub use wasmer::sys::Artifact
pub use wasmer::sys::CpuFeature
pub use wasmer::sys::CallingConvention
pub use wasmer::sys::Cranelift
pub use wasmer::sys::CraneliftOptLevel
pub use wasmer::sys::FrameInfo
pub use wasmer::sys::LinkError
pub use wasmer::sys::Engine
pub use wasmer::sys::EngineBuilder
pub use wasmer::sys::Features
pub use wasmer::sys::MiddlewareError
pub use wasmer::sys::raise_user_trap
pub use wasmer::sys::MiddlewareReaderState
pub unsafe trait wasmer::sys::ValueTypeq
pub type wasmer::sys::WasmTypeList::ArrayAsMut<[RawValue]>
pub use wasmer::sys::OperatingSystem
pub use wasmer::sys::Target
pub use wasmer::sys::Triple
pub use wasmer::sys::ParseCpuFeatureError
pub type wasmer::sys::Function::Abi = usize
pub use wasmer::sys::HOST
pub use wasmer::sys::vm::VMExtern
pub use wasmer::sys::vm::VMMemory
pub use wasmer::sys::vm::VMMemoryDefinition
pub use wasmer::sys::vm::VMTable
pub use wasmer::sys::vm::VMTableDefinition
pub use wasmer::sys::wasmparser
pub use wasmer::sys::wat2wasm

@fschutt
Copy link
Contributor Author

fschutt commented Aug 24, 2022

Progress:

// UNFIXABLE:
pub fn wasmer::sys::BaseTunables // (BaseTunables do not exist)
pub struct wasmer::sys::BaseTunables
pub struct field wasmer::sys::BaseTunables::dynamic_memory_offset_guard_size: u64
pub struct field wasmer::sys::BaseTunables::static_memory_bound: Pages
pub struct field wasmer::sys::BaseTunables::static_memory_offset_guard_size: u64
pub fn wasmer::sys::BaseTunables::clone(&self) -> BaseTunables
pub fn wasmer::sys::BaseTunables::create_host_memory(&self, ty: &MemoryType, style: &MemoryStyle) -> Result<VMMemory, MemoryError>
pub fn wasmer::sys::BaseTunables::create_host_table(&self, ty: &TableType, style: &TableStyle) -> Result<VMTable, String>
pub fn wasmer::sys::BaseTunables::for_target(target: &Target) -> Self
pub fn wasmer::sys::BaseTunables::memory_style(&self, memory: &MemoryType) -> MemoryStyle
pub fn wasmer::sys::BaseTunables::table_style(&self, _table: &TableType) -> TableStyle
pub unsafe fn wasmer::sys::BaseTunables::create_vm_memory(&self, ty: &MemoryType, style: &MemoryStyle, vm_definition_location: NonNull<VMMemoryDefinition>) -> Result<VMMemory, MemoryError>
pub unsafe fn wasmer::sys::BaseTunables::create_vm_table(&self, ty: &TableType, style: &TableStyle, vm_definition_location: NonNull<VMTableDefinition>) -> Result<VMTable, String>
#[repr(transparent)] pub struct wasmer::sys::ExternRef
pub const wasmer::sys::ExternRef::WASM_TYPE: Type
pub enum variant wasmer::sys::Value::ExternRef(Option<ExternRef>)
pub fn wasmer::sys::ExternRef::clone(&self) -> ExternRef
pub fn wasmer::sys::ExternRef::downcast<'a, T>(&self, store: &'a impl AsStoreRef) -> Option<&'a T> where T: Any + Send + Sync + 'static + Sized
pub fn wasmer::sys::ExternRef::fmt(&self, f: &mut $crate::fmt::Formatter<'_>) -> $crate::fmt::Result
pub fn wasmer::sys::ExternRef::is_from_store(&self, store: &impl AsStoreRef) -> bool
pub fn wasmer::sys::ExternRef::new<T>(store: &mut impl AsStoreMut, value: T) -> Self where T: Any + Send + Sync + 'static + Sized
pub fn wasmer::sys::Value::externref(&self) -> Option<&Option<ExternRef>>
pub fn wasmer::sys::Value::from(val: ExternRef) -> Self
pub fn wasmer::sys::Value::from(val: Option<ExternRef>) -> Self
pub fn wasmer::sys::Value::unwrap_externref(&self) -> &Option<ExternRef>
pub type wasmer::sys::ExternRef::Abi = usize
pub fn wasmer::sys::Store::new_with_tunables(engine: impl Into<Engine>, tunables: impl Tunables + Send + Sync + 'static) -> Self
pub fn wasmer::sys::Store::tunables(&self) -> &dyn Tunables
pub fn wasmer::sys::StoreMut::tunables(&self) -> &dyn Tunables
pub fn wasmer::sys::StoreRef::tunables(&self) -> &dyn Tunables
pub trait wasmer::sys::Tunables
pub trait wasmer::sys::CompilerConfig
pub const wasmer::sys::Function::WASM_TYPE: Type (type Abi => f64 / usize)
pub mod wasmer::sys::vm N
pub trait wasmer::sys::FunctionMiddleware N
pub trait wasmer::sys::ModuleMiddleware N
pub use wasmer::sys::Architecture N
pub use wasmer::sys::Artifact N
pub use wasmer::sys::CpuFeature N
pub use wasmer::sys::CallingConvention N
pub use wasmer::sys::Cranelift N
pub use wasmer::sys::CraneliftOptLevel N
pub use wasmer::sys::FrameInfo N
pub use wasmer::sys::LinkError N
pub use wasmer::sys::Engine N
pub use wasmer::sys::EngineBuilder N
pub use wasmer::sys::Features N
pub use wasmer::sys::MiddlewareError N
pub use wasmer::sys::OperatingSystem N
pub use wasmer::sys::Target N
pub use wasmer::sys::Triple N
pub use wasmer::sys::ParseCpuFeatureError N
pub use wasmer::sys::vm::VMExtern N
pub use wasmer::sys::vm::VMMemory N
pub use wasmer::sys::vm::VMMemoryDefinition N
pub use wasmer::sys::vm::VMTable N
pub use wasmer::sys::vm::VMTableDefinition N
pub use wasmer::sys::raise_user_trap N
pub use wasmer::sys::MiddlewareReaderState N
pub fn wasmer::sys::StoreRef::signal_handler(&self) -> Option<*const TrapHandlerFn<'static>> N
pub fn wasmer::sys::Store::set_trap_handler(&mut self, handler: Option<Box<TrapHandlerFn<'static>>>) N
pub fn wasmer::sys::Module::from_file(store: &impl AsStoreRef, file: impl AsRef<Path>) -> Result<Self, IoCompileError> N
pub fn wasmer::sys::Module::serialize_to_file(&self, path: impl AsRef<Path>) -> Result<(), SerializeError> N
pub fn wasmer::sys::Store::custom_trap_handler(&self, call: &dyn Fn(&TrapHandlerFn<'_>) -> bool) -> bool N
pub fn wasmer::sys::HostFunction::call_trampoline_address() -> VMTrampoline N

// FIXED:
// pub enum variant wasmer::sys::Value::V128(u128)
// pub fn wasmer::sys::Memory::eq(&self, other: &Self) -> bool
// pub fn wasmer::sys::Exports::get_typed_function<Args, Rets>(&self, store: &impl AsStoreRef, name: &str) -> Result<TypedFunction<Args, Rets>, ExportError> where Args: WasmTypeList, Rets: WasmTypeList
// pub unsafe fn wasmer::sys::Module::deserialize_from_file(store: &impl AsStoreRef, path: impl AsRef<Path>) -> Result<Self, DeserializeError>
// pub unsafe fn wasmer::sys::WasmTypeList::from_slice(store: &mut impl AsStoreMut, slice: &[RawValue]) -> Result<Self, TryFromSliceError>
// pub unsafe fn wasmer::sys::WasmTypeList::write_c_struct_to_ptr(c_struct: <Self as >::CStruct, ptr: *mut RawValue)
// pub unsafe fn wasmer::sys::Value::from_raw(store: &mut impl AsStoreMut, ty: Type, raw: RawValue) -> Self
// pub unsafe fn wasmer::sys::NativeWasmTypeInto::from_raw(store: &mut impl AsStoreMut, raw: RawValue) -> Self
// pub fn wasmer::sys::HostFunction::function_body_ptr() -> *const VMFunctionBody
// pub fn wasmer::sys::WasmSlice::is_empty(self) -> bool
// pub fn wasmer::sys::Exports::get_with_generics<'a, T, Args, Rets>(&'a self, name: &str) -> Result<T, ExportError> where Args: WasmTypeList, Rets: WasmTypeList, T: ExportableWithGenerics<'a, Args, Rets>
// pub fn wasmer::sys::Value::unwrap_v128(&self) -> u128
// pub fn wasmer::sys::Value::v128(&self) -> Option<u128>
// pub fn wasmer::sys::Value::as_raw(&self, store: &impl AsStoreRef) -> RawValue
// pub fn wasmer::sys::NativeWasmTypeInto::into_raw(self, store: &mut impl AsStoreMut) -> RawValue
// pub type wasmer::sys::WasmTypeList::ArrayAsMut<[RawValue]>
// pub fn wasmer::sys::Module::custom_sections<'a>(&'a self, name: &'a str) -> impl Iterator<Item = Box<[u8]>> + 'a
// pub fn wasmer::sys::FromToNativeWasmType::is_from_store(&self, _store: &impl AsStoreRef) -> bool

// UNCHECKED:
pub enum variant wasmer::sys::InstantiationError::*
pub enum variant wasmer::sys::Value::FuncRef(Option<Function>)
pub fn wasmer::sys::Extern::from_vm_extern(store: &mut impl AsStoreMut, vm_extern: VMExtern) -> Self
pub fn wasmer::sys::Extern::to_vm_extern(&self) -> VMExtern
pub fn wasmer::sys::Function::from(other: TypedFunction<Args, Rets>) -> Self
pub fn wasmer::sys::Function::new_native_with_env<T: Send + 'static, F, Args, Rets>(store: &mut impl AsStoreMut, env: &FunctionEnv<T>, func: F) -> Self where F: HostFunction<T, Args, Rets, WithEnv> + 'static + Send + Sync, Args: WasmTypeList, Rets: WasmTypeList
pub fn wasmer::sys::Function::ty(&self, store: &impl AsStoreRef) -> FunctionType
pub fn wasmer::sys::Imports::imports_for_module(&self, module: &Module) -> Result<Vec<Extern>, LinkError>
pub fn wasmer::sys::Instance::new_by_index(store: &mut impl AsStoreMut, module: &Module, externs: &[Extern]) -> Result<Self, InstantiationError>
pub fn wasmer::sys::InstantiationError::source(&self) -> std::option::Option<&(dyn std::error::Error + 'static)>
pub fn wasmer::sys::Store::engine(&self) -> &Engine
pub fn wasmer::sys::Store::new(engine: impl Into<Engine>) -> Self
pub fn wasmer::sys::Store::new_with_engine(engine: impl Into<Engine>) -> Self
pub fn wasmer::sys::StoreMut::engine(&self) -> &Engine
pub fn wasmer::sys::StoreRef::engine(&self) -> &Engine
pub fn wasmer::sys::Table::copy(store: &mut impl AsStoreMut, dst_table: &Self, dst_index: u32, src_table: &Self, src_index: u32, len: u32) -> Result<(), RuntimeError>
pub trait wasmer::sys::HostFunction<T, Args, Rets, Kind> where Args: WasmTypeList, Rets: WasmTypeList, Kind: HostFunctionKind
pub unsafe trait wasmer::sys::ValueTypeq
pub type wasmer::sys::Function::Abi = usize
pub use wasmer::sys::HOST
pub use wasmer::sys::wasmparser
pub use wasmer::sys::wat2wasm

@fschutt
Copy link
Contributor Author

fschutt commented Aug 24, 2022

Done:

// UNFIXABLE:
pub fn wasmer::sys::BaseTunables // (BaseTunables do not exist)
pub struct wasmer::sys::BaseTunables
pub struct field wasmer::sys::BaseTunables::dynamic_memory_offset_guard_size: u64
pub struct field wasmer::sys::BaseTunables::static_memory_bound: Pages
pub struct field wasmer::sys::BaseTunables::static_memory_offset_guard_size: u64
pub fn wasmer::sys::BaseTunables::clone(&self) -> BaseTunables
pub fn wasmer::sys::BaseTunables::create_host_memory(&self, ty: &MemoryType, style: &MemoryStyle) -> Result<VMMemory, MemoryError>
pub fn wasmer::sys::BaseTunables::create_host_table(&self, ty: &TableType, style: &TableStyle) -> Result<VMTable, String>
pub fn wasmer::sys::BaseTunables::for_target(target: &Target) -> Self
pub fn wasmer::sys::BaseTunables::memory_style(&self, memory: &MemoryType) -> MemoryStyle
pub fn wasmer::sys::BaseTunables::table_style(&self, _table: &TableType) -> TableStyle
pub unsafe fn wasmer::sys::BaseTunables::create_vm_memory(&self, ty: &MemoryType, style: &MemoryStyle, vm_definition_location: NonNull<VMMemoryDefinition>) -> Result<VMMemory, MemoryError>
pub unsafe fn wasmer::sys::BaseTunables::create_vm_table(&self, ty: &TableType, style: &TableStyle, vm_definition_location: NonNull<VMTableDefinition>) -> Result<VMTable, String>
#[repr(transparent)] pub struct wasmer::sys::ExternRef
pub const wasmer::sys::ExternRef::WASM_TYPE: Type
pub enum variant wasmer::sys::Value::ExternRef(Option<ExternRef>)
pub fn wasmer::sys::ExternRef::clone(&self) -> ExternRef
pub fn wasmer::sys::ExternRef::downcast<'a, T>(&self, store: &'a impl AsStoreRef) -> Option<&'a T> where T: Any + Send + Sync + 'static + Sized
pub fn wasmer::sys::ExternRef::fmt(&self, f: &mut $crate::fmt::Formatter<'_>) -> $crate::fmt::Result
pub fn wasmer::sys::ExternRef::is_from_store(&self, store: &impl AsStoreRef) -> bool
pub fn wasmer::sys::ExternRef::new<T>(store: &mut impl AsStoreMut, value: T) -> Self where T: Any + Send + Sync + 'static + Sized
pub fn wasmer::sys::Value::externref(&self) -> Option<&Option<ExternRef>>
pub fn wasmer::sys::Value::from(val: ExternRef) -> Self
pub fn wasmer::sys::Value::from(val: Option<ExternRef>) -> Self
pub fn wasmer::sys::Value::unwrap_externref(&self) -> &Option<ExternRef>
pub type wasmer::sys::ExternRef::Abi = usize
pub fn wasmer::sys::Store::new_with_tunables(engine: impl Into<Engine>, tunables: impl Tunables + Send + Sync + 'static) -> Self
pub fn wasmer::sys::Store::tunables(&self) -> &dyn Tunables
pub fn wasmer::sys::StoreMut::tunables(&self) -> &dyn Tunables
pub fn wasmer::sys::StoreRef::tunables(&self) -> &dyn Tunables
pub trait wasmer::sys::Tunables
pub trait wasmer::sys::CompilerConfig
pub const wasmer::sys::Function::WASM_TYPE: Type (type Abi => f64 / usize)
pub mod wasmer::sys::vm N
pub trait wasmer::sys::FunctionMiddleware N
pub trait wasmer::sys::ModuleMiddleware N
pub use wasmer::sys::Architecture N
pub use wasmer::sys::Artifact N
pub use wasmer::sys::CpuFeature N
pub use wasmer::sys::CallingConvention N
pub use wasmer::sys::Cranelift N
pub use wasmer::sys::CraneliftOptLevel N
pub use wasmer::sys::FrameInfo N
pub use wasmer::sys::LinkError N
pub use wasmer::sys::Engine N
pub use wasmer::sys::EngineBuilder N
pub use wasmer::sys::Features N
pub use wasmer::sys::MiddlewareError N
pub use wasmer::sys::OperatingSystem N
pub use wasmer::sys::Target N
pub use wasmer::sys::Triple N
pub use wasmer::sys::ParseCpuFeatureError N
pub use wasmer::sys::vm::VMExtern N
pub use wasmer::sys::vm::VMMemory N
pub use wasmer::sys::vm::VMMemoryDefinition N
pub use wasmer::sys::vm::VMTable N
pub use wasmer::sys::vm::VMTableDefinition N
pub use wasmer::sys::raise_user_trap N
pub use wasmer::sys::MiddlewareReaderState N
pub fn wasmer::sys::StoreRef::signal_handler(&self) -> Option<*const TrapHandlerFn<'static>> N
pub fn wasmer::sys::Store::set_trap_handler(&mut self, handler: Option<Box<TrapHandlerFn<'static>>>) N
pub fn wasmer::sys::Module::from_file(store: &impl AsStoreRef, file: impl AsRef<Path>) -> Result<Self, IoCompileError> N
pub fn wasmer::sys::Module::serialize_to_file(&self, path: impl AsRef<Path>) -> Result<(), SerializeError> N
pub fn wasmer::sys::Store::custom_trap_handler(&self, call: &dyn Fn(&TrapHandlerFn<'_>) -> bool) -> bool N
pub fn wasmer::sys::HostFunction::call_trampoline_address() -> VMTrampoline N
pub fn wasmer::sys::Store::engine(&self) -> &Engine
pub fn wasmer::sys::Store::new(engine: impl Into<Engine>) -> Self
pub fn wasmer::sys::Store::new_with_engine(engine: impl Into<Engine>) -> Self
pub fn wasmer::sys::StoreMut::engine(&self) -> &Engine
pub fn wasmer::sys::StoreRef::engine(&self) -> &Engine
pub type wasmer::sys::Function::Abi = usize
pub use wasmer::sys::HOST

// FIXED:
// pub enum variant wasmer::sys::Value::V128(u128)
// pub fn wasmer::sys::Memory::eq(&self, other: &Self) -> bool
// pub fn wasmer::sys::Exports::get_typed_function<Args, Rets>(&self, store: &impl AsStoreRef, name: &str) -> Result<TypedFunction<Args, Rets>, ExportError> where Args: WasmTypeList, Rets: WasmTypeList
// pub unsafe fn wasmer::sys::Module::deserialize_from_file(store: &impl AsStoreRef, path: impl AsRef<Path>) -> Result<Self, DeserializeError>
// pub unsafe fn wasmer::sys::WasmTypeList::from_slice(store: &mut impl AsStoreMut, slice: &[RawValue]) -> Result<Self, TryFromSliceError>
// pub unsafe fn wasmer::sys::WasmTypeList::write_c_struct_to_ptr(c_struct: <Self as >::CStruct, ptr: *mut RawValue)
// pub unsafe fn wasmer::sys::Value::from_raw(store: &mut impl AsStoreMut, ty: Type, raw: RawValue) -> Self
// pub unsafe fn wasmer::sys::NativeWasmTypeInto::from_raw(store: &mut impl AsStoreMut, raw: RawValue) -> Self
// pub fn wasmer::sys::HostFunction::function_body_ptr() -> *const VMFunctionBody
// pub fn wasmer::sys::WasmSlice::is_empty(self) -> bool
// pub fn wasmer::sys::Exports::get_with_generics<'a, T, Args, Rets>(&'a self, name: &str) -> Result<T, ExportError> where Args: WasmTypeList, Rets: WasmTypeList, T: ExportableWithGenerics<'a, Args, Rets>
// pub fn wasmer::sys::Value::unwrap_v128(&self) -> u128
// pub fn wasmer::sys::Value::v128(&self) -> Option<u128>
// pub fn wasmer::sys::Value::as_raw(&self, store: &impl AsStoreRef) -> RawValue
// pub fn wasmer::sys::NativeWasmTypeInto::into_raw(self, store: &mut impl AsStoreMut) -> RawValue
// pub type wasmer::sys::WasmTypeList::ArrayAsMut<[RawValue]>
// pub fn wasmer::sys::Module::custom_sections<'a>(&'a self, name: &'a str) -> impl Iterator<Item = Box<[u8]>> + 'a
// pub fn wasmer::sys::FromToNativeWasmType::is_from_store(&self, _store: &impl AsStoreRef) -> bool
// pub fn wasmer::sys::Imports::imports_for_module(&self, module: &Module) -> Result<Vec<Extern>, LinkError>
// pub enum variant wasmer::sys::InstantiationError::*
// pub fn wasmer::sys::Function::new_native_with_env<T: Send + 'static, F, Args, Rets>(store: &mut impl AsStoreMut, env: &FunctionEnv<T>, func: F) -> Self where F: HostFunction<T, Args, Rets, WithEnv> + 'static + Send + Sync, Args: WasmTypeList, Rets: WasmTypeList
// pub fn wasmer::sys::Instance::new_by_index(store: &mut impl AsStoreMut, module: &Module, externs: &[Extern]) -> Result<Self, InstantiationError>
// pub fn wasmer::sys::InstantiationError::source(&self) -> std::option::Option<&(dyn std::error::Error + 'static)>
// pub fn wasmer::sys::Function::from(other: TypedFunction<Args, Rets>) -> Self
// pub fn wasmer::sys::Function::ty(&self, store: &impl AsStoreRef) -> FunctionType
// pub fn wasmer::sys::Table::copy(store: &mut impl AsStoreMut, dst_table: &Self, dst_index: u32, src_table: &Self, src_index: u32, len: u32) -> Result<(), RuntimeError>
// pub trait wasmer::sys::HostFunction<T, Args, Rets, Kind> where Args: WasmTypeList, Rets: WasmTypeList, Kind: HostFunctionKind
// pub fn wasmer::sys::Extern::from_vm_extern(store: &mut impl AsStoreMut, vm_extern: VMExtern) -> Self
// pub fn wasmer::sys::Extern::to_vm_extern(&self) -> VMExtern
// pub use wasmer::sys::wasmparser
// pub use wasmer::sys::wat2wasm

@fschutt fschutt force-pushed the fix-sync-js-sys-api branch from 678971c to 14ddcfd Compare August 26, 2022 16:46
@fschutt fschutt marked this pull request as ready for review August 26, 2022 16:50
@fschutt
Copy link
Contributor Author

fschutt commented Aug 29, 2022

@syrusakbary can be reviewed and merged now

@fschutt fschutt changed the title [WIP] Fix simple cases of differences between -sys and -js API Fix differences between -sys and -js API Aug 29, 2022
@syrusakbary syrusakbary merged commit fd9113a into master Sep 2, 2022
@bors bors bot deleted the fix-sync-js-sys-api branch September 2, 2022 05:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Synchronize contents of lib/api/src/sys to lib/api/src/js
2 participants