aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
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 /src
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 'src')
-rw-r--r--src/BinaryFormat/Decoder.php55
-rw-r--r--src/Debug/Debug.php5
-rw-r--r--src/Execution/Allocator.php40
-rw-r--r--src/Execution/ControlFlowResult.php4
-rw-r--r--src/Execution/ControlFlowResults/Br.php3
-rw-r--r--src/Execution/DataAddr.php13
-rw-r--r--src/Execution/ElemAddr.php13
-rw-r--r--src/Execution/ExternAddr.php13
-rw-r--r--src/Execution/ExternVal.php8
-rw-r--r--src/Execution/ExternVals/Func.php3
-rw-r--r--src/Execution/ExternVals/Global_.php3
-rw-r--r--src/Execution/ExternVals/Mem.php3
-rw-r--r--src/Execution/ExternVals/Table.php3
-rw-r--r--src/Execution/FuncAddr.php13
-rw-r--r--src/Execution/GlobalAddr.php13
-rw-r--r--src/Execution/MemAddr.php13
-rw-r--r--src/Execution/ModuleInst.php12
-rw-r--r--src/Execution/Ref.php4
-rw-r--r--src/Execution/Refs/RefExtern.php3
-rw-r--r--src/Execution/Refs/RefFunc.php3
-rw-r--r--src/Execution/Runtime.php122
-rw-r--r--src/Execution/Stack.php4
-rw-r--r--src/Execution/TableAddr.php13
-rw-r--r--src/Execution/Val.php4
-rw-r--r--src/Structure/Instructions/Instr.php52
-rw-r--r--src/Structure/Instructions/Instrs/Control/BlockType.php3
-rw-r--r--src/Structure/Instructions/Instrs/Control/BlockTypes/TypeIdx.php8
-rw-r--r--src/Structure/Instructions/Instrs/Control/Br.php3
-rw-r--r--src/Structure/Instructions/Instrs/Control/BrIf.php3
-rw-r--r--src/Structure/Instructions/Instrs/Control/BrTable.php5
-rw-r--r--src/Structure/Instructions/Instrs/Control/Call.php3
-rw-r--r--src/Structure/Instructions/Instrs/Control/CallIndirect.php6
-rw-r--r--src/Structure/Instructions/Instrs/Memory/DataDrop.php3
-rw-r--r--src/Structure/Instructions/Instrs/Memory/MemoryInit.php3
-rw-r--r--src/Structure/Instructions/Instrs/Reference/RefFunc.php3
-rw-r--r--src/Structure/Instructions/Instrs/Table/ElemDrop.php3
-rw-r--r--src/Structure/Instructions/Instrs/Table/TableCopy.php5
-rw-r--r--src/Structure/Instructions/Instrs/Table/TableFill.php3
-rw-r--r--src/Structure/Instructions/Instrs/Table/TableGet.php3
-rw-r--r--src/Structure/Instructions/Instrs/Table/TableGrow.php3
-rw-r--r--src/Structure/Instructions/Instrs/Table/TableInit.php6
-rw-r--r--src/Structure/Instructions/Instrs/Table/TableSet.php3
-rw-r--r--src/Structure/Instructions/Instrs/Table/TableSize.php3
-rw-r--r--src/Structure/Instructions/Instrs/Variable/GlobalGet.php3
-rw-r--r--src/Structure/Instructions/Instrs/Variable/GlobalSet.php3
-rw-r--r--src/Structure/Instructions/Instrs/Variable/LocalGet.php3
-rw-r--r--src/Structure/Instructions/Instrs/Variable/LocalSet.php3
-rw-r--r--src/Structure/Instructions/Instrs/Variable/LocalTee.php3
-rw-r--r--src/Structure/Modules/DataMode.php3
-rw-r--r--src/Structure/Modules/DataModes/Active.php3
-rw-r--r--src/Structure/Modules/ElemMode.php3
-rw-r--r--src/Structure/Modules/ElemModes/Active.php3
-rw-r--r--src/Structure/Modules/ExportDesc.php13
-rw-r--r--src/Structure/Modules/ExportDescs/Func.php3
-rw-r--r--src/Structure/Modules/ExportDescs/Global_.php3
-rw-r--r--src/Structure/Modules/ExportDescs/Mem.php3
-rw-r--r--src/Structure/Modules/ExportDescs/Table.php3
-rw-r--r--src/Structure/Modules/Func.php3
-rw-r--r--src/Structure/Modules/ImportDesc.php3
-rw-r--r--src/Structure/Modules/ImportDescs/Func.php3
-rw-r--r--src/Structure/Modules/Start.php4
-rw-r--r--src/Structure/Types/DataIdx.php16
-rw-r--r--src/Structure/Types/ElemIdx.php16
-rw-r--r--src/Structure/Types/FuncIdx.php16
-rw-r--r--src/Structure/Types/GlobalIdx.php16
-rw-r--r--src/Structure/Types/LabelIdx.php16
-rw-r--r--src/Structure/Types/LocalIdx.php16
-rw-r--r--src/Structure/Types/MemIdx.php16
-rw-r--r--src/Structure/Types/TableIdx.php16
-rw-r--r--src/Structure/Types/TypeIdx.php16
70 files changed, 193 insertions, 507 deletions
diff --git a/src/BinaryFormat/Decoder.php b/src/BinaryFormat/Decoder.php
index 639e128..5d24cd3 100644
--- a/src/BinaryFormat/Decoder.php
+++ b/src/BinaryFormat/Decoder.php
@@ -23,24 +23,15 @@ use Nsfisis\Waddiwasi\Structure\Modules\Mem;
use Nsfisis\Waddiwasi\Structure\Modules\Module;
use Nsfisis\Waddiwasi\Structure\Modules\Start;
use Nsfisis\Waddiwasi\Structure\Modules\Table;
-use Nsfisis\Waddiwasi\Structure\Types\DataIdx;
-use Nsfisis\Waddiwasi\Structure\Types\ElemIdx;
-use Nsfisis\Waddiwasi\Structure\Types\FuncIdx;
use Nsfisis\Waddiwasi\Structure\Types\FuncType;
-use Nsfisis\Waddiwasi\Structure\Types\GlobalIdx;
use Nsfisis\Waddiwasi\Structure\Types\GlobalType;
-use Nsfisis\Waddiwasi\Structure\Types\LabelIdx;
use Nsfisis\Waddiwasi\Structure\Types\Limits;
-use Nsfisis\Waddiwasi\Structure\Types\LocalIdx;
-use Nsfisis\Waddiwasi\Structure\Types\MemIdx;
use Nsfisis\Waddiwasi\Structure\Types\MemType;
use Nsfisis\Waddiwasi\Structure\Types\Mut;
use Nsfisis\Waddiwasi\Structure\Types\NumType;
use Nsfisis\Waddiwasi\Structure\Types\RefType;
use Nsfisis\Waddiwasi\Structure\Types\ResultType;
-use Nsfisis\Waddiwasi\Structure\Types\TableIdx;
use Nsfisis\Waddiwasi\Structure\Types\TableType;
-use Nsfisis\Waddiwasi\Structure\Types\TypeIdx;
use Nsfisis\Waddiwasi\Structure\Types\ValType;
use Nsfisis\Waddiwasi\Structure\Types\VecType;
@@ -206,7 +197,7 @@ final class Decoder
}
/**
- * @return list<TypeIdx>
+ * @return list<int>
*/
private function decodeFuncSecRest(): array
{
@@ -439,7 +430,7 @@ final class Decoder
fn ($funcRef) => new Expr([Instr::RefFunc($funcRef)]),
$initFuncRefs,
),
- ElemMode::Active(new TableIdx(0), $offset),
+ ElemMode::Active(0, $offset),
);
} elseif ($mode === 1) {
$refType = $this->decodeElemKind();
@@ -482,7 +473,7 @@ final class Decoder
return new Elem(
RefType::FuncRef,
$init,
- ElemMode::Active(new TableIdx(0), $offset),
+ ElemMode::Active(0, $offset),
);
} elseif ($mode === 5) {
$refType = $this->decodeRefType();
@@ -539,7 +530,7 @@ final class Decoder
return new Data(
$init,
DataMode::Active(
- new MemIdx(0),
+ 0,
$offset,
),
);
@@ -607,49 +598,49 @@ final class Decoder
);
}
- private function decodeTypeIdx(): TypeIdx
+ private function decodeTypeIdx(): int
{
- return new TypeIdx($this->decodeU32());
+ return $this->decodeU32();
}
- private function decodeMemIdx(): MemIdx
+ private function decodeMemIdx(): int
{
- return new MemIdx($this->decodeU32());
+ return $this->decodeU32();
}
- private function decodeFuncIdx(): FuncIdx
+ private function decodeFuncIdx(): int
{
- return new FuncIdx($this->decodeU32());
+ return $this->decodeU32();
}
- private function decodeTableIdx(): TableIdx
+ private function decodeTableIdx(): int
{
- return new TableIdx($this->decodeU32());
+ return $this->decodeU32();
}
- private function decodeGlobalIdx(): GlobalIdx
+ private function decodeGlobalIdx(): int
{
- return new GlobalIdx($this->decodeU32());
+ return $this->decodeU32();
}
- private function decodeLocalIdx(): LocalIdx
+ private function decodeLocalIdx(): int
{
- return new LocalIdx($this->decodeU32());
+ return $this->decodeU32();
}
- private function decodeLabelIdx(): LabelIdx
+ private function decodeLabelIdx(): int
{
- return new LabelIdx($this->decodeU32());
+ return $this->decodeU32();
}
- private function decodeDataIdx(): DataIdx
+ private function decodeDataIdx(): int
{
- return new DataIdx($this->decodeU32());
+ return $this->decodeU32();
}
- private function decodeElemIdx(): ElemIdx
+ private function decodeElemIdx(): int
{
- return new ElemIdx($this->decodeU32());
+ return $this->decodeU32();
}
private function decodeExpr(): Expr
@@ -947,7 +938,7 @@ final class Decoder
if ($type < 0) {
throw new InvalidBinaryFormatException("blocktype");
}
- return BlockType::TypeIdx(new TypeIdx($type));
+ return BlockType::TypeIdx($type);
}
}
diff --git a/src/Debug/Debug.php b/src/Debug/Debug.php
index d33aa8b..56dcdae 100644
--- a/src/Debug/Debug.php
+++ b/src/Debug/Debug.php
@@ -15,7 +15,6 @@ use Nsfisis\Waddiwasi\Structure\Types\NumType;
use Nsfisis\Waddiwasi\Structure\Types\RefType;
use Nsfisis\Waddiwasi\Structure\Types\ResultType;
use Nsfisis\Waddiwasi\Structure\Types\TableType;
-use Nsfisis\Waddiwasi\Structure\Types\TypeIdx;
use Nsfisis\Waddiwasi\Structure\Types\ValType;
use Nsfisis\Waddiwasi\Structure\Types\ValTypes;
@@ -45,9 +44,9 @@ final readonly class Debug
}
}
- private static function typeIdxToString(TypeIdx $idx, Module $module): string
+ private static function typeIdxToString(int $idx, Module $module): string
{
- $type = $module->types[$idx->value];
+ $type = $module->types[$idx];
return self::funcTypeToString($type);
}
diff --git a/src/Execution/Allocator.php b/src/Execution/Allocator.php
index 23d9a06..730574b 100644
--- a/src/Execution/Allocator.php
+++ b/src/Execution/Allocator.php
@@ -46,7 +46,7 @@ final readonly class Allocator
* @param list<ExternVal> $externVals
* @param list<Val> $vals
* @param list<list<Ref>> $refsList
- * @param list<FuncAddr> $preAllocatedFuncs
+ * @param list<int> $preAllocatedFuncs
*/
public function allocModule(
Module $module,
@@ -69,10 +69,10 @@ final readonly class Allocator
foreach ($preAllocatedFuncs as $funcAddr) {
$m->funcAddrs[] = $funcAddr;
- $funcInst = $this->store->funcs[$funcAddr->value];
+ $funcInst = $this->store->funcs[$funcAddr];
if ($funcInst instanceof FuncInsts\Wasm) {
// @phpstan-ignore-next-line
- $this->store->funcs[$funcAddr->value] = FuncInst::Wasm(
+ $this->store->funcs[$funcAddr] = FuncInst::Wasm(
$funcInst->type,
$m,
$funcInst->code,
@@ -98,10 +98,10 @@ final readonly class Allocator
foreach ($module->exports as $export) {
$value = match ($export->desc::class) {
- ExportDescs\Func::class => ExternVal::Func($m->funcAddrs[$export->desc->func->value]),
- ExportDescs\Table::class => ExternVal::Table($m->tableAddrs[$export->desc->table->value]),
- ExportDescs\Mem::class => ExternVal::Mem($m->memAddrs[$export->desc->mem->value]),
- ExportDescs\Global_::class => ExternVal::Global_($m->globalAddrs[$export->desc->global->value]),
+ ExportDescs\Func::class => ExternVal::Func($m->funcAddrs[$export->desc->func]),
+ 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"),
};
$m->exports[] = new ExportInst($export->name, $value);
@@ -110,54 +110,54 @@ final readonly class Allocator
return $m;
}
- private function allocFunc(Func $func, ModuleInst $moduleInst): FuncAddr
+ private function allocFunc(Func $func, ModuleInst $moduleInst): int
{
- $funcType = $moduleInst->types[$func->type->value];
+ $funcType = $moduleInst->types[$func->type];
$funcInst = FuncInst::Wasm($funcType, $moduleInst, $func);
$this->store->funcs[] = $funcInst;
- return new FuncAddr(count($this->store->funcs) - 1);
+ return count($this->store->funcs) - 1;
}
- private function allocTable(TableType $tableType, Ref $ref): TableAddr
+ private function allocTable(TableType $tableType, Ref $ref): int
{
$minSize = $tableType->limits->min;
$elem = array_fill(0, $minSize, $ref);
$tableInst = new TableInst($tableType, $elem);
$this->store->tables[] = $tableInst;
- return new TableAddr(count($this->store->tables) - 1);
+ return count($this->store->tables) - 1;
}
- private function allocMem(MemType $memType): MemAddr
+ private function allocMem(MemType $memType): int
{
$memInst = new MemInst($memType);
$this->store->mems[] = $memInst;
- return new MemAddr(count($this->store->mems) - 1);
+ return count($this->store->mems) - 1;
}
- private function allocGlobal(GlobalType $globalType, Val $val): GlobalAddr
+ private function allocGlobal(GlobalType $globalType, Val $val): int
{
$globalInst = new GlobalInst($globalType, $val);
$this->store->globals[] = $globalInst;
- return new GlobalAddr(count($this->store->globals) - 1);
+ return count($this->store->globals) - 1;
}
/**
* @param list<Ref> $elem
*/
- private function allocElem(RefType $refType, array $elem): ElemAddr
+ private function allocElem(RefType $refType, array $elem): int
{
$elemInst = new ElemInst($refType, $elem);
$this->store->elems[] = $elemInst;
- return new ElemAddr(count($this->store->elems) - 1);
+ return count($this->store->elems) - 1;
}
/**
* @param list<Byte> $data
*/
- private function allocData(array $data): DataAddr
+ private function allocData(array $data): int
{
$dataInst = new DataInst($data);
$this->store->datas[] = $dataInst;
- return new DataAddr(count($this->store->datas) - 1);
+ return count($this->store->datas) - 1;
}
}
diff --git a/src/Execution/ControlFlowResult.php b/src/Execution/ControlFlowResult.php
index 1b995d9..0bb831a 100644
--- a/src/Execution/ControlFlowResult.php
+++ b/src/Execution/ControlFlowResult.php
@@ -4,11 +4,9 @@ declare(strict_types=1);
namespace Nsfisis\Waddiwasi\Execution;
-use Nsfisis\Waddiwasi\Structure\Types\LabelIdx;
-
abstract readonly class ControlFlowResult
{
- final public static function Br(LabelIdx $label): ControlFlowResults\Br
+ final public static function Br(int $label): ControlFlowResults\Br
{
return new ControlFlowResults\Br($label);
}
diff --git a/src/Execution/ControlFlowResults/Br.php b/src/Execution/ControlFlowResults/Br.php
index 8ca7ff3..a9c78b7 100644
--- a/src/Execution/ControlFlowResults/Br.php
+++ b/src/Execution/ControlFlowResults/Br.php
@@ -5,12 +5,11 @@ declare(strict_types=1);
namespace Nsfisis\Waddiwasi\Execution\ControlFlowResults;
use Nsfisis\Waddiwasi\Execution\ControlFlowResult;
-use Nsfisis\Waddiwasi\Structure\Types\LabelIdx;
final readonly class Br extends ControlFlowResult
{
protected function __construct(
- public LabelIdx $label,
+ public int $label,
) {
}
}
diff --git a/src/Execution/DataAddr.php b/src/Execution/DataAddr.php
deleted file mode 100644
index b3c4516..0000000
--- a/src/Execution/DataAddr.php
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace Nsfisis\Waddiwasi\Execution;
-
-final readonly class DataAddr
-{
- public function __construct(
- public int $value,
- ) {
- }
-}
diff --git a/src/Execution/ElemAddr.php b/src/Execution/ElemAddr.php
deleted file mode 100644
index e46b54f..0000000
--- a/src/Execution/ElemAddr.php
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace Nsfisis\Waddiwasi\Execution;
-
-final readonly class ElemAddr
-{
- public function __construct(
- public int $value,
- ) {
- }
-}
diff --git a/src/Execution/ExternAddr.php b/src/Execution/ExternAddr.php
deleted file mode 100644
index 954127c..0000000
--- a/src/Execution/ExternAddr.php
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace Nsfisis\Waddiwasi\Execution;
-
-final readonly class ExternAddr
-{
- public function __construct(
- public int $value,
- ) {
- }
-}
diff --git a/src/Execution/ExternVal.php b/src/Execution/ExternVal.php
index f095225..ead0330 100644
--- a/src/Execution/ExternVal.php
+++ b/src/Execution/ExternVal.php
@@ -6,22 +6,22 @@ namespace Nsfisis\Waddiwasi\Execution;
abstract readonly class ExternVal
{
- final public static function Func(FuncAddr $addr): ExternVals\Func
+ final public static function Func(int $addr): ExternVals\Func
{
return new ExternVals\Func($addr);
}
- final public static function Table(TableAddr $addr): ExternVals\Table
+ final public static function Table(int $addr): ExternVals\Table
{
return new ExternVals\Table($addr);
}
- final public static function Mem(MemAddr $addr): ExternVals\Mem
+ final public static function Mem(int $addr): ExternVals\Mem
{
return new ExternVals\Mem($addr);
}
- final public static function Global_(GlobalAddr $addr): ExternVals\Global_
+ final public static function Global_(int $addr): ExternVals\Global_
{
return new ExternVals\Global_($addr);
}
diff --git a/src/Execution/ExternVals/Func.php b/src/Execution/ExternVals/Func.php
index 314d44d..08d01e3 100644
--- a/src/Execution/ExternVals/Func.php
+++ b/src/Execution/ExternVals/Func.php
@@ -5,12 +5,11 @@ declare(strict_types=1);
namespace Nsfisis\Waddiwasi\Execution\ExternVals;
use Nsfisis\Waddiwasi\Execution\ExternVal;
-use Nsfisis\Waddiwasi\Execution\FuncAddr;
final readonly class Func extends ExternVal
{
protected function __construct(
- public FuncAddr $addr,
+ public int $addr,
) {
}
}
diff --git a/src/Execution/ExternVals/Global_.php b/src/Execution/ExternVals/Global_.php
index ae38c78..3142400 100644
--- a/src/Execution/ExternVals/Global_.php
+++ b/src/Execution/ExternVals/Global_.php
@@ -5,12 +5,11 @@ declare(strict_types=1);
namespace Nsfisis\Waddiwasi\Execution\ExternVals;
use Nsfisis\Waddiwasi\Execution\ExternVal;
-use Nsfisis\Waddiwasi\Execution\GlobalAddr;
final readonly class Global_ extends ExternVal
{
protected function __construct(
- public GlobalAddr $addr,
+ public int $addr,
) {
}
}
diff --git a/src/Execution/ExternVals/Mem.php b/src/Execution/ExternVals/Mem.php
index 7bded5a..4839f3b 100644
--- a/src/Execution/ExternVals/Mem.php
+++ b/src/Execution/ExternVals/Mem.php
@@ -5,12 +5,11 @@ declare(strict_types=1);
namespace Nsfisis\Waddiwasi\Execution\ExternVals;
use Nsfisis\Waddiwasi\Execution\ExternVal;
-use Nsfisis\Waddiwasi\Execution\MemAddr;
final readonly class Mem extends ExternVal
{
protected function __construct(
- public MemAddr $addr,
+ public int $addr,
) {
}
}
diff --git a/src/Execution/ExternVals/Table.php b/src/Execution/ExternVals/Table.php
index cd36bb2..6c19b89 100644
--- a/src/Execution/ExternVals/Table.php
+++ b/src/Execution/ExternVals/Table.php
@@ -5,12 +5,11 @@ declare(strict_types=1);
namespace Nsfisis\Waddiwasi\Execution\ExternVals;
use Nsfisis\Waddiwasi\Execution\ExternVal;
-use Nsfisis\Waddiwasi\Execution\TableAddr;
final readonly class Table extends ExternVal
{
protected function __construct(
- public TableAddr $addr,
+ public int $addr,
) {
}
}
diff --git a/src/Execution/FuncAddr.php b/src/Execution/FuncAddr.php
deleted file mode 100644
index 101c7c9..0000000
--- a/src/Execution/FuncAddr.php
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace Nsfisis\Waddiwasi\Execution;
-
-final readonly class FuncAddr
-{
- public function __construct(
- public int $value,
- ) {
- }
-}
diff --git a/src/Execution/GlobalAddr.php b/src/Execution/GlobalAddr.php
deleted file mode 100644
index f9a08ff..0000000
--- a/src/Execution/GlobalAddr.php
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace Nsfisis\Waddiwasi\Execution;
-
-final readonly class GlobalAddr
-{
- public function __construct(
- public int $value,
- ) {
- }
-}
diff --git a/src/Execution/MemAddr.php b/src/Execution/MemAddr.php
deleted file mode 100644
index 5c141cc..0000000
--- a/src/Execution/MemAddr.php
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace Nsfisis\Waddiwasi\Execution;
-
-final readonly class MemAddr
-{
- public function __construct(
- public int $value,
- ) {
- }
-}
diff --git a/src/Execution/ModuleInst.php b/src/Execution/ModuleInst.php
index 2cd7f08..e073916 100644
--- a/src/Execution/ModuleInst.php
+++ b/src/Execution/ModuleInst.php
@@ -10,12 +10,12 @@ final class ModuleInst
{
/**
* @param list<FuncType> $types
- * @param list<FuncAddr> $funcAddrs
- * @param list<TableAddr> $tableAddrs
- * @param list<MemAddr> $memAddrs
- * @param list<GlobalAddr> $globalAddrs
- * @param list<ElemAddr> $elemAddrs
- * @param list<DataAddr> $dataAddrs
+ * @param list<int> $funcAddrs
+ * @param list<int> $tableAddrs
+ * @param list<int> $memAddrs
+ * @param list<int> $globalAddrs
+ * @param list<int> $elemAddrs
+ * @param list<int> $dataAddrs
* @param list<ExportInst> $exports
*/
public function __construct(
diff --git a/src/Execution/Ref.php b/src/Execution/Ref.php
index 4f0c3c1..a5682d3 100644
--- a/src/Execution/Ref.php
+++ b/src/Execution/Ref.php
@@ -13,12 +13,12 @@ abstract readonly class Ref
return new Refs\RefNull($type);
}
- final public static function RefFunc(FuncAddr $addr): Refs\RefFunc
+ final public static function RefFunc(int $addr): Refs\RefFunc
{
return new Refs\RefFunc($addr);
}
- final public static function RefExtern(ExternAddr $addr): Refs\RefExtern
+ final public static function RefExtern(int $addr): Refs\RefExtern
{
return new Refs\RefExtern($addr);
}
diff --git a/src/Execution/Refs/RefExtern.php b/src/Execution/Refs/RefExtern.php
index 4beccb4..8c0509d 100644
--- a/src/Execution/Refs/RefExtern.php
+++ b/src/Execution/Refs/RefExtern.php
@@ -4,13 +4,12 @@ declare(strict_types=1);
namespace Nsfisis\Waddiwasi\Execution\Refs;
-use Nsfisis\Waddiwasi\Execution\ExternAddr;
use Nsfisis\Waddiwasi\Execution\Ref;
final readonly class RefExtern extends Ref
{
public function __construct(
- public ExternAddr $addr,
+ public int $addr,
) {
}
}
diff --git a/src/Execution/Refs/RefFunc.php b/src/Execution/Refs/RefFunc.php
index 449b780..126150c 100644
--- a/src/Execution/Refs/RefFunc.php
+++ b/src/Execution/Refs/RefFunc.php
@@ -4,13 +4,12 @@ declare(strict_types=1);
namespace Nsfisis\Waddiwasi\Execution\Refs;
-use Nsfisis\Waddiwasi\Execution\FuncAddr;
use Nsfisis\Waddiwasi\Execution\Ref;
final readonly class RefFunc extends Ref
{
public function __construct(
- public FuncAddr $addr,
+ public int $addr,
) {
}
}
diff --git a/src/Execution/Runtime.php b/src/Execution/Runtime.php
index 3617de2..5e205b1 100644
--- a/src/Execution/Runtime.php
+++ b/src/Execution/Runtime.php
@@ -11,13 +11,9 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instrs\Control\BlockTypes;
use Nsfisis\Waddiwasi\Structure\Modules\DataModes;
use Nsfisis\Waddiwasi\Structure\Modules\ElemModes;
use Nsfisis\Waddiwasi\Structure\Modules\Module;
-use Nsfisis\Waddiwasi\Structure\Types\DataIdx;
-use Nsfisis\Waddiwasi\Structure\Types\ElemIdx;
use Nsfisis\Waddiwasi\Structure\Types\FuncType;
-use Nsfisis\Waddiwasi\Structure\Types\LabelIdx;
use Nsfisis\Waddiwasi\Structure\Types\NumType;
use Nsfisis\Waddiwasi\Structure\Types\ResultType;
-use Nsfisis\Waddiwasi\Structure\Types\TableIdx;
use Nsfisis\Waddiwasi\Structure\Types\ValType;
use Nsfisis\Waddiwasi\Structure\Types\ValTypes;
@@ -97,23 +93,23 @@ final class Runtime
array_pop($instrs); // drop "end"
$instrs[] = Instr::I32Const(0);
$instrs[] = Instr::I32Const($n);
- $instrs[] = Instr::TableInit($elem->mode->table, new ElemIdx($i));
- $instrs[] = Instr::ElemDrop(new ElemIdx($i));
+ $instrs[] = Instr::TableInit($elem->mode->table, $i);
+ $instrs[] = Instr::ElemDrop($i);
$runtime->execInstrsForInit($instrs);
} elseif ($elem->mode instanceof ElemModes\Declarative) {
- $runtime->execInstrsForInit([Instr::ElemDrop(new ElemIdx($i))]);
+ $runtime->execInstrsForInit([Instr::ElemDrop($i)]);
}
}
foreach ($module->datas as $i => $data) {
if ($data->mode instanceof DataModes\Active) {
- assert($data->mode->memory->value === 0);
+ assert($data->mode->memory === 0);
$n = count($data->init);
$instrs = $data->mode->offset->instrs;
array_pop($instrs); // drop "end"
$instrs[] = Instr::I32Const(0);
$instrs[] = Instr::I32Const($n);
- $instrs[] = Instr::MemoryInit(new DataIdx($i));
- $instrs[] = Instr::DataDrop(new DataIdx($i));
+ $instrs[] = Instr::MemoryInit($i);
+ $instrs[] = Instr::DataDrop($i);
$runtime->execInstrsForInit($instrs);
}
}
@@ -142,7 +138,7 @@ final class Runtime
{
$export = $this->getExport($name);
if ($export instanceof ExternVals\Table) {
- return $this->store->tables[$export->addr->value];
+ return $this->store->tables[$export->addr];
}
return null;
}
@@ -151,7 +147,7 @@ final class Runtime
{
$export = $this->getExport($name);
if ($export instanceof ExternVals\Mem) {
- return $this->store->mems[$export->addr->value];
+ return $this->store->mems[$export->addr];
}
return null;
}
@@ -175,7 +171,7 @@ final class Runtime
assert($export instanceof ExternVals\Func);
$funcAddr = $export->addr;
- $funcInst = $this->store->funcs[$funcAddr->value];
+ $funcInst = $this->store->funcs[$funcAddr];
assert($funcInst instanceof FuncInsts\Wasm);
$paramTypes = $funcInst->type->params->types;
$resultTypes = $funcInst->type->results->types;
@@ -196,15 +192,15 @@ final class Runtime
return $results;
}
- public function invokeByFuncAddr(FuncAddr $funcAddr): void
+ public function invokeByFuncAddr(int $funcAddr): void
{
$this->doInvokeFunc($funcAddr);
}
- private function doInvokeFunc(FuncAddr $funcAddr): void
+ private function doInvokeFunc(int $funcAddr): void
{
- // echo "Invoke: $funcAddr->value\n";
- $fn = $this->store->funcs[$funcAddr->value];
+ // echo "Invoke: $funcAddr\n";
+ $fn = $this->store->funcs[$funcAddr];
if ($fn instanceof FuncInsts\Wasm) {
$this->doInvokeWasmFunc($fn, $funcAddr);
} elseif ($fn instanceof FuncInsts\Host) {
@@ -212,10 +208,10 @@ final class Runtime
} else {
throw new \RuntimeException("doInvokeFunc: unreachable");
}
- // echo "Return: $funcAddr->value\n";
+ // echo "Return: $funcAddr\n";
}
- private function doInvokeWasmFunc(FuncInsts\Wasm $fn, FuncAddr $funcAddr): void
+ private function doInvokeWasmFunc(FuncInsts\Wasm $fn, int $funcAddr): void
{
$paramTypes = $fn->type->params->types;
$n = count($paramTypes);
@@ -235,7 +231,7 @@ final class Runtime
array_map(fn ($local) => self::defaultValueFromValType($local->type), $ts),
),
$fn->module,
- "wasm: $funcAddr->value",
+ "wasm: $funcAddr",
);
$this->activateFrame($f);
$l = StackEntry::Label($m);
@@ -1517,7 +1513,7 @@ final class Runtime
{
$x = $instr->func;
$f = $this->stack->currentFrame();
- $a = $f->module->funcAddrs[$x->value];
+ $a = $f->module->funcAddrs[$x];
$this->stack->pushRefFunc($a);
}
@@ -1554,8 +1550,8 @@ final class Runtime
{
$x = $instr->var;
$f = $this->stack->currentFrame();
- $a = $f->module->globalAddrs[$x->value];
- $glob = $this->store->globals[$a->value];
+ $a = $f->module->globalAddrs[$x];
+ $glob = $this->store->globals[$a];
$val = $glob->value;
$this->stack->pushValue($val);
}
@@ -1564,8 +1560,8 @@ final class Runtime
{
$x = $instr->var;
$f = $this->stack->currentFrame();
- $a = $f->module->globalAddrs[$x->value];
- $glob = $this->store->globals[$a->value];
+ $a = $f->module->globalAddrs[$x];
+ $glob = $this->store->globals[$a];
$val = $this->stack->popValue();
$glob->value = $val;
}
@@ -1574,9 +1570,9 @@ final class Runtime
{
$x = $instr->var;
$f = $this->stack->currentFrame();
- $val = $f->locals[$x->value] ?? null;
+ $val = $f->locals[$x] ?? null;
if ($val === null) {
- throw new \RuntimeException("local.get: local $x->value not found in [$f->debugName]");
+ throw new \RuntimeException("local.get: local $x not found in [$f->debugName]");
}
$this->stack->pushValue($val);
}
@@ -1587,7 +1583,7 @@ final class Runtime
$f = $this->stack->currentFrame();
$val = $this->stack->popValue();
// @phpstan-ignore-next-line
- $f->locals[$x->value] = $val;
+ $f->locals[$x] = $val;
}
private function execInstrVariableLocalTee(Instrs\Variable\LocalTee $instr): void
@@ -1596,7 +1592,7 @@ final class Runtime
$f = $this->stack->currentFrame();
$val = $this->stack->popValue();
// @phpstan-ignore-next-line
- $f->locals[$x->value] = $val;
+ $f->locals[$x] = $val;
$this->stack->pushValue($val);
}
@@ -1604,10 +1600,10 @@ final class Runtime
{
$x = $instr->elem;
$f = $this->stack->currentFrame();
- $a = $f->module->elemAddrs[$x->value];
- $elem = $this->store->elems[$a->value];
+ $a = $f->module->elemAddrs[$x];
+ $elem = $this->store->elems[$a];
// @phpstan-ignore-next-line
- $this->store->elems[$a->value] = new ElemInst($elem->type, []);
+ $this->store->elems[$a] = new ElemInst($elem->type, []);
}
private function execInstrTableTableCopy(Instrs\Table\TableCopy $instr): void
@@ -1635,10 +1631,10 @@ final class Runtime
$x = $instr->to;
$y = $instr->from;
$f = $this->stack->currentFrame();
- $ta = $f->module->tableAddrs[$x->value];
- $tab = $this->store->tables[$ta->value];
- $ea = $f->module->elemAddrs[$y->value];
- $elem = $this->store->elems[$ea->value];
+ $ta = $f->module->tableAddrs[$x];
+ $tab = $this->store->tables[$ta];
+ $ea = $f->module->elemAddrs[$y];
+ $elem = $this->store->elems[$ea];
$n = $this->stack->popI32();
$s = $this->stack->popI32();
$d = $this->stack->popI32();
@@ -1652,7 +1648,7 @@ final class Runtime
$val = $elem->elem[$s];
$this->stack->pushI32($d);
$this->stack->pushValue(Val::Ref($val));
- $this->execInstr(Instr::TableSet(new TableIdx($x->value)));
+ $this->execInstr(Instr::TableSet($x));
$d++;
$s++;
}
@@ -1662,8 +1658,8 @@ final class Runtime
{
$x = $instr->table;
$f = $this->stack->currentFrame();
- $a = $f->module->tableAddrs[$x->value];
- $tab = $this->store->tables[$a->value];
+ $a = $f->module->tableAddrs[$x];
+ $tab = $this->store->tables[$a];
$val = $this->stack->popRef();
$i = $this->stack->popI32();
if (count($tab->elem) <= $i) {
@@ -1682,9 +1678,9 @@ final class Runtime
{
$x = $instr->data;
$f = $this->stack->currentFrame();
- $a = $f->module->dataAddrs[$x->value];
+ $a = $f->module->dataAddrs[$x];
// @phpstan-ignore-next-line
- $this->store->datas[$a->value] = new DataInst([]);
+ $this->store->datas[$a] = new DataInst([]);
}
private function execInstrMemoryF32Load(Instrs\Memory\F32Load $instr): void
@@ -1822,9 +1818,9 @@ final class Runtime
$x = $instr->data;
$f = $this->stack->currentFrame();
$ma = $f->module->memAddrs[0];
- $mem = $this->store->mems[$ma->value];
- $da = $f->module->dataAddrs[$x->value];
- $data = $this->store->datas[$da->value];
+ $mem = $this->store->mems[$ma];
+ $da = $f->module->dataAddrs[$x];
+ $data = $this->store->datas[$da];
$n = $this->stack->popI32();
$s = $this->stack->popI32();
$d = $this->stack->popI32();
@@ -1848,7 +1844,7 @@ final class Runtime
{
$f = $this->stack->currentFrame();
$a = $f->module->memAddrs[0];
- $mem = $this->store->mems[$a->value];
+ $mem = $this->store->mems[$a];
$szInByte = $mem->size();
assert(is_int($szInByte / (64 * 1024)));
$sz = $szInByte / (64 * 1024);
@@ -1870,11 +1866,11 @@ final class Runtime
} elseif ($result instanceof ControlFlowResults\Return_) {
return $result;
} elseif ($result instanceof ControlFlowResults\Br) {
- if ($result->label->value === 0) {
+ if ($result->label === 0) {
$this->deactivateLabel($n);
} else {
$this->deactivateLabel($n);
- return ControlFlowResult::Br(new LabelIdx($result->label->value - 1));
+ return ControlFlowResult::Br($result->label - 1);
}
} else {
throw new \RuntimeException("block: unreachable");
@@ -1915,7 +1911,7 @@ final class Runtime
{
$x = $instr->func;
$f = $this->stack->currentFrame();
- $a = $f->module->funcAddrs[$x->value];
+ $a = $f->module->funcAddrs[$x];
$this->doInvokeFunc($a);
}
@@ -1924,9 +1920,9 @@ final class Runtime
$x = $instr->funcTable;
$y = $instr->type;
$f = $this->stack->currentFrame();
- $ta = $f->module->tableAddrs[$x->value];
- $tab = $this->store->tables[$ta->value];
- $ftExpect = $f->module->types[$y->value];
+ $ta = $f->module->tableAddrs[$x];
+ $tab = $this->store->tables[$ta];
+ $ftExpect = $f->module->types[$y];
$i = self::wasmI32ToPhpInt($this->stack->popI32());
if (count($tab->elem) <= $i) {
throw new TrapException("call_indirect: out of bounds");
@@ -1937,7 +1933,7 @@ final class Runtime
}
assert($r instanceof Refs\RefFunc);
$a = $r->addr;
- $fn = $this->store->funcs[$a->value];
+ $fn = $this->store->funcs[$a];
assert($fn instanceof FuncInsts\Wasm || $fn instanceof FuncInsts\Host);
$ftActual = $fn->type;
if (!$ftExpect->equals($ftActual)) {
@@ -1985,7 +1981,7 @@ final class Runtime
} elseif ($result instanceof ControlFlowResults\Return_) {
return $result;
} elseif ($result instanceof ControlFlowResults\Br) {
- if ($result->label->value === 0) {
+ if ($result->label === 0) {
if ($n === 1) {
if ($this->stack->top() instanceof StackEntries\Label) {
// echo "loop: top is label\n";
@@ -2001,7 +1997,7 @@ final class Runtime
continue;
} else {
$this->deactivateLabel($n);
- return ControlFlowResult::Br(new LabelIdx($result->label->value - 1));
+ return ControlFlowResult::Br($result->label - 1);
}
} else {
throw new \RuntimeException("loop: unreachable");
@@ -2028,7 +2024,7 @@ final class Runtime
{
$f = $this->stack->currentFrame();
$a = $f->module->memAddrs[0];
- $mem = $this->store->mems[$a->value];
+ $mem = $this->store->mems[$a];
$i = $this->stack->popI32();
$ea = $i + $offset;
$c = $mem->loadI32($ea, $n, $signed);
@@ -2042,7 +2038,7 @@ final class Runtime
{
$f = $this->stack->currentFrame();
$a = $f->module->memAddrs[0];
- $mem = $this->store->mems[$a->value];
+ $mem = $this->store->mems[$a];
$i = $this->stack->popI32();
$ea = $i + $offset;
$c = $mem->loadI64($ea, $n, $signed);
@@ -2056,7 +2052,7 @@ final class Runtime
{
$f = $this->stack->currentFrame();
$a = $f->module->memAddrs[0];
- $mem = $this->store->mems[$a->value];
+ $mem = $this->store->mems[$a];
$i = $this->stack->popI32();
$ea = $i + $offset;
$c = $mem->loadF32($ea);
@@ -2070,7 +2066,7 @@ final class Runtime
{
$f = $this->stack->currentFrame();
$a = $f->module->memAddrs[0];
- $mem = $this->store->mems[$a->value];
+ $mem = $this->store->mems[$a];
$i = $this->stack->popI32();
$ea = $i + $offset;
$c = $mem->loadF64($ea);
@@ -2084,7 +2080,7 @@ final class Runtime
{
$f = $this->stack->currentFrame();
$a = $f->module->memAddrs[0];
- $mem = $this->store->mems[$a->value];
+ $mem = $this->store->mems[$a];
$c = $this->stack->popI32();
$i = $this->stack->popI32();
$ea = $i + $offset;
@@ -2098,7 +2094,7 @@ final class Runtime
{
$f = $this->stack->currentFrame();
$a = $f->module->memAddrs[0];
- $mem = $this->store->mems[$a->value];
+ $mem = $this->store->mems[$a];
$c = $this->stack->popI64();
$i = $this->stack->popI32();
$ea = $i + $offset;
@@ -2112,7 +2108,7 @@ final class Runtime
{
$f = $this->stack->currentFrame();
$a = $f->module->memAddrs[0];
- $mem = $this->store->mems[$a->value];
+ $mem = $this->store->mems[$a];
$c = $this->stack->popF32();
$i = $this->stack->popI32();
$ea = $i + $offset;
@@ -2126,7 +2122,7 @@ final class Runtime
{
$f = $this->stack->currentFrame();
$a = $f->module->memAddrs[0];
- $mem = $this->store->mems[$a->value];
+ $mem = $this->store->mems[$a];
$c = $this->stack->popF64();
$i = $this->stack->popI32();
$ea = $i + $offset;
@@ -2153,7 +2149,7 @@ final class Runtime
private static function expandBlockType(BlockType $bt, ModuleInst $module): FuncType
{
if ($bt instanceof BlockTypes\TypeIdx) {
- return $module->types[$bt->inner->value];
+ return $module->types[$bt->inner];
} elseif ($bt instanceof BlockTypes\ValType) {
$t = $bt->inner;
return new FuncType(
diff --git a/src/Execution/Stack.php b/src/Execution/Stack.php
index 3a40764..467bd9b 100644
--- a/src/Execution/Stack.php
+++ b/src/Execution/Stack.php
@@ -79,12 +79,12 @@ final class Stack
$this->pushValue(Val::RefNull($type));
}
- public function pushRefFunc(FuncAddr $addr): void
+ public function pushRefFunc(int $addr): void
{
$this->pushValue(Val::RefFunc($addr));
}
- public function pushRefExtern(ExternAddr $addr): void
+ public function pushRefExtern(int $addr): void
{
$this->pushValue(Val::RefExtern($addr));
}
diff --git a/src/Execution/TableAddr.php b/src/Execution/TableAddr.php
deleted file mode 100644
index e41eef1..0000000
--- a/src/Execution/TableAddr.php
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace Nsfisis\Waddiwasi\Execution;
-
-final readonly class TableAddr
-{
- public function __construct(
- public int $value,
- ) {
- }
-}
diff --git a/src/Execution/Val.php b/src/Execution/Val.php
index 0f9ce42..1746cae 100644
--- a/src/Execution/Val.php
+++ b/src/Execution/Val.php
@@ -55,12 +55,12 @@ abstract readonly class Val
return self::Ref(Ref::RefNull($type));
}
- final public static function RefFunc(FuncAddr $addr): Vals\Ref
+ final public static function RefFunc(int $addr): Vals\Ref
{
return self::Ref(Ref::RefFunc($addr));
}
- final public static function RefExtern(ExternAddr $addr): Vals\Ref
+ final public static function RefExtern(int $addr): Vals\Ref
{
return self::Ref(Ref::RefExtern($addr));
}
diff --git a/src/Structure/Instructions/Instr.php b/src/Structure/Instructions/Instr.php
index 2014e04..cb4b3b8 100644
--- a/src/Structure/Instructions/Instr.php
+++ b/src/Structure/Instructions/Instr.php
@@ -12,15 +12,7 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instrs\Parametric;
use Nsfisis\Waddiwasi\Structure\Instructions\Instrs\Reference;
use Nsfisis\Waddiwasi\Structure\Instructions\Instrs\Table;
use Nsfisis\Waddiwasi\Structure\Instructions\Instrs\Variable;
-use Nsfisis\Waddiwasi\Structure\Types\DataIdx;
-use Nsfisis\Waddiwasi\Structure\Types\ElemIdx;
-use Nsfisis\Waddiwasi\Structure\Types\FuncIdx;
-use Nsfisis\Waddiwasi\Structure\Types\GlobalIdx;
-use Nsfisis\Waddiwasi\Structure\Types\LabelIdx;
-use Nsfisis\Waddiwasi\Structure\Types\LocalIdx;
use Nsfisis\Waddiwasi\Structure\Types\RefType;
-use Nsfisis\Waddiwasi\Structure\Types\TableIdx;
-use Nsfisis\Waddiwasi\Structure\Types\TypeIdx;
use Nsfisis\Waddiwasi\Structure\Types\ValType;
abstract readonly class Instr
@@ -616,7 +608,7 @@ abstract readonly class Instr
}
// Reference instructions
- final public static function RefFunc(FuncIdx $func): Reference\RefFunc
+ final public static function RefFunc(int $func): Reference\RefFunc
{
return new Reference\RefFunc($func);
}
@@ -643,63 +635,63 @@ abstract readonly class Instr
}
// Variable instructions
- final public static function GlobalGet(GlobalIdx $var): Variable\GlobalGet
+ final public static function GlobalGet(int $var): Variable\GlobalGet
{
return new Variable\GlobalGet($var);
}
- final public static function GlobalSet(GlobalIdx $var): Variable\GlobalSet
+ final public static function GlobalSet(int $var): Variable\GlobalSet
{
return new Variable\GlobalSet($var);
}
- final public static function LocalGet(LocalIdx $var): Variable\LocalGet
+ final public static function LocalGet(int $var): Variable\LocalGet
{
return new Variable\LocalGet($var);
}
- final public static function LocalSet(LocalIdx $var): Variable\LocalSet
+ final public static function LocalSet(int $var): Variable\LocalSet
{
return new Variable\LocalSet($var);
}
- final public static function LocalTee(LocalIdx $var): Variable\LocalTee
+ final public static function LocalTee(int $var): Variable\LocalTee
{
return new Variable\LocalTee($var);
}
// Table instructions
- final public static function ElemDrop(ElemIdx $elem): Table\ElemDrop
+ final public static function ElemDrop(int $elem): Table\ElemDrop
{
return new Table\ElemDrop($elem);
}
- final public static function TableCopy(TableIdx $to, TableIdx $from): Table\TableCopy
+ final public static function TableCopy(int $to, int $from): Table\TableCopy
{
return new Table\TableCopy($to, $from);
}
- final public static function TableFill(TableIdx $table): Table\TableFill
+ final public static function TableFill(int $table): Table\TableFill
{
return new Table\TableFill($table);
}
- final public static function TableGet(TableIdx $table): Table\TableGet
+ final public static function TableGet(int $table): Table\TableGet
{
return new Table\TableGet($table);
}
- final public static function TableGrow(TableIdx $table): Table\TableGrow
+ final public static function TableGrow(int $table): Table\TableGrow
{
return new Table\TableGrow($table);
}
- final public static function TableInit(TableIdx $to, ElemIdx $from): Table\TableInit
+ final public static function TableInit(int $to, int $from): Table\TableInit
{
return new Table\TableInit($to, $from);
}
- final public static function TableSet(TableIdx $table): Table\TableSet
+ final public static function TableSet(int $table): Table\TableSet
{
return new Table\TableSet($table);
}
- final public static function TableSize(TableIdx $table): Table\TableSize
+ final public static function TableSize(int $table): Table\TableSize
{
return new Table\TableSize($table);
}
// Memory instructions
- final public static function DataDrop(DataIdx $data): Memory\DataDrop
+ final public static function DataDrop(int $data): Memory\DataDrop
{
return new Memory\DataDrop($data);
}
@@ -899,7 +891,7 @@ abstract readonly class Instr
{
return new Memory\MemoryGrow();
}
- final public static function MemoryInit(DataIdx $data): Memory\MemoryInit
+ final public static function MemoryInit(int $data): Memory\MemoryInit
{
return new Memory\MemoryInit($data);
}
@@ -916,26 +908,26 @@ abstract readonly class Instr
{
return new Control\Block($type, $body);
}
- final public static function Br(LabelIdx $label): Control\Br
+ final public static function Br(int $label): Control\Br
{
return new Control\Br($label);
}
- final public static function BrIf(LabelIdx $label): Control\BrIf
+ final public static function BrIf(int $label): Control\BrIf
{
return new Control\BrIf($label);
}
/**
- * @param list<LabelIdx> $labelTable
+ * @param list<int> $labelTable
*/
- final public static function BrTable(array $labelTable, LabelIdx $defaultLabel): Control\BrTable
+ final public static function BrTable(array $labelTable, int $defaultLabel): Control\BrTable
{
return new Control\BrTable($labelTable, $defaultLabel);
}
- final public static function Call(FuncIdx $func): Control\Call
+ final public static function Call(int $func): Control\Call
{
return new Control\Call($func);
}
- final public static function CallIndirect(TableIdx $funcTable, TypeIdx $type): Control\CallIndirect
+ final public static function CallIndirect(int $funcTable, int $type): Control\CallIndirect
{
return new Control\CallIndirect($funcTable, $type);
}
diff --git a/src/Structure/Instructions/Instrs/Control/BlockType.php b/src/Structure/Instructions/Instrs/Control/BlockType.php
index c2fe106..a90389b 100644
--- a/src/Structure/Instructions/Instrs/Control/BlockType.php
+++ b/src/Structure/Instructions/Instrs/Control/BlockType.php
@@ -4,12 +4,11 @@ declare(strict_types=1);
namespace Nsfisis\Waddiwasi\Structure\Instructions\Instrs\Control;
-use Nsfisis\Waddiwasi\Structure\Types\TypeIdx;
use Nsfisis\Waddiwasi\Structure\Types\ValType;
abstract readonly class BlockType
{
- final public static function TypeIdx(TypeIdx $type): BlockTypes\TypeIdx
+ final public static function TypeIdx(int $type): BlockTypes\TypeIdx
{
return new BlockTypes\TypeIdx($type);
}
diff --git a/src/Structure/Instructions/Instrs/Control/BlockTypes/TypeIdx.php b/src/Structure/Instructions/Instrs/Control/BlockTypes/TypeIdx.php
index bb798e4..564eaf4 100644
--- a/src/Structure/Instructions/Instrs/Control/BlockTypes/TypeIdx.php
+++ b/src/Structure/Instructions/Instrs/Control/BlockTypes/TypeIdx.php
@@ -5,16 +5,10 @@ declare(strict_types=1);
namespace Nsfisis\Waddiwasi\Structure\Instructions\Instrs\Control\BlockTypes;
use Nsfisis\Waddiwasi\Structure\Instructions\Instrs\Control\BlockType;
-use Nsfisis\Waddiwasi\Structure\Types\TypeIdx as OrigTypeIdx;
final readonly class TypeIdx extends BlockType
{
- protected function __construct(public OrigTypeIdx $inner)
+ protected function __construct(public int $inner)
{
}
-
- public static function opName(): string
- {
- return "hoge";
- }
}
diff --git a/src/Structure/Instructions/Instrs/Control/Br.php b/src/Structure/Instructions/Instrs/Control/Br.php
index 26af157..7fe3415 100644
--- a/src/Structure/Instructions/Instrs/Control/Br.php
+++ b/src/Structure/Instructions/Instrs/Control/Br.php
@@ -5,12 +5,11 @@ declare(strict_types=1);
namespace Nsfisis\Waddiwasi\Structure\Instructions\Instrs\Control;
use Nsfisis\Waddiwasi\Structure\Instructions\Instr;
-use Nsfisis\Waddiwasi\Structure\Types\LabelIdx;
final readonly class Br extends Instr
{
protected function __construct(
- public LabelIdx $label,
+ public int $label,
) {
}
diff --git a/src/Structure/Instructions/Instrs/Control/BrIf.php b/src/Structure/Instructions/Instrs/Control/BrIf.php
index c6a4b3c..5fb622e 100644
--- a/src/Structure/Instructions/Instrs/Control/BrIf.php
+++ b/src/Structure/Instructions/Instrs/Control/BrIf.php
@@ -5,12 +5,11 @@ declare(strict_types=1);
namespace Nsfisis\Waddiwasi\Structure\Instructions\Instrs\Control;
use Nsfisis\Waddiwasi\Structure\Instructions\Instr;
-use Nsfisis\Waddiwasi\Structure\Types\LabelIdx;
final readonly class BrIf extends Instr
{
protected function __construct(
- public LabelIdx $label,
+ public int $label,
) {
}
diff --git a/src/Structure/Instructions/Instrs/Control/BrTable.php b/src/Structure/Instructions/Instrs/Control/BrTable.php
index c7685f6..a9c37e8 100644
--- a/src/Structure/Instructions/Instrs/Control/BrTable.php
+++ b/src/Structure/Instructions/Instrs/Control/BrTable.php
@@ -5,16 +5,15 @@ declare(strict_types=1);
namespace Nsfisis\Waddiwasi\Structure\Instructions\Instrs\Control;
use Nsfisis\Waddiwasi\Structure\Instructions\Instr;
-use Nsfisis\Waddiwasi\Structure\Types\LabelIdx;
final readonly class BrTable extends Instr
{
/**
- * @param list<LabelIdx> $labelTable
+ * @param list<int> $labelTable
*/
protected function __construct(
public array $labelTable,
- public LabelIdx $defaultLabel,
+ public int $defaultLabel,
) {
}
diff --git a/src/Structure/Instructions/Instrs/Control/Call.php b/src/Structure/Instructions/Instrs/Control/Call.php
index ba73037..9ee14be 100644
--- a/src/Structure/Instructions/Instrs/Control/Call.php
+++ b/src/Structure/Instructions/Instrs/Control/Call.php
@@ -5,12 +5,11 @@ declare(strict_types=1);
namespace Nsfisis\Waddiwasi\Structure\Instructions\Instrs\Control;
use Nsfisis\Waddiwasi\Structure\Instructions\Instr;
-use Nsfisis\Waddiwasi\Structure\Types\FuncIdx;
final readonly class Call extends Instr
{
protected function __construct(
- public FuncIdx $func,
+ public int $func,
) {
}
diff --git a/src/Structure/Instructions/Instrs/Control/CallIndirect.php b/src/Structure/Instructions/Instrs/Control/CallIndirect.php
index d6fcea4..11617ce 100644
--- a/src/Structure/Instructions/Instrs/Control/CallIndirect.php
+++ b/src/Structure/Instructions/Instrs/Control/CallIndirect.php
@@ -5,14 +5,12 @@ declare(strict_types=1);
namespace Nsfisis\Waddiwasi\Structure\Instructions\Instrs\Control;
use Nsfisis\Waddiwasi\Structure\Instructions\Instr;
-use Nsfisis\Waddiwasi\Structure\Types\TableIdx;
-use Nsfisis\Waddiwasi\Structure\Types\TypeIdx;
final readonly class CallIndirect extends Instr
{
protected function __construct(
- public TableIdx $funcTable,
- public TypeIdx $type,
+ public int $funcTable,
+ public int $type,
) {
}
diff --git a/src/Structure/Instructions/Instrs/Memory/DataDrop.php b/src/Structure/Instructions/Instrs/Memory/DataDrop.php
index 90cea96..acf337b 100644
--- a/src/Structure/Instructions/Instrs/Memory/DataDrop.php
+++ b/src/Structure/Instructions/Instrs/Memory/DataDrop.php
@@ -5,12 +5,11 @@ declare(strict_types=1);
namespace Nsfisis\Waddiwasi\Structure\Instructions\Instrs\Memory;
use Nsfisis\Waddiwasi\Structure\Instructions\Instr;
-use Nsfisis\Waddiwasi\Structure\Types\DataIdx;
final readonly class DataDrop extends Instr
{
protected function __construct(
- public DataIdx $data,
+ public int $data,
) {
}
diff --git a/src/Structure/Instructions/Instrs/Memory/MemoryInit.php b/src/Structure/Instructions/Instrs/Memory/MemoryInit.php
index 5538234..8bf762b 100644
--- a/src/Structure/Instructions/Instrs/Memory/MemoryInit.php
+++ b/src/Structure/Instructions/Instrs/Memory/MemoryInit.php
@@ -5,12 +5,11 @@ declare(strict_types=1);
namespace Nsfisis\Waddiwasi\Structure\Instructions\Instrs\Memory;
use Nsfisis\Waddiwasi\Structure\Instructions\Instr;
-use Nsfisis\Waddiwasi\Structure\Types\DataIdx;
final readonly class MemoryInit extends Instr
{
protected function __construct(
- public DataIdx $data,
+ public int $data,
) {
}
diff --git a/src/Structure/Instructions/Instrs/Reference/RefFunc.php b/src/Structure/Instructions/Instrs/Reference/RefFunc.php
index 0ccbc36..97f11b5 100644
--- a/src/Structure/Instructions/Instrs/Reference/RefFunc.php
+++ b/src/Structure/Instructions/Instrs/Reference/RefFunc.php
@@ -5,12 +5,11 @@ declare(strict_types=1);
namespace Nsfisis\Waddiwasi\Structure\Instructions\Instrs\Reference;
use Nsfisis\Waddiwasi\Structure\Instructions\Instr;
-use Nsfisis\Waddiwasi\Structure\Types\FuncIdx;
final readonly class RefFunc extends Instr
{
protected function __construct(
- public FuncIdx $func,
+ public int $func,
) {
}
diff --git a/src/Structure/Instructions/Instrs/Table/ElemDrop.php b/src/Structure/Instructions/Instrs/Table/ElemDrop.php
index bbf4586..65ea56a 100644
--- a/src/Structure/Instructions/Instrs/Table/ElemDrop.php
+++ b/src/Structure/Instructions/Instrs/Table/ElemDrop.php
@@ -5,12 +5,11 @@ declare(strict_types=1);
namespace Nsfisis\Waddiwasi\Structure\Instructions\Instrs\Table;
use Nsfisis\Waddiwasi\Structure\Instructions\Instr;
-use Nsfisis\Waddiwasi\Structure\Types\ElemIdx;
final readonly class ElemDrop extends Instr
{
protected function __construct(
- public ElemIdx $elem,
+ public int $elem,
) {
}
diff --git a/src/Structure/Instructions/Instrs/Table/TableCopy.php b/src/Structure/Instructions/Instrs/Table/TableCopy.php
index 85aa9fc..b756d28 100644
--- a/src/Structure/Instructions/Instrs/Table/TableCopy.php
+++ b/src/Structure/Instructions/Instrs/Table/TableCopy.php
@@ -5,13 +5,12 @@ declare(strict_types=1);
namespace Nsfisis\Waddiwasi\Structure\Instructions\Instrs\Table;
use Nsfisis\Waddiwasi\Structure\Instructions\Instr;
-use Nsfisis\Waddiwasi\Structure\Types\TableIdx;
final readonly class TableCopy extends Instr
{
protected function __construct(
- public TableIdx $to,
- public TableIdx $from,
+ public int $to,
+ public int $from,
) {
}
diff --git a/src/Structure/Instructions/Instrs/Table/TableFill.php b/src/Structure/Instructions/Instrs/Table/TableFill.php
index 84c6e13..fea7bb9 100644
--- a/src/Structure/Instructions/Instrs/Table/TableFill.php
+++ b/src/Structure/Instructions/Instrs/Table/TableFill.php
@@ -5,12 +5,11 @@ declare(strict_types=1);
namespace Nsfisis\Waddiwasi\Structure\Instructions\Instrs\Table;
use Nsfisis\Waddiwasi\Structure\Instructions\Instr;
-use Nsfisis\Waddiwasi\Structure\Types\TableIdx;
final readonly class TableFill extends Instr
{
protected function __construct(
- public TableIdx $table,
+ public int $table,
) {
}
diff --git a/src/Structure/Instructions/Instrs/Table/TableGet.php b/src/Structure/Instructions/Instrs/Table/TableGet.php
index e10dd5a..bb7b58f 100644
--- a/src/Structure/Instructions/Instrs/Table/TableGet.php
+++ b/src/Structure/Instructions/Instrs/Table/TableGet.php
@@ -5,12 +5,11 @@ declare(strict_types=1);
namespace Nsfisis\Waddiwasi\Structure\Instructions\Instrs\Table;
use Nsfisis\Waddiwasi\Structure\Instructions\Instr;
-use Nsfisis\Waddiwasi\Structure\Types\TableIdx;
final readonly class TableGet extends Instr
{
protected function __construct(
- public TableIdx $table,
+ public int $table,
) {
}
diff --git a/src/Structure/Instructions/Instrs/Table/TableGrow.php b/src/Structure/Instructions/Instrs/Table/TableGrow.php
index 4f224fc..026a09b 100644
--- a/src/Structure/Instructions/Instrs/Table/TableGrow.php
+++ b/src/Structure/Instructions/Instrs/Table/TableGrow.php
@@ -5,12 +5,11 @@ declare(strict_types=1);
namespace Nsfisis\Waddiwasi\Structure\Instructions\Instrs\Table;
use Nsfisis\Waddiwasi\Structure\Instructions\Instr;
-use Nsfisis\Waddiwasi\Structure\Types\TableIdx;
final readonly class TableGrow extends Instr
{
protected function __construct(
- public TableIdx $table,
+ public int $table,
) {
}
diff --git a/src/Structure/Instructions/Instrs/Table/TableInit.php b/src/Structure/Instructions/Instrs/Table/TableInit.php
index 2c834c0..b728de3 100644
--- a/src/Structure/Instructions/Instrs/Table/TableInit.php
+++ b/src/Structure/Instructions/Instrs/Table/TableInit.php
@@ -5,14 +5,12 @@ declare(strict_types=1);
namespace Nsfisis\Waddiwasi\Structure\Instructions\Instrs\Table;
use Nsfisis\Waddiwasi\Structure\Instructions\Instr;
-use Nsfisis\Waddiwasi\Structure\Types\ElemIdx;
-use Nsfisis\Waddiwasi\Structure\Types\TableIdx;
final readonly class TableInit extends Instr
{
protected function __construct(
- public TableIdx $to,
- public ElemIdx $from,
+ public int $to,
+ public int $from,
) {
}
diff --git a/src/Structure/Instructions/Instrs/Table/TableSet.php b/src/Structure/Instructions/Instrs/Table/TableSet.php
index f02c375..5e5bb1b 100644
--- a/src/Structure/Instructions/Instrs/Table/TableSet.php
+++ b/src/Structure/Instructions/Instrs/Table/TableSet.php
@@ -5,12 +5,11 @@ declare(strict_types=1);
namespace Nsfisis\Waddiwasi\Structure\Instructions\Instrs\Table;
use Nsfisis\Waddiwasi\Structure\Instructions\Instr;
-use Nsfisis\Waddiwasi\Structure\Types\TableIdx;
final readonly class TableSet extends Instr
{
protected function __construct(
- public TableIdx $table,
+ public int $table,
) {
}
diff --git a/src/Structure/Instructions/Instrs/Table/TableSize.php b/src/Structure/Instructions/Instrs/Table/TableSize.php
index 321c8f7..3357f48 100644
--- a/src/Structure/Instructions/Instrs/Table/TableSize.php
+++ b/src/Structure/Instructions/Instrs/Table/TableSize.php
@@ -5,12 +5,11 @@ declare(strict_types=1);
namespace Nsfisis\Waddiwasi\Structure\Instructions\Instrs\Table;
use Nsfisis\Waddiwasi\Structure\Instructions\Instr;
-use Nsfisis\Waddiwasi\Structure\Types\TableIdx;
final readonly class TableSize extends Instr
{
protected function __construct(
- public TableIdx $table,
+ public int $table,
) {
}
diff --git a/src/Structure/Instructions/Instrs/Variable/GlobalGet.php b/src/Structure/Instructions/Instrs/Variable/GlobalGet.php
index 542a805..8ee9f09 100644
--- a/src/Structure/Instructions/Instrs/Variable/GlobalGet.php
+++ b/src/Structure/Instructions/Instrs/Variable/GlobalGet.php
@@ -5,12 +5,11 @@ declare(strict_types=1);
namespace Nsfisis\Waddiwasi\Structure\Instructions\Instrs\Variable;
use Nsfisis\Waddiwasi\Structure\Instructions\Instr;
-use Nsfisis\Waddiwasi\Structure\Types\GlobalIdx;
final readonly class GlobalGet extends Instr
{
protected function __construct(
- public GlobalIdx $var,
+ public int $var,
) {
}
diff --git a/src/Structure/Instructions/Instrs/Variable/GlobalSet.php b/src/Structure/Instructions/Instrs/Variable/GlobalSet.php
index 1540dd3..3dbc5ec 100644
--- a/src/Structure/Instructions/Instrs/Variable/GlobalSet.php
+++ b/src/Structure/Instructions/Instrs/Variable/GlobalSet.php
@@ -5,12 +5,11 @@ declare(strict_types=1);
namespace Nsfisis\Waddiwasi\Structure\Instructions\Instrs\Variable;
use Nsfisis\Waddiwasi\Structure\Instructions\Instr;
-use Nsfisis\Waddiwasi\Structure\Types\GlobalIdx;
final readonly class GlobalSet extends Instr
{
protected function __construct(
- public GlobalIdx $var,
+ public int $var,
) {
}
diff --git a/src/Structure/Instructions/Instrs/Variable/LocalGet.php b/src/Structure/Instructions/Instrs/Variable/LocalGet.php
index 4fc0ced..c9ba7e7 100644
--- a/src/Structure/Instructions/Instrs/Variable/LocalGet.php
+++ b/src/Structure/Instructions/Instrs/Variable/LocalGet.php
@@ -5,12 +5,11 @@ declare(strict_types=1);
namespace Nsfisis\Waddiwasi\Structure\Instructions\Instrs\Variable;
use Nsfisis\Waddiwasi\Structure\Instructions\Instr;
-use Nsfisis\Waddiwasi\Structure\Types\LocalIdx;
final readonly class LocalGet extends Instr
{
protected function __construct(
- public LocalIdx $var,
+ public int $var,
) {
}
diff --git a/src/Structure/Instructions/Instrs/Variable/LocalSet.php b/src/Structure/Instructions/Instrs/Variable/LocalSet.php
index 4a21ca3..eb79baa 100644
--- a/src/Structure/Instructions/Instrs/Variable/LocalSet.php
+++ b/src/Structure/Instructions/Instrs/Variable/LocalSet.php
@@ -5,12 +5,11 @@ declare(strict_types=1);
namespace Nsfisis\Waddiwasi\Structure\Instructions\Instrs\Variable;
use Nsfisis\Waddiwasi\Structure\Instructions\Instr;
-use Nsfisis\Waddiwasi\Structure\Types\LocalIdx;
final readonly class LocalSet extends Instr
{
protected function __construct(
- public LocalIdx $var,
+ public int $var,
) {
}
diff --git a/src/Structure/Instructions/Instrs/Variable/LocalTee.php b/src/Structure/Instructions/Instrs/Variable/LocalTee.php
index 97fb46a..862b4d2 100644
--- a/src/Structure/Instructions/Instrs/Variable/LocalTee.php
+++ b/src/Structure/Instructions/Instrs/Variable/LocalTee.php
@@ -5,12 +5,11 @@ declare(strict_types=1);
namespace Nsfisis\Waddiwasi\Structure\Instructions\Instrs\Variable;
use Nsfisis\Waddiwasi\Structure\Instructions\Instr;
-use Nsfisis\Waddiwasi\Structure\Types\LocalIdx;
final readonly class LocalTee extends Instr
{
protected function __construct(
- public LocalIdx $var,
+ public int $var,
) {
}
diff --git a/src/Structure/Modules/DataMode.php b/src/Structure/Modules/DataMode.php
index 08228d9..96cd7dc 100644
--- a/src/Structure/Modules/DataMode.php
+++ b/src/Structure/Modules/DataMode.php
@@ -5,7 +5,6 @@ declare(strict_types=1);
namespace Nsfisis\Waddiwasi\Structure\Modules;
use Nsfisis\Waddiwasi\Structure\Instructions\Expr;
-use Nsfisis\Waddiwasi\Structure\Types\MemIdx;
abstract readonly class DataMode
{
@@ -15,7 +14,7 @@ abstract readonly class DataMode
}
final public static function Active(
- MemIdx $memory,
+ int $memory,
Expr $offset,
): DataModes\Active {
return new DataModes\Active($memory, $offset);
diff --git a/src/Structure/Modules/DataModes/Active.php b/src/Structure/Modules/DataModes/Active.php
index 4e74ced..1a46f3e 100644
--- a/src/Structure/Modules/DataModes/Active.php
+++ b/src/Structure/Modules/DataModes/Active.php
@@ -6,12 +6,11 @@ namespace Nsfisis\Waddiwasi\Structure\Modules\DataModes;
use Nsfisis\Waddiwasi\Structure\Instructions\Expr;
use Nsfisis\Waddiwasi\Structure\Modules\DataMode;
-use Nsfisis\Waddiwasi\Structure\Types\MemIdx;
final readonly class Active extends DataMode
{
protected function __construct(
- public MemIdx $memory,
+ public int $memory,
public Expr $offset,
) {
}
diff --git a/src/Structure/Modules/ElemMode.php b/src/Structure/Modules/ElemMode.php
index d6496dd..051a7e1 100644
--- a/src/Structure/Modules/ElemMode.php
+++ b/src/Structure/Modules/ElemMode.php
@@ -5,7 +5,6 @@ declare(strict_types=1);
namespace Nsfisis\Waddiwasi\Structure\Modules;
use Nsfisis\Waddiwasi\Structure\Instructions\Expr;
-use Nsfisis\Waddiwasi\Structure\Types\TableIdx;
abstract readonly class ElemMode
{
@@ -15,7 +14,7 @@ abstract readonly class ElemMode
}
final public static function Active(
- TableIdx $table,
+ int $table,
Expr $offset,
): ElemModes\Active {
return new ElemModes\Active($table, $offset);
diff --git a/src/Structure/Modules/ElemModes/Active.php b/src/Structure/Modules/ElemModes/Active.php
index 06f3b41..bd5f123 100644
--- a/src/Structure/Modules/ElemModes/Active.php
+++ b/src/Structure/Modules/ElemModes/Active.php
@@ -6,12 +6,11 @@ namespace Nsfisis\Waddiwasi\Structure\Modules\ElemModes;
use Nsfisis\Waddiwasi\Structure\Instructions\Expr;
use Nsfisis\Waddiwasi\Structure\Modules\ElemMode;
-use Nsfisis\Waddiwasi\Structure\Types\TableIdx;
final readonly class Active extends ElemMode
{
protected function __construct(
- public TableIdx $table,
+ public int $table,
public Expr $offset,
) {
}
diff --git a/src/Structure/Modules/ExportDesc.php b/src/Structure/Modules/ExportDesc.php
index 7183c2a..06e67ba 100644
--- a/src/Structure/Modules/ExportDesc.php
+++ b/src/Structure/Modules/ExportDesc.php
@@ -4,29 +4,24 @@ declare(strict_types=1);
namespace Nsfisis\Waddiwasi\Structure\Modules;
-use Nsfisis\Waddiwasi\Structure\Types\FuncIdx;
-use Nsfisis\Waddiwasi\Structure\Types\GlobalIdx;
-use Nsfisis\Waddiwasi\Structure\Types\MemIdx;
-use Nsfisis\Waddiwasi\Structure\Types\TableIdx;
-
abstract readonly class ExportDesc
{
- final public static function Func(FuncIdx $func): ExportDescs\Func
+ final public static function Func(int $func): ExportDescs\Func
{
return new ExportDescs\Func($func);
}
- final public static function Table(TableIdx $table): ExportDescs\Table
+ final public static function Table(int $table): ExportDescs\Table
{
return new ExportDescs\Table($table);
}
- final public static function Mem(MemIdx $mem): ExportDescs\Mem
+ final public static function Mem(int $mem): ExportDescs\Mem
{
return new ExportDescs\Mem($mem);
}
- final public static function Global(GlobalIdx $global): ExportDescs\Global_
+ final public static function Global(int $global): ExportDescs\Global_
{
return new ExportDescs\Global_($global);
}
diff --git a/src/Structure/Modules/ExportDescs/Func.php b/src/Structure/Modules/ExportDescs/Func.php
index 43dc039..dabd213 100644
--- a/src/Structure/Modules/ExportDescs/Func.php
+++ b/src/Structure/Modules/ExportDescs/Func.php
@@ -5,12 +5,11 @@ declare(strict_types=1);
namespace Nsfisis\Waddiwasi\Structure\Modules\ExportDescs;
use Nsfisis\Waddiwasi\Structure\Modules\ExportDesc;
-use Nsfisis\Waddiwasi\Structure\Types\FuncIdx;
final readonly class Func extends ExportDesc
{
protected function __construct(
- public FuncIdx $func,
+ public int $func,
) {
}
}
diff --git a/src/Structure/Modules/ExportDescs/Global_.php b/src/Structure/Modules/ExportDescs/Global_.php
index 4e87b4a..6fa15f9 100644
--- a/src/Structure/Modules/ExportDescs/Global_.php
+++ b/src/Structure/Modules/ExportDescs/Global_.php
@@ -5,12 +5,11 @@ declare(strict_types=1);
namespace Nsfisis\Waddiwasi\Structure\Modules\ExportDescs;
use Nsfisis\Waddiwasi\Structure\Modules\ExportDesc;
-use Nsfisis\Waddiwasi\Structure\Types\GlobalIdx;
final readonly class Global_ extends ExportDesc
{
protected function __construct(
- public GlobalIdx $global,
+ public int $global,
) {
}
}
diff --git a/src/Structure/Modules/ExportDescs/Mem.php b/src/Structure/Modules/ExportDescs/Mem.php
index 068963c..7eeebf2 100644
--- a/src/Structure/Modules/ExportDescs/Mem.php
+++ b/src/Structure/Modules/ExportDescs/Mem.php
@@ -5,12 +5,11 @@ declare(strict_types=1);
namespace Nsfisis\Waddiwasi\Structure\Modules\ExportDescs;
use Nsfisis\Waddiwasi\Structure\Modules\ExportDesc;
-use Nsfisis\Waddiwasi\Structure\Types\MemIdx;
final readonly class Mem extends ExportDesc
{
protected function __construct(
- public MemIdx $mem,
+ public int $mem,
) {
}
}
diff --git a/src/Structure/Modules/ExportDescs/Table.php b/src/Structure/Modules/ExportDescs/Table.php
index d9501bd..ff32cc0 100644
--- a/src/Structure/Modules/ExportDescs/Table.php
+++ b/src/Structure/Modules/ExportDescs/Table.php
@@ -5,12 +5,11 @@ declare(strict_types=1);
namespace Nsfisis\Waddiwasi\Structure\Modules\ExportDescs;
use Nsfisis\Waddiwasi\Structure\Modules\ExportDesc;
-use Nsfisis\Waddiwasi\Structure\Types\TableIdx;
final readonly class Table extends ExportDesc
{
protected function __construct(
- public TableIdx $table,
+ public int $table,
) {
}
}
diff --git a/src/Structure/Modules/Func.php b/src/Structure/Modules/Func.php
index c91e8e8..bab1889 100644
--- a/src/Structure/Modules/Func.php
+++ b/src/Structure/Modules/Func.php
@@ -5,7 +5,6 @@ declare(strict_types=1);
namespace Nsfisis\Waddiwasi\Structure\Modules;
use Nsfisis\Waddiwasi\Structure\Instructions\Expr;
-use Nsfisis\Waddiwasi\Structure\Types\TypeIdx;
final readonly class Func
{
@@ -13,7 +12,7 @@ final readonly class Func
* @param list<Local> $locals
*/
public function __construct(
- public TypeIdx $type,
+ public int $type,
public array $locals,
public Expr $body,
) {
diff --git a/src/Structure/Modules/ImportDesc.php b/src/Structure/Modules/ImportDesc.php
index a5f2b40..77bd928 100644
--- a/src/Structure/Modules/ImportDesc.php
+++ b/src/Structure/Modules/ImportDesc.php
@@ -7,11 +7,10 @@ namespace Nsfisis\Waddiwasi\Structure\Modules;
use Nsfisis\Waddiwasi\Structure\Types\GlobalType;
use Nsfisis\Waddiwasi\Structure\Types\MemType;
use Nsfisis\Waddiwasi\Structure\Types\TableType;
-use Nsfisis\Waddiwasi\Structure\Types\TypeIdx;
abstract readonly class ImportDesc
{
- final public static function Func(TypeIdx $func): ImportDescs\Func
+ final public static function Func(int $func): ImportDescs\Func
{
return new ImportDescs\Func($func);
}
diff --git a/src/Structure/Modules/ImportDescs/Func.php b/src/Structure/Modules/ImportDescs/Func.php
index 8aa3e34..2bf373e 100644
--- a/src/Structure/Modules/ImportDescs/Func.php
+++ b/src/Structure/Modules/ImportDescs/Func.php
@@ -5,12 +5,11 @@ declare(strict_types=1);
namespace Nsfisis\Waddiwasi\Structure\Modules\ImportDescs;
use Nsfisis\Waddiwasi\Structure\Modules\ImportDesc;
-use Nsfisis\Waddiwasi\Structure\Types\TypeIdx;
final readonly class Func extends ImportDesc
{
protected function __construct(
- public TypeIdx $func,
+ public int $func,
) {
}
}
diff --git a/src/Structure/Modules/Start.php b/src/Structure/Modules/Start.php
index afb583b..1ef75df 100644
--- a/src/Structure/Modules/Start.php
+++ b/src/Structure/Modules/Start.php
@@ -4,12 +4,10 @@ declare(strict_types=1);
namespace Nsfisis\Waddiwasi\Structure\Modules;
-use Nsfisis\Waddiwasi\Structure\Types\FuncIdx;
-
final readonly class Start
{
public function __construct(
- public FuncIdx $func,
+ public int $func,
) {
}
}
diff --git a/src/Structure/Types/DataIdx.php b/src/Structure/Types/DataIdx.php
deleted file mode 100644
index 5390ad4..0000000
--- a/src/Structure/Types/DataIdx.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace Nsfisis\Waddiwasi\Structure\Types;
-
-final readonly class DataIdx
-{
- /**
- * @param U32 $value
- */
- public function __construct(
- public int $value,
- ) {
- }
-}
diff --git a/src/Structure/Types/ElemIdx.php b/src/Structure/Types/ElemIdx.php
deleted file mode 100644
index 989ef94..0000000
--- a/src/Structure/Types/ElemIdx.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace Nsfisis\Waddiwasi\Structure\Types;
-
-final readonly class ElemIdx
-{
- /**
- * @param U32 $value
- */
- public function __construct(
- public int $value,
- ) {
- }
-}
diff --git a/src/Structure/Types/FuncIdx.php b/src/Structure/Types/FuncIdx.php
deleted file mode 100644
index 9e2d9f7..0000000
--- a/src/Structure/Types/FuncIdx.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace Nsfisis\Waddiwasi\Structure\Types;
-
-final readonly class FuncIdx
-{
- /**
- * @param U32 $value
- */
- public function __construct(
- public int $value,
- ) {
- }
-}
diff --git a/src/Structure/Types/GlobalIdx.php b/src/Structure/Types/GlobalIdx.php
deleted file mode 100644
index c65d182..0000000
--- a/src/Structure/Types/GlobalIdx.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace Nsfisis\Waddiwasi\Structure\Types;
-
-final readonly class GlobalIdx
-{
- /**
- * @param U32 $value
- */
- public function __construct(
- public int $value,
- ) {
- }
-}
diff --git a/src/Structure/Types/LabelIdx.php b/src/Structure/Types/LabelIdx.php
deleted file mode 100644
index e6941b0..0000000
--- a/src/Structure/Types/LabelIdx.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace Nsfisis\Waddiwasi\Structure\Types;
-
-final readonly class LabelIdx
-{
- /**
- * @param U32 $value
- */
- public function __construct(
- public int $value,
- ) {
- }
-}
diff --git a/src/Structure/Types/LocalIdx.php b/src/Structure/Types/LocalIdx.php
deleted file mode 100644
index 6620281..0000000
--- a/src/Structure/Types/LocalIdx.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace Nsfisis\Waddiwasi\Structure\Types;
-
-final readonly class LocalIdx
-{
- /**
- * @param U32 $value
- */
- public function __construct(
- public int $value,
- ) {
- }
-}
diff --git a/src/Structure/Types/MemIdx.php b/src/Structure/Types/MemIdx.php
deleted file mode 100644
index 5fb9d76..0000000
--- a/src/Structure/Types/MemIdx.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace Nsfisis\Waddiwasi\Structure\Types;
-
-final readonly class MemIdx
-{
- /**
- * @param U32 $value
- */
- public function __construct(
- public int $value,
- ) {
- }
-}
diff --git a/src/Structure/Types/TableIdx.php b/src/Structure/Types/TableIdx.php
deleted file mode 100644
index af2d72b..0000000
--- a/src/Structure/Types/TableIdx.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace Nsfisis\Waddiwasi\Structure\Types;
-
-final readonly class TableIdx
-{
- /**
- * @param U32 $value
- */
- public function __construct(
- public int $value,
- ) {
- }
-}
diff --git a/src/Structure/Types/TypeIdx.php b/src/Structure/Types/TypeIdx.php
deleted file mode 100644
index c0074d7..0000000
--- a/src/Structure/Types/TypeIdx.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace Nsfisis\Waddiwasi\Structure\Types;
-
-final readonly class TypeIdx
-{
- /**
- * @param U32 $value
- */
- public function __construct(
- public int $value,
- ) {
- }
-}