fn initialize_tables(
    module: &Module,
    contents: &mut InstanceContents,
) -> Result<(), InstantiationError> {
    let vmctx: *mut VMContext = contents.vmctx_mut();
    for init in &module.table_elements {
        let start = get_table_init_start(init, module, contents);
        let slice = get_table_slice(
            init,
            module,
            &mut contents.tables,
            &contents.vmctx,
            &contents.offsets,
        );

        let subslice = &mut slice[start..start + init.elements.len()];
        for (i, func_idx) in init.elements.iter().enumerate() {
            let callee_sig = module.functions[*func_idx];
            let (callee_ptr, callee_vmctx) =
                if let Some(index) = module.defined_func_index(*func_idx) {
                    (contents.finished_functions[index], vmctx)
                } else {
                    let imported_func =
                        imported_function(&contents.vmctx, &contents.offsets, *func_idx);
                    (imported_func.body, imported_func.vmctx)
                };
            let type_index = signature_id(&contents.vmctx, &contents.offsets, callee_sig);
            subslice[i] = VMCallerCheckedAnyfunc {
                func_ptr: callee_ptr,
                type_index,
                vmctx: callee_vmctx,
            };
        }
    }

    Ok(())
}
/// Initialize the table memory from the provided initializers.
Initialize the table memory from the provided initializers.
Initialize the table memory from the provided initializers .
fn initialize_tables(
    module: &Module,
    contents: &mut InstanceContents,
) -> Result<(), InstantiationError> {
    let vmctx: *mut VMContext = contents.vmctx_mut();
    for init in &module.table_elements {
        let start = get_table_init_start(init, module, contents);
        let slice = get_table_slice(
            init,
            module,
            &mut contents.tables,
            &contents.vmctx,
            &contents.offsets,
        );
        let subslice = &mut slice[start..start + init.elements.len()];
        for (i, func_idx) in init.elements.iter().enumerate() {
            let callee_sig = module.functions[*func_idx];
            let (callee_ptr, callee_vmctx) =
                if let Some(index) = module.defined_func_index(*func_idx) {
                    (contents.finished_functions[index], vmctx)
                } else {
                    let imported_func =
                        imported_function(&contents.vmctx, &contents.offsets, *func_idx);
                    (imported_func.body, imported_func.vmctx)
                };
            let type_index = signature_id(&contents.vmctx, &contents.offsets, callee_sig);
            subslice[i] = VMCallerCheckedAnyfunc {
                func_ptr: callee_ptr,
                type_index,
                vmctx: callee_vmctx,
            };
        }
    }
    Ok(())
}
fn initialize_tables ( module : & Module , contents : & mut InstanceContents , ) -> Result < ( ) , InstantiationError > { let vmctx : * mut VMContext = contents . vmctx_mut ( ) ; for init in & module . table_elements { let start = get_table_init_start ( init , module , contents ) ; let slice = get_table_slice ( init , module , & mut contents . tables , & contents . vmctx , & contents . offsets , ) ; let subslice = & mut slice [ start .. start + init . elements . len ( ) ] ; for ( i , func_idx ) in init . elements . iter ( ) . enumerate ( ) { let callee_sig = module . functions [ * func_idx ] ; let ( callee_ptr , callee_vmctx ) = if let Some ( index ) = module . defined_func_index ( * func_idx ) { ( contents . finished_functions [ index ] , vmctx ) } else { let imported_func = imported_function ( & contents . vmctx , & contents . offsets , * func_idx ) ; ( imported_func . body , imported_func . vmctx ) } ; let type_index = signature_id ( & contents . vmctx , & contents . offsets , callee_sig ) ; subslice [ i ] = VMCallerCheckedAnyfunc { func_ptr : callee_ptr , type_index , vmctx : callee_vmctx , } ; } } Ok ( ( ) ) }
Initialize the table memory from the provided initializers.
Initialize the table memory from the provided initializers .
module
&Module
contents
&mut InstanceContents