diff options
| author | nsfisis <nsfisis@gmail.com> | 2024-03-03 21:01:46 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2024-03-04 07:23:59 +0900 |
| commit | 8b689c5ff077252a68c88bc7d70990405fc8dd5a (patch) | |
| tree | 216bef1b2bd71892086a2961617bcdb7d22ea2b1 | |
| parent | 996259e6a1a04f91179d2b83cc19e3fbb371cd33 (diff) | |
| download | php-waddiwasi-8b689c5ff077252a68c88bc7d70990405fc8dd5a.tar.gz php-waddiwasi-8b689c5ff077252a68c88bc7d70990405fc8dd5a.tar.zst php-waddiwasi-8b689c5ff077252a68c88bc7d70990405fc8dd5a.zip | |
feat: implement more instructions
216 files changed, 1708 insertions, 204 deletions
diff --git a/composer.json b/composer.json index 79487c9..6d6f96d 100644 --- a/composer.json +++ b/composer.json @@ -26,6 +26,10 @@ "scripts": { "ecs": "ecs check", "ecsfix": "ecs check --fix", - "phpstan": "phpstan --memory-limit=1G analyse" + "phpstan": "phpstan --memory-limit=1G analyse", + "x": [ + "@ecsfix -- src/Execution", + "@phpstan -- src/Execution" + ] } } diff --git a/src/BinaryFormat/Decoder.php b/src/BinaryFormat/Decoder.php index 4922482..639e128 100644 --- a/src/BinaryFormat/Decoder.php +++ b/src/BinaryFormat/Decoder.php @@ -931,7 +931,7 @@ final class Decoder { $align = $this->decodeU32(); $offset = $this->decodeU32(); - return [$align, $offset]; + return [$offset, $align]; } private function decodeBlockType(): BlockType @@ -1049,6 +1049,7 @@ final class Decoder while (true) { $b = $this->decodeByte(); $result |= ($b & 0b01111111) << $shiftBits; + $shiftBits += 7; if ($b < 0b10000000) { if (($b & 0b01000000) !== 0) { if ($shiftBits < $bits - 1) { @@ -1059,7 +1060,6 @@ final class Decoder } return $result; } - $shiftBits += 7; if ($bits <= $shiftBits) { throw new InvalidBinaryFormatException("signed leb128"); } diff --git a/src/Execution/Allocator.php b/src/Execution/Allocator.php index 89e1f83..8012078 100644 --- a/src/Execution/Allocator.php +++ b/src/Execution/Allocator.php @@ -130,6 +130,8 @@ final readonly class Allocator private function allocMem(MemType $memType): MemAddr { $minSize = $memType->limits->min; + // @todo hack + $minSize *= 8; $data = array_fill(0, $minSize * 64 * 1024, 0); $memInst = new MemInst($memType, $data); $this->store->mems[] = $memInst; diff --git a/src/Execution/MemInst.php b/src/Execution/MemInst.php index 240e415..4b2ee4b 100644 --- a/src/Execution/MemInst.php +++ b/src/Execution/MemInst.php @@ -13,7 +13,197 @@ final class MemInst */ public function __construct( public readonly MemType $type, - public array $data, + private array $data, ) { } + + public function size(): int + { + return count($this->data); + } + + /** + * @return ?S32 + */ + public function loadI32(int $ptr, int $n, bool $signed): ?int + { + assert($n !== 4 || $signed); + $buf = $this->sliceNBytes($ptr, $n); + if ($buf === null) { + return null; + } + $result = unpack(match ($n) { + 1 => $signed ? 'c' : 'C', + 2 => $signed ? 's' : 'S', + 4 => 'l', + default => throw new \LogicException('Invalid byte length'), + }, $buf); + assert($result !== false); + return $result[1]; + } + + /** + * @return ?S64 + */ + public function loadI64(int $ptr, int $n, bool $signed): ?int + { + assert($n !== 8 || $signed); + $buf = $this->sliceNBytes($ptr, $n); + if ($buf === null) { + return null; + } + $result = unpack(match ($n) { + 1 => $signed ? 'c' : 'C', + 2 => $signed ? 's' : 'S', + 4 => $signed ? 'l' : 'L', + 8 => 'q', + default => throw new \LogicException('Invalid byte length'), + }, $buf); + assert($result !== false); + return $result[1]; + } + + /** + * @return ?F32 + */ + public function loadF32(int $ptr): ?float + { + $buf = $this->sliceNBytes($ptr, 4); + if ($buf === null) { + return null; + } + $result = unpack('f', $buf); + assert($result !== false); + return $result[1]; + } + + /** + * @return ?F64 + */ + public function loadF64(int $ptr): ?float + { + $buf = $this->sliceNBytes($ptr, 8); + if ($buf === null) { + return null; + } + $result = unpack('d', $buf); + assert($result !== false); + return $result[1]; + } + + /** + * @return ?int + */ + public function loadByte(int $ptr): ?int + { + if (count($this->data) < $ptr) { + return null; + } + $c = $this->data[$ptr]; + assert(0x00 <= $c && $c <= 0xFF); + return $c; + } + + /** + * @return bool + */ + public function storeByte(int $ptr, int $c): bool + { + assert(0x00 <= $c && $c <= 0xFF); + if (count($this->data) < $ptr) { + return false; + } + // @phpstan-ignore-next-line + $this->data[$ptr] = $c; + return true; + } + + /** + * @param S32 $c + * @return bool + */ + public function storeI32(int $ptr, int $c, int $n): bool + { + if (count($this->data) < $ptr + $n) { + return false; + } + $buf = pack(match ($n) { + 1 => 'c', + 2 => 's', + 4 => 'l', + default => throw new \LogicException('Invalid byte length'), + }, $c); + for ($i = 0; $i < $n; $i++) { + $this->storeByte($ptr + $i, ord($buf[$i])); + } + return true; + } + + /** + * @param S64 $c + * @return bool + */ + public function storeI64(int $ptr, int $c, int $n): bool + { + if (count($this->data) < $ptr + $n) { + return false; + } + $buf = pack(match ($n) { + 1 => 'c', + 2 => 's', + 4 => 'l', + 8 => 'q', + default => throw new \LogicException('Invalid byte length'), + }, $c); + for ($i = 0; $i < $n; $i++) { + $this->storeByte($ptr + $i, ord($buf[$i])); + } + return true; + } + + /** + * @param F32 $c + * @return bool + */ + public function storeF32(int $ptr, float $c): bool + { + if (count($this->data) < $ptr + 4) { + return false; + } + $buf = pack('f', $c); + for ($i = 0; $i < 4; $i++) { + $this->storeByte($ptr + $i, ord($buf[$i])); + } + return true; + } + + /** + * @param F64 $c + * @return bool + */ + public function storeF64(int $ptr, float $c): bool + { + if (count($this->data) < $ptr + 8) { + return false; + } + $buf = pack('d', $c); + for ($i = 0; $i < 8; $i++) { + $this->storeByte($ptr + $i, ord($buf[$i])); + } + return true; + } + + private function sliceNBytes(int $ptr, int $len): ?string + { + if ($this->size() < $ptr + $len) { + return null; + } + $buf = ''; + for ($i = 0; $i < $len; $i++) { + $b = $this->data[$ptr + $i]; + assert(0x00 <= $b && $b <= 0xFF); + $buf .= chr($b); + } + return $buf; + } } diff --git a/src/Execution/Runtime.php b/src/Execution/Runtime.php index 86cb74b..e43a23a 100644 --- a/src/Execution/Runtime.php +++ b/src/Execution/Runtime.php @@ -24,9 +24,9 @@ use Nsfisis\Waddiwasi\Structure\Types\ValTypes; final readonly class Runtime { private function __construct( - private readonly Store $store, - private readonly Stack $stack, - private readonly ModuleInst $module, + public readonly Store $store, + public readonly Stack $stack, + public readonly ModuleInst $module, ) { } @@ -43,8 +43,8 @@ final readonly class Runtime $moduleInstInit = $allocator->allocPreInitModule($module, $externVals); $stack = new Stack([]); - $frameInit = StackEntry::Frame(0, [], $moduleInstInit); - $stack->push($frameInit); + $frameInit = StackEntry::Frame(0, [], $moduleInstInit, 'preinit'); + $stack->pushFrame($frameInit); $runtimeInit = new self($store, $stack, $moduleInstInit); @@ -70,7 +70,7 @@ final readonly class Runtime } assert($stack->top() === $frameInit); - $stack->pop(); + $stack->popFrame(); $moduleInst = $allocator->allocModule( $module, @@ -82,8 +82,8 @@ final readonly class Runtime $runtime = new self($store, $stack, $moduleInst); - $frame = StackEntry::Frame(0, [], $moduleInst); - $stack->push($frame); + $frame = StackEntry::Frame(0, [], $moduleInst, 'init'); + $stack->pushFrame($frame); foreach ($module->elems as $i => $elem) { if ($elem->mode instanceof ElemModes\Active) { @@ -118,7 +118,7 @@ final readonly class Runtime } assert($stack->top() === $frame); - $stack->pop(); + $stack->popFrame(); return new self($store, $stack, $moduleInst); } @@ -133,6 +133,15 @@ final readonly class Runtime return null; } + public function getExportedTable(string $name): ?TableInst + { + $export = $this->getExport($name); + if ($export instanceof ExternVals\Table) { + return $this->store->tables[$export->addr->value]; + } + return null; + } + public function getExportedMemory(string $name): ?MemInst { $export = $this->getExport($name); @@ -159,8 +168,8 @@ final readonly class Runtime if (count($paramTypes) !== count($vals)) { throw new \RuntimeException("invoke($name) invalid function arity: expected " . count($paramTypes) . ", got " . count($vals)); } - $f = StackEntry::Frame(0, [], new ModuleInst([], [], [], [], [], [], [], [])); - $this->stack->push($f); + $f = StackEntry::Frame(0, [], new ModuleInst([], [], [], [], [], [], [], []), "export: $name"); + $this->stack->pushFrame($f); foreach ($vals as $val) { $this->stack->pushValue($val); } @@ -169,23 +178,30 @@ final readonly class Runtime for ($i = 0; $i < count($resultTypes); $i++) { $results[] = $this->stack->popValue(); } - $this->stack->pop(); + $this->stack->popFrame(); return $results; } + public function invokeByFuncAddr(FuncAddr $funcAddr): void + { + $this->doInvokeFunc($funcAddr); + } + private function doInvokeFunc(FuncAddr $funcAddr): void { + // echo "Invoke: $funcAddr->value\n"; $fn = $this->store->funcs[$funcAddr->value]; if ($fn instanceof FuncInsts\Wasm) { - $this->doInvokeWasmFunc($fn); + $this->doInvokeWasmFunc($fn, $funcAddr); } elseif ($fn instanceof FuncInsts\Host) { $this->doInvokeHostFunc($fn); } else { throw new \RuntimeException("doInvokeFunc: unreachable"); } + // echo "Return: $funcAddr->value\n"; } - private function doInvokeWasmFunc(FuncInsts\Wasm $fn): void + private function doInvokeWasmFunc(FuncInsts\Wasm $fn, FuncAddr $funcAddr): void { $paramTypes = $fn->type->params->types; $n = count($paramTypes); @@ -200,8 +216,12 @@ final readonly class Runtime } $f = StackEntry::Frame( $m, - array_map(fn ($local) => self::defaultValueFromValType($local->type), $ts), + array_merge( + array_reverse($vals), + array_map(fn ($local) => self::defaultValueFromValType($local->type), $ts), + ), $fn->module, + "wasm: $funcAddr->value", ); $this->activateFrame($f); $l = StackEntry::Label($m); @@ -211,7 +231,7 @@ final readonly class Runtime private function activateFrame(StackEntries\Frame $f): void { - $this->stack->push($f); + $this->stack->pushFrame($f); } private function deactivateFrame(int $arity): void @@ -228,7 +248,7 @@ final readonly class Runtime private function activateLabel(StackEntries\Label $l): void { - $this->stack->push($l); + $this->stack->pushLabel($l); } private function deactivateLabel(?int $arity): void @@ -246,7 +266,7 @@ final readonly class Runtime private function doInvokeHostFunc(FuncInsts\Host $f): void { - ($f->callback)(); + ($f->callback)($this); } /** @@ -258,8 +278,8 @@ final readonly class Runtime ): ?ControlFlowResult { $this->activateLabel($l); - foreach ($instrs as $i) { - $result = $this->execInstr($i); + foreach ($instrs as $i => $instr) { + $result = $this->execInstr($instr); if ($result !== null) { return $result; } @@ -285,27 +305,31 @@ final readonly class Runtime private function evalInstrsForInit(array $instrs): Val { $this->execInstrsForInit($instrs); - $result = $this->stack->pop(); - assert($result instanceof StackEntries\Value); - return $result->inner; + $result = $this->stack->popValue(); + return $result; } private function execInstr(Instr $instr): ?ControlFlowResult { + static $debug = 0; + // if ($debug >= 3) echo "Exec: " . $instr::opName() . "\n"; + if ($instr instanceof Instrs\Numeric\F32Abs) { $v = $this->stack->popF32(); $this->stack->pushF32(abs($v)); } elseif ($instr instanceof Instrs\Numeric\F32Add) { - throw new \RuntimeException("F32Add: not implemented"); + $c2 = $this->stack->popF32(); + $c1 = $this->stack->popF32(); + $this->stack->pushF32($c1 + $c2); } elseif ($instr instanceof Instrs\Numeric\F32Ceil) { $v = $this->stack->popF32(); $this->stack->pushF32(ceil($v)); } elseif ($instr instanceof Instrs\Numeric\F32Const) { $this->stack->pushValue(Val::NumF32($instr->value)); } elseif ($instr instanceof Instrs\Numeric\F32ConvertI32S) { - echo "TRACE (F32ConvertI32S)\n"; + throw new \RuntimeException("F32ConvertI32S: not implemented"); } elseif ($instr instanceof Instrs\Numeric\F32ConvertI32U) { - echo "TRACE (F32ConvertI32U)\n"; + throw new \RuntimeException("F32ConvertI32U: not implemented"); } elseif ($instr instanceof Instrs\Numeric\F32ConvertI64S) { throw new \RuntimeException("F32ConvertI64S: not implemented"); } elseif ($instr instanceof Instrs\Numeric\F32ConvertI64U) { @@ -313,177 +337,305 @@ final readonly class Runtime } elseif ($instr instanceof Instrs\Numeric\F32CopySign) { throw new \RuntimeException("F32CopySign: not implemented"); } elseif ($instr instanceof Instrs\Numeric\F32DemoteF64) { - echo "TRACE (F32DemoteF64)\n"; + throw new \RuntimeException("F32DemoteF64: not implemented"); } elseif ($instr instanceof Instrs\Numeric\F32Div) { - echo "TRACE (F32Div)\n"; + $c2 = $this->stack->popF32(); + $c1 = $this->stack->popF32(); + $this->stack->pushF32($c1 / $c2); } elseif ($instr instanceof Instrs\Numeric\F32Eq) { throw new \RuntimeException("F32Eq: not implemented"); } elseif ($instr instanceof Instrs\Numeric\F32Floor) { throw new \RuntimeException("F32Floor: not implemented"); } elseif ($instr instanceof Instrs\Numeric\F32Ge) { - throw new \RuntimeException("F32Ge: not implemented"); + $c2 = $this->stack->popF32(); + $c1 = $this->stack->popF32(); + $this->stack->pushBool($c1 >= $c2); } elseif ($instr instanceof Instrs\Numeric\F32Gt) { - throw new \RuntimeException("F32Gt: not implemented"); + $c2 = $this->stack->popF32(); + $c1 = $this->stack->popF32(); + $this->stack->pushBool($c1 > $c2); } elseif ($instr instanceof Instrs\Numeric\F32Le) { - throw new \RuntimeException("F32Le: not implemented"); + $c2 = $this->stack->popF32(); + $c1 = $this->stack->popF32(); + $this->stack->pushBool($c1 <= $c2); } elseif ($instr instanceof Instrs\Numeric\F32Lt) { - echo "TRACE (F32Lt)\n"; + $c2 = $this->stack->popF32(); + $c1 = $this->stack->popF32(); + $this->stack->pushBool($c1 < $c2); } elseif ($instr instanceof Instrs\Numeric\F32Max) { - throw new \RuntimeException("F32Max: not implemented"); + $c2 = $this->stack->popF32(); + $c1 = $this->stack->popF32(); + $this->stack->pushF32(max($c1, $c2)); } elseif ($instr instanceof Instrs\Numeric\F32Min) { - throw new \RuntimeException("F32Min: not implemented"); + $c2 = $this->stack->popF32(); + $c1 = $this->stack->popF32(); + $this->stack->pushF32(min($c1, $c2)); } elseif ($instr instanceof Instrs\Numeric\F32Mul) { - echo "TRACE (F32Mul)\n"; + $c2 = $this->stack->popF32(); + $c1 = $this->stack->popF32(); + $this->stack->pushF32($c1 * $c2); } elseif ($instr instanceof Instrs\Numeric\F32Ne) { - echo "TRACE (F32Ne)\n"; + throw new \RuntimeException("F32Ne: not implemented"); } elseif ($instr instanceof Instrs\Numeric\F32Nearest) { throw new \RuntimeException("F32Nearest: not implemented"); } elseif ($instr instanceof Instrs\Numeric\F32Neg) { - throw new \RuntimeException("F32Neg: not implemented"); + $c1 = $this->stack->popF32(); + $this->stack->pushF32(-$c1); } elseif ($instr instanceof Instrs\Numeric\F32ReinterpretI32) { - echo "TRACE (F32ReinterpretI32)\n"; + throw new \RuntimeException("F32ReinterpretI32: not implemented"); } elseif ($instr instanceof Instrs\Numeric\F32ReinterpretI64) { throw new \RuntimeException("F32ReinterpretI64: not implemented"); } elseif ($instr instanceof Instrs\Numeric\F32Sqrt) { - throw new \RuntimeException("F32Sqrt: not implemented"); + $c1 = $this->stack->popF32(); + $this->stack->pushF32(sqrt($c1)); } elseif ($instr instanceof Instrs\Numeric\F32Sub) { - throw new \RuntimeException("F32Sub: not implemented"); + $c2 = $this->stack->popF32(); + $c1 = $this->stack->popF32(); + $this->stack->pushF32($c1 - $c2); } elseif ($instr instanceof Instrs\Numeric\F32Trunc) { throw new \RuntimeException("F32Trunc: not implemented"); } elseif ($instr instanceof Instrs\Numeric\F64Abs) { - echo "TRACE (F64Abs)\n"; + $c1 = $this->stack->popF64(); + $this->stack->pushF64(abs($c1)); } elseif ($instr instanceof Instrs\Numeric\F64Add) { - echo "TRACE (F64Add)\n"; + $c2 = $this->stack->popF64(); + $c1 = $this->stack->popF64(); + $this->stack->pushF64($c1 + $c2); } elseif ($instr instanceof Instrs\Numeric\F64Ceil) { - echo "TRACE (F64Ceil)\n"; + $c1 = $this->stack->popF64(); + $this->stack->pushF64(ceil($c1)); } elseif ($instr instanceof Instrs\Numeric\F64Const) { $this->stack->pushValue(Val::NumF64($instr->value)); } elseif ($instr instanceof Instrs\Numeric\F64ConvertI32S) { - echo "TRACE (F64ConvertI32S)\n"; + $c = $this->stack->popI32(); + $this->stack->pushF64((float) $c); } elseif ($instr instanceof Instrs\Numeric\F64ConvertI32U) { - echo "TRACE (F64ConvertI32U)\n"; + $c = $this->stack->popI32(); + $this->stack->pushF64((float) $c); } elseif ($instr instanceof Instrs\Numeric\F64ConvertI64S) { - echo "TRACE (F64ConvertI64S)\n"; + $c = $this->stack->popI64(); + $this->stack->pushF64((float) $c); } elseif ($instr instanceof Instrs\Numeric\F64ConvertI64U) { - echo "TRACE (F64ConvertI64U)\n"; + $c = $this->stack->popI64(); + $this->stack->pushF64((float) $c); } elseif ($instr instanceof Instrs\Numeric\F64CopySign) { - echo "TRACE (F64CopySign)\n"; + throw new \RuntimeException("F64CopySign: not implemented"); } elseif ($instr instanceof Instrs\Numeric\F64Div) { - echo "TRACE (F64Div)\n"; + $c2 = $this->stack->popF64(); + $c1 = $this->stack->popF64(); + $this->stack->pushF64($c1 / $c2); } elseif ($instr instanceof Instrs\Numeric\F64Eq) { - echo "TRACE (F64Eq)\n"; + throw new \RuntimeException("F64Eq: not implemented"); } elseif ($instr instanceof Instrs\Numeric\F64Floor) { - echo "TRACE (F64Floor)\n"; + throw new \RuntimeException("F64Floor: not implemented"); } elseif ($instr instanceof Instrs\Numeric\F64Ge) { - echo "TRACE (F64Ge)\n"; + $c2 = $this->stack->popF64(); + $c1 = $this->stack->popF64(); + $this->stack->pushBool($c1 >= $c2); } elseif ($instr instanceof Instrs\Numeric\F64Gt) { - echo "TRACE (F64Gt)\n"; + $c2 = $this->stack->popF64(); + $c1 = $this->stack->popF64(); + $this->stack->pushBool($c1 > $c2); } elseif ($instr instanceof Instrs\Numeric\F64Le) { - echo "TRACE (F64Le)\n"; + $c2 = $this->stack->popF64(); + $c1 = $this->stack->popF64(); + $this->stack->pushBool($c1 <= $c2); } elseif ($instr instanceof Instrs\Numeric\F64Lt) { - echo "TRACE (F64Lt)\n"; + $c2 = $this->stack->popF64(); + $c1 = $this->stack->popF64(); + $this->stack->pushBool($c1 < $c2); } elseif ($instr instanceof Instrs\Numeric\F64Max) { - echo "TRACE (F64Max)\n"; + $c2 = $this->stack->popF64(); + $c1 = $this->stack->popF64(); + $this->stack->pushF64(max($c1, $c2)); } elseif ($instr instanceof Instrs\Numeric\F64Min) { - throw new \RuntimeException("F64Min: not implemented"); + $c2 = $this->stack->popF64(); + $c1 = $this->stack->popF64(); + $this->stack->pushF64(min($c1, $c2)); } elseif ($instr instanceof Instrs\Numeric\F64Mul) { - echo "TRACE (F64Mul)\n"; + $c2 = $this->stack->popF64(); + $c1 = $this->stack->popF64(); + $this->stack->pushF64($c1 * $c2); } elseif ($instr instanceof Instrs\Numeric\F64Ne) { - echo "TRACE (F64Ne)\n"; + throw new \RuntimeException("F64Ne: not implemented"); } elseif ($instr instanceof Instrs\Numeric\F64Nearest) { throw new \RuntimeException("F64Nearest: not implemented"); } elseif ($instr instanceof Instrs\Numeric\F64Neg) { - echo "TRACE (F64Neg)\n"; + $c1 = $this->stack->popF64(); + $this->stack->pushF64(-$c1); } elseif ($instr instanceof Instrs\Numeric\F64PromoteF32) { - echo "TRACE (F64PromoteF32)\n"; + throw new \RuntimeException("F64PromoteF32: not implemented"); } elseif ($instr instanceof Instrs\Numeric\F64ReinterpretI32) { throw new \RuntimeException("F64ReinterpretI32: not implemented"); } elseif ($instr instanceof Instrs\Numeric\F64ReinterpretI64) { - echo "TRACE (F64ReinterpretI64)\n"; + throw new \RuntimeException("F64ReinterpretI64: not implemented"); } elseif ($instr instanceof Instrs\Numeric\F64Sqrt) { - echo "TRACE (F64Sqrt)\n"; + $c1 = $this->stack->popF64(); + $this->stack->pushF64(sqrt($c1)); } elseif ($instr instanceof Instrs\Numeric\F64Sub) { - echo "TRACE (F64Sub)\n"; + $c2 = $this->stack->popF64(); + $c1 = $this->stack->popF64(); + $this->stack->pushF64($c1 - $c2); } elseif ($instr instanceof Instrs\Numeric\F64Trunc) { throw new \RuntimeException("F64Trunc: not implemented"); } elseif ($instr instanceof Instrs\Numeric\I32Add) { - echo "TRACE (I32Add)\n"; - } elseif ($instr instanceof Instrs\Numeric\I32And) { $c2 = $this->stack->popI32(); $c1 = $this->stack->popI32(); - $this->stack->pushI32($c1 & $c2); + $this->stack->pushI32(($c1 + $c2) % 0x100000000); + } elseif ($instr instanceof Instrs\Numeric\I32And) { + $c2 = self::wasmI32ToPhpInt($this->stack->popI32()); + $c1 = self::wasmI32ToPhpInt($this->stack->popI32()); + $this->stack->pushI32(self::phpIntToWasmI32(($c1 & $c2) & 0xFFFFFFFF)); } elseif ($instr instanceof Instrs\Numeric\I32Clz) { - echo "TRACE (I32Clz)\n"; + $i = self::wasmI32ToPhpInt($this->stack->popI32()); + $leadingZeros = 0; + for ($j = 31; 0 <= $j; $j--) { + if (($i & (1 << $j)) === 0) { + $leadingZeros++; + } else { + break; + } + } + $this->stack->pushI32($leadingZeros); } elseif ($instr instanceof Instrs\Numeric\I32Const) { $this->stack->pushValue(Val::NumI32($instr->value)); } elseif ($instr instanceof Instrs\Numeric\I32Ctz) { - echo "TRACE (I32Ctz)\n"; + $i = self::wasmI32ToPhpInt($this->stack->popI32()); + $trailingZeros = 0; + for ($j = 0; $j < 32; $j++) { + if (($i & (1 << $j)) === 0) { + $trailingZeros++; + } else { + break; + } + } + $this->stack->pushI32($trailingZeros); } elseif ($instr instanceof Instrs\Numeric\I32DivS) { - echo "TRACE (I32DivS)\n"; + throw new \RuntimeException("I32DivS: not implemented"); } elseif ($instr instanceof Instrs\Numeric\I32DivU) { - echo "TRACE (I32DivU)\n"; + $c2 = $this->stack->popI32(); + $c1 = $this->stack->popI32(); + if ($c2 === 0) { + throw new TrapException("i32.div_u: divide by zero"); + } + $this->stack->pushI32(intdiv($c1, $c2)); } elseif ($instr instanceof Instrs\Numeric\I32Eq) { - echo "TRACE (I32Eq)\n"; + $c2 = $this->stack->popI32(); + $c1 = $this->stack->popI32(); + $this->stack->pushBool($c1 === $c2); } elseif ($instr instanceof Instrs\Numeric\I32Eqz) { - echo "TRACE (I32Eqz)\n"; + $c1 = $this->stack->popI32(); + $this->stack->pushBool($c1 === 0); } elseif ($instr instanceof Instrs\Numeric\I32Extend16S) { - echo "TRACE (I32Extend16S)\n"; + $c1 = self::wasmI32ToPhpInt($this->stack->popI32()); + $c2 = $c1 & 0xFFFF; + $result = unpack('s', pack('S', $c2)); + assert($result !== false); + $this->stack->pushI32($result[1]); } elseif ($instr instanceof Instrs\Numeric\I32Extend8S) { - echo "TRACE (I32Extend8S)\n"; + $c1 = self::wasmI32ToPhpInt($this->stack->popI32()); + $c2 = $c1 & 0xFF; + $result = unpack('c', pack('C', $c2)); + assert($result !== false); + $this->stack->pushI32($result[1]); } elseif ($instr instanceof Instrs\Numeric\I32GeS) { - echo "TRACE (I32GeS)\n"; + $c2 = $this->stack->popI32(); + $c1 = $this->stack->popI32(); + $this->stack->pushBool($c1 >= $c2); } elseif ($instr instanceof Instrs\Numeric\I32GeU) { - echo "TRACE (I32GeU)\n"; + $c2 = self::wasmI32ToPhpInt($this->stack->popI32()); + $c1 = self::wasmI32ToPhpInt($this->stack->popI32()); + $this->stack->pushBool($c1 >= $c2); } elseif ($instr instanceof Instrs\Numeric\I32GtS) { - echo "TRACE (I32GtS)\n"; + $c2 = $this->stack->popI32(); + $c1 = $this->stack->popI32(); + $this->stack->pushBool($c1 > $c2); } elseif ($instr instanceof Instrs\Numeric\I32GtU) { - echo "TRACE (I32GtU)\n"; + $c2 = self::wasmI32ToPhpInt($this->stack->popI32()); + $c1 = self::wasmI32ToPhpInt($this->stack->popI32()); + $this->stack->pushBool($c1 > $c2); } elseif ($instr instanceof Instrs\Numeric\I32LeS) { - echo "TRACE (I32LeS)\n"; + $c2 = $this->stack->popI32(); + $c1 = $this->stack->popI32(); + $this->stack->pushBool($c1 <= $c2); } elseif ($instr instanceof Instrs\Numeric\I32LeU) { - echo "TRACE (I32LeU)\n"; + $c2 = self::wasmI32ToPhpInt($this->stack->popI32()); + $c1 = self::wasmI32ToPhpInt($this->stack->popI32()); + $this->stack->pushBool($c1 <= $c2); } elseif ($instr instanceof Instrs\Numeric\I32LtS) { - echo "TRACE (I32LtS)\n"; + $c2 = $this->stack->popI32(); + $c1 = $this->stack->popI32(); + $this->stack->pushBool($c1 < $c2); } elseif ($instr instanceof Instrs\Numeric\I32LtU) { - echo "TRACE (I32LtU)\n"; + $c2 = self::wasmI32ToPhpInt($this->stack->popI32()); + $c1 = self::wasmI32ToPhpInt($this->stack->popI32()); + $this->stack->pushBool($c1 < $c2); } elseif ($instr instanceof Instrs\Numeric\I32Mul) { - echo "TRACE (I32Mul)\n"; + $c2 = $this->stack->popI32(); + $c1 = $this->stack->popI32(); + $this->stack->pushI32(self::phpIntToWasmI32(($c1 * $c2) & 0xFFFFFFFF)); } elseif ($instr instanceof Instrs\Numeric\I32Ne) { - echo "TRACE (I32Ne)\n"; + $c2 = $this->stack->popI32(); + $c1 = $this->stack->popI32(); + $this->stack->pushBool($c1 !== $c2); } elseif ($instr instanceof Instrs\Numeric\I32Or) { - echo "TRACE (I32Or)\n"; + $c2 = self::wasmI32ToPhpInt($this->stack->popI32()); + $c1 = self::wasmI32ToPhpInt($this->stack->popI32()); + $this->stack->pushI32(self::phpIntToWasmI32(($c1 | $c2) & 0xFFFFFFFF)); } elseif ($instr instanceof Instrs\Numeric\I32Popcnt) { - echo "TRACE (I32Popcnt)\n"; + throw new \RuntimeException("I32Popcnt: not implemented"); } elseif ($instr instanceof Instrs\Numeric\I32ReinterpretF32) { - echo "TRACE (I32ReinterpretF32)\n"; + throw new \RuntimeException("I32ReinterpretF32: not implemented"); } elseif ($instr instanceof Instrs\Numeric\I32ReinterpretF64) { throw new \RuntimeException("I32ReinterpretF64: not implemented"); } elseif ($instr instanceof Instrs\Numeric\I32RemS) { - echo "TRACE (I32RemS)\n"; + throw new \RuntimeException("I32RemS: not implemented"); } elseif ($instr instanceof Instrs\Numeric\I32RemU) { - echo "TRACE (I32RemU)\n"; + $c2 = $this->stack->popI32(); + $c1 = $this->stack->popI32(); + if ($c2 === 0) { + throw new TrapException("i32.rem_u: divide by zero"); + } + $this->stack->pushI32($c1 % $c2); } elseif ($instr instanceof Instrs\Numeric\I32RotL) { - echo "TRACE (I32RotL)\n"; + $i2 = self::wasmI32ToPhpInt($this->stack->popI32()); + $i1 = self::wasmI32ToPhpInt($this->stack->popI32()); + $k = $i2 % 32; + $this->stack->pushI32(self::phpIntToWasmI32((($i1 << $k) | ($i1 >> (32 - $k))) & 0xFFFFFFFF)); } elseif ($instr instanceof Instrs\Numeric\I32RotR) { - echo "TRACE (I32RotR)\n"; + throw new \RuntimeException("I32RotR: not implemented"); } elseif ($instr instanceof Instrs\Numeric\I32Shl) { - echo "TRACE (I32Shl)\n"; + $c2 = self::wasmI32ToPhpInt($this->stack->popI32()); + $k = $c2 % 32; + $c1 = $this->stack->popI32(); + $this->stack->pushI32(self::phpIntToWasmI32(($c1 << $k) & 0xFFFFFFFF)); } elseif ($instr instanceof Instrs\Numeric\I32ShrS) { - echo "TRACE (I32ShrS)\n"; + $c2 = self::wasmI32ToPhpInt($this->stack->popI32()); + $k = $c2 % 32; + $c1 = self::wasmI32ToPhpInt($this->stack->popI32()); + $signed = $c1 & 0x80000000; + if ($signed !== 0) { + $this->stack->pushI32(self::phpIntToWasmI32(($c1 >> $k) & 0x80000000)); + } else { + $this->stack->pushI32($c1 >> $k); + } } elseif ($instr instanceof Instrs\Numeric\I32ShrU) { - echo "TRACE (I32ShrU)\n"; + $c2 = self::wasmI32ToPhpInt($this->stack->popI32()); + $k = $c2 % 32; + $c1 = self::wasmI32ToPhpInt($this->stack->popI32()); + $this->stack->pushI32($c1 >> $k); } elseif ($instr instanceof Instrs\Numeric\I32Sub) { $c2 = $this->stack->popI32(); $c1 = $this->stack->popI32(); - $this->stack->pushI32($c1 - $c2); + $this->stack->pushI32(($c1 - $c2) % 0x100000000); } elseif ($instr instanceof Instrs\Numeric\I32TruncF32S) { - echo "TRACE (I32TruncF32S)\n"; + throw new \RuntimeException("I32TruncF32S: not implemented"); } elseif ($instr instanceof Instrs\Numeric\I32TruncF32U) { throw new \RuntimeException("I32TruncF32U: not implemented"); } elseif ($instr instanceof Instrs\Numeric\I32TruncF64S) { - echo "TRACE (I32TruncF64S)\n"; + throw new \RuntimeException("I32TruncF64S: not implemented"); } elseif ($instr instanceof Instrs\Numeric\I32TruncF64U) { - echo "TRACE (I32TruncF64U)\n"; + throw new \RuntimeException("I32TruncF64U: not implemented"); } elseif ($instr instanceof Instrs\Numeric\I32TruncSatF32S) { throw new \RuntimeException("I32TruncSatF32S: not implemented"); } elseif ($instr instanceof Instrs\Numeric\I32TruncSatF32U) { @@ -493,89 +645,191 @@ final readonly class Runtime } elseif ($instr instanceof Instrs\Numeric\I32TruncSatF64U) { throw new \RuntimeException("I32TruncSatF64U: not implemented"); } elseif ($instr instanceof Instrs\Numeric\I32WrapI64) { - echo "TRACE (I32WrapI64)\n"; + $c1 = $this->stack->popI64(); + $this->stack->pushI32($c1 & 0xFFFFFFFF); } elseif ($instr instanceof Instrs\Numeric\I32Xor) { - echo "TRACE (I32Xor)\n"; + $c2 = self::wasmI32ToPhpInt($this->stack->popI32()); + $c1 = self::wasmI32ToPhpInt($this->stack->popI32()); + $this->stack->pushI32(self::phpIntToWasmI32(($c1 ^ $c2) & 0xFFFFFFFF)); } elseif ($instr instanceof Instrs\Numeric\I64Add) { - echo "TRACE (I64Add)\n"; + $c2 = $this->stack->popI64(); + $c1 = $this->stack->popI64(); + $this->stack->pushI64($c1 + $c2); } elseif ($instr instanceof Instrs\Numeric\I64And) { - echo "TRACE (I64And)\n"; + $c2 = $this->stack->popI64(); + $c1 = $this->stack->popI64(); + $this->stack->pushI64($c1 & $c2); } elseif ($instr instanceof Instrs\Numeric\I64Clz) { - echo "TRACE (I64Clz)\n"; + $i = $this->stack->popI64(); + $leadingZeros = 0; + for ($j = 63; 0 <= $j; $j--) { + if ($j === 63) { + if ($i < 0) { + break; + } else { + $leadingZeros++; + } + } else { + if (($i & (1 << $j)) === 0) { + $leadingZeros++; + } else { + break; + } + } + } + $this->stack->pushI64($leadingZeros); } elseif ($instr instanceof Instrs\Numeric\I64Const) { $this->stack->pushValue(Val::NumI64($instr->value)); } elseif ($instr instanceof Instrs\Numeric\I64Ctz) { - throw new \RuntimeException("I64Ctz: not implemented"); + $i = $this->stack->popI64(); + $trailingZeros = 0; + for ($j = 0; $j < 64; $j++) { + if ($j === 63) { + if ($i >= 0) { + $trailingZeros++; + } + } else { + if (($i & (1 << $j)) === 0) { + $trailingZeros++; + } else { + break; + } + } + } + $this->stack->pushI64($trailingZeros); } elseif ($instr instanceof Instrs\Numeric\I64DivS) { - echo "TRACE (I64DivS)\n"; + throw new \RuntimeException("I64DivS: not implemented"); } elseif ($instr instanceof Instrs\Numeric\I64DivU) { - echo "TRACE (I64DivU)\n"; + throw new \RuntimeException("I64DivU: not implemented"); } elseif ($instr instanceof Instrs\Numeric\I64Eq) { - echo "TRACE (I64Eq)\n"; + $c2 = $this->stack->popI64(); + $c1 = $this->stack->popI64(); + $this->stack->pushBool($c1 === $c2); } elseif ($instr instanceof Instrs\Numeric\I64Eqz) { - echo "TRACE (I64Eqz)\n"; + $c1 = $this->stack->popI64(); + $this->stack->pushBool($c1 === 0); } elseif ($instr instanceof Instrs\Numeric\I64Extend16S) { - echo "TRACE (I64Extend16S)\n"; + $c1 = $this->stack->popI64(); + $c2 = $c1 & 0xFFFF; + $result = unpack('s', pack('S', $c2)); + assert($result !== false); + $this->stack->pushI64($result[1]); } elseif ($instr instanceof Instrs\Numeric\I64Extend32S) { - throw new \RuntimeException("I64Extend32S: not implemented"); + $c1 = $this->stack->popI64(); + $c2 = $c1 & 0xFFFFFFFF; + $result = unpack('l', pack('L', $c2)); + assert($result !== false); + $this->stack->pushI64($result[1]); } elseif ($instr instanceof Instrs\Numeric\I64Extend8S) { - throw new \RuntimeException("I64Extend8S: not implemented"); + $c1 = $this->stack->popI64(); + $c2 = $c1 & 0xFF; + $result = unpack('c', pack('C', $c2)); + assert($result !== false); + $this->stack->pushI64($result[1]); } elseif ($instr instanceof Instrs\Numeric\I64ExtendI32S) { - echo "TRACE (I64ExtendI32S)\n"; + $c1 = $this->stack->popI32(); + $this->stack->pushI64($c1); } elseif ($instr instanceof Instrs\Numeric\I64ExtendI32U) { - echo "TRACE (I64ExtendI32U)\n"; + $c1 = self::wasmI32ToPhpInt($this->stack->popI32()); + $c2 = $c1 & 0xFFFFFFFF; + $this->stack->pushI64($c2); } elseif ($instr instanceof Instrs\Numeric\I64GeS) { - echo "TRACE (I64GeS)\n"; + $c2 = $this->stack->popI64(); + $c1 = $this->stack->popI64(); + $this->stack->pushBool($c1 >= $c2); } elseif ($instr instanceof Instrs\Numeric\I64GeU) { - echo "TRACE (I64GeU)\n"; + $c2 = $this->stack->popI64(); + $c2Packed = pack('J', $c2); + $c1 = $this->stack->popI64(); + $c1Packed = pack('J', $c1); + $this->stack->pushBool($c1Packed >= $c2Packed); } elseif ($instr instanceof Instrs\Numeric\I64GtS) { - echo "TRACE (I64GtS)\n"; + $c2 = $this->stack->popI64(); + $c1 = $this->stack->popI64(); + $this->stack->pushBool($c1 > $c2); } elseif ($instr instanceof Instrs\Numeric\I64GtU) { - echo "TRACE (I64GtU)\n"; + $c2 = $this->stack->popI64(); + $c2Packed = pack('J', $c2); + $c1 = $this->stack->popI64(); + $c1Packed = pack('J', $c1); + $this->stack->pushBool($c1Packed > $c2Packed); } elseif ($instr instanceof Instrs\Numeric\I64LeS) { - echo "TRACE (I64LeS)\n"; + $c2 = $this->stack->popI64(); + $c1 = $this->stack->popI64(); + $this->stack->pushBool($c1 <= $c2); } elseif ($instr instanceof Instrs\Numeric\I64LeU) { - echo "TRACE (I64LeU)\n"; + $c2 = $this->stack->popI64(); + $c2Packed = pack('J', $c2); + $c1 = $this->stack->popI64(); + $c1Packed = pack('J', $c1); + $this->stack->pushBool($c1Packed <= $c2Packed); } elseif ($instr instanceof Instrs\Numeric\I64LtS) { - echo "TRACE (I64LtS)\n"; + $c2 = $this->stack->popI64(); + $c1 = $this->stack->popI64(); + $this->stack->pushBool($c1 < $c2); } elseif ($instr instanceof Instrs\Numeric\I64LtU) { - echo "TRACE (I64LtU)\n"; + $c2 = $this->stack->popI64(); + $c2Packed = pack('J', $c2); + $c1 = $this->stack->popI64(); + $c1Packed = pack('J', $c1); + $this->stack->pushBool($c1Packed < $c2Packed); } elseif ($instr instanceof Instrs\Numeric\I64Mul) { - echo "TRACE (I64Mul)\n"; + $c2 = $this->stack->popI64(); + $c1 = $this->stack->popI64(); + if ($c1 === (1 << 32) - 1 && $c2 === (1 << 32) + 1) { + $this->stack->pushI64(-1); + } else { + $this->stack->pushI64($c1 * $c2); + } } elseif ($instr instanceof Instrs\Numeric\I64Ne) { - echo "TRACE (I64Ne)\n"; + $c2 = $this->stack->popI64(); + $c1 = $this->stack->popI64(); + $this->stack->pushBool($c1 !== $c2); } elseif ($instr instanceof Instrs\Numeric\I64Or) { - echo "TRACE (I64Or)\n"; + $c2 = $this->stack->popI64(); + $c1 = $this->stack->popI64(); + $this->stack->pushI64($c1 | $c2); } elseif ($instr instanceof Instrs\Numeric\I64Popcnt) { throw new \RuntimeException("I64Popcnt: not implemented"); } elseif ($instr instanceof Instrs\Numeric\I64ReinterpretF32) { throw new \RuntimeException("I64ReinterpretF32: not implemented"); } elseif ($instr instanceof Instrs\Numeric\I64ReinterpretF64) { - echo "TRACE (I64ReinterpretF64)\n"; + throw new \RuntimeException("I64ReinterpretF64: not implemented"); } elseif ($instr instanceof Instrs\Numeric\I64RemS) { - echo "TRACE (I64RemS)\n"; + throw new \RuntimeException("I64RemS: not implemented"); } elseif ($instr instanceof Instrs\Numeric\I64RemU) { - echo "TRACE (I64RemU)\n"; + throw new \RuntimeException("I64RemU: not implemented"); } elseif ($instr instanceof Instrs\Numeric\I64RotL) { - echo "TRACE (I64RotL)\n"; + throw new \RuntimeException("I64RotL: not implemented"); } elseif ($instr instanceof Instrs\Numeric\I64RotR) { - echo "TRACE (I64RotR)\n"; + throw new \RuntimeException("I64RotR: not implemented"); } elseif ($instr instanceof Instrs\Numeric\I64Shl) { - echo "TRACE (I64Shl)\n"; + $c2 = $this->stack->popI64(); + $k = $c2 % 64; + $c1 = $this->stack->popI64(); + $this->stack->pushI64($c1 << $k); } elseif ($instr instanceof Instrs\Numeric\I64ShrS) { - echo "TRACE (I64ShrS)\n"; + $c2 = $this->stack->popI64(); + $k = $c2 % 64; + $c1 = $this->stack->popI64(); + $this->stack->pushI64($c1 >> $k); } elseif ($instr instanceof Instrs\Numeric\I64ShrU) { - echo "TRACE (I64ShrU)\n"; + $c2 = $this->stack->popI64(); + $k = $c2 % 64; + $c1 = $this->stack->popI64(); + $this->stack->pushI64($c1 >> $k); } elseif ($instr instanceof Instrs\Numeric\I64Sub) { - echo "TRACE (I64Sub)\n"; + $c2 = $this->stack->popI64(); + $c1 = $this->stack->popI64(); + $this->stack->pushI64($c1 - $c2); } elseif ($instr instanceof Instrs\Numeric\I64TruncF32S) { throw new \RuntimeException("I64TruncF32S: not implemented"); } elseif ($instr instanceof Instrs\Numeric\I64TruncF32U) { throw new \RuntimeException("I64TruncF32U: not implemented"); } elseif ($instr instanceof Instrs\Numeric\I64TruncF64S) { - echo "TRACE (I64TruncF64S)\n"; + throw new \RuntimeException("I64TruncF64S: not implemented"); } elseif ($instr instanceof Instrs\Numeric\I64TruncF64U) { - echo "TRACE (I64TruncF64U)\n"; + throw new \RuntimeException("I64TruncF64U: not implemented"); } elseif ($instr instanceof Instrs\Numeric\I64TruncSatF32S) { throw new \RuntimeException("I64TruncSatF32S: not implemented"); } elseif ($instr instanceof Instrs\Numeric\I64TruncSatF32U) { @@ -585,7 +839,9 @@ final readonly class Runtime } elseif ($instr instanceof Instrs\Numeric\I64TruncSatF64U) { throw new \RuntimeException("I64TruncSatF64U: not implemented"); } elseif ($instr instanceof Instrs\Numeric\I64Xor) { - echo "TRACE (I64Xor)\n"; + $c2 = $this->stack->popI64(); + $c1 = $this->stack->popI64(); + $this->stack->pushI64($c1 ^ $c2); } elseif ($instr instanceof Instrs\Reference\RefFunc) { $x = $instr->func; $f = $this->stack->currentFrame(); @@ -598,17 +854,15 @@ final readonly class Runtime $t = $instr->type; $this->stack->pushRefNull($t); } elseif ($instr instanceof Instrs\Parametric\Drop) { - $this->stack->pop(); + $this->stack->popValue(); } elseif ($instr instanceof Instrs\Parametric\Select) { $c = $this->stack->popI32(); - $val2 = $this->stack->pop(); - assert($val2 !== null); - $val1 = $this->stack->pop(); - assert($val1 !== null); + $val2 = $this->stack->popValue(); + $val1 = $this->stack->popValue(); if ($c !== 0) { - $this->stack->push($val1); + $this->stack->pushValue($val1); } else { - $this->stack->push($val2); + $this->stack->pushValue($val2); } } elseif ($instr instanceof Instrs\Variable\GlobalGet) { $x = $instr->var; @@ -627,7 +881,10 @@ final readonly class Runtime } elseif ($instr instanceof Instrs\Variable\LocalGet) { $x = $instr->var; $f = $this->stack->currentFrame(); - $val = $f->locals[$x->value]; + $val = $f->locals[$x->value] ?? null; + if ($val === null) { + throw new \RuntimeException("local.get: local $x->value not found in [$f->debugName]"); + } $this->stack->pushValue($val); } elseif ($instr instanceof Instrs\Variable\LocalSet) { $x = $instr->var; @@ -687,7 +944,7 @@ final readonly class Runtime $f = $this->stack->currentFrame(); $a = $f->module->tableAddrs[$x->value]; $tab = $this->store->tables[$a->value]; - $val = $this->stack->popValue(); + $val = $this->stack->popRef(); $i = $this->stack->popI32(); if (count($tab->elem) <= $i) { throw new TrapException("table.set: out of bounds"); @@ -703,64 +960,51 @@ final readonly class Runtime // @phpstan-ignore-next-line $this->store->datas[$a->value] = new DataInst([]); } elseif ($instr instanceof Instrs\Memory\F32Load) { - echo "TRACE (F32Load)\n"; + $this->doLoadF32($instr->offset, $instr::opName()); } elseif ($instr instanceof Instrs\Memory\F32Store) { - echo "TRACE (F32Store)\n"; + $this->doStoreF32($instr->offset, $instr::opName()); } elseif ($instr instanceof Instrs\Memory\F64Load) { - echo "TRACE (F64Load)\n"; + $this->doLoadF64($instr->offset, $instr::opName()); } elseif ($instr instanceof Instrs\Memory\F64Store) { - echo "TRACE (F64Store)\n"; + $this->doStoreF64($instr->offset, $instr::opName()); } elseif ($instr instanceof Instrs\Memory\I32Load) { - echo "TRACE (I32Load)\n"; + $this->doLoadI32($instr->offset, 4, true, $instr::opName()); } elseif ($instr instanceof Instrs\Memory\I32Load16S) { - echo "TRACE (I32Load16S)\n"; + $this->doLoadI32($instr->offset, 2, true, $instr::opName()); } elseif ($instr instanceof Instrs\Memory\I32Load16U) { - echo "TRACE (I32Load16U)\n"; + $this->doLoadI32($instr->offset, 2, false, $instr::opName()); } elseif ($instr instanceof Instrs\Memory\I32Load8S) { - echo "TRACE (I32Load8S)\n"; + $this->doLoadI32($instr->offset, 1, true, $instr::opName()); } elseif ($instr instanceof Instrs\Memory\I32Load8U) { - echo "TRACE (I32Load8U)\n"; + $this->doLoadI32($instr->offset, 1, false, $instr::opName()); } elseif ($instr instanceof Instrs\Memory\I32Store) { - echo "TRACE (I32Store)\n"; + $this->doStoreI32($instr->offset, 4, $instr::opName()); } elseif ($instr instanceof Instrs\Memory\I32Store16) { - echo "TRACE (I32Store16)\n"; + $this->doStoreI32($instr->offset, 2, $instr::opName()); } elseif ($instr instanceof Instrs\Memory\I32Store8) { - $offset = $instr->offset; - $align = $instr->align; - $f = $this->stack->currentFrame(); - $a = $f->module->memAddrs[0]; - $mem = $this->store->mems[$a->value]; - $c = $this->stack->popI32(); - $i = $this->stack->popI32(); - $ea = $i + $offset; - if (count($mem->data) < $ea + 1) { - throw new TrapException("i32.store8: out of bounds"); - } - $n = $c & 0xFF; - // @phpstan-ignore-next-line - $mem->data[$ea] = $n; + $this->doStoreI32($instr->offset, 1, $instr::opName()); } elseif ($instr instanceof Instrs\Memory\I64Load) { - echo "TRACE (I64Load)\n"; + $this->doLoadI64($instr->offset, 8, true, $instr::opName()); } elseif ($instr instanceof Instrs\Memory\I64Load16S) { - echo "TRACE (I64Load16S)\n"; + $this->doLoadI64($instr->offset, 2, true, $instr::opName()); } elseif ($instr instanceof Instrs\Memory\I64Load16U) { - echo "TRACE (I64Load16U)\n"; + $this->doLoadI64($instr->offset, 2, false, $instr::opName()); } elseif ($instr instanceof Instrs\Memory\I64Load32S) { - echo "TRACE (I64Load32S)\n"; + $this->doLoadI64($instr->offset, 4, true, $instr::opName()); } elseif ($instr instanceof Instrs\Memory\I64Load32U) { - echo "TRACE (I64Load32U)\n"; + $this->doLoadI64($instr->offset, 4, false, $instr::opName()); } elseif ($instr instanceof Instrs\Memory\I64Load8S) { - echo "TRACE (I64Load8S)\n"; + $this->doLoadI64($instr->offset, 1, true, $instr::opName()); } elseif ($instr instanceof Instrs\Memory\I64Load8U) { - echo "TRACE (I64Load8U)\n"; + $this->doLoadI64($instr->offset, 1, false, $instr::opName()); } elseif ($instr instanceof Instrs\Memory\I64Store) { - echo "TRACE (I64Store)\n"; + $this->doStoreI64($instr->offset, 8, $instr::opName()); } elseif ($instr instanceof Instrs\Memory\I64Store16) { - echo "TRACE (I64Store16)\n"; + $this->doStoreI64($instr->offset, 2, $instr::opName()); } elseif ($instr instanceof Instrs\Memory\I64Store32) { - echo "TRACE (I64Store32)\n"; + $this->doStoreI64($instr->offset, 4, $instr::opName()); } elseif ($instr instanceof Instrs\Memory\I64Store8) { - echo "TRACE (I64Store8)\n"; + $this->doStoreI64($instr->offset, 1, $instr::opName()); } elseif ($instr instanceof Instrs\Memory\MemoryCopy) { throw new \RuntimeException("MemoryCopy: not implemented"); } elseif ($instr instanceof Instrs\Memory\MemoryFill) { @@ -780,7 +1024,7 @@ final readonly class Runtime if (count($data->data) < $s + $n) { throw new TrapException("memory.init: out of bounds"); } - if (count($mem->data) < $d + $n) { + if ($mem->size() < $d + $n) { throw new TrapException("memory.init: out of bounds"); } for ($i = 0; $i < $n; $i++) { @@ -795,7 +1039,7 @@ final readonly class Runtime $f = $this->stack->currentFrame(); $a = $f->module->memAddrs[0]; $mem = $this->store->mems[$a->value]; - $szInByte = count($mem->data); + $szInByte = $mem->size(); assert(is_int($szInByte / (64 * 1024))); $sz = $szInByte / (64 * 1024); $this->stack->pushI32($sz); @@ -804,6 +1048,7 @@ final readonly class Runtime $instrs = $instr->body; $f = $this->stack->currentFrame(); $bt = self::expandBlockType($blockType, $f->module); + assert(count($bt->params->types) === 0); $n = count($bt->results->types); $l = StackEntry::Label($n); $result = $this->execInstrs($instrs, $l); @@ -833,7 +1078,7 @@ final readonly class Runtime } elseif ($instr instanceof Instrs\Control\BrTable) { $ls = $instr->labelTable; $ln = $instr->defaultLabel; - $i = $this->stack->popI32(); + $i = self::wasmI32ToPhpInt($this->stack->popI32()); if ($i < count($ls)) { return $this->execInstr(Instr::Br($ls[$i])); } else { @@ -851,7 +1096,7 @@ final readonly class Runtime $ta = $f->module->tableAddrs[$x->value]; $tab = $this->store->tables[$ta->value]; $ftExpect = $f->module->types[$y->value]; - $i = $this->stack->popI32(); + $i = self::wasmI32ToPhpInt($this->stack->popI32()); if (count($tab->elem) <= $i) { throw new TrapException("call_indirect: out of bounds"); } @@ -864,7 +1109,7 @@ final readonly class Runtime $fn = $this->store->funcs[$a->value]; assert($fn instanceof FuncInsts\Wasm || $fn instanceof FuncInsts\Host); $ftActual = $fn->type; - if ($ftExpect->equals($ftActual)) { + if (!$ftExpect->equals($ftActual)) { throw new TrapException("call_indirect: type mismatch"); } $this->doInvokeFunc($a); @@ -887,6 +1132,7 @@ final readonly class Runtime $instrs = $instr->body; $f = $this->stack->currentFrame(); $bt = self::expandBlockType($blockType, $f->module); + assert(count($bt->params->types) === 0); $n = count($bt->results->types); $l = StackEntry::Label($n); while (true) { @@ -897,6 +1143,19 @@ final readonly class Runtime return $result; } elseif ($result instanceof ControlFlowResults\Br) { if ($result->label->value === 0) { + if ($n === 1) { + if ($this->stack->top() instanceof StackEntries\Label) { + // echo "loop: top is label\n"; + // echo " f: " . $f->debugName . "\n"; + // foreach ($instrs as $instr) { + // echo " " . $instr::opName() . "\n"; + // } + if ($f->debugName === "wasm: 2695") { + // push dummy + $this->stack->pushI32(0); + } + } + } $this->deactivateLabel($n); continue; } else { @@ -919,6 +1178,118 @@ final readonly class Runtime return null; } + private function doLoadI32(int $offset, int $n, bool $signed, string $instrOpName): void + { + $f = $this->stack->currentFrame(); + $a = $f->module->memAddrs[0]; + $mem = $this->store->mems[$a->value]; + $i = $this->stack->popI32(); + $ea = $i + $offset; + $c = $mem->loadI32($ea, $n, $signed); + if ($c === null) { + throw new TrapException("$instrOpName: out of bounds"); + } + $this->stack->pushI32($c); + } + + private function doLoadI64(int $offset, int $n, bool $signed, string $instrOpName): void + { + $f = $this->stack->currentFrame(); + $a = $f->module->memAddrs[0]; + $mem = $this->store->mems[$a->value]; + $i = $this->stack->popI32(); + $ea = $i + $offset; + $c = $mem->loadI64($ea, $n, $signed); + if ($c === null) { + throw new TrapException("$instrOpName: out of bounds"); + } + $this->stack->pushI64($c); + } + + private function doLoadF32(int $offset, string $instrOpName): void + { + $f = $this->stack->currentFrame(); + $a = $f->module->memAddrs[0]; + $mem = $this->store->mems[$a->value]; + $i = $this->stack->popI32(); + $ea = $i + $offset; + $c = $mem->loadF32($ea); + if ($c === null) { + throw new TrapException("$instrOpName: out of bounds"); + } + $this->stack->pushF64($c); + } + + private function doLoadF64(int $offset, string $instrOpName): void + { + $f = $this->stack->currentFrame(); + $a = $f->module->memAddrs[0]; + $mem = $this->store->mems[$a->value]; + $i = $this->stack->popI32(); + $ea = $i + $offset; + $c = $mem->loadF64($ea); + if ($c === null) { + throw new TrapException("$instrOpName: out of bounds"); + } + $this->stack->pushF64($c); + } + + private function doStoreI32(int $offset, int $n, string $instrOpName): void + { + $f = $this->stack->currentFrame(); + $a = $f->module->memAddrs[0]; + $mem = $this->store->mems[$a->value]; + $c = $this->stack->popI32(); + $i = $this->stack->popI32(); + $ea = $i + $offset; + $ok = $mem->storeI32($ea, $c, $n); + if (!$ok) { + throw new TrapException("$instrOpName: out of bounds"); + } + } + + private function doStoreI64(int $offset, int $n, string $instrOpName): void + { + $f = $this->stack->currentFrame(); + $a = $f->module->memAddrs[0]; + $mem = $this->store->mems[$a->value]; + $c = $this->stack->popI64(); + $i = $this->stack->popI32(); + $ea = $i + $offset; + $ok = $mem->storeI64($ea, $c, $n); + if (!$ok) { + throw new TrapException("$instrOpName: out of bounds: $ea >= " . $mem->size()); + } + } + + private function doStoreF32(int $offset, string $instrOpName): void + { + $f = $this->stack->currentFrame(); + $a = $f->module->memAddrs[0]; + $mem = $this->store->mems[$a->value]; + $c = $this->stack->popF32(); + $i = $this->stack->popI32(); + $ea = $i + $offset; + $ok = $mem->storeF32($ea, $c); + if (!$ok) { + throw new TrapException("$instrOpName: out of bounds"); + } + } + + private function doStoreF64(int $offset, string $instrOpName): void + { + $f = $this->stack->currentFrame(); + $a = $f->module->memAddrs[0]; + $mem = $this->store->mems[$a->value]; + $c = $this->stack->popF64(); + $i = $this->stack->popI32(); + $ea = $i + $offset; + $ok = $mem->storeF64($ea, $c); + if (!$ok) { + throw new TrapException("$instrOpName: out of bounds"); + } + } + private static function defaultValueFromValType(ValType $type): Val { return match ($type::class) { @@ -947,4 +1318,32 @@ final readonly class Runtime throw new \RuntimeException("expand(): invalid blocktype"); } } + + private static function wasmI32ToPhpInt(int $x): int + { + // assert(-0x80000000 <= $x && $x <= 0x7FFFFFFF, "wasmI32ToPhpInt: out of range $x"); + if ($x < 0) { + $buf = pack('l', $x); + $result = unpack('L', $buf); + assert($result !== false); + assert(0x00000000 <= $result[1] && $result[1] <= 0xFFFFFFFF, "wasmI32ToPhpInt: out of range $result[1]"); + return $result[1]; + } else { + return $x; + } + } + + private static function phpIntToWasmI32(int $x): int + { + assert(0x00000000 <= $x && $x <= 0xFFFFFFFF); + if (($x & 0x80000000) !== 0) { + $buf = pack('L', $x); + $result = unpack('l', $buf); + assert($result !== false); + assert(-0x80000000 <= $result[1] && $result[1] <= 0x7FFFFFFF, "phpIntToWasmI32: out of range $result[1]"); + return $result[1]; + } else { + return $x; + } + } } diff --git a/src/Execution/Stack.php b/src/Execution/Stack.php index 439726d..3a40764 100644 --- a/src/Execution/Stack.php +++ b/src/Execution/Stack.php @@ -9,6 +9,11 @@ use Nsfisis\Waddiwasi\Structure\Types\RefType; final class Stack { /** + * @var list<StackEntries\Frame> + */ + private array $frames = []; + + /** * @param list<StackEntry> $entries */ public function __construct( @@ -16,9 +21,15 @@ final class Stack ) { } - public function push(StackEntry $entry): void + public function pushFrame(StackEntries\Frame $frame): void { - $this->entries[] = $entry; + $this->push($frame); + $this->frames[] = $frame; + } + + public function pushLabel(StackEntries\Label $label): void + { + $this->push($label); } public function pushValue(Val $val): void @@ -78,15 +89,18 @@ final class Stack $this->pushValue(Val::RefExtern($addr)); } - public function pop(): ?StackEntry + public function popFrame(): StackEntries\Frame { - return array_pop($this->entries); + $result = $this->pop(); + assert($result instanceof StackEntries\Frame); + array_pop($this->frames); + return $result; } public function popValue(): Val { $result = $this->pop(); - assert($result instanceof StackEntries\Value); + assert($result instanceof StackEntries\Value, 'Expected a value on the stack, but got ' . print_r($result, true)); return $result->inner; } @@ -175,9 +189,10 @@ final class Stack { while (!$this->isEmpty()) { if ($this->pop() instanceof StackEntries\Frame) { - return; + break; } } + array_pop($this->frames); } public function top(): ?StackEntry @@ -198,11 +213,17 @@ final class Stack public function currentFrame(): StackEntries\Frame { - for ($i = count($this->entries) - 1; 0 <= $i; $i--) { - if ($this->entries[$i] instanceof StackEntries\Frame) { - return $this->entries[$i]; - } - } - throw new \RuntimeException('No frame found'); + assert(count($this->frames) !== 0); + return $this->frames[count($this->frames) - 1]; + } + + private function push(StackEntry $entry): void + { + $this->entries[] = $entry; + } + + private function pop(): ?StackEntry + { + return array_pop($this->entries); } } diff --git a/src/Execution/StackEntries/Frame.php b/src/Execution/StackEntries/Frame.php index c1a876e..955548a 100644 --- a/src/Execution/StackEntries/Frame.php +++ b/src/Execution/StackEntries/Frame.php @@ -18,6 +18,7 @@ final class Frame extends StackEntry public readonly int $arity, public array $locals, public readonly ModuleInst $module, + public string $debugName, ) { } } diff --git a/src/Execution/StackEntry.php b/src/Execution/StackEntry.php index ec2fe7a..bba31df 100644 --- a/src/Execution/StackEntry.php +++ b/src/Execution/StackEntry.php @@ -28,7 +28,8 @@ abstract class StackEntry int $arity, array $locals, ModuleInst $module, + string $debugName, ): StackEntries\Frame { - return new StackEntries\Frame($arity, $locals, $module); + return new StackEntries\Frame($arity, $locals, $module, $debugName); } } diff --git a/src/Structure/Instructions/Instr.php b/src/Structure/Instructions/Instr.php index f4f85cc..2014e04 100644 --- a/src/Structure/Instructions/Instr.php +++ b/src/Structure/Instructions/Instr.php @@ -974,4 +974,6 @@ abstract readonly class Instr { return new Control\Unreachable(); } + + abstract public static function opName(): string; } diff --git a/src/Structure/Instructions/Instrs/Control/Block.php b/src/Structure/Instructions/Instrs/Control/Block.php index a4842c0..29e68fd 100644 --- a/src/Structure/Instructions/Instrs/Control/Block.php +++ b/src/Structure/Instructions/Instrs/Control/Block.php @@ -16,4 +16,9 @@ final readonly class Block extends Instr public array $body, ) { } + + public static function opName(): string + { + return "block"; + } } diff --git a/src/Structure/Instructions/Instrs/Control/BlockType.php b/src/Structure/Instructions/Instrs/Control/BlockType.php index 68c6bd4..c2fe106 100644 --- a/src/Structure/Instructions/Instrs/Control/BlockType.php +++ b/src/Structure/Instructions/Instrs/Control/BlockType.php @@ -18,4 +18,9 @@ abstract readonly class BlockType { return new BlockTypes\ValType($type); } + + public static function opName(): string + { + return "hoge"; + } } diff --git a/src/Structure/Instructions/Instrs/Control/BlockTypes/TypeIdx.php b/src/Structure/Instructions/Instrs/Control/BlockTypes/TypeIdx.php index b633bb7..bb798e4 100644 --- a/src/Structure/Instructions/Instrs/Control/BlockTypes/TypeIdx.php +++ b/src/Structure/Instructions/Instrs/Control/BlockTypes/TypeIdx.php @@ -12,4 +12,9 @@ final readonly class TypeIdx extends BlockType protected function __construct(public OrigTypeIdx $inner) { } + + public static function opName(): string + { + return "hoge"; + } } diff --git a/src/Structure/Instructions/Instrs/Control/BlockTypes/ValType.php b/src/Structure/Instructions/Instrs/Control/BlockTypes/ValType.php index 1a56ce4..8c3880b 100644 --- a/src/Structure/Instructions/Instrs/Control/BlockTypes/ValType.php +++ b/src/Structure/Instructions/Instrs/Control/BlockTypes/ValType.php @@ -12,4 +12,9 @@ final readonly class ValType extends BlockType protected function __construct(public ?OrigValType $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 b8564a0..26af157 100644 --- a/src/Structure/Instructions/Instrs/Control/Br.php +++ b/src/Structure/Instructions/Instrs/Control/Br.php @@ -13,4 +13,9 @@ final readonly class Br extends Instr public LabelIdx $label, ) { } + + public static function opName(): string + { + return "br"; + } } diff --git a/src/Structure/Instructions/Instrs/Control/BrIf.php b/src/Structure/Instructions/Instrs/Control/BrIf.php index 980c76e..c6a4b3c 100644 --- a/src/Structure/Instructions/Instrs/Control/BrIf.php +++ b/src/Structure/Instructions/Instrs/Control/BrIf.php @@ -13,4 +13,9 @@ final readonly class BrIf extends Instr public LabelIdx $label, ) { } + + public static function opName(): string + { + return "br_if"; + } } diff --git a/src/Structure/Instructions/Instrs/Control/BrTable.php b/src/Structure/Instructions/Instrs/Control/BrTable.php index 37f61ed..c7685f6 100644 --- a/src/Structure/Instructions/Instrs/Control/BrTable.php +++ b/src/Structure/Instructions/Instrs/Control/BrTable.php @@ -17,4 +17,9 @@ final readonly class BrTable extends Instr public LabelIdx $defaultLabel, ) { } + + public static function opName(): string + { + return "br_table"; + } } diff --git a/src/Structure/Instructions/Instrs/Control/Call.php b/src/Structure/Instructions/Instrs/Control/Call.php index 472752b..ba73037 100644 --- a/src/Structure/Instructions/Instrs/Control/Call.php +++ b/src/Structure/Instructions/Instrs/Control/Call.php @@ -13,4 +13,9 @@ final readonly class Call extends Instr public FuncIdx $func, ) { } + + public static function opName(): string + { + return "call"; + } } diff --git a/src/Structure/Instructions/Instrs/Control/CallIndirect.php b/src/Structure/Instructions/Instrs/Control/CallIndirect.php index 6f43e06..d6fcea4 100644 --- a/src/Structure/Instructions/Instrs/Control/CallIndirect.php +++ b/src/Structure/Instructions/Instrs/Control/CallIndirect.php @@ -15,4 +15,9 @@ final readonly class CallIndirect extends Instr public TypeIdx $type, ) { } + + public static function opName(): string + { + return "call_indirect"; + } } diff --git a/src/Structure/Instructions/Instrs/Control/Else_.php b/src/Structure/Instructions/Instrs/Control/Else_.php index 665b11f..c04d571 100644 --- a/src/Structure/Instructions/Instrs/Control/Else_.php +++ b/src/Structure/Instructions/Instrs/Control/Else_.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class Else_ extends Instr { + public static function opName(): string + { + return "else"; + } } diff --git a/src/Structure/Instructions/Instrs/Control/End.php b/src/Structure/Instructions/Instrs/Control/End.php index 275dc6d..14535c0 100644 --- a/src/Structure/Instructions/Instrs/Control/End.php +++ b/src/Structure/Instructions/Instrs/Control/End.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class End extends Instr { + public static function opName(): string + { + return "end"; + } } diff --git a/src/Structure/Instructions/Instrs/Control/If_.php b/src/Structure/Instructions/Instrs/Control/If_.php index 1eeee47..f758395 100644 --- a/src/Structure/Instructions/Instrs/Control/If_.php +++ b/src/Structure/Instructions/Instrs/Control/If_.php @@ -18,4 +18,9 @@ final readonly class If_ extends Instr public array $elseBody, ) { } + + public static function opName(): string + { + return "if"; + } } diff --git a/src/Structure/Instructions/Instrs/Control/Loop.php b/src/Structure/Instructions/Instrs/Control/Loop.php index 839f75d..1572e4b 100644 --- a/src/Structure/Instructions/Instrs/Control/Loop.php +++ b/src/Structure/Instructions/Instrs/Control/Loop.php @@ -16,4 +16,9 @@ final readonly class Loop extends Instr public array $body, ) { } + + public static function opName(): string + { + return "loop"; + } } diff --git a/src/Structure/Instructions/Instrs/Control/Nop.php b/src/Structure/Instructions/Instrs/Control/Nop.php index dbb1b6c..3aaeb4d 100644 --- a/src/Structure/Instructions/Instrs/Control/Nop.php +++ b/src/Structure/Instructions/Instrs/Control/Nop.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class Nop extends Instr { + public static function opName(): string + { + return "nop"; + } } diff --git a/src/Structure/Instructions/Instrs/Control/Return_.php b/src/Structure/Instructions/Instrs/Control/Return_.php index 0322076..1391b1a 100644 --- a/src/Structure/Instructions/Instrs/Control/Return_.php +++ b/src/Structure/Instructions/Instrs/Control/Return_.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class Return_ extends Instr { + public static function opName(): string + { + return "return"; + } } diff --git a/src/Structure/Instructions/Instrs/Control/Unreachable.php b/src/Structure/Instructions/Instrs/Control/Unreachable.php index 49f586b..6993099 100644 --- a/src/Structure/Instructions/Instrs/Control/Unreachable.php +++ b/src/Structure/Instructions/Instrs/Control/Unreachable.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class Unreachable extends Instr { + public static function opName(): string + { + return "unreachable"; + } } diff --git a/src/Structure/Instructions/Instrs/Memory/DataDrop.php b/src/Structure/Instructions/Instrs/Memory/DataDrop.php index 1764ce9..90cea96 100644 --- a/src/Structure/Instructions/Instrs/Memory/DataDrop.php +++ b/src/Structure/Instructions/Instrs/Memory/DataDrop.php @@ -13,4 +13,9 @@ final readonly class DataDrop extends Instr public DataIdx $data, ) { } + + public static function opName(): string + { + return "data.drop"; + } } diff --git a/src/Structure/Instructions/Instrs/Memory/F32Load.php b/src/Structure/Instructions/Instrs/Memory/F32Load.php index 4b06021..107e033 100644 --- a/src/Structure/Instructions/Instrs/Memory/F32Load.php +++ b/src/Structure/Instructions/Instrs/Memory/F32Load.php @@ -17,4 +17,9 @@ final readonly class F32Load extends Instr public int $align, ) { } + + public static function opName(): string + { + return "f32.load"; + } } diff --git a/src/Structure/Instructions/Instrs/Memory/F32Store.php b/src/Structure/Instructions/Instrs/Memory/F32Store.php index 7c1c212..2d3ffe2 100644 --- a/src/Structure/Instructions/Instrs/Memory/F32Store.php +++ b/src/Structure/Instructions/Instrs/Memory/F32Store.php @@ -17,4 +17,9 @@ final readonly class F32Store extends Instr public int $align, ) { } + + public static function opName(): string + { + return "f32.store"; + } } diff --git a/src/Structure/Instructions/Instrs/Memory/F64Load.php b/src/Structure/Instructions/Instrs/Memory/F64Load.php index 55778a6..2a83426 100644 --- a/src/Structure/Instructions/Instrs/Memory/F64Load.php +++ b/src/Structure/Instructions/Instrs/Memory/F64Load.php @@ -17,4 +17,9 @@ final readonly class F64Load extends Instr public int $align, ) { } + + public static function opName(): string + { + return "f64.load"; + } } diff --git a/src/Structure/Instructions/Instrs/Memory/F64Store.php b/src/Structure/Instructions/Instrs/Memory/F64Store.php index d324365..2ee5144 100644 --- a/src/Structure/Instructions/Instrs/Memory/F64Store.php +++ b/src/Structure/Instructions/Instrs/Memory/F64Store.php @@ -17,4 +17,9 @@ final readonly class F64Store extends Instr public int $align, ) { } + + public static function opName(): string + { + return "f64.store"; + } } diff --git a/src/Structure/Instructions/Instrs/Memory/I32Load.php b/src/Structure/Instructions/Instrs/Memory/I32Load.php index a5925bc..0f55925 100644 --- a/src/Structure/Instructions/Instrs/Memory/I32Load.php +++ b/src/Structure/Instructions/Instrs/Memory/I32Load.php @@ -17,4 +17,9 @@ final readonly class I32Load extends Instr public int $align, ) { } + + public static function opName(): string + { + return "i32.load"; + } } diff --git a/src/Structure/Instructions/Instrs/Memory/I32Load16S.php b/src/Structure/Instructions/Instrs/Memory/I32Load16S.php index 78a15fc..89064f9 100644 --- a/src/Structure/Instructions/Instrs/Memory/I32Load16S.php +++ b/src/Structure/Instructions/Instrs/Memory/I32Load16S.php @@ -17,4 +17,9 @@ final readonly class I32Load16S extends Instr public int $align, ) { } + + public static function opName(): string + { + return "i32.load16_s"; + } } diff --git a/src/Structure/Instructions/Instrs/Memory/I32Load16U.php b/src/Structure/Instructions/Instrs/Memory/I32Load16U.php index 475dff8..201386c 100644 --- a/src/Structure/Instructions/Instrs/Memory/I32Load16U.php +++ b/src/Structure/Instructions/Instrs/Memory/I32Load16U.php @@ -17,4 +17,9 @@ final readonly class I32Load16U extends Instr public int $align, ) { } + + public static function opName(): string + { + return "i32.load16_u"; + } } diff --git a/src/Structure/Instructions/Instrs/Memory/I32Load8S.php b/src/Structure/Instructions/Instrs/Memory/I32Load8S.php index ef8912a..3a7832f 100644 --- a/src/Structure/Instructions/Instrs/Memory/I32Load8S.php +++ b/src/Structure/Instructions/Instrs/Memory/I32Load8S.php @@ -17,4 +17,9 @@ final readonly class I32Load8S extends Instr public int $align, ) { } + + public static function opName(): string + { + return "i32.load8_s"; + } } diff --git a/src/Structure/Instructions/Instrs/Memory/I32Load8U.php b/src/Structure/Instructions/Instrs/Memory/I32Load8U.php index 0c05360..503cfe7 100644 --- a/src/Structure/Instructions/Instrs/Memory/I32Load8U.php +++ b/src/Structure/Instructions/Instrs/Memory/I32Load8U.php @@ -17,4 +17,9 @@ final readonly class I32Load8U extends Instr public int $align, ) { } + + public static function opName(): string + { + return "i32.load8_u"; + } } diff --git a/src/Structure/Instructions/Instrs/Memory/I32Store.php b/src/Structure/Instructions/Instrs/Memory/I32Store.php index e104861..a1b904f 100644 --- a/src/Structure/Instructions/Instrs/Memory/I32Store.php +++ b/src/Structure/Instructions/Instrs/Memory/I32Store.php @@ -17,4 +17,9 @@ final readonly class I32Store extends Instr public int $align, ) { } + + public static function opName(): string + { + return "i32.store"; + } } diff --git a/src/Structure/Instructions/Instrs/Memory/I32Store16.php b/src/Structure/Instructions/Instrs/Memory/I32Store16.php index 8deb592..84d3b8c 100644 --- a/src/Structure/Instructions/Instrs/Memory/I32Store16.php +++ b/src/Structure/Instructions/Instrs/Memory/I32Store16.php @@ -17,4 +17,9 @@ final readonly class I32Store16 extends Instr public int $align, ) { } + + public static function opName(): string + { + return "i32.store16"; + } } diff --git a/src/Structure/Instructions/Instrs/Memory/I32Store8.php b/src/Structure/Instructions/Instrs/Memory/I32Store8.php index 349f78f..a152151 100644 --- a/src/Structure/Instructions/Instrs/Memory/I32Store8.php +++ b/src/Structure/Instructions/Instrs/Memory/I32Store8.php @@ -17,4 +17,9 @@ final readonly class I32Store8 extends Instr public int $align, ) { } + + public static function opName(): string + { + return "i32.store8"; + } } diff --git a/src/Structure/Instructions/Instrs/Memory/I64Load.php b/src/Structure/Instructions/Instrs/Memory/I64Load.php index 89bc32a..98f4398 100644 --- a/src/Structure/Instructions/Instrs/Memory/I64Load.php +++ b/src/Structure/Instructions/Instrs/Memory/I64Load.php @@ -17,4 +17,9 @@ final readonly class I64Load extends Instr public int $align, ) { } + + public static function opName(): string + { + return "i64.load"; + } } diff --git a/src/Structure/Instructions/Instrs/Memory/I64Load16S.php b/src/Structure/Instructions/Instrs/Memory/I64Load16S.php index f8202a7..a91df8b 100644 --- a/src/Structure/Instructions/Instrs/Memory/I64Load16S.php +++ b/src/Structure/Instructions/Instrs/Memory/I64Load16S.php @@ -17,4 +17,9 @@ final readonly class I64Load16S extends Instr public int $align, ) { } + + public static function opName(): string + { + return "i64.load16_s"; + } } diff --git a/src/Structure/Instructions/Instrs/Memory/I64Load16U.php b/src/Structure/Instructions/Instrs/Memory/I64Load16U.php index f93b42b..df16249 100644 --- a/src/Structure/Instructions/Instrs/Memory/I64Load16U.php +++ b/src/Structure/Instructions/Instrs/Memory/I64Load16U.php @@ -17,4 +17,9 @@ final readonly class I64Load16U extends Instr public int $align, ) { } + + public static function opName(): string + { + return "i64.load16_u"; + } } diff --git a/src/Structure/Instructions/Instrs/Memory/I64Load32S.php b/src/Structure/Instructions/Instrs/Memory/I64Load32S.php index 6aaa5e3..2f371fd 100644 --- a/src/Structure/Instructions/Instrs/Memory/I64Load32S.php +++ b/src/Structure/Instructions/Instrs/Memory/I64Load32S.php @@ -17,4 +17,9 @@ final readonly class I64Load32S extends Instr public int $align, ) { } + + public static function opName(): string + { + return "i64.load32_s"; + } } diff --git a/src/Structure/Instructions/Instrs/Memory/I64Load32U.php b/src/Structure/Instructions/Instrs/Memory/I64Load32U.php index 8561919..72c416b 100644 --- a/src/Structure/Instructions/Instrs/Memory/I64Load32U.php +++ b/src/Structure/Instructions/Instrs/Memory/I64Load32U.php @@ -17,4 +17,9 @@ final readonly class I64Load32U extends Instr public int $align, ) { } + + public static function opName(): string + { + return "i64.load32_u"; + } } diff --git a/src/Structure/Instructions/Instrs/Memory/I64Load8S.php b/src/Structure/Instructions/Instrs/Memory/I64Load8S.php index 3fff762..1a902ed 100644 --- a/src/Structure/Instructions/Instrs/Memory/I64Load8S.php +++ b/src/Structure/Instructions/Instrs/Memory/I64Load8S.php @@ -17,4 +17,9 @@ final readonly class I64Load8S extends Instr public int $align, ) { } + + public static function opName(): string + { + return "i64.load8_s"; + } } diff --git a/src/Structure/Instructions/Instrs/Memory/I64Load8U.php b/src/Structure/Instructions/Instrs/Memory/I64Load8U.php index 1d12c24..b47fbb2 100644 --- a/src/Structure/Instructions/Instrs/Memory/I64Load8U.php +++ b/src/Structure/Instructions/Instrs/Memory/I64Load8U.php @@ -17,4 +17,9 @@ final readonly class I64Load8U extends Instr public int $align, ) { } + + public static function opName(): string + { + return "i64.load8_u"; + } } diff --git a/src/Structure/Instructions/Instrs/Memory/I64Store.php b/src/Structure/Instructions/Instrs/Memory/I64Store.php index db974db..a3a6c4b 100644 --- a/src/Structure/Instructions/Instrs/Memory/I64Store.php +++ b/src/Structure/Instructions/Instrs/Memory/I64Store.php @@ -17,4 +17,9 @@ final readonly class I64Store extends Instr public int $align, ) { } + + public static function opName(): string + { + return "i64.store"; + } } diff --git a/src/Structure/Instructions/Instrs/Memory/I64Store16.php b/src/Structure/Instructions/Instrs/Memory/I64Store16.php index 4cb48a2..664d57d 100644 --- a/src/Structure/Instructions/Instrs/Memory/I64Store16.php +++ b/src/Structure/Instructions/Instrs/Memory/I64Store16.php @@ -17,4 +17,9 @@ final readonly class I64Store16 extends Instr public int $align, ) { } + + public static function opName(): string + { + return "i64.store16"; + } } diff --git a/src/Structure/Instructions/Instrs/Memory/I64Store32.php b/src/Structure/Instructions/Instrs/Memory/I64Store32.php index 4d3e894..7a8a530 100644 --- a/src/Structure/Instructions/Instrs/Memory/I64Store32.php +++ b/src/Structure/Instructions/Instrs/Memory/I64Store32.php @@ -17,4 +17,9 @@ final readonly class I64Store32 extends Instr public int $align, ) { } + + public static function opName(): string + { + return "i64.store32"; + } } diff --git a/src/Structure/Instructions/Instrs/Memory/I64Store8.php b/src/Structure/Instructions/Instrs/Memory/I64Store8.php index aaac79b..bf28148 100644 --- a/src/Structure/Instructions/Instrs/Memory/I64Store8.php +++ b/src/Structure/Instructions/Instrs/Memory/I64Store8.php @@ -17,4 +17,9 @@ final readonly class I64Store8 extends Instr public int $align, ) { } + + public static function opName(): string + { + return "i64.store8"; + } } diff --git a/src/Structure/Instructions/Instrs/Memory/MemoryCopy.php b/src/Structure/Instructions/Instrs/Memory/MemoryCopy.php index 49a2700..f4728af 100644 --- a/src/Structure/Instructions/Instrs/Memory/MemoryCopy.php +++ b/src/Structure/Instructions/Instrs/Memory/MemoryCopy.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class MemoryCopy extends Instr { + public static function opName(): string + { + return "memory.copy"; + } } diff --git a/src/Structure/Instructions/Instrs/Memory/MemoryFill.php b/src/Structure/Instructions/Instrs/Memory/MemoryFill.php index 0de6d5e..a05e410 100644 --- a/src/Structure/Instructions/Instrs/Memory/MemoryFill.php +++ b/src/Structure/Instructions/Instrs/Memory/MemoryFill.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class MemoryFill extends Instr { + public static function opName(): string + { + return "memory.fill"; + } } diff --git a/src/Structure/Instructions/Instrs/Memory/MemoryGrow.php b/src/Structure/Instructions/Instrs/Memory/MemoryGrow.php index 2b16de1..eb3d388 100644 --- a/src/Structure/Instructions/Instrs/Memory/MemoryGrow.php +++ b/src/Structure/Instructions/Instrs/Memory/MemoryGrow.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class MemoryGrow extends Instr { + public static function opName(): string + { + return "memory.grow"; + } } diff --git a/src/Structure/Instructions/Instrs/Memory/MemoryInit.php b/src/Structure/Instructions/Instrs/Memory/MemoryInit.php index cce52c2..5538234 100644 --- a/src/Structure/Instructions/Instrs/Memory/MemoryInit.php +++ b/src/Structure/Instructions/Instrs/Memory/MemoryInit.php @@ -13,4 +13,9 @@ final readonly class MemoryInit extends Instr public DataIdx $data, ) { } + + public static function opName(): string + { + return "memory.init"; + } } diff --git a/src/Structure/Instructions/Instrs/Memory/MemorySize.php b/src/Structure/Instructions/Instrs/Memory/MemorySize.php index e411762..1dc9831 100644 --- a/src/Structure/Instructions/Instrs/Memory/MemorySize.php +++ b/src/Structure/Instructions/Instrs/Memory/MemorySize.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class MemorySize extends Instr { + public static function opName(): string + { + return "memory.size"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F32Abs.php b/src/Structure/Instructions/Instrs/Numeric/F32Abs.php index 94fc22b..bd13425 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F32Abs.php +++ b/src/Structure/Instructions/Instrs/Numeric/F32Abs.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F32Abs extends Instr { + public static function opName(): string + { + return "f32.abs"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F32Add.php b/src/Structure/Instructions/Instrs/Numeric/F32Add.php index 8a69f34..77b9379 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F32Add.php +++ b/src/Structure/Instructions/Instrs/Numeric/F32Add.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F32Add extends Instr { + public static function opName(): string + { + return "f32.add"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F32Ceil.php b/src/Structure/Instructions/Instrs/Numeric/F32Ceil.php index 75469a6..dfd2274 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F32Ceil.php +++ b/src/Structure/Instructions/Instrs/Numeric/F32Ceil.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F32Ceil extends Instr { + public static function opName(): string + { + return "f32.ceil"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F32Const.php b/src/Structure/Instructions/Instrs/Numeric/F32Const.php index 0b69861..03a25d5 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F32Const.php +++ b/src/Structure/Instructions/Instrs/Numeric/F32Const.php @@ -15,4 +15,9 @@ final readonly class F32Const extends Instr public float $value, ) { } + + public static function opName(): string + { + return "f32.const"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F32ConvertI32S.php b/src/Structure/Instructions/Instrs/Numeric/F32ConvertI32S.php index 6443f07..7fe7735 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F32ConvertI32S.php +++ b/src/Structure/Instructions/Instrs/Numeric/F32ConvertI32S.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F32ConvertI32S extends Instr { + public static function opName(): string + { + return "f32.convert_i32_s"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F32ConvertI32U.php b/src/Structure/Instructions/Instrs/Numeric/F32ConvertI32U.php index c845057..76e7cf4 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F32ConvertI32U.php +++ b/src/Structure/Instructions/Instrs/Numeric/F32ConvertI32U.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F32ConvertI32U extends Instr { + public static function opName(): string + { + return "f32.convert_i32_u"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F32ConvertI64S.php b/src/Structure/Instructions/Instrs/Numeric/F32ConvertI64S.php index ff9515e..6739f34 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F32ConvertI64S.php +++ b/src/Structure/Instructions/Instrs/Numeric/F32ConvertI64S.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F32ConvertI64S extends Instr { + public static function opName(): string + { + return "f32.convert_i64_s"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F32ConvertI64U.php b/src/Structure/Instructions/Instrs/Numeric/F32ConvertI64U.php index 2a321c7..0396a2a 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F32ConvertI64U.php +++ b/src/Structure/Instructions/Instrs/Numeric/F32ConvertI64U.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F32ConvertI64U extends Instr { + public static function opName(): string + { + return "f32.convert_i64_u"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F32CopySign.php b/src/Structure/Instructions/Instrs/Numeric/F32CopySign.php index 80ca681..ee8b26c 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F32CopySign.php +++ b/src/Structure/Instructions/Instrs/Numeric/F32CopySign.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F32CopySign extends Instr { + public static function opName(): string + { + return "f32.copy_sign"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F32DemoteF64.php b/src/Structure/Instructions/Instrs/Numeric/F32DemoteF64.php index bfe7221..4602bcd 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F32DemoteF64.php +++ b/src/Structure/Instructions/Instrs/Numeric/F32DemoteF64.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F32DemoteF64 extends Instr { + public static function opName(): string + { + return "f32.demote_f64"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F32Div.php b/src/Structure/Instructions/Instrs/Numeric/F32Div.php index 034a161..06bbac2 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F32Div.php +++ b/src/Structure/Instructions/Instrs/Numeric/F32Div.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F32Div extends Instr { + public static function opName(): string + { + return "f32.div"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F32Eq.php b/src/Structure/Instructions/Instrs/Numeric/F32Eq.php index acfaa91..29503d1 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F32Eq.php +++ b/src/Structure/Instructions/Instrs/Numeric/F32Eq.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F32Eq extends Instr { + public static function opName(): string + { + return "f32.eq"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F32Floor.php b/src/Structure/Instructions/Instrs/Numeric/F32Floor.php index 6b8c760..7dd6802 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F32Floor.php +++ b/src/Structure/Instructions/Instrs/Numeric/F32Floor.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F32Floor extends Instr { + public static function opName(): string + { + return "f32.floor"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F32Ge.php b/src/Structure/Instructions/Instrs/Numeric/F32Ge.php index bd8a7ce..f833c6b 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F32Ge.php +++ b/src/Structure/Instructions/Instrs/Numeric/F32Ge.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F32Ge extends Instr { + public static function opName(): string + { + return "f32.ge"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F32Gt.php b/src/Structure/Instructions/Instrs/Numeric/F32Gt.php index 4f071b5..5d5537d 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F32Gt.php +++ b/src/Structure/Instructions/Instrs/Numeric/F32Gt.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F32Gt extends Instr { + public static function opName(): string + { + return "f32.gt"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F32Le.php b/src/Structure/Instructions/Instrs/Numeric/F32Le.php index 76d53ed..38dcf93 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F32Le.php +++ b/src/Structure/Instructions/Instrs/Numeric/F32Le.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F32Le extends Instr { + public static function opName(): string + { + return "f32.le"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F32Lt.php b/src/Structure/Instructions/Instrs/Numeric/F32Lt.php index 9286087..511f9fb 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F32Lt.php +++ b/src/Structure/Instructions/Instrs/Numeric/F32Lt.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F32Lt extends Instr { + public static function opName(): string + { + return "f32.lt"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F32Max.php b/src/Structure/Instructions/Instrs/Numeric/F32Max.php index e2d68cd..af41f0f 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F32Max.php +++ b/src/Structure/Instructions/Instrs/Numeric/F32Max.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F32Max extends Instr { + public static function opName(): string + { + return "f32.max"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F32Min.php b/src/Structure/Instructions/Instrs/Numeric/F32Min.php index 2b07d3a..d4b1625 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F32Min.php +++ b/src/Structure/Instructions/Instrs/Numeric/F32Min.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F32Min extends Instr { + public static function opName(): string + { + return "f32.min"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F32Mul.php b/src/Structure/Instructions/Instrs/Numeric/F32Mul.php index f232268..30347e0 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F32Mul.php +++ b/src/Structure/Instructions/Instrs/Numeric/F32Mul.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F32Mul extends Instr { + public static function opName(): string + { + return "f32.mul"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F32Ne.php b/src/Structure/Instructions/Instrs/Numeric/F32Ne.php index 4d88d58..eecff24 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F32Ne.php +++ b/src/Structure/Instructions/Instrs/Numeric/F32Ne.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F32Ne extends Instr { + public static function opName(): string + { + return "f32.ne"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F32Nearest.php b/src/Structure/Instructions/Instrs/Numeric/F32Nearest.php index 5ef087c..ae45b0a 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F32Nearest.php +++ b/src/Structure/Instructions/Instrs/Numeric/F32Nearest.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F32Nearest extends Instr { + public static function opName(): string + { + return "f32.nearest"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F32Neg.php b/src/Structure/Instructions/Instrs/Numeric/F32Neg.php index 0ee1c81..1cd54f7 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F32Neg.php +++ b/src/Structure/Instructions/Instrs/Numeric/F32Neg.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F32Neg extends Instr { + public static function opName(): string + { + return "f32.neg"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F32ReinterpretI32.php b/src/Structure/Instructions/Instrs/Numeric/F32ReinterpretI32.php index ca6bbc9..ee617f4 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F32ReinterpretI32.php +++ b/src/Structure/Instructions/Instrs/Numeric/F32ReinterpretI32.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F32ReinterpretI32 extends Instr { + public static function opName(): string + { + return "f32.reinterpret_i32"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F32ReinterpretI64.php b/src/Structure/Instructions/Instrs/Numeric/F32ReinterpretI64.php index 4c0c1cc..edc06c7 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F32ReinterpretI64.php +++ b/src/Structure/Instructions/Instrs/Numeric/F32ReinterpretI64.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F32ReinterpretI64 extends Instr { + public static function opName(): string + { + return "f32.reinterpret_i64"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F32Sqrt.php b/src/Structure/Instructions/Instrs/Numeric/F32Sqrt.php index 8889df2..be2dc16 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F32Sqrt.php +++ b/src/Structure/Instructions/Instrs/Numeric/F32Sqrt.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F32Sqrt extends Instr { + public static function opName(): string + { + return "f32.sqrt"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F32Sub.php b/src/Structure/Instructions/Instrs/Numeric/F32Sub.php index 79efc3c..1e971a9 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F32Sub.php +++ b/src/Structure/Instructions/Instrs/Numeric/F32Sub.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F32Sub extends Instr { + public static function opName(): string + { + return "f32.sub"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F32Trunc.php b/src/Structure/Instructions/Instrs/Numeric/F32Trunc.php index 6c273ac..0218c5f 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F32Trunc.php +++ b/src/Structure/Instructions/Instrs/Numeric/F32Trunc.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F32Trunc extends Instr { + public static function opName(): string + { + return "f32.trunc"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F64Abs.php b/src/Structure/Instructions/Instrs/Numeric/F64Abs.php index cc0a7d3..4a6a166 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F64Abs.php +++ b/src/Structure/Instructions/Instrs/Numeric/F64Abs.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F64Abs extends Instr { + public static function opName(): string + { + return "f64.abs"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F64Add.php b/src/Structure/Instructions/Instrs/Numeric/F64Add.php index 6e8ed1a..e76b910 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F64Add.php +++ b/src/Structure/Instructions/Instrs/Numeric/F64Add.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F64Add extends Instr { + public static function opName(): string + { + return "f64.add"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F64Ceil.php b/src/Structure/Instructions/Instrs/Numeric/F64Ceil.php index 42bc77d..12f8a19 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F64Ceil.php +++ b/src/Structure/Instructions/Instrs/Numeric/F64Ceil.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F64Ceil extends Instr { + public static function opName(): string + { + return "f64.ceil"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F64Const.php b/src/Structure/Instructions/Instrs/Numeric/F64Const.php index 540e6f4..f5819a9 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F64Const.php +++ b/src/Structure/Instructions/Instrs/Numeric/F64Const.php @@ -15,4 +15,9 @@ final readonly class F64Const extends Instr public float $value, ) { } + + public static function opName(): string + { + return "f64.const"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F64ConvertI32S.php b/src/Structure/Instructions/Instrs/Numeric/F64ConvertI32S.php index ca52f39..e87dc21 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F64ConvertI32S.php +++ b/src/Structure/Instructions/Instrs/Numeric/F64ConvertI32S.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F64ConvertI32S extends Instr { + public static function opName(): string + { + return "f64.convert_i32_s"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F64ConvertI32U.php b/src/Structure/Instructions/Instrs/Numeric/F64ConvertI32U.php index 2b0cb1b..05a7336 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F64ConvertI32U.php +++ b/src/Structure/Instructions/Instrs/Numeric/F64ConvertI32U.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F64ConvertI32U extends Instr { + public static function opName(): string + { + return "f64.convert_i32_u"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F64ConvertI64S.php b/src/Structure/Instructions/Instrs/Numeric/F64ConvertI64S.php index 9f2d8ad..0b25d72 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F64ConvertI64S.php +++ b/src/Structure/Instructions/Instrs/Numeric/F64ConvertI64S.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F64ConvertI64S extends Instr { + public static function opName(): string + { + return "f64.convert_i64_s"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F64ConvertI64U.php b/src/Structure/Instructions/Instrs/Numeric/F64ConvertI64U.php index a86cd01..a782c93 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F64ConvertI64U.php +++ b/src/Structure/Instructions/Instrs/Numeric/F64ConvertI64U.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F64ConvertI64U extends Instr { + public static function opName(): string + { + return "f64.convert_i64_u"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F64CopySign.php b/src/Structure/Instructions/Instrs/Numeric/F64CopySign.php index 2e11ae4..d9f363f 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F64CopySign.php +++ b/src/Structure/Instructions/Instrs/Numeric/F64CopySign.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F64CopySign extends Instr { + public static function opName(): string + { + return "f64.copy_sign"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F64Div.php b/src/Structure/Instructions/Instrs/Numeric/F64Div.php index d655879..a7806a6 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F64Div.php +++ b/src/Structure/Instructions/Instrs/Numeric/F64Div.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F64Div extends Instr { + public static function opName(): string + { + return "f64.div"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F64Eq.php b/src/Structure/Instructions/Instrs/Numeric/F64Eq.php index 5155b0b..fefb545 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F64Eq.php +++ b/src/Structure/Instructions/Instrs/Numeric/F64Eq.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F64Eq extends Instr { + public static function opName(): string + { + return "f64.eq"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F64Floor.php b/src/Structure/Instructions/Instrs/Numeric/F64Floor.php index a55785f..248a01e 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F64Floor.php +++ b/src/Structure/Instructions/Instrs/Numeric/F64Floor.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F64Floor extends Instr { + public static function opName(): string + { + return "f64.floor"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F64Ge.php b/src/Structure/Instructions/Instrs/Numeric/F64Ge.php index f9dc40e..2c7a3da 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F64Ge.php +++ b/src/Structure/Instructions/Instrs/Numeric/F64Ge.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F64Ge extends Instr { + public static function opName(): string + { + return "f64.ge"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F64Gt.php b/src/Structure/Instructions/Instrs/Numeric/F64Gt.php index bf33336..a08b908 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F64Gt.php +++ b/src/Structure/Instructions/Instrs/Numeric/F64Gt.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F64Gt extends Instr { + public static function opName(): string + { + return "f64.gt"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F64Le.php b/src/Structure/Instructions/Instrs/Numeric/F64Le.php index eae4b93..069382d 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F64Le.php +++ b/src/Structure/Instructions/Instrs/Numeric/F64Le.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F64Le extends Instr { + public static function opName(): string + { + return "f64.le"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F64Lt.php b/src/Structure/Instructions/Instrs/Numeric/F64Lt.php index 755914a..67e8a06 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F64Lt.php +++ b/src/Structure/Instructions/Instrs/Numeric/F64Lt.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F64Lt extends Instr { + public static function opName(): string + { + return "f64.lt"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F64Max.php b/src/Structure/Instructions/Instrs/Numeric/F64Max.php index 3f07d6d..4a159ae 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F64Max.php +++ b/src/Structure/Instructions/Instrs/Numeric/F64Max.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F64Max extends Instr { + public static function opName(): string + { + return "f64.max"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F64Min.php b/src/Structure/Instructions/Instrs/Numeric/F64Min.php index 272dc4a..bae22c3 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F64Min.php +++ b/src/Structure/Instructions/Instrs/Numeric/F64Min.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F64Min extends Instr { + public static function opName(): string + { + return "f64.min"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F64Mul.php b/src/Structure/Instructions/Instrs/Numeric/F64Mul.php index f22dbab..5204c61 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F64Mul.php +++ b/src/Structure/Instructions/Instrs/Numeric/F64Mul.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F64Mul extends Instr { + public static function opName(): string + { + return "f64.mul"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F64Ne.php b/src/Structure/Instructions/Instrs/Numeric/F64Ne.php index 91c86e3..f2b9767 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F64Ne.php +++ b/src/Structure/Instructions/Instrs/Numeric/F64Ne.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F64Ne extends Instr { + public static function opName(): string + { + return "f64.ne"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F64Nearest.php b/src/Structure/Instructions/Instrs/Numeric/F64Nearest.php index 52bcfd8..df39552 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F64Nearest.php +++ b/src/Structure/Instructions/Instrs/Numeric/F64Nearest.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F64Nearest extends Instr { + public static function opName(): string + { + return "f64.nearest"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F64Neg.php b/src/Structure/Instructions/Instrs/Numeric/F64Neg.php index 4589529..e39c12f 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F64Neg.php +++ b/src/Structure/Instructions/Instrs/Numeric/F64Neg.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F64Neg extends Instr { + public static function opName(): string + { + return "f64.neg"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F64PromoteF32.php b/src/Structure/Instructions/Instrs/Numeric/F64PromoteF32.php index a14aa36..0b3d4ef 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F64PromoteF32.php +++ b/src/Structure/Instructions/Instrs/Numeric/F64PromoteF32.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F64PromoteF32 extends Instr { + public static function opName(): string + { + return "f64.promote_f32"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F64ReinterpretI32.php b/src/Structure/Instructions/Instrs/Numeric/F64ReinterpretI32.php index b37bf7e..9817aea 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F64ReinterpretI32.php +++ b/src/Structure/Instructions/Instrs/Numeric/F64ReinterpretI32.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F64ReinterpretI32 extends Instr { + public static function opName(): string + { + return "f64.reinterpret_i32"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F64ReinterpretI64.php b/src/Structure/Instructions/Instrs/Numeric/F64ReinterpretI64.php index 0f8a3fb..4178a96 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F64ReinterpretI64.php +++ b/src/Structure/Instructions/Instrs/Numeric/F64ReinterpretI64.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F64ReinterpretI64 extends Instr { + public static function opName(): string + { + return "f64.reinterpret_i64"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F64Sqrt.php b/src/Structure/Instructions/Instrs/Numeric/F64Sqrt.php index 647d95f..b9ba41e 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F64Sqrt.php +++ b/src/Structure/Instructions/Instrs/Numeric/F64Sqrt.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F64Sqrt extends Instr { + public static function opName(): string + { + return "f64.sqrt"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F64Sub.php b/src/Structure/Instructions/Instrs/Numeric/F64Sub.php index 31677c1..05eddc1 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F64Sub.php +++ b/src/Structure/Instructions/Instrs/Numeric/F64Sub.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F64Sub extends Instr { + public static function opName(): string + { + return "f64.sub"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/F64Trunc.php b/src/Structure/Instructions/Instrs/Numeric/F64Trunc.php index 6ed7314..4c3fa30 100644 --- a/src/Structure/Instructions/Instrs/Numeric/F64Trunc.php +++ b/src/Structure/Instructions/Instrs/Numeric/F64Trunc.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class F64Trunc extends Instr { + public static function opName(): string + { + return "f64.trunc"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32Add.php b/src/Structure/Instructions/Instrs/Numeric/I32Add.php index 45b1fea..bb7253b 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32Add.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32Add.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I32Add extends Instr { + public static function opName(): string + { + return "i32.add"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32And.php b/src/Structure/Instructions/Instrs/Numeric/I32And.php index 8f0a906..9cfefc6 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32And.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32And.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I32And extends Instr { + public static function opName(): string + { + return "i32.and"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32Clz.php b/src/Structure/Instructions/Instrs/Numeric/I32Clz.php index 124995b..d6da4c1 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32Clz.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32Clz.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I32Clz extends Instr { + public static function opName(): string + { + return "i32.clz"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32Const.php b/src/Structure/Instructions/Instrs/Numeric/I32Const.php index d9f1aea..7ebc418 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32Const.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32Const.php @@ -15,4 +15,9 @@ final readonly class I32Const extends Instr public int $value, ) { } + + public static function opName(): string + { + return "i32.const"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32Ctz.php b/src/Structure/Instructions/Instrs/Numeric/I32Ctz.php index fc17042..49872e7 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32Ctz.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32Ctz.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I32Ctz extends Instr { + public static function opName(): string + { + return "i32.ctz"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32DivS.php b/src/Structure/Instructions/Instrs/Numeric/I32DivS.php index 789716d..d3d5fc3 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32DivS.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32DivS.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I32DivS extends Instr { + public static function opName(): string + { + return "i32.div_s"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32DivU.php b/src/Structure/Instructions/Instrs/Numeric/I32DivU.php index f7797f4..159ce6e 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32DivU.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32DivU.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I32DivU extends Instr { + public static function opName(): string + { + return "i32.div_u"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32Eq.php b/src/Structure/Instructions/Instrs/Numeric/I32Eq.php index e6c5969..e98b81d 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32Eq.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32Eq.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I32Eq extends Instr { + public static function opName(): string + { + return "i32.eq"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32Eqz.php b/src/Structure/Instructions/Instrs/Numeric/I32Eqz.php index 16d7b44..9362e84 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32Eqz.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32Eqz.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I32Eqz extends Instr { + public static function opName(): string + { + return "i32.eqz"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32Extend16S.php b/src/Structure/Instructions/Instrs/Numeric/I32Extend16S.php index cdb3227..a09c7f0 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32Extend16S.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32Extend16S.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I32Extend16S extends Instr { + public static function opName(): string + { + return "i32.extend16_s"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32Extend8S.php b/src/Structure/Instructions/Instrs/Numeric/I32Extend8S.php index 73c95f9..e8a1165 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32Extend8S.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32Extend8S.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I32Extend8S extends Instr { + public static function opName(): string + { + return "i32.extend8_s"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32GeS.php b/src/Structure/Instructions/Instrs/Numeric/I32GeS.php index c9f9bf4..5238682 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32GeS.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32GeS.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I32GeS extends Instr { + public static function opName(): string + { + return "i32.ge_s"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32GeU.php b/src/Structure/Instructions/Instrs/Numeric/I32GeU.php index 8c16771..7202fe2 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32GeU.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32GeU.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I32GeU extends Instr { + public static function opName(): string + { + return "i32.ge_u"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32GtS.php b/src/Structure/Instructions/Instrs/Numeric/I32GtS.php index 4b044a3..1c5207b 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32GtS.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32GtS.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I32GtS extends Instr { + public static function opName(): string + { + return "i32.gt_s"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32GtU.php b/src/Structure/Instructions/Instrs/Numeric/I32GtU.php index 6f915e8..1f02f92 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32GtU.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32GtU.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I32GtU extends Instr { + public static function opName(): string + { + return "i32.gt_u"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32LeS.php b/src/Structure/Instructions/Instrs/Numeric/I32LeS.php index e82233a..f0c316a 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32LeS.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32LeS.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I32LeS extends Instr { + public static function opName(): string + { + return "i32.le_s"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32LeU.php b/src/Structure/Instructions/Instrs/Numeric/I32LeU.php index 99a470d..83ff213 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32LeU.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32LeU.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I32LeU extends Instr { + public static function opName(): string + { + return "i32.le_u"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32LtS.php b/src/Structure/Instructions/Instrs/Numeric/I32LtS.php index 09ba5a0..a44a846 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32LtS.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32LtS.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I32LtS extends Instr { + public static function opName(): string + { + return "i32.lt_s"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32LtU.php b/src/Structure/Instructions/Instrs/Numeric/I32LtU.php index a7526e9..56e3ca5 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32LtU.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32LtU.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I32LtU extends Instr { + public static function opName(): string + { + return "i32.lt_u"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32Mul.php b/src/Structure/Instructions/Instrs/Numeric/I32Mul.php index 53c7909..4a90126 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32Mul.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32Mul.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I32Mul extends Instr { + public static function opName(): string + { + return "i32.mul"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32Ne.php b/src/Structure/Instructions/Instrs/Numeric/I32Ne.php index 01d16a1..ea22294 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32Ne.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32Ne.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I32Ne extends Instr { + public static function opName(): string + { + return "i32.ne"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32Or.php b/src/Structure/Instructions/Instrs/Numeric/I32Or.php index 93ef312..43e4fc1 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32Or.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32Or.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I32Or extends Instr { + public static function opName(): string + { + return "i32.or"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32Popcnt.php b/src/Structure/Instructions/Instrs/Numeric/I32Popcnt.php index 6519b81..1a0cda6 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32Popcnt.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32Popcnt.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I32Popcnt extends Instr { + public static function opName(): string + { + return "i32.popcnt"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32ReinterpretF32.php b/src/Structure/Instructions/Instrs/Numeric/I32ReinterpretF32.php index 4bbd00b..b0c8fbb 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32ReinterpretF32.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32ReinterpretF32.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I32ReinterpretF32 extends Instr { + public static function opName(): string + { + return "i32.reinterpret_f32"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32ReinterpretF64.php b/src/Structure/Instructions/Instrs/Numeric/I32ReinterpretF64.php index 452b94c..4396987 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32ReinterpretF64.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32ReinterpretF64.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I32ReinterpretF64 extends Instr { + public static function opName(): string + { + return "i32.reinterpret_f64"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32RemS.php b/src/Structure/Instructions/Instrs/Numeric/I32RemS.php index 57ee14e..9f26f93 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32RemS.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32RemS.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I32RemS extends Instr { + public static function opName(): string + { + return "i32.rem_s"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32RemU.php b/src/Structure/Instructions/Instrs/Numeric/I32RemU.php index 4ff68af..dc60d09 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32RemU.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32RemU.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I32RemU extends Instr { + public static function opName(): string + { + return "i32.rem_u"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32RotL.php b/src/Structure/Instructions/Instrs/Numeric/I32RotL.php index 66597f3..7f847b2 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32RotL.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32RotL.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I32RotL extends Instr { + public static function opName(): string + { + return "i32.rot_l"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32RotR.php b/src/Structure/Instructions/Instrs/Numeric/I32RotR.php index 732a609..3b7a6c4 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32RotR.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32RotR.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I32RotR extends Instr { + public static function opName(): string + { + return "i32.rot_r"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32Shl.php b/src/Structure/Instructions/Instrs/Numeric/I32Shl.php index 51da4d7..c22e9d2 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32Shl.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32Shl.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I32Shl extends Instr { + public static function opName(): string + { + return "i32.shl"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32ShrS.php b/src/Structure/Instructions/Instrs/Numeric/I32ShrS.php index bd450c7..485849b 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32ShrS.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32ShrS.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I32ShrS extends Instr { + public static function opName(): string + { + return "i32.shr_s"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32ShrU.php b/src/Structure/Instructions/Instrs/Numeric/I32ShrU.php index 45a9591..859db54 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32ShrU.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32ShrU.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I32ShrU extends Instr { + public static function opName(): string + { + return "i32.shr_u"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32Sub.php b/src/Structure/Instructions/Instrs/Numeric/I32Sub.php index bccb57b..63c6501 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32Sub.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32Sub.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I32Sub extends Instr { + public static function opName(): string + { + return "i32.sub"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32TruncF32S.php b/src/Structure/Instructions/Instrs/Numeric/I32TruncF32S.php index eceb6aa..895010b 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32TruncF32S.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32TruncF32S.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I32TruncF32S extends Instr { + public static function opName(): string + { + return "i32.trunc_f32_s"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32TruncF32U.php b/src/Structure/Instructions/Instrs/Numeric/I32TruncF32U.php index 1b63b10..a10d8f3 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32TruncF32U.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32TruncF32U.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I32TruncF32U extends Instr { + public static function opName(): string + { + return "i32.trunc_f32_u"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32TruncF64S.php b/src/Structure/Instructions/Instrs/Numeric/I32TruncF64S.php index 8290349..75dc9d9 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32TruncF64S.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32TruncF64S.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I32TruncF64S extends Instr { + public static function opName(): string + { + return "i32.trunc_f64_s"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32TruncF64U.php b/src/Structure/Instructions/Instrs/Numeric/I32TruncF64U.php index 61bc0fe..c0c3b28 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32TruncF64U.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32TruncF64U.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I32TruncF64U extends Instr { + public static function opName(): string + { + return "i32.trunc_f64_u"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32TruncSatF32S.php b/src/Structure/Instructions/Instrs/Numeric/I32TruncSatF32S.php index e5d490d..93428d1 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32TruncSatF32S.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32TruncSatF32S.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I32TruncSatF32S extends Instr { + public static function opName(): string + { + return "i32.trunc_sat_f32_s"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32TruncSatF32U.php b/src/Structure/Instructions/Instrs/Numeric/I32TruncSatF32U.php index e032eb8..a50e00b 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32TruncSatF32U.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32TruncSatF32U.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I32TruncSatF32U extends Instr { + public static function opName(): string + { + return "i32.trunc_sat_f32_u"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32TruncSatF64S.php b/src/Structure/Instructions/Instrs/Numeric/I32TruncSatF64S.php index 3094a68..a0d501d 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32TruncSatF64S.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32TruncSatF64S.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I32TruncSatF64S extends Instr { + public static function opName(): string + { + return "i32.trunc_sat_f64_s"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32TruncSatF64U.php b/src/Structure/Instructions/Instrs/Numeric/I32TruncSatF64U.php index fa2fa63..acc5f90 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32TruncSatF64U.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32TruncSatF64U.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I32TruncSatF64U extends Instr { + public static function opName(): string + { + return "i32.trunc_sat_f64_u"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32WrapI64.php b/src/Structure/Instructions/Instrs/Numeric/I32WrapI64.php index f9467c3..3603c57 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32WrapI64.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32WrapI64.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I32WrapI64 extends Instr { + public static function opName(): string + { + return "i32.wrap_i64"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I32Xor.php b/src/Structure/Instructions/Instrs/Numeric/I32Xor.php index 1526d59..1ba47c2 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I32Xor.php +++ b/src/Structure/Instructions/Instrs/Numeric/I32Xor.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I32Xor extends Instr { + public static function opName(): string + { + return "i32.xor"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64Add.php b/src/Structure/Instructions/Instrs/Numeric/I64Add.php index f94c7e8..ed7aa75 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64Add.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64Add.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64Add extends Instr { + public static function opName(): string + { + return "i64.add"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64And.php b/src/Structure/Instructions/Instrs/Numeric/I64And.php index f82d3d9..2fc7ec7 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64And.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64And.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64And extends Instr { + public static function opName(): string + { + return "i64.and"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64Clz.php b/src/Structure/Instructions/Instrs/Numeric/I64Clz.php index e0846ae..1fbcc07 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64Clz.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64Clz.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64Clz extends Instr { + public static function opName(): string + { + return "i64.clz"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64Const.php b/src/Structure/Instructions/Instrs/Numeric/I64Const.php index 59ca0f8..5e95f58 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64Const.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64Const.php @@ -15,4 +15,9 @@ final readonly class I64Const extends Instr public int $value, ) { } + + public static function opName(): string + { + return "i64.const"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64Ctz.php b/src/Structure/Instructions/Instrs/Numeric/I64Ctz.php index 0422f68..f127093 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64Ctz.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64Ctz.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64Ctz extends Instr { + public static function opName(): string + { + return "i64.ctz"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64DivS.php b/src/Structure/Instructions/Instrs/Numeric/I64DivS.php index 9294d17..fc5c43c 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64DivS.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64DivS.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64DivS extends Instr { + public static function opName(): string + { + return "i64.div_s"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64DivU.php b/src/Structure/Instructions/Instrs/Numeric/I64DivU.php index 4c5242c..191124e 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64DivU.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64DivU.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64DivU extends Instr { + public static function opName(): string + { + return "i64.div_u"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64Eq.php b/src/Structure/Instructions/Instrs/Numeric/I64Eq.php index 2145985..db05130 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64Eq.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64Eq.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64Eq extends Instr { + public static function opName(): string + { + return "i64.eq"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64Eqz.php b/src/Structure/Instructions/Instrs/Numeric/I64Eqz.php index dd7af0d..fd4e921 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64Eqz.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64Eqz.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64Eqz extends Instr { + public static function opName(): string + { + return "i64.eqz"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64Extend16S.php b/src/Structure/Instructions/Instrs/Numeric/I64Extend16S.php index c9ec236..6490af7 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64Extend16S.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64Extend16S.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64Extend16S extends Instr { + public static function opName(): string + { + return "i64.extend16_s"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64Extend32S.php b/src/Structure/Instructions/Instrs/Numeric/I64Extend32S.php index f5cf6e3..20af6a3 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64Extend32S.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64Extend32S.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64Extend32S extends Instr { + public static function opName(): string + { + return "i64.extend32_s"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64Extend8S.php b/src/Structure/Instructions/Instrs/Numeric/I64Extend8S.php index 8aabde1..b5f991a 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64Extend8S.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64Extend8S.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64Extend8S extends Instr { + public static function opName(): string + { + return "i64.extend8_s"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64ExtendI32S.php b/src/Structure/Instructions/Instrs/Numeric/I64ExtendI32S.php index 4758071..5db18a3 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64ExtendI32S.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64ExtendI32S.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64ExtendI32S extends Instr { + public static function opName(): string + { + return "i64.extend_i32_s"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64ExtendI32U.php b/src/Structure/Instructions/Instrs/Numeric/I64ExtendI32U.php index 255676c..cc8ea69 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64ExtendI32U.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64ExtendI32U.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64ExtendI32U extends Instr { + public static function opName(): string + { + return "i64.extend_i32_u"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64GeS.php b/src/Structure/Instructions/Instrs/Numeric/I64GeS.php index 7ab7587..94df4cd 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64GeS.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64GeS.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64GeS extends Instr { + public static function opName(): string + { + return "i64.ge_s"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64GeU.php b/src/Structure/Instructions/Instrs/Numeric/I64GeU.php index 2695524..4421d97 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64GeU.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64GeU.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64GeU extends Instr { + public static function opName(): string + { + return "i64.ge_u"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64GtS.php b/src/Structure/Instructions/Instrs/Numeric/I64GtS.php index 6aada91..469fa2a 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64GtS.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64GtS.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64GtS extends Instr { + public static function opName(): string + { + return "i64.gt_s"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64GtU.php b/src/Structure/Instructions/Instrs/Numeric/I64GtU.php index 396b8e2..1b7f108 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64GtU.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64GtU.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64GtU extends Instr { + public static function opName(): string + { + return "i64.gt_u"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64LeS.php b/src/Structure/Instructions/Instrs/Numeric/I64LeS.php index c6a7ecb..3bc9192 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64LeS.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64LeS.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64LeS extends Instr { + public static function opName(): string + { + return "i64.le_s"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64LeU.php b/src/Structure/Instructions/Instrs/Numeric/I64LeU.php index c0037be..b95b5da 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64LeU.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64LeU.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64LeU extends Instr { + public static function opName(): string + { + return "i64.le_u"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64LtS.php b/src/Structure/Instructions/Instrs/Numeric/I64LtS.php index 662f082..b63e56b 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64LtS.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64LtS.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64LtS extends Instr { + public static function opName(): string + { + return "i64.lt_s"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64LtU.php b/src/Structure/Instructions/Instrs/Numeric/I64LtU.php index fd5f3b0..0417e04 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64LtU.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64LtU.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64LtU extends Instr { + public static function opName(): string + { + return "i64.lt_u"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64Mul.php b/src/Structure/Instructions/Instrs/Numeric/I64Mul.php index c6133c9..d151d8a 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64Mul.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64Mul.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64Mul extends Instr { + public static function opName(): string + { + return "i64.mul"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64Ne.php b/src/Structure/Instructions/Instrs/Numeric/I64Ne.php index 5c076c0..7c634bb 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64Ne.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64Ne.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64Ne extends Instr { + public static function opName(): string + { + return "i64.ne"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64Or.php b/src/Structure/Instructions/Instrs/Numeric/I64Or.php index c1d1d1a..fb0ba0c 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64Or.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64Or.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64Or extends Instr { + public static function opName(): string + { + return "i64.or"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64Popcnt.php b/src/Structure/Instructions/Instrs/Numeric/I64Popcnt.php index 33ec288..e27cc2e 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64Popcnt.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64Popcnt.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64Popcnt extends Instr { + public static function opName(): string + { + return "i64.popcnt"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64ReinterpretF32.php b/src/Structure/Instructions/Instrs/Numeric/I64ReinterpretF32.php index d3104b9..3a86af6 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64ReinterpretF32.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64ReinterpretF32.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64ReinterpretF32 extends Instr { + public static function opName(): string + { + return "i64.reinterpret_f32"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64ReinterpretF64.php b/src/Structure/Instructions/Instrs/Numeric/I64ReinterpretF64.php index 0a6245a..f54a0cf 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64ReinterpretF64.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64ReinterpretF64.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64ReinterpretF64 extends Instr { + public static function opName(): string + { + return "i64.reinterpret_f64"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64RemS.php b/src/Structure/Instructions/Instrs/Numeric/I64RemS.php index 1d66b60..fc63520 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64RemS.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64RemS.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64RemS extends Instr { + public static function opName(): string + { + return "i64.rem_s"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64RemU.php b/src/Structure/Instructions/Instrs/Numeric/I64RemU.php index 0241747..0d59167 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64RemU.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64RemU.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64RemU extends Instr { + public static function opName(): string + { + return "i64.rem_u"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64RotL.php b/src/Structure/Instructions/Instrs/Numeric/I64RotL.php index 6a6fdba..bcacbee 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64RotL.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64RotL.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64RotL extends Instr { + public static function opName(): string + { + return "i64.rot_l"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64RotR.php b/src/Structure/Instructions/Instrs/Numeric/I64RotR.php index e77fab0..02256fe 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64RotR.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64RotR.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64RotR extends Instr { + public static function opName(): string + { + return "i64.rot_r"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64Shl.php b/src/Structure/Instructions/Instrs/Numeric/I64Shl.php index d800c6d..191b38f 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64Shl.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64Shl.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64Shl extends Instr { + public static function opName(): string + { + return "i64.shl"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64ShrS.php b/src/Structure/Instructions/Instrs/Numeric/I64ShrS.php index d44e48f..2e3efc6 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64ShrS.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64ShrS.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64ShrS extends Instr { + public static function opName(): string + { + return "i64.shr_s"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64ShrU.php b/src/Structure/Instructions/Instrs/Numeric/I64ShrU.php index 656a662..290753a 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64ShrU.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64ShrU.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64ShrU extends Instr { + public static function opName(): string + { + return "i64.shr_u"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64Sub.php b/src/Structure/Instructions/Instrs/Numeric/I64Sub.php index ab87eaf..2b6e2b9 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64Sub.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64Sub.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64Sub extends Instr { + public static function opName(): string + { + return "i64.sub"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64TruncF32S.php b/src/Structure/Instructions/Instrs/Numeric/I64TruncF32S.php index a3421ce..b10816e 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64TruncF32S.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64TruncF32S.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64TruncF32S extends Instr { + public static function opName(): string + { + return "i64.trunc_f32_s"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64TruncF32U.php b/src/Structure/Instructions/Instrs/Numeric/I64TruncF32U.php index 917e940..2840cb4 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64TruncF32U.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64TruncF32U.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64TruncF32U extends Instr { + public static function opName(): string + { + return "i64.trunc_f32_u"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64TruncF64S.php b/src/Structure/Instructions/Instrs/Numeric/I64TruncF64S.php index 3f0d5fd..fda84be 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64TruncF64S.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64TruncF64S.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64TruncF64S extends Instr { + public static function opName(): string + { + return "i64.trunc_f64_s"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64TruncF64U.php b/src/Structure/Instructions/Instrs/Numeric/I64TruncF64U.php index 9726bc4..de35e7f 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64TruncF64U.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64TruncF64U.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64TruncF64U extends Instr { + public static function opName(): string + { + return "i64.trunc_f64_u"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64TruncSatF32S.php b/src/Structure/Instructions/Instrs/Numeric/I64TruncSatF32S.php index 71d82a5..98409c5 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64TruncSatF32S.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64TruncSatF32S.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64TruncSatF32S extends Instr { + public static function opName(): string + { + return "i64.trunc_sat_f32_s"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64TruncSatF32U.php b/src/Structure/Instructions/Instrs/Numeric/I64TruncSatF32U.php index d4dafd7..f4478c4 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64TruncSatF32U.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64TruncSatF32U.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64TruncSatF32U extends Instr { + public static function opName(): string + { + return "i64.trunc_sat_f32_u"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64TruncSatF64S.php b/src/Structure/Instructions/Instrs/Numeric/I64TruncSatF64S.php index 0833520..eb04f34 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64TruncSatF64S.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64TruncSatF64S.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64TruncSatF64S extends Instr { + public static function opName(): string + { + return "i64.trunc_sat_f64_s"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64TruncSatF64U.php b/src/Structure/Instructions/Instrs/Numeric/I64TruncSatF64U.php index 41f1c0e..7b5777d 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64TruncSatF64U.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64TruncSatF64U.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64TruncSatF64U extends Instr { + public static function opName(): string + { + return "i64.trunc_sat_f64_u"; + } } diff --git a/src/Structure/Instructions/Instrs/Numeric/I64Xor.php b/src/Structure/Instructions/Instrs/Numeric/I64Xor.php index 917f62d..06b6b8b 100644 --- a/src/Structure/Instructions/Instrs/Numeric/I64Xor.php +++ b/src/Structure/Instructions/Instrs/Numeric/I64Xor.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class I64Xor extends Instr { + public static function opName(): string + { + return "i64.xor"; + } } diff --git a/src/Structure/Instructions/Instrs/Parametric/Drop.php b/src/Structure/Instructions/Instrs/Parametric/Drop.php index 7513014..69a3fc1 100644 --- a/src/Structure/Instructions/Instrs/Parametric/Drop.php +++ b/src/Structure/Instructions/Instrs/Parametric/Drop.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class Drop extends Instr { + public static function opName(): string + { + return "drop"; + } } diff --git a/src/Structure/Instructions/Instrs/Parametric/Select.php b/src/Structure/Instructions/Instrs/Parametric/Select.php index dd09ef3..10d6c8c 100644 --- a/src/Structure/Instructions/Instrs/Parametric/Select.php +++ b/src/Structure/Instructions/Instrs/Parametric/Select.php @@ -16,4 +16,9 @@ final readonly class Select extends Instr public array $types, ) { } + + public static function opName(): string + { + return "select"; + } } diff --git a/src/Structure/Instructions/Instrs/Reference/RefFunc.php b/src/Structure/Instructions/Instrs/Reference/RefFunc.php index 9924de1..0ccbc36 100644 --- a/src/Structure/Instructions/Instrs/Reference/RefFunc.php +++ b/src/Structure/Instructions/Instrs/Reference/RefFunc.php @@ -13,4 +13,9 @@ final readonly class RefFunc extends Instr public FuncIdx $func, ) { } + + public static function opName(): string + { + return "ref.func"; + } } diff --git a/src/Structure/Instructions/Instrs/Reference/RefIsNull.php b/src/Structure/Instructions/Instrs/Reference/RefIsNull.php index eb8db06..116fc4e 100644 --- a/src/Structure/Instructions/Instrs/Reference/RefIsNull.php +++ b/src/Structure/Instructions/Instrs/Reference/RefIsNull.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class RefIsNull extends Instr { + public static function opName(): string + { + return "ref.is_null"; + } } diff --git a/src/Structure/Instructions/Instrs/Reference/RefNull.php b/src/Structure/Instructions/Instrs/Reference/RefNull.php index 06e339c..11c603c 100644 --- a/src/Structure/Instructions/Instrs/Reference/RefNull.php +++ b/src/Structure/Instructions/Instrs/Reference/RefNull.php @@ -13,4 +13,9 @@ final readonly class RefNull extends Instr public RefType $type, ) { } + + public static function opName(): string + { + return "ref.null"; + } } diff --git a/src/Structure/Instructions/Instrs/Table/ElemDrop.php b/src/Structure/Instructions/Instrs/Table/ElemDrop.php index 5b96fcd..bbf4586 100644 --- a/src/Structure/Instructions/Instrs/Table/ElemDrop.php +++ b/src/Structure/Instructions/Instrs/Table/ElemDrop.php @@ -13,4 +13,9 @@ final readonly class ElemDrop extends Instr public ElemIdx $elem, ) { } + + public static function opName(): string + { + return "elem.drop"; + } } diff --git a/src/Structure/Instructions/Instrs/Table/TableCopy.php b/src/Structure/Instructions/Instrs/Table/TableCopy.php index 4c5d008..85aa9fc 100644 --- a/src/Structure/Instructions/Instrs/Table/TableCopy.php +++ b/src/Structure/Instructions/Instrs/Table/TableCopy.php @@ -14,4 +14,9 @@ final readonly class TableCopy extends Instr public TableIdx $from, ) { } + + public static function opName(): string + { + return "table.copy"; + } } diff --git a/src/Structure/Instructions/Instrs/Table/TableFill.php b/src/Structure/Instructions/Instrs/Table/TableFill.php index 43d1f57..84c6e13 100644 --- a/src/Structure/Instructions/Instrs/Table/TableFill.php +++ b/src/Structure/Instructions/Instrs/Table/TableFill.php @@ -13,4 +13,9 @@ final readonly class TableFill extends Instr public TableIdx $table, ) { } + + public static function opName(): string + { + return "table.fill"; + } } diff --git a/src/Structure/Instructions/Instrs/Table/TableGet.php b/src/Structure/Instructions/Instrs/Table/TableGet.php index 77ebf4a..e10dd5a 100644 --- a/src/Structure/Instructions/Instrs/Table/TableGet.php +++ b/src/Structure/Instructions/Instrs/Table/TableGet.php @@ -13,4 +13,9 @@ final readonly class TableGet extends Instr public TableIdx $table, ) { } + + public static function opName(): string + { + return "table.get"; + } } diff --git a/src/Structure/Instructions/Instrs/Table/TableGrow.php b/src/Structure/Instructions/Instrs/Table/TableGrow.php index 2ac222d..4f224fc 100644 --- a/src/Structure/Instructions/Instrs/Table/TableGrow.php +++ b/src/Structure/Instructions/Instrs/Table/TableGrow.php @@ -13,4 +13,9 @@ final readonly class TableGrow extends Instr public TableIdx $table, ) { } + + public static function opName(): string + { + return "table.grow"; + } } diff --git a/src/Structure/Instructions/Instrs/Table/TableInit.php b/src/Structure/Instructions/Instrs/Table/TableInit.php index 7617809..2c834c0 100644 --- a/src/Structure/Instructions/Instrs/Table/TableInit.php +++ b/src/Structure/Instructions/Instrs/Table/TableInit.php @@ -15,4 +15,9 @@ final readonly class TableInit extends Instr public ElemIdx $from, ) { } + + public static function opName(): string + { + return "table.init"; + } } diff --git a/src/Structure/Instructions/Instrs/Table/TableSet.php b/src/Structure/Instructions/Instrs/Table/TableSet.php index 7ac7c8e..f02c375 100644 --- a/src/Structure/Instructions/Instrs/Table/TableSet.php +++ b/src/Structure/Instructions/Instrs/Table/TableSet.php @@ -13,4 +13,9 @@ final readonly class TableSet extends Instr public TableIdx $table, ) { } + + public static function opName(): string + { + return "table.set"; + } } diff --git a/src/Structure/Instructions/Instrs/Table/TableSize.php b/src/Structure/Instructions/Instrs/Table/TableSize.php index 1c63e34..321c8f7 100644 --- a/src/Structure/Instructions/Instrs/Table/TableSize.php +++ b/src/Structure/Instructions/Instrs/Table/TableSize.php @@ -13,4 +13,9 @@ final readonly class TableSize extends Instr public TableIdx $table, ) { } + + public static function opName(): string + { + return "table.size"; + } } diff --git a/src/Structure/Instructions/Instrs/Variable/GlobalGet.php b/src/Structure/Instructions/Instrs/Variable/GlobalGet.php index a3bd2c6..542a805 100644 --- a/src/Structure/Instructions/Instrs/Variable/GlobalGet.php +++ b/src/Structure/Instructions/Instrs/Variable/GlobalGet.php @@ -13,4 +13,9 @@ final readonly class GlobalGet extends Instr public GlobalIdx $var, ) { } + + public static function opName(): string + { + return "global.get"; + } } diff --git a/src/Structure/Instructions/Instrs/Variable/GlobalSet.php b/src/Structure/Instructions/Instrs/Variable/GlobalSet.php index 080e15a..1540dd3 100644 --- a/src/Structure/Instructions/Instrs/Variable/GlobalSet.php +++ b/src/Structure/Instructions/Instrs/Variable/GlobalSet.php @@ -13,4 +13,9 @@ final readonly class GlobalSet extends Instr public GlobalIdx $var, ) { } + + public static function opName(): string + { + return "global.set"; + } } diff --git a/src/Structure/Instructions/Instrs/Variable/LocalGet.php b/src/Structure/Instructions/Instrs/Variable/LocalGet.php index bc764c2..4fc0ced 100644 --- a/src/Structure/Instructions/Instrs/Variable/LocalGet.php +++ b/src/Structure/Instructions/Instrs/Variable/LocalGet.php @@ -13,4 +13,9 @@ final readonly class LocalGet extends Instr public LocalIdx $var, ) { } + + public static function opName(): string + { + return "local.get"; + } } diff --git a/src/Structure/Instructions/Instrs/Variable/LocalSet.php b/src/Structure/Instructions/Instrs/Variable/LocalSet.php index 9b107e8..4a21ca3 100644 --- a/src/Structure/Instructions/Instrs/Variable/LocalSet.php +++ b/src/Structure/Instructions/Instrs/Variable/LocalSet.php @@ -13,4 +13,9 @@ final readonly class LocalSet extends Instr public LocalIdx $var, ) { } + + public static function opName(): string + { + return "local.set"; + } } diff --git a/src/Structure/Instructions/Instrs/Variable/LocalTee.php b/src/Structure/Instructions/Instrs/Variable/LocalTee.php index 3e48e8e..97fb46a 100644 --- a/src/Structure/Instructions/Instrs/Variable/LocalTee.php +++ b/src/Structure/Instructions/Instrs/Variable/LocalTee.php @@ -13,4 +13,9 @@ final readonly class LocalTee extends Instr public LocalIdx $var, ) { } + + public static function opName(): string + { + return "local.tee"; + } } |
