Packages

  • package root
    Definition Classes
    root
  • package swam
    Definition Classes
    root
  • package binary
    Definition Classes
    swam
  • package cfg
    Definition Classes
    swam
  • package decompilation
    Definition Classes
    swam
  • package generator
    Definition Classes
    swam
  • package runtime

    This package contains all the classes and types related to running WebAssembly modules.

    This package contains all the classes and types related to running WebAssembly modules.

    The entry point for almost all users will be Engine. A typical use of the engine is:

    import swam._
    import text._
    import runtime._
    import exports._
    
    import cats.implicits._
    import cats.effect._
    
    import java.nio.file.Paths
    
    val tcompiler = Compiler[IO]
    val engine = Engine[IO]
    
    for {
      tcompiler <- tcompiler
      engine <- engine
      mod <- engine.compile(/* source of the module */)
      inst <- mod.newInstance()
      f <- inst.exports.function1[Int, Int]("f")
      res <- f(43)
    } yield res
    
    println(res.unsafeRunSync())
    Definition Classes
    swam
  • package syntax

    Instructions in this package are grouped by category as described in the specification.

    Instructions in this package are grouped by category as described in the specification.

    Definition Classes
    swam
  • package text
    Definition Classes
    swam
  • package traversal
    Definition Classes
    swam
  • SectionTransformer
  • SectionTraverser
  • Transformer
  • Traverser
  • VectorOps
  • package util
    Definition Classes
    swam
  • package validation
    Definition Classes
    swam
p

swam

traversal

package traversal

Source
package.scala
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. traversal
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. class SectionTransformer[F[_], Ctx] extends AnyRef
  2. class SectionTraverser[F[_], Res] extends AnyRef
  3. class Transformer[F[_], Ctx] extends AnyRef

    Transforms a WebAssembly program into another one.

    Transforms a WebAssembly program into another one. Tree traversal is performed in bottom-up order, with a _preparation_ phase for recursive instructions to upgrade the context before inspecting children.

    Every instruction has a default noop transform method, as well as a instruction categories (see group Category for instructions).

    To implement your own transformation, you can override the methods that need specific handling.

    A Transformer is a cats.Semigroup, two transformers can be merged into one, based on the approach presented in Miniphases: Compilation using Modular and Efficient Tree Transformations. When merged, two transformers are fused, making it possible to perform both transformations in one tree traversal only. Make sure your transformations respect the criteria defined in section 6 of the Miniphase paper to fuse them, otherwise, behavior of the result won't be the expected one. If not, transformations cannot be fused, and must be chained one after the other and perform two tree traversals.

  4. class Traverser[F[_], Res] extends AnyRef

    Traverses a WebAssembly program and computes some result.

    Traverses a WebAssembly program and computes some result. Tree traversal is performed in bottom-up order, with a _preparation_ phase for recursive instructions to upgrade the context before inspecting children.

    Every instruction has a default noop traverse method, as well as a instruction categories (see group Category for instructions).

    To implement your own traversal, you can override the methods that need specific handling.

  5. implicit final class VectorOps[A] extends AnyVal

Value Members

  1. object Transformer

Inherited from AnyRef

Inherited from Any

Ungrouped