aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/rubyvm-on-php-on-wasm
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-04-06 02:31:47 +0900
committernsfisis <nsfisis@gmail.com>2025-04-06 02:31:47 +0900
commitd33b1cc0416b8f0b05efcd2fad5200fd1db998a1 (patch)
tree844a9d4cf1052c8a80f63320909c890a2228a14f /examples/rubyvm-on-php-on-wasm
parentfa9ad79209d85b0677b00ca1d41d070105fec09f (diff)
downloadphp-waddiwasi-d33b1cc0416b8f0b05efcd2fad5200fd1db998a1.tar.gz
php-waddiwasi-d33b1cc0416b8f0b05efcd2fad5200fd1db998a1.tar.zst
php-waddiwasi-d33b1cc0416b8f0b05efcd2fad5200fd1db998a1.zip
refactor: add Runtime::instantiateFromStream()
Diffstat (limited to 'examples/rubyvm-on-php-on-wasm')
-rw-r--r--examples/rubyvm-on-php-on-wasm/php-wasm.php4
1 files changed, 1 insertions, 3 deletions
diff --git a/examples/rubyvm-on-php-on-wasm/php-wasm.php b/examples/rubyvm-on-php-on-wasm/php-wasm.php
index 148b98a..c89c8c4 100644
--- a/examples/rubyvm-on-php-on-wasm/php-wasm.php
+++ b/examples/rubyvm-on-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'
@@ -13,11 +12,10 @@ require_once '%DIR%/HelloWorld.php';
EOS;
$wasmBinaryStream = new FileStream(__DIR__ . '/php-wasm.wasm');
-$module = (new Decoder($wasmBinaryStream))->decode();
$linker = require_once __DIR__ . '/emscripten_bridge.php';
-$runtime = Runtime::instantiate($module, $linker);
+$runtime = Runtime::instantiateFromStream($wasmBinaryStream, $linker);
$codePtr = allocateStringOnWasmMemory($runtime, strtr(PHP_HELLO_WORLD, ['%DIR%' => __DIR__]));
$results = $runtime->invoke("php_wasm_run", [$codePtr]);