From e79241c1988e7c0b3d422cdb99c9a105d0cfa903 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 7 Jul 2024 14:44:45 +0900 Subject: refactor: add Store::registerFunc() --- examples/php-on-wasm/php-wasm.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'examples/php-on-wasm/php-wasm.php') diff --git a/examples/php-on-wasm/php-wasm.php b/examples/php-on-wasm/php-wasm.php index 9072bf0..1faebe6 100644 --- a/examples/php-on-wasm/php-wasm.php +++ b/examples/php-on-wasm/php-wasm.php @@ -6,7 +6,6 @@ require_once __DIR__ . '/../../vendor/autoload.php'; use Nsfisis\Waddiwasi\BinaryFormat\Decoder; use Nsfisis\Waddiwasi\BinaryFormat\InvalidBinaryFormatException; -use Nsfisis\Waddiwasi\Execution\ExternVal; use Nsfisis\Waddiwasi\Execution\FuncInst; use Nsfisis\Waddiwasi\Execution\Refs; use Nsfisis\Waddiwasi\Execution\Runtime; @@ -130,8 +129,7 @@ $hostFuncs = [ $store = Store::empty(); $externVals = []; foreach ($hostFuncs as $hostFunc) { - $store->funcs[] = $hostFunc; - $externVals[] = ExternVal::Func(\count($store->funcs) - 1); + $externVals[] = $store->registerFunc($hostFunc); } $runtime = Runtime::instantiate($store, $module, $externVals); $codePtr = allocateStringOnWasmMemory($runtime, PHP_HELLO_WORLD); -- cgit v1.2.3-70-g09d2