aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Execution/Allocator.php
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-03-14 11:13:15 +0900
committernsfisis <nsfisis@gmail.com>2024-03-14 11:13:15 +0900
commitbae8cf7a0287442e7e822a194d2b6eba8c32552c (patch)
treeca89f59bc432bfc4d8b07f14c8e95373ca8f0321 /src/Execution/Allocator.php
parentf4edb19f21c4777a95a5a8705d0e5f602103eb44 (diff)
downloadphp-waddiwasi-bae8cf7a0287442e7e822a194d2b6eba8c32552c.tar.gz
php-waddiwasi-bae8cf7a0287442e7e822a194d2b6eba8c32552c.tar.zst
php-waddiwasi-bae8cf7a0287442e7e822a194d2b6eba8c32552c.zip
perf: use global functions
Diffstat (limited to 'src/Execution/Allocator.php')
-rw-r--r--src/Execution/Allocator.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Execution/Allocator.php b/src/Execution/Allocator.php
index 299e761..f808174 100644
--- a/src/Execution/Allocator.php
+++ b/src/Execution/Allocator.php
@@ -11,6 +11,8 @@ use Nsfisis\Waddiwasi\Structure\Types\GlobalType;
use Nsfisis\Waddiwasi\Structure\Types\MemType;
use Nsfisis\Waddiwasi\Structure\Types\RefType;
use Nsfisis\Waddiwasi\Structure\Types\TableType;
+use RuntimeException;
+use function count;
final readonly class Allocator
{
@@ -63,7 +65,7 @@ final readonly class Allocator
ExternVals\Table::class => $m->tableAddrs[] = $externVal->addr,
ExternVals\Mem::class => $m->memAddrs[] = $externVal->addr,
ExternVals\Global_::class => $m->globalAddrs[] = $externVal->addr,
- default => throw new \RuntimeException("unreachable"),
+ default => throw new RuntimeException("unreachable"),
};
}
@@ -102,7 +104,7 @@ final readonly class Allocator
ExportDescs\Table::class => ExternVal::Table($m->tableAddrs[$export->desc->table]),
ExportDescs\Mem::class => ExternVal::Mem($m->memAddrs[$export->desc->mem]),
ExportDescs\Global_::class => ExternVal::Global_($m->globalAddrs[$export->desc->global]),
- default => throw new \RuntimeException("unreachable"),
+ default => throw new RuntimeException("unreachable"),
};
$m->exports[] = new ExportInst($export->name, $value);
}