pub struct CodeMemory { /* private fields */ }
Expand description

Management of executable memory within a MmapVec

This type consumes ownership of a region of memory and will manage the executable permissions of the contained JIT code as necessary.

Implementations§

Creates a new CodeMemory by taking ownership of the provided MmapVec.

The returned CodeMemory manages the internal MmapVec and the publish method is used to actually make the memory executable.

Returns a reference to the underlying MmapVec this memory owns.

Returns the contents of the text section of the ELF executable this represents.

Returns the contents of the ELF_WASMTIME_DWARF section.

Returns the data in the ELF_NAME_DATA section.

Returns the concatenated list of all data associated with this wasm module.

This is used for initialization of memories and all data ranges stored in a Module are relative to the slice returned here.

Returns the encoded address map section used to pass to wasmtime_environ::lookup_file_pos.

Returns the contents of the ELF_WASMTIME_INFO section, or an empty slice if it wasn’t found.

Returns the contents of the ELF_WASMTIME_TRAPS section, or an empty slice if it wasn’t found.

Returns a VMTrampoline function pointer for the given function in the text section.

Unsafety

This function is unsafe as there’s no guarantee that the returned function pointer is valid.

Publishes the internal ELF image to be ready for execution.

This method can only be called once and will panic if called twice. This will parse the ELF image from the original MmapVec and do everything necessary to get it ready for execution, including:

  • Change page protections from read/write to read/execute.
  • Register unwinding information with the OS

After this function executes all JIT code should be ready to execute.

Trait Implementations§

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.