Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
virgil-serbanuta committed Jan 22, 2025
1 parent 026cd6d commit c036994
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions pykwasm/src/pykwasm/scripts/binary-parser-gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,11 +331,12 @@ def with_prefix(self, p: bytes) -> 'InstrConfig':

# fmt: off
INSTRS_CONFIG:list[InstrConfig]=[
# Wasm _control instructions_ are encoded with the follow tags.
# Note that `ELSE` instructions must appear in conjunction with `IF` instructions.

# The tuple structure is:
# ('INSTRUCTION_NAME', b'instruction-prefix', ['Argument1Type', 'Argument2Type', ...], '#ConstructorName')

# Wasm _control instructions_.
# Note that `ELSE` instructions must appear in conjunction with `IF` instructions.

InstrConfig('UNREACHABLE', b'\x00', [], 'unreachable'),
InstrConfig('NOP', b'\x01', [], 'nop'),
InstrConfig('BLOCK', b'\x02', ['Block', ], identity()), # #block
Expand All @@ -349,7 +350,7 @@ def with_prefix(self, p: bytes) -> 'InstrConfig':
InstrConfig('CALL', b'\x10', ['UnsignedInt', ], '#call'),
InstrConfig('CALL_INDIRECT', b'\x11', ['UnsignedInt', 'UnsignedInt', ], 'buildCallIndirect'), # #call_indirect

# _Reference instructions_ are encoded with the following tags:
# _Reference instructions_::

InstrConfig('REF_NULL', b'\xD0', ['HeapType', ], symbol('aRef.null')),
InstrConfig('REF_ISNULL', b'\xD1', [], '#ref.is_null'),
Expand All @@ -359,15 +360,15 @@ def with_prefix(self, p: bytes) -> 'InstrConfig':
InstrConfig('SELECT', b'\x1B', [], 'select'),
InstrConfig('SELECT_GENERIC', b'\x1C', ['ValTypes', ], not_implemented()),

# _Variable instructions_ are encoded with the following tags:
# _Variable instructions_:

InstrConfig('LOCAL_GET', b'\x20', ['UnsignedInt', ], '#local.get'),
InstrConfig('LOCAL_SET', b'\x21', ['UnsignedInt', ], '#local.set'),
InstrConfig('LOCAL_TEE', b'\x22', ['UnsignedInt', ], '#local.tee'),
InstrConfig('GLOBAL_GET', b'\x23', ['UnsignedInt', ], '#global.get'),
InstrConfig('GLOBAL_SET', b'\x24', ['UnsignedInt', ], '#global.set'),

# _Table instructions_ are encoded with the following tags:
# _Table instructions_:

InstrConfig('TABLE_GET', b'\x25', ['UnsignedInt', ], '#table.get'),
InstrConfig('TABLE_SET', b'\x26', ['UnsignedInt', ], '#table.set'),
Expand All @@ -378,7 +379,7 @@ def with_prefix(self, p: bytes) -> 'InstrConfig':
InstrConfig('TABLE_SIZE', b'\xFC\x10', ['UnsignedInt', ], '#table.size'),
InstrConfig('TABLE_FILL', b'\xFC\x11', ['UnsignedInt', ], '#table.fill'),

# _Memory instructions_ are encoded with the following tags:
# _Memory instructions_::

InstrConfig('I32_LOAD', b'\x28', [constructor_arg('i32'), constructor_arg('load'), 'MemArg', ], '#load'),
InstrConfig('I64_LOAD', b'\x29', [constructor_arg('i64'), constructor_arg('load'), 'MemArg', ], '#load'),
Expand Down Expand Up @@ -410,7 +411,7 @@ def with_prefix(self, p: bytes) -> 'InstrConfig':
InstrConfig('MEM_COPY', b'\xFC\x0A', [parse_constant(b'\x00'), parse_constant(b'\x00'), ], 'memory.copy'),
InstrConfig('MEM_FILL', b'\xFC\x0B', [parse_constant(b'\x00'), ], 'memory.fill'),

# _Numeric instructions_ have the following tags:
# _Numeric instructions_:

InstrConfig('I32_CONST', b'\x41', [constructor_arg('i32'), 'SignedInt', ], symbol('aIConst')),
InstrConfig('I64_CONST', b'\x42', [constructor_arg('i64'), 'SignedInt', ], symbol('aIConst')),
Expand Down Expand Up @@ -568,7 +569,7 @@ def with_prefix(self, p: bytes) -> 'InstrConfig':
InstrConfig('I64_TRUNC_SAT_F64_S', b'\xFC\x06', [], not_implemented()),
InstrConfig('I64_TRUNC_SAT_F64_U', b'\xFC\x07', [], not_implemented()),

# _Vector instructions_ have the following tags:
# _Vector instructions_:

InstrConfig('V128_LOAD', b'\xFD\x00', ['MemArg', ], not_implemented()),
InstrConfig('V128_LOAD_8X8_S', b'\xFD\x01', ['MemArg', ], not_implemented()),
Expand Down

0 comments on commit c036994

Please sign in to comment.