aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-03-13 22:42:58 +0900
committernsfisis <nsfisis@gmail.com>2024-03-13 22:42:58 +0900
commit814e5197439fbf2b404e8e66f3c6dd6e5ed39776 (patch)
tree72901a7e2f1641366d2cfd57b883929989c68328 /examples
parent7348999caf3ce1e0be64697319581d52f1d7f8ea (diff)
downloadphp-waddiwasi-814e5197439fbf2b404e8e66f3c6dd6e5ed39776.tar.gz
php-waddiwasi-814e5197439fbf2b404e8e66f3c6dd6e5ed39776.tar.zst
php-waddiwasi-814e5197439fbf2b404e8e66f3c6dd6e5ed39776.zip
perf: make *Addr/*Idx to primitive int
Diffstat (limited to 'examples')
-rw-r--r--examples/php-on-wasm/php-wasm.php5
1 files changed, 2 insertions, 3 deletions
diff --git a/examples/php-on-wasm/php-wasm.php b/examples/php-on-wasm/php-wasm.php
index b5a9fed..bff3525 100644
--- a/examples/php-on-wasm/php-wasm.php
+++ b/examples/php-on-wasm/php-wasm.php
@@ -10,7 +10,6 @@ use Nsfisis\Waddiwasi\BinaryFormat\Decoder;
use Nsfisis\Waddiwasi\BinaryFormat\InvalidBinaryFormatException;
use Nsfisis\Waddiwasi\Debug\Debug;
use Nsfisis\Waddiwasi\Execution\ExternVal;
-use Nsfisis\Waddiwasi\Execution\FuncAddr;
use Nsfisis\Waddiwasi\Execution\FuncInst;
use Nsfisis\Waddiwasi\Execution\Nums;
use Nsfisis\Waddiwasi\Execution\Refs;
@@ -138,7 +137,7 @@ $store = Store::empty();
$externVals = [];
foreach ($hostFuncs as $hostFunc) {
$store->funcs[] = $hostFunc;
- $externVals[] = ExternVal::Func(new FuncAddr(count($store->funcs) - 1));
+ $externVals[] = ExternVal::Func(count($store->funcs) - 1);
}
$runtime = Runtime::instantiate($store, $module, $externVals);
$codePtr = allocateStringOnWasmMemory($runtime, PHP_HELLO_WORLD);
@@ -212,7 +211,7 @@ function makeHostFunc(string $typeDef, callable $fn): FuncInst {
return FuncInst::Host($type, $fn);
}
-function getWasmTableEntry(Runtime $runtime, int $funcPtr): FuncAddr {
+function getWasmTableEntry(Runtime $runtime, int $funcPtr): int {
static $wasmTable = null;
if ($wasmTable === null) {