wasmtime_environ::component

Module dfg

source
Expand description

A dataflow-graph-like intermediate representation of a component

This module contains ComponentDfg which is an intermediate step towards becoming a full-fledged Component. The main purpose for the existence of this representation of a component is to track dataflow between various items within a component and support edits to them after the initial inlined translation of a component.

Currently fused adapters are represented with a core WebAssembly module which gets “injected” into the final component as-if the component already bundled it. In doing so the adapter modules need to be partitioned and inserted into the final sequence of modules to instantiate. While this is possible to do with a flat GlobalInitializer list it gets unwieldy really quickly especially when other translation features are added.

This module is largely a duplicate of the component::info module in this crate. The hierarchy here uses *Id types instead of *Index types to represent that they don’t have any necessary implicit ordering. Additionally nothing is kept in an ordered list and instead this is worked with in a general dataflow fashion where dependencies are walked during processing.

The ComponentDfg::finish method will convert the dataflow graph to a linearized GlobalInitializer list which is intended to not be edited after it’s created.

The ComponentDfg is created as part of the component::inline phase of translation where the dataflow performed there allows identification of fused adapters, what arguments make their way to core wasm modules, etc.

Structs§

Enums§

  • Same as info::CoreDef, except has an extra Adapter variant.
  • Same as info::Export
  • Same as info::InstantiateModule
  • Possible side effects that are possible with instantiating this component.
  • Same as info::Trampoline