From 26f49b7e27076e689541b9e13a1b54f60a4ee5c2 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Thu, 11 Jul 2024 02:57:23 +0900 Subject: feat: organize namespaces --- .../Instructions/Instrs/Control/Block.php | 24 ++++++++++++++++++++ .../Instructions/Instrs/Control/BlockType.php | 25 +++++++++++++++++++++ .../Instrs/Control/BlockTypes/TypeIdx.php | 14 ++++++++++++ .../Instrs/Control/BlockTypes/ValType.php | 20 +++++++++++++++++ .../Structure/Instructions/Instrs/Control/Br.php | 20 +++++++++++++++++ .../Structure/Instructions/Instrs/Control/BrIf.php | 20 +++++++++++++++++ .../Instructions/Instrs/Control/BrTable.php | 24 ++++++++++++++++++++ .../Structure/Instructions/Instrs/Control/Call.php | 20 +++++++++++++++++ .../Instructions/Instrs/Control/CallIndirect.php | 21 +++++++++++++++++ .../Instructions/Instrs/Control/Else_.php | 15 +++++++++++++ .../Structure/Instructions/Instrs/Control/End.php | 15 +++++++++++++ .../Structure/Instructions/Instrs/Control/If_.php | 26 ++++++++++++++++++++++ .../Structure/Instructions/Instrs/Control/Loop.php | 24 ++++++++++++++++++++ .../Structure/Instructions/Instrs/Control/Nop.php | 15 +++++++++++++ .../Instructions/Instrs/Control/Return_.php | 15 +++++++++++++ .../Instructions/Instrs/Control/Unreachable.php | 15 +++++++++++++ 16 files changed, 313 insertions(+) create mode 100644 src/WebAssembly/Structure/Instructions/Instrs/Control/Block.php create mode 100644 src/WebAssembly/Structure/Instructions/Instrs/Control/BlockType.php create mode 100644 src/WebAssembly/Structure/Instructions/Instrs/Control/BlockTypes/TypeIdx.php create mode 100644 src/WebAssembly/Structure/Instructions/Instrs/Control/BlockTypes/ValType.php create mode 100644 src/WebAssembly/Structure/Instructions/Instrs/Control/Br.php create mode 100644 src/WebAssembly/Structure/Instructions/Instrs/Control/BrIf.php create mode 100644 src/WebAssembly/Structure/Instructions/Instrs/Control/BrTable.php create mode 100644 src/WebAssembly/Structure/Instructions/Instrs/Control/Call.php create mode 100644 src/WebAssembly/Structure/Instructions/Instrs/Control/CallIndirect.php create mode 100644 src/WebAssembly/Structure/Instructions/Instrs/Control/Else_.php create mode 100644 src/WebAssembly/Structure/Instructions/Instrs/Control/End.php create mode 100644 src/WebAssembly/Structure/Instructions/Instrs/Control/If_.php create mode 100644 src/WebAssembly/Structure/Instructions/Instrs/Control/Loop.php create mode 100644 src/WebAssembly/Structure/Instructions/Instrs/Control/Nop.php create mode 100644 src/WebAssembly/Structure/Instructions/Instrs/Control/Return_.php create mode 100644 src/WebAssembly/Structure/Instructions/Instrs/Control/Unreachable.php (limited to 'src/WebAssembly/Structure/Instructions/Instrs/Control') diff --git a/src/WebAssembly/Structure/Instructions/Instrs/Control/Block.php b/src/WebAssembly/Structure/Instructions/Instrs/Control/Block.php new file mode 100644 index 0000000..af2c97f --- /dev/null +++ b/src/WebAssembly/Structure/Instructions/Instrs/Control/Block.php @@ -0,0 +1,24 @@ + $body + */ + protected function __construct( + public BlockType $type, + public array $body, + ) { + } + + public static function opName(): string + { + return "block"; + } +} diff --git a/src/WebAssembly/Structure/Instructions/Instrs/Control/BlockType.php b/src/WebAssembly/Structure/Instructions/Instrs/Control/BlockType.php new file mode 100644 index 0000000..1188625 --- /dev/null +++ b/src/WebAssembly/Structure/Instructions/Instrs/Control/BlockType.php @@ -0,0 +1,25 @@ + $labelTable + */ + protected function __construct( + public array $labelTable, + public int $defaultLabel, + ) { + } + + public static function opName(): string + { + return "br_table"; + } +} diff --git a/src/WebAssembly/Structure/Instructions/Instrs/Control/Call.php b/src/WebAssembly/Structure/Instructions/Instrs/Control/Call.php new file mode 100644 index 0000000..461f561 --- /dev/null +++ b/src/WebAssembly/Structure/Instructions/Instrs/Control/Call.php @@ -0,0 +1,20 @@ + $thenBody + * @param list $elseBody + */ + protected function __construct( + public BlockType $type, + public array $thenBody, + public array $elseBody, + ) { + } + + public static function opName(): string + { + return "if"; + } +} diff --git a/src/WebAssembly/Structure/Instructions/Instrs/Control/Loop.php b/src/WebAssembly/Structure/Instructions/Instrs/Control/Loop.php new file mode 100644 index 0000000..ca48ca1 --- /dev/null +++ b/src/WebAssembly/Structure/Instructions/Instrs/Control/Loop.php @@ -0,0 +1,24 @@ + $body + */ + protected function __construct( + public BlockType $type, + public array $body, + ) { + } + + public static function opName(): string + { + return "loop"; + } +} diff --git a/src/WebAssembly/Structure/Instructions/Instrs/Control/Nop.php b/src/WebAssembly/Structure/Instructions/Instrs/Control/Nop.php new file mode 100644 index 0000000..50a3773 --- /dev/null +++ b/src/WebAssembly/Structure/Instructions/Instrs/Control/Nop.php @@ -0,0 +1,15 @@ +