Packages

  • package root
    Definition Classes
    root
  • package swam
    Definition Classes
    root
  • 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 internals
    Definition Classes
    runtime
  • package compiler
    Definition Classes
    internals
  • package interpreter
    Definition Classes
    internals
  • Asm
  • AsmInst
  • Continuation
  • Continue
  • Done
  • Suspend

package interpreter

Ordering
  1. Alphabetic
Visibility
  1. Public
  2. Protected

Type Members

  1. class Asm[F[_]] extends AnyRef
  2. sealed trait AsmInst[F[_]] extends AnyRef

    Asm is the interpreted language.

    Asm is the interpreted language. It closely mirrors the WebAssembly bytecode with few differences:

    • it has typed breaks;
    • it has no blocks, loops, or if structures, they are all compiled to breaks;
    • it has a parameterized drop operation to drop several elements from the stack at once;
    • it has arbitrary (un)conditional jump instructions.

    This results in a language where labels are pre-compiled, avoiding indirections, and avoiding managing them on the stack. The assembly language is also less safe as it has arbitrary jumps inside a method body. The bytecode compiler is responsible for generating correctly typed assembly code from the bytecode.

    Breaks are parameterized by the jump addresses, the number of return values and the number of elements to discard from the stack before pushing return values back.

  3. sealed trait Continuation[+F[_]] extends AnyRef
  4. case class Done(res: Vector[Long]) extends Continuation[Nothing] with Product with Serializable
  5. case class Suspend[F[_]](res: F[Vector[Long]]) extends Continuation[F] with Product with Serializable

Value Members

  1. case object Continue extends Continuation[Nothing] with Product with Serializable

Ungrouped