pub unsafe fn new(
        heap: VirtAddr,
        num_globals: u32,
        num_imported_funcs: u32,
        tables: Vec<Table>,
    ) -> Self {
        // Allocate the memory for the VmContext.
        let layout = Self::layout(num_globals, num_imported_funcs, tables.len() as u32);
        let ptr = alloc(layout);
        if ptr.is_null() {
            handle_alloc_error(layout);
        }

        // Set the heap pointer here already.
        let heap_ptr = ptr.offset(VmContext::heap_offset() as isize) as *mut VirtAddr;
        *heap_ptr = heap;

        Self {
            ptr: VirtAddr::from(ptr),
            num_imported_funcs,
            num_globals,
            tables,
        }
    }
/// Creates a new container for a VmContext.
Creates a new container for a VmContext.
Creates a new container for a VmContext .
pub unsafe fn new(
        heap: VirtAddr,
        num_globals: u32,
        num_imported_funcs: u32,
        tables: Vec<Table>,
    ) -> Self {
        // Allocate the memory for the VmContext.
        let layout = Self::layout(num_globals, num_imported_funcs, tables.len() as u32);
        let ptr = alloc(layout);
        if ptr.is_null() {
            handle_alloc_error(layout);
        }
        // Set the heap pointer here already.
        let heap_ptr = ptr.offset(VmContext::heap_offset() as isize) as *mut VirtAddr;
        *heap_ptr = heap;
        Self {
            ptr: VirtAddr::from(ptr),
            num_imported_funcs,
            num_globals,
            tables,
        }
    }
pub unsafe fn new ( heap : VirtAddr , num_globals : u32 , num_imported_funcs : u32 , tables : Vec < Table > , ) -> Self { // Allocate the memory for the VmContext. let layout = Self :: layout ( num_globals , num_imported_funcs , tables . len ( ) as u32 ) ; let ptr = alloc ( layout ) ; if ptr . is_null ( ) { handle_alloc_error ( layout ) ; } // Set the heap pointer here already. let heap_ptr = ptr . offset ( VmContext :: heap_offset ( ) as isize ) as * mut VirtAddr ; * heap_ptr = heap ; Self { ptr : VirtAddr :: from ( ptr ) , num_imported_funcs , num_globals , tables , } }
Creates a new container for a VmContext.
Creates a new container for a VmContext .
heap
VirtAddr
num_globals
u32
num_imported_funcs
u32
tables
Vec<Table>
heap
VirtAddr
num_globals
u32
num_imported_funcs
u32
tables
Vec<Table>