From d33b1cc0416b8f0b05efcd2fad5200fd1db998a1 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 6 Apr 2025 02:31:47 +0900 Subject: refactor: add Runtime::instantiateFromStream() --- examples/php-on-wasm/php-wasm.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'examples/php-on-wasm') diff --git a/examples/php-on-wasm/php-wasm.php b/examples/php-on-wasm/php-wasm.php index 90a5c1a..c66b79c 100644 --- a/examples/php-on-wasm/php-wasm.php +++ b/examples/php-on-wasm/php-wasm.php @@ -5,7 +5,6 @@ declare(strict_types=1); require_once __DIR__ . '/../../vendor/autoload.php'; use Nsfisis\Waddiwasi\Stream\FileStream; -use Nsfisis\Waddiwasi\WebAssembly\BinaryFormat\Decoder; use Nsfisis\Waddiwasi\WebAssembly\Execution\Runtime; const PHP_HELLO_WORLD = <<<'EOS' @@ -15,9 +14,8 @@ EOS; $linker = (require_once __DIR__ . '/emscripten_bridge.php'); $wasmBinaryStream = new FileStream(__DIR__ . '/php-wasm.wasm'); -$module = (new Decoder($wasmBinaryStream))->decode(); -$runtime = Runtime::instantiate($module, $linker); +$runtime = Runtime::instantiateFromStream($wasmBinaryStream, $linker); $codePtr = allocateStringOnWasmMemory($runtime, PHP_HELLO_WORLD); $results = $runtime->invoke("php_wasm_run", [$codePtr]); -- cgit v1.2.3-70-g09d2