Struct wasmedge_sys::Config

source ·
pub struct Config { /* private fields */ }
Expand description

Defines Config struct used to check/set the configuration options.

Config manages the configuration options, which are used to initiate Loader, Validator, Executor, and Compiler.

The configuration options are categorized into the following four groups:

  • WebAssembly Proposals

    This group of options are used to turn on/off the WebAssembly proposals. They are effective to any WasmEdge context created with Config.

  • Host Registrations

    • Wasi turns on the WASI support.

    • WasmEdgeProcess turns on the wasmedge_process support.

  • Memory Management

    • maximum_memory_page limits the page size of Memory.
  • AOT Compilation

    The AOT compiler options configure the behavior about optimization level, output format, dump IR, and generic binary.

    • Compiler Optimization Levels

      • O0 performs as many optimizations as possible.

      • O1 optimizes quickly without destroying debuggability.

      • 02 optimizes for fast execution as much as possible without triggering significant incremental compile time or code size growth.

      • O3 optimizes for fast execution as much as possible.

      • Os optimizes for small code size as much as possible without triggering significant incremental compile time or execution time slowdowns.

      • Oz optimizes for small code size as much as possible.

    • Compiler Output Formats

      • Native specifies the output format is native dynamic library (*.wasm.so).

      • Wasm specifies the output format is WebAssembly with AOT compiled codes in custom section (*.wasm).

    • dump_ir determines if AOT compiler generates IR or not.

    • generic_binary determines if AOT compiler generates the generic binary or not.

    • interruptible determines if AOT compiler generates interruptible binary or not.

    The configuration options above are only effective to Compiler.

  • Runtime Statistics

    • instr_counting determines if measuring the count of instructions when running a compiled or pure WASM.

    • cost_measuring determines if measuring the instruction costs when running a compiled or pure WASM.

    • time_measuring determines if measuring the running time when running a compiled or pure WASM.

API users can first set the options of interest, such as those related to the WebAssembly proposals, host registrations, AOT compiler options, and etc., then apply the configuration to create other WasmEdge runtime structs.

Implementations§

Creates a new Config.

Error

If fail to create, then an error is returned.

Enables or disables host registration wasi. By default, the option is disabled.

Argument
  • enable - Whether the option turns on or not.

Checks if host registration wasi turns on or not.

Sets the maximum number of the memory pages available.

Argument
  • count - The page count (64KB per page).

Returns the number of the memory pages available.

Enables or disables the ImportExportMutGlobals option. By default, the option is enabled.

Argument
  • enable - Whether the option turns on or not.

Checks if the ImportExportMutGlobals option turns on or not.

Enables or disables the NonTrapFloatToIntConversions option. By default, the option is enabled.

Argument
  • enable - Whether the option turns on or not.

Checks if the NonTrapFloatToIntConversions option turns on or not.

Enables or disables the SignExtensionOperators option. By default, the option is enabled.

Argument
  • enable - Whether the option turns on or not.

Checks if the SignExtensionOperators option turns on or not.

Enables or disables the MultiValue option. By default, the option is enabled.

Argument
  • enable - Whether the option turns on or not.

Checks if the MultiValue option turns on or not.

Enables or disables the BulkMemoryOperations option. By default, the option is enabled.

Argument
  • enable - Whether the option turns on or not.

Checks if the BulkMemoryOperations option turns on or not.

Enables or disables the ReferenceTypes option. By default, the option is enabled.

Argument
  • enable - Whether the option turns on or not.

Checks if the ReferenceTypes option turns on or not.

Enables or disables the SIMD option. By default, the option is enabled.

Argument
  • enable - Whether the option turns on or not.

Checks if the SIMD option turns on or not.

Enables or disables the TailCall option. By default, the option is disabled.

Argument
  • enable - Whether the option turns on or not.

Checks if the TailCall option turns on or not.

Enables or disables the Annotations option. By default, the option is disabled.

Argument
  • enable - Whether the option turns on or not.

Checks if the Annotations option turns on or not.

Enables or disables the Memory64 option. By default, the option is disabled.

Argument
  • enable - Whether the option turns on or not.

Checks if the Memory64 option turns on or not.

Enables or disables the Threads option. By default, the option is disabled.

Argument
  • enable - Whether the option turns on or not.

Checks if the Threads option turns on or not.

Enables or disables the ExceptionHandling option. By default, the option is disabled.

Argument
  • enable - Whether the option turns on or not.

Checks if the ExceptionHandling option turns on or not.

Enables or disables the FunctionReferences option. By default, the option is disabled.

Argument
  • enable - Whether the option turns on or not.

Checks if the FunctionReferences option turns on or not.

Enables or disables the MultiMemories option. By default, the option is disabled.

Argument
  • enable - Whether the option turns on or not.

Checks if the MultiMemories option turns on or not.

Enables or disables the ForceInterpreter option. By default, the option is disabled.

Argument
  • enable - Whether the option turns on or not.

Checks if the ForceInterpreter option turns on or not.

Sets the optimization level of AOT compiler. By default, the optimization level is O3.

Notice that this function is only available when the aot feature is enabled.

Argument
  • opt_level - The optimization level of AOT compiler.

Returns the optimization level of AOT compiler.

Notice that this function is only available when the aot feature is enabled.

Sets the output binary format of AOT compiler. By default, the compiler output format is Wasm.

Notice that this function is only available when the aot feature is enabled.

Argument
  • format - The format of the output binary.

Returns the output binary format of AOT compiler.

Notice that this function is only available when the aot feature is enabled.

Sets the dump IR option of AOT compiler. By default, the option is disabled.

Notice that this function is only available when the aot feature is enabled.

Argument
  • flag - Whether dump ir or not.

Checks if the dump IR option turns on or not.

Notice that this function is only available when the aot feature is enabled.

Sets the generic binary option of AOT compiler. By default, the option is disabled.

Notice that this function is only available when the aot feature is enabled.

Argument
  • flag - Whether generate the generic binary or not when perform AOT compilation.

Checks if the generic binary option of AOT compiler turns on or not.

Notice that this function is only available when the aot feature is enabled.

Enables or Disables the Interruptible option of AOT compiler. This option determines to generate interruptible binary or not when compilation in AOT compiler. By default, the option is disabled.

Notice that this function is only available when the aot feature is enabled.

Argument
  • enable - Whether turn on the Interruptible option.

Checks if the Interruptible option of AOT Compiler turns on or not.

Notice that this function is only available when the aot feature is enabled.

Sets the instruction counting option. By default, the option is disabled.

Argument
  • flag - Whether support instruction counting or not when execution after AOT compilation.

Checks if the instruction counting option turns on or not.

Sets the cost measuring option. By default, the option is disabled.

Argument
  • flag - Whether support cost measuring or not when execution after AOT compilation.

Checks if the cost measuring option turns on or not.

Sets the time measuring option. By default, the option is disabled.

Argument
  • flag - Whether support time measuring or not when execution after AOT compilation.

Checks if the time measuring option turns on or not.

Provides a raw pointer to the inner Configure context.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
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 resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
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.