/// Create an instance at the given memory address.
///
/// It is assumed the memory was properly aligned and the
/// allocation was `alloc_size` in bytes.
Create an instance at the given memory address.
It is assumed the memory was properly aligned and the
allocation was `alloc_size` in bytes.
Create an instance at the given memory address . It is assumed the memory was properly aligned and the allocation was ` alloc_size ` in bytes .
unsafe fn new_at(
        ptr: *mut Instance,
        alloc_size: usize,
        offsets: VMOffsets<HostPtr>,
        req: InstanceAllocationRequest,
        memories: PrimaryMap<DefinedMemoryIndex, Memory>,
        tables: PrimaryMap<DefinedTableIndex, Table>,
    ) {
        // The allocation must be *at least* the size required of `Instance`.
        assert!(alloc_size >= Self::alloc_layout(&offsets).size());
        let module = req.runtime_info.module();
        let dropped_elements = EntitySet::with_capacity(module.passive_elements.len());
        let dropped_data = EntitySet::with_capacity(module.passive_data_map.len());
        ptr::write(
            ptr,
            Instance {
                runtime_info: req.runtime_info.clone(),
                offsets,
                memories,
                tables,
                dropped_elements,
                dropped_data,
                host_state: req.host_state,
                vmctx: VMContext {
                    _marker: std::marker::PhantomPinned,
                },
            },
        );
        (*ptr).initialize_vmctx(module, req.store, req.imports);
    }
unsafe fn new_at ( ptr : * mut Instance , alloc_size : usize , offsets : VMOffsets < HostPtr > , req : InstanceAllocationRequest , memories : PrimaryMap < DefinedMemoryIndex , Memory > , tables : PrimaryMap < DefinedTableIndex , Table > , ) { // The allocation must be *at least* the size required of `Instance`. assert ! ( alloc_size Self alloc_layout ( offsets ) size ( ) ) ; let module = req . runtime_info . module ( ) ; let dropped_elements = EntitySet :: with_capacity ( module . passive_elements . len ( ) ) ; let dropped_data = EntitySet :: with_capacity ( module . passive_data_map . len ( ) ) ; ptr :: write ( ptr , Instance { runtime_info : req . runtime_info . clone ( ) , offsets , memories , tables , dropped_elements , dropped_data , host_state : req . host_state , vmctx : VMContext { _marker : std :: marker :: PhantomPinned , } , } , ) ; ( * ptr ) . initialize_vmctx ( module , req . store , req . imports ) ; }
Create an instance at the given memory address.
Create an instance at the given memory address .
ptr
*mut Instance
alloc_size
usize
offsets
VMOffsets<HostPtr>
req
InstanceAllocationRequest
memories
PrimaryMap<DefinedMemoryIndex, Memory>
tables
PrimaryMap<DefinedTableIndex, Table>