From bae8cf7a0287442e7e822a194d2b6eba8c32552c Mon Sep 17 00:00:00 2001 From: nsfisis Date: Thu, 14 Mar 2024 11:13:15 +0900 Subject: perf: use global functions --- src/Execution/Allocator.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/Execution/Allocator.php') 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); } -- cgit v1.2.3-70-g09d2