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
  • Compiler
  • Context
  • Func
  • FunctionContext
  • Glob
  • LabelStack
  • Mem
  • Tab

case class LabelStack(parent: LabelStack, target: Target, arity: Int, pushed: Int) extends Product with Serializable

A stack of labels, each one tracking following information:

  • the parent label
  • its target on break
  • its arity (i.e. the number of return value to pop and return on break)
  • the number of pushed value so far for the current label At top-level, the parent is null and target is 0. No checks need to be performed because the compiler is only called if the program is correct, in which case all breaks target an existing label. The top-level label is a special synthesized one, representing the top-level block of the function body.
Source
Compiler.scala
Linear Supertypes
Serializable, Product, Equals, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. LabelStack
  2. Serializable
  3. Product
  4. Equals
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new LabelStack(parent: LabelStack, target: Target, arity: Int, pushed: Int)

Value Members

  1. val arity: Int
  2. def break(lbll: Int): (LabelStack, Int)
    Annotations
    @inline()
  3. def isToplevel: Boolean
    Annotations
    @inline()
  4. val parent: LabelStack
  5. def pop(n: Int): LabelStack
    Annotations
    @inline()
  6. def productElementNames: Iterator[String]
    Definition Classes
    Product
  7. def push(n: Int): LabelStack
    Annotations
    @inline()
  8. val pushed: Int
  9. val target: Target