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 interpreter
    Definition Classes
    internals
  • Asm
  • AsmInst
  • Continuation
  • Continue
  • Done
  • Suspend

sealed trait AsmInst[F[_]] extends AnyRef

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.

Source
asm.scala
Linear Supertypes
AnyRef, Any
Known Subclasses
Br, BrIf, BrTable, Breaking, Call, CallIndirect, Drop, F32Abs, F32Add, F32Ceil, F32Const, F32ConvertSI32, F32ConvertSI64, F32ConvertUI32, F32ConvertUI64, F32Copysign, F32DemoteF64, F32Div, F32Eq, F32Floor, F32Ge, F32Gt, F32Le, F32Load, F32Lt, F32Max, F32Min, F32Mul, F32Ne, F32Nearest, F32Neg, F32ReinterpretI32, F32Sqrt, F32Store, F32Sub, F32Trunc, F64Abs, F64Add, F64Ceil, F64Const, F64ConvertSI32, F64ConvertSI64, F64ConvertUI32, F64ConvertUI64, F64Copysign, F64Div, F64Eq, F64Floor, F64Ge, F64Gt, F64Le, F64Load, F64Lt, F64Max, F64Min, F64Mul, F64Ne, F64Nearest, F64Neg, F64PromoteF32, F64ReinterpretI64, F64Sqrt, F64Store, F64Sub, F64Trunc, GlobalGet, GlobalSet, I32Add, I32And, I32Clz, I32Const, I32Ctz, I32DivS, I32DivU, I32Eq, I32Eqz, I32Extend16S, I32Extend8S, I32GeS, I32GeU, I32GtS, I32GtU, I32LeS, I32LeU, I32Load, I32Load16S, I32Load16U, I32Load8S, I32Load8U, I32LtS, I32LtU, I32Mul, I32Ne, I32Or, I32Popcnt, I32ReinterpretF32, I32RemS, I32RemU, I32Rotl, I32Rotr, I32Shl, I32ShrS, I32ShrU, I32Store, I32Store16, I32Store8, I32Sub, I32TruncSF32, I32TruncSF64, I32TruncSatSF32, I32TruncSatSF64, I32TruncSatUF32, I32TruncSatUF64, I32TruncUF32, I32TruncUF64, I32WrapI64, I32Xor, I64Add, I64And, I64Clz, I64Const, I64Ctz, I64DivS, I64DivU, I64Eq, I64Eqz, I64Extend16S, I64Extend32S, I64Extend8S, I64ExtendSI32, I64ExtendUI32, I64GeS, I64GeU, I64GtS, I64GtU, I64LeS, I64LeU, I64Load, I64Load16S, I64Load16U, I64Load32S, I64Load32U, I64Load8S, I64Load8U, I64LtS, I64LtU, I64Mul, I64Ne, I64Or, I64Popcnt, I64ReinterpretF64, I64RemS, I64RemU, I64Rotl, I64Rotr, I64Shl, I64ShrS, I64ShrU, I64Store, I64Store16, I64Store32, I64Store8, I64Sub, I64TruncSF32, I64TruncSF64, I64TruncSatSF32, I64TruncSatSF64, I64TruncSatUF32, I64TruncSatUF64, I64TruncUF32, I64TruncUF64, I64Xor, Invoking, Jump, JumpIf, LocalGet, LocalSet, LocalTee, MemoryGrow, MemorySize, Nop, Return, Select, Unreachable
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. AsmInst
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Abstract Value Members

  1. abstract def execute(t: Frame[F]): Continuation[F]

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  8. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  9. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  10. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  11. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  12. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  13. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  14. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  15. def toString(): String
    Definition Classes
    AnyRef → Any
  16. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  17. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  18. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated @deprecated
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

Inherited from AnyRef

Inherited from Any

Ungrouped