aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-07-18 02:39:36 +0900
committernsfisis <nsfisis@gmail.com>2024-07-18 02:39:36 +0900
commitc44c6f91b89508a71a838406b286d114e461ca18 (patch)
tree8e90f3c630924f02114bdb65c01ef0ee81657d33 /src
parent402d690243533cc1d1e164da1d44b8d913574aa8 (diff)
downloadphp-waddiwasi-c44c6f91b89508a71a838406b286d114e461ca18.tar.gz
php-waddiwasi-c44c6f91b89508a71a838406b286d114e461ca18.tar.zst
php-waddiwasi-c44c6f91b89508a71a838406b286d114e461ca18.zip
refactor: simplify Runtime::instantiate()'s parameters
Diffstat (limited to 'src')
-rw-r--r--src/WebAssembly/Execution/Linker.php2
-rw-r--r--src/WebAssembly/Execution/Runtime.php9
2 files changed, 5 insertions, 6 deletions
diff --git a/src/WebAssembly/Execution/Linker.php b/src/WebAssembly/Execution/Linker.php
index 3c9c1d0..89aaaba 100644
--- a/src/WebAssembly/Execution/Linker.php
+++ b/src/WebAssembly/Execution/Linker.php
@@ -14,7 +14,7 @@ final class Linker
private array $symbols = [];
public function __construct(
- private Store $store,
+ public readonly Store $store,
) {
}
diff --git a/src/WebAssembly/Execution/Runtime.php b/src/WebAssembly/Execution/Runtime.php
index 2604212..1bb440b 100644
--- a/src/WebAssembly/Execution/Runtime.php
+++ b/src/WebAssembly/Execution/Runtime.php
@@ -39,14 +39,13 @@ final class Runtime implements ExporterInterface
) {
}
- /**
- * @param list<ExternVal> $externVals
- */
public static function instantiate(
- Store $store,
Module $module,
- array $externVals,
+ Linker $linker,
): self {
+ $store = $linker->store;
+ $externVals = $linker->resolve($module);
+
$allocator = new Allocator($store);
$moduleInstInit = $allocator->allocPreInitModule($module, $externVals);