aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/WebAssembly
diff options
context:
space:
mode:
Diffstat (limited to 'src/WebAssembly')
-rw-r--r--src/WebAssembly/Execution/Runtime.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/WebAssembly/Execution/Runtime.php b/src/WebAssembly/Execution/Runtime.php
index 1bb440b..a120d7d 100644
--- a/src/WebAssembly/Execution/Runtime.php
+++ b/src/WebAssembly/Execution/Runtime.php
@@ -4,6 +4,8 @@ declare(strict_types=1);
namespace Nsfisis\Waddiwasi\WebAssembly\Execution;
+use Nsfisis\Waddiwasi\Stream\StreamInterface;
+use Nsfisis\Waddiwasi\WebAssembly\BinaryFormat\Decoder;
use Nsfisis\Waddiwasi\WebAssembly\Structure\Instructions\Instr;
use Nsfisis\Waddiwasi\WebAssembly\Structure\Instructions\Instrs;
use Nsfisis\Waddiwasi\WebAssembly\Structure\Instructions\Instrs\Control\BlockType;
@@ -125,6 +127,16 @@ final class Runtime implements ExporterInterface
return new self($store, $stack, $moduleInst);
}
+ public static function instantiateFromStream(
+ StreamInterface $stream,
+ Linker $linker,
+ ): self {
+ return self::instantiate(
+ (new Decoder($stream))->decode(),
+ $linker,
+ );
+ }
+
public function exports(): array
{
return $this->module->exports;