diff --git a/src/Stack.zig b/src/Stack.zig index 68bdb72..7c2dedd 100644 --- a/src/Stack.zig +++ b/src/Stack.zig @@ -213,7 +213,7 @@ pub fn popIndexType(stack: *Stack, index_type: ValType) i64 { }; } -pub fn pushLabel(stack: *Stack, num_returns: u32, continuation: u32) !void { +pub fn pushLabel(stack: *Stack, num_returns: u32, continuation: u32) void { assert(stack.num_labels < stack.labels.len); stack.labels[stack.num_labels] = Label{ diff --git a/src/common.zig b/src/common.zig index aac66b4..cc33a5b 100644 --- a/src/common.zig +++ b/src/common.zig @@ -4,26 +4,6 @@ const std = @import("std"); pub const StableArray = @import("stable-array").StableArray; -pub fn decodeLEB128(comptime T: type, reader: anytype) !T { - if (@typeInfo(T).int.signedness == .signed) { - return std.leb.readILEB128(T, reader) catch |e| { - if (e == error.Overflow) { - return error.MalformedLEB128; - } else { - return e; - } - }; - } else { - return std.leb.readULEB128(T, reader) catch |e| { - if (e == error.Overflow) { - return error.MalformedLEB128; - } else { - return e; - } - }; - } -} - pub const LogLevel = enum(c_int) { Info, Error, diff --git a/src/definition.zig b/src/definition.zig index ba33aaf..df3047d 100644 --- a/src/definition.zig +++ b/src/definition.zig @@ -18,69 +18,71 @@ const Store = inst.Store; const GlobalInstance = inst.GlobalInstance; pub const MalformedError = error{ - MalformedMagicSignature, - MalformedUnexpectedEnd, - MalformedUnsupportedWasmVersion, - MalformedSectionId, - MalformedTypeSentinel, - MalformedLEB128, - MalformedMissingZeroByte, - MalformedTooManyLocals, - MalformedFunctionCodeSectionMismatch, - MalformedMissingDataCountSection, + MalformedBytecode, + MalformedCustomSection, MalformedDataCountMismatch, MalformedDataType, + MalformedElementType, + MalformedFunctionCodeSectionMismatch, MalformedIllegalOpcode, - MalformedReferenceType, - MalformedSectionSizeMismatch, MalformedInvalidImport, + MalformedLEB128, MalformedLimits, + MalformedMagicSignature, + MalformedMissingDataCountSection, + MalformedMissingZeroByte, MalformedMultipleStartSections, - MalformedElementType, - MalformedUTF8Encoding, MalformedMutability, - MalformedCustomSection, - + MalformedReferenceType, + MalformedSectionId, + MalformedSectionSizeMismatch, + MalformedTableType, + MalformedTooManyLocals, + MalformedTypeSentinel, + MalformedUnexpectedEnd, + MalformedUnsupportedWasmVersion, + MalformedUTF8Encoding, MalformedValType, - MalformedBytecode, }; pub const ValidationError = error{ - ValidationTypeMismatch, - ValidationTypeMustBeNumeric, - ValidationUnknownType, - ValidationUnknownFunction, - ValidationUnknownGlobal, - ValidationUnknownLocal, - ValidationUnknownTable, - ValidationUnknownMemory, - ValidationUnknownElement, - ValidationUnknownData, - ValidationOutOfBounds, - ValidationTypeStackHeightMismatch, ValidationBadAlignment, - ValidationUnknownLabel, - ValidationImmutableGlobal, ValidationBadConstantExpression, - ValidationGlobalReferencingMutableGlobal, - ValidationUnknownBlockTypeIndex, - ValidationSelectArity, - ValidationMultipleMemories, - ValidationMemoryInvalidMaxLimit, - ValidationMemoryMaxPagesExceeded, - ValidationConstantExpressionGlobalMustBeImport, ValidationConstantExpressionGlobalMustBeImmutable, - ValidationStartFunctionType, - ValidationLimitsMinMustNotBeLargerThanMax, + ValidationConstantExpressionGlobalMustBeImport, ValidationConstantExpressionTypeMismatch, ValidationDuplicateExportName, ValidationFuncRefUndeclared, + ValidationGlobalReferencingMutableGlobal, ValidationIfElseMismatch, + ValidationImmutableGlobal, ValidationInvalidLaneIndex, + ValidationLimitsMinMustNotBeLargerThanMax, + ValidationMemoryInvalidMaxLimit, + ValidationMemoryMaxPagesExceeded, + ValidationMultipleMemories, + ValidationOutOfBounds, + ValidationSelectArity, + ValidationStartFunctionType, ValidationTooManyFunctionImportParams, ValidationTooManyFunctionImportReturns, + ValidationTypeMismatch, + ValidationTypeMustBeNumeric, + ValidationTypeStackHeightMismatch, + ValidationUnknownBlockTypeIndex, + ValidationUnknownData, + ValidationUnknownElement, + ValidationUnknownFunction, + ValidationUnknownGlobal, + ValidationUnknownLabel, + ValidationUnknownLocal, + ValidationUnknownMemory, + ValidationUnknownTable, + ValidationUnknownType, }; +const DecodeError = AllocError || MalformedError || ValidationError; + pub const i8x16 = @Vector(16, i8); pub const u8x16 = @Vector(16, u8); pub const i16x8 = @Vector(8, i16); @@ -98,17 +100,79 @@ const Section = enum(u8) { Custom, FunctionType, Import, Function, Table, Memory const k_function_type_sentinel_byte: u8 = 0x60; const k_block_type_void_sentinel_byte: u8 = 0x40; -fn decodeFloat(comptime T: type, reader: anytype) !T { +fn eosError(e: anyerror) MalformedError { + if (e == error.EndOfStream) { + return MalformedError.MalformedUnexpectedEnd; + } else if (e == error.EndOfBuffer) { + return MalformedError.MalformedUnexpectedEnd; + } else { + unreachable; + } +} + +fn readByte(reader: anytype) MalformedError!u8 { + return reader.readByte() catch |e| return eosError(e); +} + +fn readBytes(reader: anytype, bytes: []u8) MalformedError!usize { + return reader.read(bytes) catch |e| return eosError(e); +} + +fn decodeLEB128(comptime T: type, reader: anytype) MalformedError!T { + if (@typeInfo(T).int.signedness == .signed) { + return std.leb.readILEB128(T, reader) catch |e| { + if (e == error.Overflow) { + return error.MalformedLEB128; + } else { + return eosError(e); + } + }; + } else { + return std.leb.readULEB128(T, reader) catch |e| { + if (e == error.Overflow) { + return error.MalformedLEB128; + } else { + return eosError(e); + } + }; + } +} + +fn decodeWasmOpcode(reader: anytype) MalformedError!WasmOpcode { + const byte = try readByte(&reader); + var wasm_op: WasmOpcode = undefined; + if (byte == 0xFC or byte == 0xFD) { + const type_opcode = try decodeLEB128(u32, reader); + if (type_opcode > std.math.maxInt(u8)) { + return error.MalformedIllegalOpcode; + } + const byte2 = @as(u8, @intCast(type_opcode)); + var extended: u16 = byte; + extended = extended << 8; + extended |= byte2; + + wasm_op = std.meta.intToEnum(WasmOpcode, extended) catch { + return error.MalformedIllegalOpcode; + }; + } else { + wasm_op = std.meta.intToEnum(WasmOpcode, byte) catch { + return error.MalformedIllegalOpcode; + }; + } + return wasm_op; +} + +fn decodeFloat(comptime T: type, reader: anytype) MalformedError!T { return switch (T) { - f32 => @as(f32, @bitCast(try reader.readInt(u32, .little))), - f64 => @as(f64, @bitCast(try reader.readInt(u64, .little))), + f32 => @as(f32, @bitCast(reader.readInt(u32, .little) catch |e| return eosError(e))), + f64 => @as(f64, @bitCast(reader.readInt(u64, .little) catch |e| return eosError(e))), else => unreachable, }; } -fn decodeVec(reader: anytype) !v128 { +fn decodeVec(reader: anytype) MalformedError!v128 { var bytes: [16]u8 = undefined; - _ = try reader.read(&bytes); + _ = reader.read(&bytes) catch |e| eosError(e); return std.mem.bytesToValue(v128, &bytes); } @@ -121,7 +185,7 @@ pub const ValType = enum(c_int) { FuncRef, ExternRef, - fn bytecodeToValtype(byte: u8) !ValType { + fn bytecodeToValtype(byte: u8) MalformedError!ValType { return switch (byte) { 0x7B => .V128, 0x7F => .I32, @@ -136,11 +200,11 @@ pub const ValType = enum(c_int) { }; } - fn decode(reader: anytype) !ValType { - return try bytecodeToValtype(try reader.readByte()); + fn decode(reader: anytype) MalformedError!ValType { + return try bytecodeToValtype(try readByte(&reader)); } - fn decodeReftype(reader: anytype) !ValType { + fn decodeReftype(reader: anytype) MalformedError!ValType { const valtype = try decode(reader); if (isRefType(valtype) == false) { return error.MalformedReferenceType; @@ -317,7 +381,7 @@ pub const Limits = struct { pub const k_max_pages_i64 = k_max_bytes_i64 / MemoryDefinition.k_page_size; fn decode(reader: anytype) !Limits { - const limit_type: u8 = try reader.readByte(); + const limit_type: u8 = try readByte(&reader); if (limit_type > 7) { return error.MalformedLimits; @@ -325,7 +389,7 @@ pub const Limits = struct { const is_u32 = limit_type < 4; - const min = common.decodeLEB128(u64, reader) catch return error.MalformedLimits; + const min = decodeLEB128(u64, reader) catch return error.MalformedLimits; if (is_u32 and min > std.math.maxInt(u32)) { return error.MalformedLimits; } @@ -335,7 +399,7 @@ pub const Limits = struct { switch (std.math.rem(u8, limit_type, 2) catch unreachable) { 0 => {}, 1 => { - max = common.decodeLEB128(u64, reader) catch return error.MalformedLimits; + max = decodeLEB128(u64, reader) catch return error.MalformedLimits; if (is_u32 and max.? > std.math.maxInt(u32)) { return error.MalformedLimits; } @@ -423,17 +487,17 @@ pub const ConstantExpression = union(ConstantExpressionType) { }; fn decode(reader: anytype, module_def: *const ModuleDefinition, comptime expected_global_mut: ExpectedGlobalMut, expected_valtype: ValType) !ConstantExpression { - const opcode = try WasmOpcode.decode(reader); + const opcode = try decodeWasmOpcode(reader); const expr = switch (opcode) { - .I32_Const => ConstantExpression{ .Value = TaggedVal{ .type = .I32, .val = .{ .I32 = try common.decodeLEB128(i32, reader) } } }, - .I64_Const => ConstantExpression{ .Value = TaggedVal{ .type = .I64, .val = .{ .I64 = try common.decodeLEB128(i64, reader) } } }, + .I32_Const => ConstantExpression{ .Value = TaggedVal{ .type = .I32, .val = .{ .I32 = try decodeLEB128(i32, reader) } } }, + .I64_Const => ConstantExpression{ .Value = TaggedVal{ .type = .I64, .val = .{ .I64 = try decodeLEB128(i64, reader) } } }, .F32_Const => ConstantExpression{ .Value = TaggedVal{ .type = .F32, .val = .{ .F32 = try decodeFloat(f32, reader) } } }, .F64_Const => ConstantExpression{ .Value = TaggedVal{ .type = .F64, .val = .{ .F64 = try decodeFloat(f64, reader) } } }, .V128_Const => ConstantExpression{ .Value = TaggedVal{ .type = .V128, .val = .{ .V128 = try decodeVec(reader) } } }, .Ref_Null => ConstantExpression{ .Value = TaggedVal.nullRef(try ValType.decode(reader)) orelse return error.MalformedBytecode }, - .Ref_Func => ConstantExpression{ .Value = TaggedVal.funcrefFromIndex(try common.decodeLEB128(u32, reader)) }, - .Global_Get => ConstantExpression{ .Global = try common.decodeLEB128(u32, reader) }, + .Ref_Func => ConstantExpression{ .Value = TaggedVal.funcrefFromIndex(try decodeLEB128(u32, reader)) }, + .Global_Get => ConstantExpression{ .Global = try decodeLEB128(u32, reader) }, else => return error.ValidationBadConstantExpression, }; @@ -476,7 +540,7 @@ pub const ConstantExpression = union(ConstantExpressionType) { } } - const end = @as(WasmOpcode, @enumFromInt(try reader.readByte())); + const end = @as(WasmOpcode, @enumFromInt(try readByte(&reader))); if (end != .End) { return error.ValidationBadConstantExpression; } @@ -597,7 +661,7 @@ pub const GlobalMut = enum(u8) { Mutable = 1, fn decode(reader: anytype) !GlobalMut { - const byte = try reader.readByte(); + const byte = try readByte(&reader); const value = std.meta.intToEnum(GlobalMut, byte) catch { return error.MalformedMutability; }; @@ -654,8 +718,8 @@ pub const DataDefinition = struct { offset: ?ConstantExpression, mode: DataMode, - fn decode(reader: anytype, module_def: *const ModuleDefinition, allocator: std.mem.Allocator) !DataDefinition { - const data_type: u32 = try common.decodeLEB128(u32, reader); + fn decode(reader: anytype, module_def: *const ModuleDefinition, allocator: std.mem.Allocator) DecodeError!DataDefinition { + const data_type: u32 = try decodeLEB128(u32, reader); if (data_type > 2) { return error.MalformedDataType; } @@ -665,7 +729,7 @@ pub const DataDefinition = struct { if (data_type == 0x00) { memory_index = 0; } else if (data_type == 0x02) { - memory_index = try common.decodeLEB128(u32, reader); + memory_index = try decodeLEB128(u32, reader); } if (memory_index) |index| { @@ -683,10 +747,10 @@ pub const DataDefinition = struct { offset = try ConstantExpression.decode(reader, module_def, .Immutable, index_type); } - const num_bytes = try common.decodeLEB128(u32, reader); + const num_bytes = try decodeLEB128(u32, reader); var bytes = std.ArrayList(u8).init(allocator); try bytes.resize(num_bytes); - const num_read = try reader.read(bytes.items); + const num_read = try readBytes(reader, bytes.items); if (num_read != num_bytes) { return error.MalformedUnexpectedEnd; } @@ -737,8 +801,8 @@ const MemArg = struct { fn decode(reader: anytype, comptime bitwidth: u32) !MemArg { std.debug.assert(bitwidth % 8 == 0); const memarg = MemArg{ - .alignment = try common.decodeLEB128(u32, reader), - .offset = try common.decodeLEB128(u64, reader), + .alignment = try decodeLEB128(u32, reader), + .offset = try decodeLEB128(u64, reader), }; const bit_alignment = std.math.powi(u32, 2, memarg.alignment) catch return error.ValidationBadAlignment; if (bit_alignment > bitwidth / 8) { @@ -845,7 +909,7 @@ pub const Instruction = struct { var block_type: BlockType = undefined; var block_value: BlockTypeValue = undefined; - const blocktype_raw = try _reader.readByte(); + const blocktype_raw = try readByte(&_reader); const valtype_or_err = ValType.bytecodeToValtype(blocktype_raw); if (std.meta.isError(valtype_or_err)) { if (blocktype_raw == k_block_type_void_sentinel_byte) { @@ -853,7 +917,7 @@ pub const Instruction = struct { block_value = BlockTypeValue{ .TypeIndex = 0 }; } else { _reader.context.pos -= 1; // move the stream backwards 1 byte to reconstruct the integer - const index_33bit = try common.decodeLEB128(i33, _reader); + const index_33bit = try decodeLEB128(i33, _reader); if (index_33bit < 0) { return error.MalformedBytecode; } @@ -888,8 +952,8 @@ pub const Instruction = struct { } fn decodeTablePair(_reader: anytype) !InstructionImmediates { - const elem_index = try common.decodeLEB128(u32, _reader); - const table_index = try common.decodeLEB128(u32, _reader); + const elem_index = try decodeLEB128(u32, _reader); + const table_index = try decodeLEB128(u32, _reader); return InstructionImmediates{ .TablePair = TablePairImmediates{ @@ -899,9 +963,9 @@ pub const Instruction = struct { }; } - fn decodeMemoryOffsetAndLane(_reader: anytype, comptime bitwidth: u32, _module: *ModuleDefinition) !InstructionImmediates { + fn decodeMemoryOffsetAndLane(_reader: anytype, comptime bitwidth: u32, _module: *ModuleDefinition) DecodeError!InstructionImmediates { const memarg = try MemArg.decode(_reader, bitwidth); - const laneidx = try _reader.readByte(); + const laneidx = try readByte(&_reader); const immediates = MemoryOffsetAndLaneImmediates{ .offset = memarg.offset, .laneidx = laneidx, @@ -912,7 +976,7 @@ pub const Instruction = struct { } }; - const wasm_op: WasmOpcode = try WasmOpcode.decode(reader); + const wasm_op: WasmOpcode = try decodeWasmOpcode(reader); // note that this opcode can be remapped as we get more information about the instruction var opcode: Opcode = wasm_op.toOpcode(); @@ -921,14 +985,14 @@ pub const Instruction = struct { switch (opcode) { .Select_T => { - const num_types = try common.decodeLEB128(u32, reader); + const num_types = try decodeLEB128(u32, reader); if (num_types != 1) { return error.ValidationSelectArity; } immediate = InstructionImmediates{ .ValType = try ValType.decode(reader) }; }, .Local_Get, .Local_Set, .Local_Tee => { - const index = try common.decodeLEB128(u32, reader); + const index = try decodeLEB128(u32, reader); immediate = InstructionImmediates{ .Index = index }; const type_def: *const FunctionTypeDefinition = func.typeDefinition(module); @@ -956,7 +1020,7 @@ pub const Instruction = struct { } }, .Global_Get, .Global_Set => { - immediate = InstructionImmediates{ .Index = try common.decodeLEB128(u32, reader) }; + immediate = InstructionImmediates{ .Index = try decodeLEB128(u32, reader) }; if (immediate.Index < module.globals.items.len) { if (module.globals.items[immediate.Index].valtype == .V128) { opcode = switch (opcode) { @@ -968,16 +1032,16 @@ pub const Instruction = struct { } }, .Table_Get => { - immediate = InstructionImmediates{ .Index = try common.decodeLEB128(u32, reader) }; + immediate = InstructionImmediates{ .Index = try decodeLEB128(u32, reader) }; }, .Table_Set => { - immediate = InstructionImmediates{ .Index = try common.decodeLEB128(u32, reader) }; + immediate = InstructionImmediates{ .Index = try decodeLEB128(u32, reader) }; }, .I32_Const => { - immediate = InstructionImmediates{ .ValueI32 = try common.decodeLEB128(i32, reader) }; + immediate = InstructionImmediates{ .ValueI32 = try decodeLEB128(i32, reader) }; }, .I64_Const => { - immediate = InstructionImmediates{ .ValueI64 = try common.decodeLEB128(i64, reader) }; + immediate = InstructionImmediates{ .ValueI64 = try decodeLEB128(i64, reader) }; }, .F32_Const => { immediate = InstructionImmediates{ .ValueF32 = try decodeFloat(f32, reader) }; @@ -1005,13 +1069,13 @@ pub const Instruction = struct { }; }, .Branch => { - immediate = InstructionImmediates{ .LabelId = try common.decodeLEB128(u32, reader) }; + immediate = InstructionImmediates{ .LabelId = try decodeLEB128(u32, reader) }; }, .Branch_If => { - immediate = InstructionImmediates{ .LabelId = try common.decodeLEB128(u32, reader) }; + immediate = InstructionImmediates{ .LabelId = try decodeLEB128(u32, reader) }; }, .Branch_Table => { - const table_length = try common.decodeLEB128(u32, reader); + const table_length = try decodeLEB128(u32, reader); var label_ids = std.ArrayList(u32).init(module.allocator); defer label_ids.deinit(); @@ -1019,10 +1083,10 @@ pub const Instruction = struct { var index: u32 = 0; while (index < table_length) : (index += 1) { - const id = try common.decodeLEB128(u32, reader); + const id = try decodeLEB128(u32, reader); label_ids.addOneAssumeCapacity().* = id; } - const fallback_id = try common.decodeLEB128(u32, reader); + const fallback_id = try decodeLEB128(u32, reader); // check to see if there are any existing tables we can reuse var needs_immediate: bool = true; @@ -1054,13 +1118,13 @@ pub const Instruction = struct { } }, .Call_Local => { - const index = try common.decodeLEB128(u32, reader); + const index = try decodeLEB128(u32, reader); immediate = InstructionImmediates{ .Index = index }; // function index }, .Call_Indirect => { immediate = InstructionImmediates{ .CallIndirect = .{ - .type_index = try common.decodeLEB128(u32, reader), - .table_index = try common.decodeLEB128(u32, reader), + .type_index = try decodeLEB128(u32, reader), + .table_index = try decodeLEB128(u32, reader), } }; }, .I32_Load => { @@ -1156,13 +1220,13 @@ pub const Instruction = struct { immediate = InstructionImmediates{ .MemoryOffset = memarg.offset }; }, .Memory_Size => { - const reserved = try reader.readByte(); + const reserved = try readByte(&reader); if (reserved != 0x00) { return error.MalformedMissingZeroByte; } }, .Memory_Grow => { - const reserved = try reader.readByte(); + const reserved = try readByte(&reader); if (reserved != 0x00) { return error.MalformedMissingZeroByte; } @@ -1174,9 +1238,9 @@ pub const Instruction = struct { return error.MalformedMissingDataCountSection; } - immediate = InstructionImmediates{ .Index = try common.decodeLEB128(u32, reader) }; // dataidx + immediate = InstructionImmediates{ .Index = try decodeLEB128(u32, reader) }; // dataidx - const reserved = try reader.readByte(); + const reserved = try readByte(&reader); if (reserved != 0x00) { return error.MalformedMissingZeroByte; } @@ -1190,23 +1254,23 @@ pub const Instruction = struct { immediate = InstructionImmediates{ .ValType = valtype }; }, .Ref_Func => { - immediate = InstructionImmediates{ .Index = try common.decodeLEB128(u32, reader) }; // funcidx + immediate = InstructionImmediates{ .Index = try decodeLEB128(u32, reader) }; // funcidx }, .Data_Drop => { - immediate = InstructionImmediates{ .Index = try common.decodeLEB128(u32, reader) }; // dataidx + immediate = InstructionImmediates{ .Index = try decodeLEB128(u32, reader) }; // dataidx }, .Memory_Copy => { - var reserved = try reader.readByte(); + var reserved = try readByte(&reader); if (reserved != 0x00) { return error.MalformedMissingZeroByte; } - reserved = try reader.readByte(); + reserved = try readByte(&reader); if (reserved != 0x00) { return error.MalformedMissingZeroByte; } }, .Memory_Fill => { - const reserved = try reader.readByte(); + const reserved = try readByte(&reader); if (reserved != 0x00) { return error.MalformedMissingZeroByte; } @@ -1215,19 +1279,19 @@ pub const Instruction = struct { immediate = try Helpers.decodeTablePair(reader); }, .Elem_Drop => { - immediate = InstructionImmediates{ .Index = try common.decodeLEB128(u32, reader) }; // elemidx + immediate = InstructionImmediates{ .Index = try decodeLEB128(u32, reader) }; // elemidx }, .Table_Copy => { immediate = try Helpers.decodeTablePair(reader); }, .Table_Grow => { - immediate = InstructionImmediates{ .Index = try common.decodeLEB128(u32, reader) }; // elemidx + immediate = InstructionImmediates{ .Index = try decodeLEB128(u32, reader) }; // elemidx }, .Table_Size => { - immediate = InstructionImmediates{ .Index = try common.decodeLEB128(u32, reader) }; // elemidx + immediate = InstructionImmediates{ .Index = try decodeLEB128(u32, reader) }; // elemidx }, .Table_Fill => { - immediate = InstructionImmediates{ .Index = try common.decodeLEB128(u32, reader) }; // elemidx + immediate = InstructionImmediates{ .Index = try decodeLEB128(u32, reader) }; // elemidx }, .V128_Load => { const memarg = try MemArg.decode(reader, 128); @@ -1276,7 +1340,7 @@ pub const Instruction = struct { .F64x2_Extract_Lane, .F64x2_Replace_Lane, => { - immediate = InstructionImmediates{ .Index = try reader.readByte() }; // laneidx + immediate = InstructionImmediates{ .Index = try readByte(&reader) }; // laneidx }, .V128_Store => { const memarg = try MemArg.decode(reader, 128); @@ -1290,7 +1354,7 @@ pub const Instruction = struct { .I8x16_Shuffle => { var lane_indices: [16]u8 = undefined; for (&lane_indices) |*v| { - const laneidx: u8 = try reader.readByte(); + const laneidx: u8 = try readByte(&reader); v.* = laneidx; } @@ -1374,7 +1438,7 @@ pub const NameCustomSection = struct { const DecodeHelpers = struct { fn readName(stream: anytype) ![]const u8 { const reader = stream.reader(); - const name_length = try common.decodeLEB128(u32, reader); + const name_length = try decodeLEB128(u32, reader); const name: []const u8 = stream.buffer[stream.pos .. stream.pos + name_length]; try stream.seekBy(name_length); return name; @@ -1385,20 +1449,20 @@ pub const NameCustomSection = struct { var reader = fixed_buffer_stream.reader(); while (try fixed_buffer_stream.getPos() != try fixed_buffer_stream.getEndPos()) { - const section_code = try reader.readByte(); - const section_size = try common.decodeLEB128(u32, reader); + const section_code = try readByte(&reader); + const section_size = try decodeLEB128(u32, reader); switch (section_code) { 0 => { self.module_name = try DecodeHelpers.readName(&fixed_buffer_stream); }, 1 => { - const num_func_names = try common.decodeLEB128(u32, reader); + const num_func_names = try decodeLEB128(u32, reader); try self.function_names.ensureTotalCapacity(num_func_names); var index: u32 = 0; while (index < num_func_names) : (index += 1) { - const func_index = try common.decodeLEB128(u32, reader); + const func_index = try decodeLEB128(u32, reader); const func_name: []const u8 = try DecodeHelpers.readName(&fixed_buffer_stream); try self.function_names.putNoClobber(func_index, func_name); } @@ -2780,28 +2844,18 @@ pub const ModuleDefinition = struct { return def; } - pub fn decode(self: *ModuleDefinition, wasm: []const u8) anyerror!void { + pub fn decode(self: *ModuleDefinition, wasm: []const u8) DecodeError!void { std.debug.assert(self.is_decoded == false); - self.decodeInternal(wasm) catch |e| { - const wrapped_error: anyerror = switch (e) { - error.EndOfStream => error.MalformedUnexpectedEnd, - else => e, - }; - return wrapped_error; - }; - } - - fn decodeInternal(self: *ModuleDefinition, wasm: []const u8) anyerror!void { const DecodeHelpers = struct { - fn readRefValue(valtype: ValType, reader: anytype) !Val { + fn readRefValue(valtype: ValType, reader: anytype) MalformedError!Val { switch (valtype) { .FuncRef => { - const func_index = try common.decodeLEB128(u32, reader); + const func_index = try decodeLEB128(u32, reader); return Val.funcrefFromIndex(func_index); }, .ExternRef => { - const ref = try common.decodeLEB128(usize, reader); + const ref = try decodeLEB128(usize, reader); return Val{ .ExternRef = ref }; }, else => unreachable, @@ -2809,8 +2863,8 @@ pub const ModuleDefinition = struct { } // TODO move these names into a string pool - fn readName(reader: anytype, _allocator: std.mem.Allocator) ![]const u8 { - const name_length = try common.decodeLEB128(u32, reader); + fn readName(reader: anytype, _allocator: std.mem.Allocator) DecodeError![]const u8 { + const name_length = try decodeLEB128(u32, reader); const name: []u8 = try _allocator.alloc(u8, name_length); errdefer _allocator.free(name); @@ -2836,11 +2890,11 @@ pub const ModuleDefinition = struct { // wasm header { - const magic = try reader.readInt(u32, .big); + const magic = reader.readInt(u32, .big) catch |e| return eosError(e); if (magic != 0x0061736D) { return error.MalformedMagicSignature; } - const version = try reader.readInt(u32, .little); + const version = reader.readInt(u32, .little) catch |e| return eosError(e); if (version != 1) { return error.MalformedUnsupportedWasmVersion; } @@ -2849,10 +2903,10 @@ pub const ModuleDefinition = struct { var num_functions_parsed: u32 = 0; while (stream.pos < stream.buffer.len) { - const section_id: Section = std.meta.intToEnum(Section, try reader.readByte()) catch { + const section_id: Section = std.meta.intToEnum(Section, try readByte(&reader)) catch { return error.MalformedSectionId; }; - const section_size_bytes: usize = try common.decodeLEB128(u32, reader); + const section_size_bytes: usize = try decodeLEB128(u32, reader); const section_start_pos = stream.pos; switch (section_id) { @@ -2884,18 +2938,18 @@ pub const ModuleDefinition = struct { } }, .FunctionType => { - const num_types = try common.decodeLEB128(u32, reader); + const num_types = try decodeLEB128(u32, reader); try self.types.ensureTotalCapacity(num_types); var types_index: u32 = 0; while (types_index < num_types) : (types_index += 1) { - const sentinel = try reader.readByte(); + const sentinel = try readByte(&reader); if (sentinel != k_function_type_sentinel_byte) { return error.MalformedTypeSentinel; } - const num_params = try common.decodeLEB128(u32, reader); + const num_params = try decodeLEB128(u32, reader); var func = FunctionTypeDefinition{ .num_params = num_params, .types = std.ArrayList(ValType).init(allocator) }; errdefer func.types.deinit(); @@ -2908,7 +2962,7 @@ pub const ModuleDefinition = struct { try func.types.append(param_type); } - const num_returns = try common.decodeLEB128(u32, reader); + const num_returns = try decodeLEB128(u32, reader); var returns_left = num_returns; while (returns_left > 0) { returns_left -= 1; @@ -2921,7 +2975,7 @@ pub const ModuleDefinition = struct { } }, .Import => { - const num_imports = try common.decodeLEB128(u32, reader); + const num_imports = try decodeLEB128(u32, reader); var import_index: u32 = 0; while (import_index < num_imports) : (import_index += 1) { @@ -2936,10 +2990,10 @@ pub const ModuleDefinition = struct { .import_name = import_name, }; - const desc = try reader.readByte(); + const desc = try readByte(&reader); switch (desc) { 0x00 => { - const type_index = try common.decodeLEB128(u32, reader); + const type_index = try decodeLEB128(u32, reader); try ModuleValidator.validateTypeIndex(type_index, self); const func_type: *const FunctionTypeDefinition = &self.types.items[type_index]; if (func_type.num_params >= MAX_FUNCTION_IMPORT_PARAMS) { @@ -3023,14 +3077,14 @@ pub const ModuleDefinition = struct { } }, .Function => { - const num_funcs = try common.decodeLEB128(u32, reader); + const num_funcs = try decodeLEB128(u32, reader); // the array could have already been populated with import trampolines try self.functions.ensureUnusedCapacity(num_funcs); for (0..num_funcs) |_| { const func = FunctionDefinition{ - .type_index = try common.decodeLEB128(u32, reader), + .type_index = try decodeLEB128(u32, reader), // we'll fix these up later when we find them in the Code section .instructions_begin = 0, @@ -3044,7 +3098,7 @@ pub const ModuleDefinition = struct { } }, .Table => { - const num_tables = try common.decodeLEB128(u32, reader); + const num_tables = try decodeLEB128(u32, reader); try self.tables.ensureTotalCapacity(num_tables); @@ -3052,7 +3106,7 @@ pub const ModuleDefinition = struct { while (table_index < num_tables) : (table_index += 1) { const valtype = try ValType.decode(reader); if (valtype.isRefType() == false) { - return error.InvalidTableType; + return error.MalformedTableType; } const limits = try Limits.decode(reader); @@ -3064,7 +3118,7 @@ pub const ModuleDefinition = struct { } }, .Memory => { - const num_memories = try common.decodeLEB128(u32, reader); + const num_memories = try decodeLEB128(u32, reader); if (num_memories > 1) { return error.ValidationMultipleMemories; @@ -3107,7 +3161,7 @@ pub const ModuleDefinition = struct { } }, .Global => { - const num_globals = try common.decodeLEB128(u32, reader); + const num_globals = try decodeLEB128(u32, reader); try self.globals.ensureTotalCapacity(num_globals); @@ -3135,7 +3189,7 @@ pub const ModuleDefinition = struct { } }, .Export => { - const num_exports = try common.decodeLEB128(u32, reader); + const num_exports = try decodeLEB128(u32, reader); var export_names = std.StringHashMap(void).init(allocator); defer export_names.deinit(); @@ -3152,8 +3206,8 @@ pub const ModuleDefinition = struct { } } - const exportType = @as(ExportType, @enumFromInt(try reader.readByte())); - const item_index = try common.decodeLEB128(u32, reader); + const exportType = @as(ExportType, @enumFromInt(try readByte(&reader))); + const item_index = try decodeLEB128(u32, reader); const def = ExportDefinition{ .name = name, .index = item_index }; switch (exportType) { @@ -3183,7 +3237,7 @@ pub const ModuleDefinition = struct { return error.MalformedMultipleStartSections; } - self.start_func_index = try common.decodeLEB128(u32, reader); + self.start_func_index = try decodeLEB128(u32, reader); if (self.functions.items.len <= self.start_func_index.?) { return error.ValidationUnknownFunction; @@ -3203,7 +3257,7 @@ pub const ModuleDefinition = struct { } fn readElemsVal(elems: *std.ArrayList(Val), valtype: ValType, _reader: anytype, _module: *const ModuleDefinition) !void { - const num_elems = try common.decodeLEB128(u32, _reader); + const num_elems = try decodeLEB128(u32, _reader); try elems.ensureTotalCapacity(num_elems); var elem_index: u32 = 0; @@ -3217,7 +3271,7 @@ pub const ModuleDefinition = struct { } fn readElemsExpr(elems: *std.ArrayList(ConstantExpression), _reader: anytype, _module: *const ModuleDefinition, expected_reftype: ValType) !void { - const num_elems = try common.decodeLEB128(u32, _reader); + const num_elems = try decodeLEB128(u32, _reader); try elems.ensureTotalCapacity(num_elems); var elem_index: u32 = 0; @@ -3228,20 +3282,20 @@ pub const ModuleDefinition = struct { } fn readNullElemkind(_reader: anytype) !void { - const null_elemkind = try _reader.readByte(); + const null_elemkind = try readByte(&_reader); if (null_elemkind != 0x00) { return error.MalformedBytecode; } } }; - const num_segments = try common.decodeLEB128(u32, reader); + const num_segments = try decodeLEB128(u32, reader); try self.elements.ensureTotalCapacity(num_segments); var segment_index: u32 = 0; while (segment_index < num_segments) : (segment_index += 1) { - const flags = try common.decodeLEB128(u32, reader); + const flags = try decodeLEB128(u32, reader); var def = ElementDefinition{ .mode = ElementMode.Active, @@ -3265,7 +3319,7 @@ pub const ModuleDefinition = struct { try ElementHelpers.readElemsVal(&def.elems_value, def.reftype, reader, self); }, 0x02 => { - def.table_index = try common.decodeLEB128(u32, reader); + def.table_index = try decodeLEB128(u32, reader); def.offset = try ElementHelpers.readOffsetExpr(reader, self); try ElementHelpers.readNullElemkind(reader); try ElementHelpers.readElemsVal(&def.elems_value, def.reftype, reader, self); @@ -3285,7 +3339,7 @@ pub const ModuleDefinition = struct { try ElementHelpers.readElemsExpr(&def.elems_expr, reader, self, def.reftype); }, 0x06 => { - def.table_index = try common.decodeLEB128(u32, reader); + def.table_index = try decodeLEB128(u32, reader); def.offset = try ElementHelpers.readOffsetExpr(reader, self); def.reftype = try ValType.decodeReftype(reader); try ElementHelpers.readElemsExpr(&def.elems_expr, reader, self, def.reftype); @@ -3318,7 +3372,7 @@ pub const ModuleDefinition = struct { var instruction_validation_immediates = &self.code.validation_immediates; std.debug.assert(instructions.items.len == instruction_validation_immediates.items.len); - const num_codes = try common.decodeLEB128(u32, reader); + const num_codes = try decodeLEB128(u32, reader); // codes refer to local functions not including the trampoline funcs we've generated for calling imports if (num_codes != self.functions.items.len - self.imports.functions.items.len) { @@ -3336,7 +3390,7 @@ pub const ModuleDefinition = struct { var code_index: u32 = 0; while (code_index < num_codes) { - const code_size = try common.decodeLEB128(u32, reader); + const code_size = try decodeLEB128(u32, reader); const code_begin_pos = stream.pos; var func_def: *FunctionDefinition = &self.functions.items[code_index + self.imports.functions.items.len]; @@ -3345,12 +3399,12 @@ pub const ModuleDefinition = struct { { func_def.locals_begin = self.code.locals.items.len; - const num_locals = try common.decodeLEB128(u32, reader); + const num_locals = try decodeLEB128(u32, reader); try local_types_scratch.resize(num_locals); var locals_total: usize = 0; for (local_types_scratch.items) |*item| { - const n = try common.decodeLEB128(u32, reader); + const n = try decodeLEB128(u32, reader); const local_type = try ValType.decode(reader); locals_total += n; @@ -3465,7 +3519,7 @@ pub const ModuleDefinition = struct { } }, .Data => { - const num_datas = try common.decodeLEB128(u32, reader); + const num_datas = try decodeLEB128(u32, reader); if (self.data_count != null and num_datas != self.data_count.?) { return error.MalformedDataCountMismatch; @@ -3478,7 +3532,7 @@ pub const ModuleDefinition = struct { } }, .DataCount => { - self.data_count = try common.decodeLEB128(u32, reader); + self.data_count = try decodeLEB128(u32, reader); try self.datas.ensureTotalCapacity(self.data_count.?); }, } @@ -3615,7 +3669,7 @@ pub const ModuleDefinition = struct { return null; } - pub fn dump(self: *const ModuleDefinition, writer: anytype) !void { + pub fn dump(self: *const ModuleDefinition, writer: anytype) anyerror!void { const Helpers = struct { fn function(_writer: anytype, functype: *const FunctionTypeDefinition) !void { const params: []const ValType = functype.getParams(); diff --git a/src/instance.zig b/src/instance.zig index 0863670..54480ed 100644 --- a/src/instance.zig +++ b/src/instance.zig @@ -58,6 +58,7 @@ pub const TrapError = error{ TrapUnreachable, TrapIntegerDivisionByZero, TrapIntegerOverflow, + TrapNegativeDenominator, TrapIndirectCallTypeMismatch, TrapInvalidIntegerConversion, TrapOutOfBoundsMemoryAccess, @@ -66,7 +67,9 @@ pub const TrapError = error{ TrapOutOfBoundsTableAccess, TrapStackExhausted, TrapUnknown, -} || metering.MeteringTrapError; +} || metering.MeteringTrapError || HostFunctionError; + +pub const InstantiateError = AllocError || UnlinkableError || UninstantiableError || TrapError; pub const DebugTrace = struct { pub const Mode = enum { @@ -179,7 +182,7 @@ pub const TableInstance = struct { return true; } - fn init_range_val(table: *TableInstance, module: *ModuleInstance, elems: []const Val, init_length: u32, start_elem_index: u32, start_table_index: u32) !void { + fn init_range_val(table: *TableInstance, module: *ModuleInstance, elems: []const Val, init_length: u32, start_elem_index: u32, start_table_index: u32) TrapError!void { if (table.refs.items.len < start_table_index + init_length) { return error.TrapOutOfBoundsTableAccess; } @@ -203,7 +206,7 @@ pub const TableInstance = struct { } } - fn init_range_expr(table: *TableInstance, module: *ModuleInstance, elems: []ConstantExpression, init_length: u32, start_elem_index: u32, start_table_index: u32) !void { + fn init_range_expr(table: *TableInstance, module: *ModuleInstance, elems: []ConstantExpression, init_length: u32, start_elem_index: u32, start_table_index: u32) TrapError!void { if (start_table_index < 0 or table.refs.items.len < start_table_index + init_length) { return error.TrapOutOfBoundsTableAccess; } @@ -720,11 +723,11 @@ pub const DebugTrapInstructionMode = enum { pub const VM = struct { const InitFn = *const fn (vm: *VM) void; const DeinitFn = *const fn (vm: *VM) void; - const InstantiateFn = *const fn (vm: *VM, module: *ModuleInstance, opts: ModuleInstantiateOpts) anyerror!void; - const InvokeFn = *const fn (vm: *VM, module: *ModuleInstance, handle: FunctionHandle, params: [*]const Val, returns: [*]Val, opts: InvokeOpts) anyerror!void; - const ResumeInvokeFn = *const fn (vm: *VM, module: *ModuleInstance, returns: []Val, opts: ResumeInvokeOpts) anyerror!void; - const StepFn = *const fn (vm: *VM, module: *ModuleInstance, returns: []Val) anyerror!void; - const SetDebugTrapFn = *const fn (vm: *VM, module: *ModuleInstance, wasm_address: u32, mode: DebugTrapInstructionMode) anyerror!bool; + const InstantiateFn = *const fn (vm: *VM, module: *ModuleInstance, opts: ModuleInstantiateOpts) InstantiateError!void; + const InvokeFn = *const fn (vm: *VM, module: *ModuleInstance, handle: FunctionHandle, params: [*]const Val, returns: [*]Val, opts: InvokeOpts) TrapError!void; + const ResumeInvokeFn = *const fn (vm: *VM, module: *ModuleInstance, returns: []Val, opts: ResumeInvokeOpts) TrapError!void; + const StepFn = *const fn (vm: *VM, module: *ModuleInstance, returns: []Val) TrapError!void; + const SetDebugTrapFn = *const fn (vm: *VM, module: *ModuleInstance, wasm_address: u32, mode: DebugTrapInstructionMode) AllocError!bool; const FormatBacktraceFn = *const fn (vm: *VM, indent: u8, allocator: std.mem.Allocator) anyerror!std.ArrayList(u8); const FindFuncTypeDefFn = *const fn (vm: *VM, module: *ModuleInstance, func_index: usize) *const FunctionTypeDefinition; const ResolveFuncRefFn = *const fn (vm: *VM, ref: FuncRef) FuncRef; @@ -781,23 +784,23 @@ pub const VM = struct { allocator.free(mem); } - fn instantiate(vm: *VM, module: *ModuleInstance, opts: ModuleInstantiateOpts) anyerror!void { + fn instantiate(vm: *VM, module: *ModuleInstance, opts: ModuleInstantiateOpts) InstantiateError!void { try vm.instantiate_fn(vm, module, opts); } - pub fn invoke(vm: *VM, module: *ModuleInstance, handle: FunctionHandle, params: [*]const Val, returns: [*]Val, opts: InvokeOpts) anyerror!void { + pub fn invoke(vm: *VM, module: *ModuleInstance, handle: FunctionHandle, params: [*]const Val, returns: [*]Val, opts: InvokeOpts) TrapError!void { try vm.invoke_fn(vm, module, handle, params, returns, opts); } - pub fn resumeInvoke(vm: *VM, module: *ModuleInstance, returns: []Val, opts: ResumeInvokeOpts) anyerror!void { + pub fn resumeInvoke(vm: *VM, module: *ModuleInstance, returns: []Val, opts: ResumeInvokeOpts) TrapError!void { try vm.resume_invoke_fn(vm, module, returns, opts); } - pub fn step(vm: *VM, module: *ModuleInstance, returns: []Val) anyerror!void { + pub fn step(vm: *VM, module: *ModuleInstance, returns: []Val) TrapError!void { try vm.step_fn(vm, module, returns); } - pub fn setDebugTrap(vm: *VM, module: *ModuleInstance, wasm_address: u32, mode: DebugTrapInstructionMode) anyerror!bool { + pub fn setDebugTrap(vm: *VM, module: *ModuleInstance, wasm_address: u32, mode: DebugTrapInstructionMode) AllocError!bool { return try vm.set_debug_trap_fn(vm, module, wasm_address, mode); } @@ -843,7 +846,7 @@ pub const ModuleInstance = struct { allocator.destroy(self); } - pub fn instantiate(self: *ModuleInstance, opts: ModuleInstantiateOpts) !void { + pub fn instantiate(self: *ModuleInstance, opts: ModuleInstantiateOpts) InstantiateError!void { const Helpers = struct { fn areLimitsCompatible(def_limits: *const Limits, instance_limits: *const Limits) bool { // if (def_limits.limit_type != instance_limits.limit_type) { @@ -1165,7 +1168,7 @@ pub const ModuleInstance = struct { } } - pub fn exports(self: *ModuleInstance, name: []const u8) !ModuleImportPackage { + pub fn exports(self: *ModuleInstance, name: []const u8) AllocError!ModuleImportPackage { var imports = try ModuleImportPackage.init(name, self, null, self.allocator); for (self.module_def.exports.functions.items) |*item| { @@ -1262,20 +1265,20 @@ pub const ModuleInstance = struct { return error.ExportUnknownGlobal; } - pub fn invoke(self: *ModuleInstance, handle: FunctionHandle, params: [*]const Val, returns: [*]Val, opts: InvokeOpts) anyerror!void { + pub fn invoke(self: *ModuleInstance, handle: FunctionHandle, params: [*]const Val, returns: [*]Val, opts: InvokeOpts) TrapError!void { try self.vm.invoke(self, handle, params, returns, opts); } /// Use to resume an invoked function after it returned error.DebugTrap - pub fn resumeInvoke(self: *ModuleInstance, returns: []Val, opts: ResumeInvokeOpts) anyerror!void { + pub fn resumeInvoke(self: *ModuleInstance, returns: []Val, opts: ResumeInvokeOpts) TrapError!void { try self.vm.resumeInvoke(self, returns, opts); } - pub fn step(self: *ModuleInstance, returns: []Val) anyerror!void { + pub fn step(self: *ModuleInstance, returns: []Val) TrapError!void { try self.vm.step(self, returns); } - pub fn setDebugTrap(self: *ModuleInstance, wasm_address: u32, mode: DebugTrapInstructionMode) anyerror!bool { + pub fn setDebugTrap(self: *ModuleInstance, wasm_address: u32, mode: DebugTrapInstructionMode) AllocError!bool { try self.vm.setDebugTrap(self, wasm_address, mode); } diff --git a/src/opcode.zig b/src/opcode.zig index 851170f..cbdb732 100644 --- a/src/opcode.zig +++ b/src/opcode.zig @@ -921,30 +921,6 @@ pub const WasmOpcode = enum(u16) { std.debug.assert(opcode != .Invalid); return opcode; } - - pub fn decode(reader: anytype) !WasmOpcode { - const byte = try reader.readByte(); - var wasm_op: WasmOpcode = undefined; - if (byte == 0xFC or byte == 0xFD) { - const type_opcode = try common.decodeLEB128(u32, reader); - if (type_opcode > std.math.maxInt(u8)) { - return error.MalformedIllegalOpcode; - } - const byte2 = @as(u8, @intCast(type_opcode)); - var extended: u16 = byte; - extended = extended << 8; - extended |= byte2; - - wasm_op = std.meta.intToEnum(WasmOpcode, extended) catch { - return error.MalformedIllegalOpcode; - }; - } else { - wasm_op = std.meta.intToEnum(WasmOpcode, byte) catch { - return error.MalformedIllegalOpcode; - }; - } - return wasm_op; - } }; const ConversionTables = struct { diff --git a/src/stack_ops.zig b/src/stack_ops.zig index 8a43e00..1330915 100644 --- a/src/stack_ops.zig +++ b/src/stack_ops.zig @@ -78,6 +78,18 @@ pub const HostFunctionData = struct { num_return_values: u16 = 0, }; +fn trappedMod(comptime T: type, numerator: T, denominator: T) TrapError!T { + return std.math.mod(T, numerator, denominator) catch |e| { + if (e == error.DivisionByZero) { + return error.TrapIntegerDivisionByZero; + } else if (e == error.NegativeDenominator) { + return error.TrapNegativeDenominator; + } else { + unreachable; + } + }; +} + pub fn traceInstruction(instruction_name: []const u8, pc: u32, stack: *const Stack) void { if (config.enable_debug_trace and DebugTrace.shouldTraceInstructions()) { const frame: *const CallFrame = stack.topFrame(); @@ -89,7 +101,7 @@ pub fn traceInstruction(instruction_name: []const u8, pc: u32, stack: *const Sta } } -pub inline fn debugTrap(pc: u32, stack: *Stack) anyerror!void { +pub inline fn debugTrap(pc: u32, stack: *Stack) TrapError!void { const root_module_instance: *ModuleInstance = stack.frames[0].module_instance; const stack_vm = StackVM.fromVM(root_module_instance.vm); @@ -103,14 +115,14 @@ inline fn getStore(stack: *Stack) *Store { return &stack.topFrame().module_instance.store; } -pub inline fn block(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { +pub inline fn block(pc: u32, code: [*]const Instruction, stack: *Stack) void { const immediate = code[pc].immediate.Block; - try stack.pushLabel(immediate.num_returns, immediate.continuation); + stack.pushLabel(immediate.num_returns, immediate.continuation); } -pub inline fn loop(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { +pub inline fn loop(pc: u32, code: [*]const Instruction, stack: *Stack) void { const immediate = code[pc].immediate.Block; - try stack.pushLabel(immediate.num_returns, immediate.continuation); + stack.pushLabel(immediate.num_returns, immediate.continuation); } pub fn @"if"(pc: u32, code: [*]const Instruction, stack: *Stack) u32 { @@ -120,10 +132,10 @@ pub fn @"if"(pc: u32, code: [*]const Instruction, stack: *Stack) u32 { const condition = stack.popI32(); if (condition != 0) { - try stack.pushLabel(immediate.num_returns, pc + immediate.end_continuation_relative); + stack.pushLabel(immediate.num_returns, pc + immediate.end_continuation_relative); next_pc = pc + 1; } else { - try stack.pushLabel(immediate.num_returns, pc + immediate.end_continuation_relative); + stack.pushLabel(immediate.num_returns, pc + immediate.end_continuation_relative); next_pc = pc + immediate.else_continuation_relative + 1; } return next_pc; @@ -136,7 +148,7 @@ pub fn ifNoElse(pc: u32, code: [*]const Instruction, stack: *Stack) u32 { const condition = stack.popI32(); if (condition != 0) { - try stack.pushLabel(immediate.num_returns, pc + immediate.end_continuation_relative); + stack.pushLabel(immediate.num_returns, pc + immediate.end_continuation_relative); next_pc = pc + 1; } else { next_pc = pc + immediate.end_continuation_relative + 1; @@ -220,7 +232,7 @@ pub inline fn callLocal(pc: u32, code: [*]const Instruction, stack: *Stack) !Fun return @call(.always_inline, call, .{ pc, stack, module_instance, func }); } -pub inline fn callImport(pc: u32, code: [*]const Instruction, stack: *Stack) !FuncCallData { +pub inline fn callImport(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!FuncCallData { const func_index: u32 = code[pc].immediate.Index; const module_instance: *ModuleInstance = stack.topFrame().module_instance; const store: *const Store = &module_instance.store; @@ -308,7 +320,7 @@ pub inline fn callImport(pc: u32, code: [*]const Instruction, stack: *Stack) !Fu } } -pub inline fn callIndirect(pc: u32, code: [*]const Instruction, stack: *Stack) !FuncCallData { +pub inline fn callIndirect(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!FuncCallData { const immediates: *const CallIndirectImmediates = &code[pc].immediate.CallIndirect; const table_index: u32 = immediates.table_index; @@ -411,7 +423,7 @@ pub inline fn globalSetV128(pc: u32, code: [*]const Instruction, stack: *Stack) global.value.V128 = stack.popV128(); } -pub inline fn tableGet(pc: u32, code: [*]const Instruction, stack: *Stack) !void { +pub inline fn tableGet(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { const table_index: u32 = code[pc].immediate.Index; const table: *const TableInstance = getStore(stack).getTable(table_index); const index: i32 = stack.popI32(); @@ -422,7 +434,7 @@ pub inline fn tableGet(pc: u32, code: [*]const Instruction, stack: *Stack) !void stack.pushFuncRef(ref.FuncRef); } -pub inline fn tableSet(pc: u32, code: [*]const Instruction, stack: *Stack) !void { +pub inline fn tableSet(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { const table_index: u32 = code[pc].immediate.Index; var table: *TableInstance = getStore(stack).getTable(table_index); const ref = stack.popFuncRef(); @@ -433,117 +445,117 @@ pub inline fn tableSet(pc: u32, code: [*]const Instruction, stack: *Stack) !void table.refs.items[@as(usize, @intCast(index))].FuncRef = ref; } -pub inline fn i32Load(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { +pub inline fn i32Load(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { const value = try loadFromMem(i32, stack, code[pc].immediate.MemoryOffset); stack.pushI32(value); } -pub inline fn i64Load(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { +pub inline fn i64Load(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { const value = try loadFromMem(i64, stack, code[pc].immediate.MemoryOffset); stack.pushI64(value); } -pub inline fn f32Load(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { +pub inline fn f32Load(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { const value = try loadFromMem(f32, stack, code[pc].immediate.MemoryOffset); stack.pushF32(value); } -pub inline fn f64Load(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { +pub inline fn f64Load(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { const value = try loadFromMem(f64, stack, code[pc].immediate.MemoryOffset); stack.pushF64(value); } -pub inline fn i32Load8S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { +pub inline fn i32Load8S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { const value: i32 = try loadFromMem(i8, stack, code[pc].immediate.MemoryOffset); stack.pushI32(value); } -pub inline fn i32Load8U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { +pub inline fn i32Load8U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { const value: u32 = try loadFromMem(u8, stack, code[pc].immediate.MemoryOffset); stack.pushI32(@as(i32, @bitCast(value))); } -pub inline fn i32Load16S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { +pub inline fn i32Load16S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { const value: i32 = try loadFromMem(i16, stack, code[pc].immediate.MemoryOffset); stack.pushI32(value); } -pub inline fn i32Load16U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { +pub inline fn i32Load16U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { const value: u32 = try loadFromMem(u16, stack, code[pc].immediate.MemoryOffset); stack.pushI32(@as(i32, @bitCast(value))); } -pub inline fn i64Load8S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { +pub inline fn i64Load8S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { const value: i64 = try loadFromMem(i8, stack, code[pc].immediate.MemoryOffset); stack.pushI64(value); } -pub inline fn i64Load8U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { +pub inline fn i64Load8U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { const value: u64 = try loadFromMem(u8, stack, code[pc].immediate.MemoryOffset); stack.pushI64(@as(i64, @bitCast(value))); } -pub inline fn i64Load16S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { +pub inline fn i64Load16S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { const value: i64 = try loadFromMem(i16, stack, code[pc].immediate.MemoryOffset); stack.pushI64(value); } -pub inline fn i64Load16U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { +pub inline fn i64Load16U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { const value: u64 = try loadFromMem(u16, stack, code[pc].immediate.MemoryOffset); stack.pushI64(@as(i64, @bitCast(value))); } -pub inline fn i64Load32S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { +pub inline fn i64Load32S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { const value: i64 = try loadFromMem(i32, stack, code[pc].immediate.MemoryOffset); stack.pushI64(value); } -pub inline fn i64Load32U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { +pub inline fn i64Load32U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { const value: u64 = try loadFromMem(u32, stack, code[pc].immediate.MemoryOffset); stack.pushI64(@as(i64, @bitCast(value))); } -pub inline fn i32Store(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { +pub inline fn i32Store(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { const value: i32 = stack.popI32(); return storeInMem(value, stack, code[pc].immediate.MemoryOffset); } -pub inline fn i64Store(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { +pub inline fn i64Store(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { const value: i64 = stack.popI64(); return storeInMem(value, stack, code[pc].immediate.MemoryOffset); } -pub inline fn f32Store(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { +pub inline fn f32Store(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { const value: f32 = stack.popF32(); return storeInMem(value, stack, code[pc].immediate.MemoryOffset); } -pub inline fn f64Store(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { +pub inline fn f64Store(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { const value: f64 = stack.popF64(); return storeInMem(value, stack, code[pc].immediate.MemoryOffset); } -pub inline fn i32Store8(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { +pub inline fn i32Store8(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { const value: i8 = @as(i8, @truncate(stack.popI32())); return storeInMem(value, stack, code[pc].immediate.MemoryOffset); } -pub inline fn i32Store16(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { +pub inline fn i32Store16(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { const value: i16 = @as(i16, @truncate(stack.popI32())); return storeInMem(value, stack, code[pc].immediate.MemoryOffset); } -pub inline fn i64Store8(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { +pub inline fn i64Store8(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { const value: i8 = @as(i8, @truncate(stack.popI64())); return storeInMem(value, stack, code[pc].immediate.MemoryOffset); } -pub inline fn i64Store16(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { +pub inline fn i64Store16(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { const value: i16 = @as(i16, @truncate(stack.popI64())); return storeInMem(value, stack, code[pc].immediate.MemoryOffset); } -pub inline fn i64Store32(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { +pub inline fn i64Store32(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { const value: i32 = @as(i32, @truncate(stack.popI64())); return storeInMem(value, stack, code[pc].immediate.MemoryOffset); } @@ -880,7 +892,7 @@ pub inline fn i32Mul(stack: *Stack) void { stack.pushI32(value); } -pub inline fn i32DivS(stack: *Stack) anyerror!void { +pub inline fn i32DivS(stack: *Stack) TrapError!void { const v2: i32 = stack.popI32(); const v1: i32 = stack.popI32(); const value = std.math.divTrunc(i32, v1, v2) catch |e| { @@ -889,13 +901,13 @@ pub inline fn i32DivS(stack: *Stack) anyerror!void { } else if (e == error.Overflow) { return error.TrapIntegerOverflow; } else { - return e; + unreachable; } }; stack.pushI32(value); } -pub inline fn i32DivU(stack: *Stack) anyerror!void { +pub inline fn i32DivU(stack: *Stack) TrapError!void { const v2: u32 = @as(u32, @bitCast(stack.popI32())); const v1: u32 = @as(u32, @bitCast(stack.popI32())); const value_unsigned = std.math.divFloor(u32, v1, v2) catch |e| { @@ -904,14 +916,14 @@ pub inline fn i32DivU(stack: *Stack) anyerror!void { } else if (e == error.Overflow) { return error.TrapIntegerOverflow; } else { - return e; + unreachable; } }; const value = @as(i32, @bitCast(value_unsigned)); stack.pushI32(value); } -pub inline fn i32RemS(stack: *Stack) anyerror!void { +pub inline fn i32RemS(stack: *Stack) TrapError!void { const v2: i32 = stack.popI32(); const v1: i32 = stack.popI32(); const denom: i32 = @intCast(@abs(v2)); @@ -919,20 +931,20 @@ pub inline fn i32RemS(stack: *Stack) anyerror!void { if (e == error.DivisionByZero) { return error.TrapIntegerDivisionByZero; } else { - return e; + unreachable; } }; stack.pushI32(value); } -pub inline fn i32RemU(stack: *Stack) anyerror!void { +pub inline fn i32RemU(stack: *Stack) TrapError!void { const v2: u32 = @as(u32, @bitCast(stack.popI32())); const v1: u32 = @as(u32, @bitCast(stack.popI32())); const value_unsigned = std.math.rem(u32, v1, v2) catch |e| { if (e == error.DivisionByZero) { return error.TrapIntegerDivisionByZero; } else { - return e; + unreachable; } }; const value = @as(i32, @bitCast(value_unsigned)); @@ -960,26 +972,27 @@ pub inline fn i32Xor(stack: *Stack) void { stack.pushI32(value); } -pub inline fn i32Shl(stack: *Stack) anyerror!void { +pub inline fn i32Shl(stack: *Stack) TrapError!void { const shift_unsafe: i32 = stack.popI32(); const int: i32 = stack.popI32(); - const shift: i32 = try std.math.mod(i32, shift_unsafe, 32); + const shift: i32 = try trappedMod(i32, shift_unsafe, 32); + const value = std.math.shl(i32, int, shift); stack.pushI32(value); } -pub inline fn i32ShrS(stack: *Stack) anyerror!void { +pub inline fn i32ShrS(stack: *Stack) TrapError!void { const shift_unsafe: i32 = stack.popI32(); const int: i32 = stack.popI32(); - const shift = try std.math.mod(i32, shift_unsafe, 32); + const shift = try trappedMod(i32, shift_unsafe, 32); const value = std.math.shr(i32, int, shift); stack.pushI32(value); } -pub inline fn i32ShrU(stack: *Stack) anyerror!void { +pub inline fn i32ShrU(stack: *Stack) TrapError!void { const shift_unsafe: u32 = @as(u32, @bitCast(stack.popI32())); const int: u32 = @as(u32, @bitCast(stack.popI32())); - const shift = try std.math.mod(u32, shift_unsafe, 32); + const shift = try trappedMod(u32, shift_unsafe, 32); const value = @as(i32, @bitCast(std.math.shr(u32, int, shift))); stack.pushI32(value); } @@ -1037,7 +1050,7 @@ pub inline fn i64Mul(stack: *Stack) void { stack.pushI64(value); } -pub inline fn i64DivS(stack: *Stack) anyerror!void { +pub inline fn i64DivS(stack: *Stack) TrapError!void { const v2: i64 = stack.popI64(); const v1: i64 = stack.popI64(); const value = std.math.divTrunc(i64, v1, v2) catch |e| { @@ -1046,13 +1059,13 @@ pub inline fn i64DivS(stack: *Stack) anyerror!void { } else if (e == error.Overflow) { return error.TrapIntegerOverflow; } else { - return e; + unreachable; } }; stack.pushI64(value); } -pub inline fn i64DivU(stack: *Stack) anyerror!void { +pub inline fn i64DivU(stack: *Stack) TrapError!void { const v2: u64 = @as(u64, @bitCast(stack.popI64())); const v1: u64 = @as(u64, @bitCast(stack.popI64())); const value_unsigned = std.math.divFloor(u64, v1, v2) catch |e| { @@ -1061,14 +1074,14 @@ pub inline fn i64DivU(stack: *Stack) anyerror!void { } else if (e == error.Overflow) { return error.TrapIntegerOverflow; } else { - return e; + unreachable; } }; const value = @as(i64, @bitCast(value_unsigned)); stack.pushI64(value); } -pub inline fn i64RemS(stack: *Stack) anyerror!void { +pub inline fn i64RemS(stack: *Stack) TrapError!void { const v2: i64 = stack.popI64(); const v1: i64 = stack.popI64(); const denom: i64 = @intCast(@abs(v2)); @@ -1076,20 +1089,20 @@ pub inline fn i64RemS(stack: *Stack) anyerror!void { if (e == error.DivisionByZero) { return error.TrapIntegerDivisionByZero; } else { - return e; + unreachable; } }; stack.pushI64(value); } -pub inline fn i64RemU(stack: *Stack) anyerror!void { +pub inline fn i64RemU(stack: *Stack) TrapError!void { const v2: u64 = @as(u64, @bitCast(stack.popI64())); const v1: u64 = @as(u64, @bitCast(stack.popI64())); const value_unsigned = std.math.rem(u64, v1, v2) catch |e| { if (e == error.DivisionByZero) { return error.TrapIntegerDivisionByZero; } else { - return e; + unreachable; } }; const value = @as(i64, @bitCast(value_unsigned)); @@ -1117,26 +1130,26 @@ pub inline fn i64Xor(stack: *Stack) void { stack.pushI64(value); } -pub inline fn i64Shl(stack: *Stack) anyerror!void { +pub inline fn i64Shl(stack: *Stack) TrapError!void { const shift_unsafe: i64 = stack.popI64(); const int: i64 = stack.popI64(); - const shift: i64 = try std.math.mod(i64, shift_unsafe, 64); + const shift: i64 = try trappedMod(i64, shift_unsafe, 64); const value = std.math.shl(i64, int, shift); stack.pushI64(value); } -pub inline fn i64ShrS(stack: *Stack) anyerror!void { +pub inline fn i64ShrS(stack: *Stack) TrapError!void { const shift_unsafe: i64 = stack.popI64(); const int: i64 = stack.popI64(); - const shift = try std.math.mod(i64, shift_unsafe, 64); + const shift = try trappedMod(i64, shift_unsafe, 64); const value = std.math.shr(i64, int, shift); stack.pushI64(value); } -pub inline fn i64ShrU(stack: *Stack) anyerror!void { +pub inline fn i64ShrU(stack: *Stack) TrapError!void { const shift_unsafe: u64 = @as(u64, @bitCast(stack.popI64())); const int: u64 = @as(u64, @bitCast(stack.popI64())); - const shift = try std.math.mod(u64, shift_unsafe, 64); + const shift = try trappedMod(u64, shift_unsafe, 64); const value = @as(i64, @bitCast(std.math.shr(u64, int, shift))); stack.pushI64(value); } @@ -1355,25 +1368,25 @@ pub inline fn i32WrapI64(stack: *Stack) void { stack.pushI32(mod); } -pub inline fn i32TruncF32S(stack: *Stack) anyerror!void { +pub inline fn i32TruncF32S(stack: *Stack) TrapError!void { const v = stack.popF32(); const int = try truncateTo(i32, v); stack.pushI32(int); } -pub inline fn i32TruncF32U(stack: *Stack) anyerror!void { +pub inline fn i32TruncF32U(stack: *Stack) TrapError!void { const v = stack.popF32(); const int = try truncateTo(u32, v); stack.pushI32(@as(i32, @bitCast(int))); } -pub inline fn i32TruncF64S(stack: *Stack) anyerror!void { +pub inline fn i32TruncF64S(stack: *Stack) TrapError!void { const v = stack.popF64(); const int = try truncateTo(i32, v); stack.pushI32(int); } -pub inline fn i32TruncF64U(stack: *Stack) anyerror!void { +pub inline fn i32TruncF64U(stack: *Stack) TrapError!void { const v = stack.popF64(); const int = try truncateTo(u32, v); stack.pushI32(@as(i32, @bitCast(int))); @@ -1391,25 +1404,25 @@ pub inline fn i64ExtendI32U(stack: *Stack) void { stack.pushI64(@as(i64, @bitCast(v64))); } -pub inline fn i64TruncF32S(stack: *Stack) anyerror!void { +pub inline fn i64TruncF32S(stack: *Stack) TrapError!void { const v = stack.popF32(); const int = try truncateTo(i64, v); stack.pushI64(int); } -pub inline fn i64TruncF32U(stack: *Stack) anyerror!void { +pub inline fn i64TruncF32U(stack: *Stack) TrapError!void { const v = stack.popF32(); const int = try truncateTo(u64, v); stack.pushI64(@as(i64, @bitCast(int))); } -pub inline fn i64TruncF64S(stack: *Stack) anyerror!void { +pub inline fn i64TruncF64S(stack: *Stack) TrapError!void { const v = stack.popF64(); const int = try truncateTo(i64, v); stack.pushI64(int); } -pub inline fn i64TruncF64U(stack: *Stack) anyerror!void { +pub inline fn i64TruncF64U(stack: *Stack) TrapError!void { const v = stack.popF64(); const int = try truncateTo(u64, v); stack.pushI64(@as(i64, @bitCast(int))); @@ -1520,7 +1533,7 @@ pub inline fn i64Extend32S(stack: *Stack) void { stack.pushI64(v_extended); } -pub inline fn refNull(stack: *Stack) anyerror!void { +pub inline fn refNull(stack: *Stack) TrapError!void { const ref = FuncRef.nullRef(); stack.pushFuncRef(ref); } @@ -1586,7 +1599,7 @@ pub inline fn i64TruncSatF64U(stack: *Stack) void { stack.pushI64(@as(i64, @bitCast(int))); } -pub inline fn memoryInit(pc: u32, code: [*]const Instruction, stack: *Stack) !void { +pub inline fn memoryInit(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { const data_index: u32 = code[pc].immediate.Index; const data: *const DataDefinition = &stack.topFrame().module_instance.module_def.datas.items[data_index]; const memory: *MemoryInstance = &getStore(stack).memories.items[0]; @@ -1622,7 +1635,7 @@ pub inline fn dataDrop(pc: u32, code: [*]const Instruction, stack: *Stack) void data.bytes.clearAndFree(); } -pub inline fn memoryCopy(stack: *Stack) !void { +pub inline fn memoryCopy(stack: *Stack) TrapError!void { const memory: *MemoryInstance = &getStore(stack).memories.items[0]; const index_type: ValType = memory.limits.indexType(); @@ -1656,7 +1669,7 @@ pub inline fn memoryCopy(stack: *Stack) !void { } } -pub inline fn memoryFill(stack: *Stack) !void { +pub inline fn memoryFill(stack: *Stack) TrapError!void { const memory: *MemoryInstance = &getStore(stack).memories.items[0]; const index_type: ValType = memory.limits.indexType(); @@ -1680,7 +1693,7 @@ pub inline fn memoryFill(stack: *Stack) !void { @memset(destination, value); } -pub inline fn tableInit(pc: u32, code: [*]const Instruction, stack: *Stack) !void { +pub inline fn tableInit(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { const pair: TablePairImmediates = code[pc].immediate.TablePair; const elem_index = pair.index_x; const table_index = pair.index_y; @@ -1719,7 +1732,7 @@ pub inline fn elemDrop(pc: u32, code: [*]const Instruction, stack: *Stack) void elem.refs.clearAndFree(); } -pub inline fn tableCopy(pc: u32, code: [*]const Instruction, stack: *Stack) !void { +pub inline fn tableCopy(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { const pair: TablePairImmediates = code[pc].immediate.TablePair; const dest_table_index = pair.index_x; const src_table_index = pair.index_y; @@ -1772,7 +1785,7 @@ pub inline fn tableSize(pc: u32, code: [*]const Instruction, stack: *Stack) void stack.pushI32(length); } -pub inline fn tableFill(pc: u32, code: [*]const Instruction, stack: *Stack) !void { +pub inline fn tableFill(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { const table_index: u32 = code[pc].immediate.Index; const table: *TableInstance = getStore(stack).getTable(table_index); @@ -1792,54 +1805,54 @@ pub inline fn tableFill(pc: u32, code: [*]const Instruction, stack: *Stack) !voi @memset(dest, funcref); } -pub inline fn v128Load(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { +pub inline fn v128Load(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { const value = try loadFromMem(v128, stack, code[pc].immediate.MemoryOffset); stack.pushV128(value); } -pub inline fn v128Load8x8S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { - return vectorLoadExtend(i8, i16, 8, code[pc].immediate.MemoryOffset, stack); +pub inline fn v128Load8x8S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { + return try vectorLoadExtend(i8, i16, 8, code[pc].immediate.MemoryOffset, stack); } -pub inline fn v128Load8x8U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { - return vectorLoadExtend(u8, i16, 8, code[pc].immediate.MemoryOffset, stack); +pub inline fn v128Load8x8U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { + return try vectorLoadExtend(u8, i16, 8, code[pc].immediate.MemoryOffset, stack); } -pub inline fn v128Load16x4S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { - return vectorLoadExtend(i16, i32, 4, code[pc].immediate.MemoryOffset, stack); +pub inline fn v128Load16x4S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { + return try vectorLoadExtend(i16, i32, 4, code[pc].immediate.MemoryOffset, stack); } -pub inline fn v128Load16x4U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { - return vectorLoadExtend(u16, i32, 4, code[pc].immediate.MemoryOffset, stack); +pub inline fn v128Load16x4U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { + return try vectorLoadExtend(u16, i32, 4, code[pc].immediate.MemoryOffset, stack); } -pub inline fn v128Load32x2S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { - return vectorLoadExtend(i32, i64, 2, code[pc].immediate.MemoryOffset, stack); +pub inline fn v128Load32x2S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { + return try vectorLoadExtend(i32, i64, 2, code[pc].immediate.MemoryOffset, stack); } -pub inline fn v128Load32x2U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { - return vectorLoadExtend(u32, i64, 2, code[pc].immediate.MemoryOffset, stack); +pub inline fn v128Load32x2U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { + return try vectorLoadExtend(u32, i64, 2, code[pc].immediate.MemoryOffset, stack); } -pub inline fn v128Load8Splat(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { +pub inline fn v128Load8Splat(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { const scalar = try loadFromMem(u8, stack, code[pc].immediate.MemoryOffset); const vec: u8x16 = @splat(scalar); stack.pushV128(@as(v128, @bitCast(vec))); } -pub inline fn v128Load16Splat(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { +pub inline fn v128Load16Splat(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { const scalar = try loadFromMem(u16, stack, code[pc].immediate.MemoryOffset); const vec: u16x8 = @splat(scalar); stack.pushV128(@as(v128, @bitCast(vec))); } -pub inline fn v128Load32Splat(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { +pub inline fn v128Load32Splat(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { const scalar = try loadFromMem(u32, stack, code[pc].immediate.MemoryOffset); const vec: u32x4 = @splat(scalar); stack.pushV128(@as(v128, @bitCast(vec))); } -pub inline fn v128Load64Splat(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { +pub inline fn v128Load64Splat(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { const scalar = try loadFromMem(u64, stack, code[pc].immediate.MemoryOffset); const vec: u64x2 = @splat(scalar); stack.pushV128(@as(v128, @bitCast(vec))); @@ -2105,9 +2118,9 @@ pub inline fn f64x2GE(stack: *Stack) void { vectorBoolOp(f64x2, .Ge, stack); } -pub inline fn v128Store(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { +pub inline fn v128Store(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { const value: v128 = stack.popV128(); - return storeInMem(value, stack, code[pc].immediate.MemoryOffset); + return try storeInMem(value, stack, code[pc].immediate.MemoryOffset); } pub inline fn v128Const(pc: u32, code: [*]const Instruction, stack: *Stack) void { @@ -3050,7 +3063,7 @@ fn storeInMem(value: anytype, stack: *Stack, offset_from_memarg: u64) TrapError! fn call(pc: u32, stack: *Stack, module_instance: *ModuleInstance, func: *const FunctionInstance) TrapError!FuncCallData { const continuation: u32 = pc + 1; try stack.pushFrame(func, module_instance); - try stack.pushLabel(func.num_returns, continuation); + stack.pushLabel(func.num_returns, continuation); DebugTrace.traceFunction(module_instance, stack.num_frames, func.def_index); @@ -3341,7 +3354,7 @@ fn vectorBitmask(comptime T: type, vec: v128) i32 { } } -fn vectorLoadLane(comptime T: type, instruction: Instruction, stack: *Stack) !void { +fn vectorLoadLane(comptime T: type, instruction: Instruction, stack: *Stack) TrapError!void { const vec_type_info = @typeInfo(T).vector; var vec = @as(T, @bitCast(stack.popV128())); @@ -3351,7 +3364,7 @@ fn vectorLoadLane(comptime T: type, instruction: Instruction, stack: *Stack) !vo stack.pushV128(@as(v128, @bitCast(vec))); } -fn vectorLoadExtend(comptime mem_type: type, comptime extend_type: type, comptime len: usize, mem_offset: u64, stack: *Stack) !void { +fn vectorLoadExtend(comptime mem_type: type, comptime extend_type: type, comptime len: usize, mem_offset: u64, stack: *Stack) TrapError!void { const offset_from_stack: i32 = stack.popI32(); const store: *Store = getStore(stack); const array: [len]extend_type = try loadArrayFromMem(mem_type, extend_type, len, store, mem_offset, offset_from_stack); @@ -3359,7 +3372,7 @@ fn vectorLoadExtend(comptime mem_type: type, comptime extend_type: type, comptim stack.pushV128(@as(v128, @bitCast(vec))); } -fn vectorLoadLaneZero(comptime T: type, instruction: Instruction, stack: *Stack) !void { +fn vectorLoadLaneZero(comptime T: type, instruction: Instruction, stack: *Stack) TrapError!void { const vec_type_info = @typeInfo(T).vector; const mem_offset = instruction.immediate.MemoryOffset; @@ -3369,7 +3382,7 @@ fn vectorLoadLaneZero(comptime T: type, instruction: Instruction, stack: *Stack) stack.pushV128(@as(v128, @bitCast(vec))); } -fn vectorStoreLane(comptime T: type, instruction: Instruction, stack: *Stack) !void { +fn vectorStoreLane(comptime T: type, instruction: Instruction, stack: *Stack) TrapError!void { const vec = @as(T, @bitCast(stack.popV128())); const immediate = stack.topFrame().module_instance.module_def.code.memory_offset_and_lane_immediates.items[instruction.immediate.Index]; const scalar = vec[immediate.laneidx]; diff --git a/src/vm_register.zig b/src/vm_register.zig index 2bb9668..7d9fd48 100644 --- a/src/vm_register.zig +++ b/src/vm_register.zig @@ -1,10 +1,9 @@ const std = @import("std"); const assert = std.debug.assert; +const AllocError = std.mem.Allocator.Error; const builtin = @import("builtin"); -const AllocError = std.mem.Allocator.Error; - const common = @import("common.zig"); const StableArray = common.StableArray; @@ -55,6 +54,8 @@ const FuncRef = def.FuncRef; const inst = @import("instance.zig"); const VM = inst.VM; +const InstantiateError = inst.InstantiateError; +const TrapError = inst.TrapError; const ModuleInstance = inst.ModuleInstance; const InvokeOpts = inst.InvokeOpts; const ResumeInvokeOpts = inst.ResumeInvokeOpts; @@ -1110,60 +1111,60 @@ pub const RegisterVM = struct { _ = vm; } - pub fn instantiate(vm: *VM, module: *ModuleInstance, opts: ModuleInstantiateOpts) anyerror!void { + pub fn instantiate(vm: *VM, module: *ModuleInstance, opts: ModuleInstantiateOpts) InstantiateError!void { _ = vm; _ = module; _ = opts; - return error.Unimplemented; + unreachable; } - pub fn invoke(vm: *VM, module: *ModuleInstance, handle: FunctionHandle, params: [*]const Val, returns: [*]Val, opts: InvokeOpts) anyerror!void { + pub fn invoke(vm: *VM, module: *ModuleInstance, handle: FunctionHandle, params: [*]const Val, returns: [*]Val, opts: InvokeOpts) TrapError!void { _ = vm; _ = module; _ = handle; _ = params; _ = returns; _ = opts; - return error.Unimplemented; + unreachable; } - pub fn invokeWithIndex(vm: *VM, module: *ModuleInstance, func_index: usize, params: [*]const Val, returns: [*]Val) anyerror!void { + pub fn invokeWithIndex(vm: *VM, module: *ModuleInstance, func_index: usize, params: [*]const Val, returns: [*]Val) TrapError!void { _ = vm; _ = module; _ = func_index; _ = params; _ = returns; - return error.Unimplemented; + unreachable; } - pub fn resumeInvoke(vm: *VM, module: *ModuleInstance, returns: []Val, opts: ResumeInvokeOpts) anyerror!void { + pub fn resumeInvoke(vm: *VM, module: *ModuleInstance, returns: []Val, opts: ResumeInvokeOpts) TrapError!void { _ = vm; _ = module; _ = returns; _ = opts; - return error.Unimplemented; + unreachable; } - pub fn step(vm: *VM, module: *ModuleInstance, returns: []Val) anyerror!void { + pub fn step(vm: *VM, module: *ModuleInstance, returns: []Val) TrapError!void { _ = vm; _ = module; _ = returns; - return error.Unimplemented; + unreachable; } - pub fn setDebugTrap(vm: *VM, module: *ModuleInstance, wasm_address: u32, mode: DebugTrapInstructionMode) anyerror!bool { + pub fn setDebugTrap(vm: *VM, module: *ModuleInstance, wasm_address: u32, mode: DebugTrapInstructionMode) AllocError!bool { _ = vm; _ = module; _ = wasm_address; _ = mode; - return error.Unimplemented; + unreachable; } pub fn formatBacktrace(vm: *VM, indent: u8, allocator: std.mem.Allocator) anyerror!std.ArrayList(u8) { _ = vm; _ = indent; _ = allocator; - return error.Unimplemented; + unreachable; } pub fn findFuncTypeDef(vm: *VM, module: *ModuleInstance, local_func_index: usize) *const FunctionTypeDefinition { diff --git a/src/vm_stack.zig b/src/vm_stack.zig index a341b9a..ee4d011 100644 --- a/src/vm_stack.zig +++ b/src/vm_stack.zig @@ -1,6 +1,7 @@ const std = @import("std"); const builtin = @import("builtin"); const assert = std.debug.assert; +const AllocError = std.mem.Allocator.Error; const config = @import("config"); @@ -54,6 +55,7 @@ const FuncRef = def.FuncRef; const inst = @import("instance.zig"); const UnlinkableError = inst.UnlinkableError; const UninstantiableError = inst.UninstantiableError; +const InstantiateError = inst.InstantiateError; const ExportError = inst.ExportError; const TrapError = inst.TrapError; const HostFunctionError = inst.HostFunctionError; @@ -120,7 +122,7 @@ fn preamble(name: []const u8, pc: u32, code: [*]const Instruction, stack: *Stack } // pc is the "program counter", which points to the next instruction to execute -const InstructionFunc = *const fn (pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void; +const InstructionFunc = *const fn (pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void; // Maps all instructions to an execution function, to map opcodes directly to function pointers // which avoids a giant switch statement. Because the switch-style has a single conditional @@ -583,7 +585,7 @@ const InstructionFuncs = struct { &op_F64x2_Convert_Low_I32x4_U, }; - fn run(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn run(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try @call(.always_tail, InstructionFuncs.lookup(code[pc].opcode), .{ pc, code, stack }); } @@ -591,2676 +593,2676 @@ const InstructionFuncs = struct { return opcodeToFuncTable[@intFromEnum(opcode)]; } - fn op_Invalid(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Invalid(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Invalid", pc, code, stack); unreachable; } - fn op_Unreachable(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Unreachable(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Unreachable", pc, code, stack); return error.TrapUnreachable; } - fn op_DebugTrap(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_DebugTrap(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("DebugTrap", pc, code, stack); return OpHelpers.debugTrap(pc, stack); } - fn op_Noop(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Noop(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Noop", pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_Block(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Block(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Block", pc, code, stack); - try OpHelpers.block(pc, code, stack); + OpHelpers.block(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_Loop(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Loop(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Loop", pc, code, stack); - try OpHelpers.loop(pc, code, stack); + OpHelpers.loop(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_If(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_If(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("If", pc, code, stack); const next_pc = OpHelpers.@"if"(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[next_pc].opcode), .{ next_pc, code, stack }); } - fn op_IfNoElse(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_IfNoElse(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("IfNoElse", pc, code, stack); const next_pc = OpHelpers.ifNoElse(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[next_pc].opcode), .{ next_pc, code, stack }); } - fn op_Else(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Else(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Else", pc, code, stack); const next_pc = OpHelpers.@"else"(pc, code); try @call(.always_tail, InstructionFuncs.lookup(code[next_pc].opcode), .{ next_pc, code, stack }); } - fn op_End(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_End(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("End", pc, code, stack); const next = OpHelpers.end(pc, code, stack) orelse return; try @call(.always_tail, InstructionFuncs.lookup(next.code[next.continuation].opcode), .{ next.continuation, next.code, stack }); } - fn op_Branch(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Branch(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Branch", pc, code, stack); const next: FuncCallData = OpHelpers.branch(pc, code, stack) orelse return; try @call(.always_tail, InstructionFuncs.lookup(next.code[next.continuation].opcode), .{ next.continuation, next.code, stack }); } - fn op_Branch_If(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Branch_If(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Branch_If", pc, code, stack); const next = OpHelpers.branchIf(pc, code, stack) orelse return; try @call(.always_tail, InstructionFuncs.lookup(next.code[next.continuation].opcode), .{ next.continuation, next.code, stack }); } - fn op_Branch_Table(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Branch_Table(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Branch_Table", pc, code, stack); const next = OpHelpers.branchTable(pc, code, stack) orelse return; try @call(.always_tail, InstructionFuncs.lookup(next.code[next.continuation].opcode), .{ next.continuation, next.code, stack }); } - fn op_Return(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Return(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Return", pc, code, stack); const next: FuncCallData = OpHelpers.@"return"(stack) orelse return; try @call(.always_tail, InstructionFuncs.lookup(next.code[next.continuation].opcode), .{ next.continuation, next.code, stack }); } - fn op_Call_Local(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Call_Local(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Call", pc, code, stack); const next = try OpHelpers.callLocal(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(next.code[next.continuation].opcode), .{ next.continuation, next.code, stack }); } - fn op_Call_Import(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Call_Import(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Call", pc, code, stack); const next = try OpHelpers.callImport(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(next.code[next.continuation].opcode), .{ next.continuation, next.code, stack }); } - fn op_Call_Indirect(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Call_Indirect(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Call_Indirect", pc, code, stack); const next = try OpHelpers.callIndirect(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(next.code[next.continuation].opcode), .{ next.continuation, next.code, stack }); } - fn op_Drop(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Drop(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Drop", pc, code, stack); OpHelpers.drop(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_Drop_V128(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Drop_V128(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Drop_V128", pc, code, stack); OpHelpers.dropV128(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_Select(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Select(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Select", pc, code, stack); OpHelpers.select(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_Select_V128(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Select_V128(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Select_V128", pc, code, stack); OpHelpers.selectV128(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_Local_Get(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Local_Get(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Local_Get", pc, code, stack); OpHelpers.localGet(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_Local_Set(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Local_Set(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Local_Set", pc, code, stack); OpHelpers.localSet(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_Local_Tee(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Local_Tee(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Local_Tee", pc, code, stack); OpHelpers.localTee(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_Local_Get_V128(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Local_Get_V128(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Local_Get_V128", pc, code, stack); OpHelpers.localGetV128(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_Local_Set_V128(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Local_Set_V128(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Local_Set_V128", pc, code, stack); OpHelpers.localSetV128(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_Local_Tee_V128(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Local_Tee_V128(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Local_Tee_V128", pc, code, stack); OpHelpers.localTeeV128(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_Global_Get(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Global_Get(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Global_Get", pc, code, stack); OpHelpers.globalGet(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_Global_Set(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Global_Set(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Global_Set", pc, code, stack); OpHelpers.globalSet(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_Global_Get_V128(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Global_Get_V128(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Global_Get_V128", pc, code, stack); OpHelpers.globalGetV128(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_Global_Set_V128(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Global_Set_V128(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Global_Set_V128", pc, code, stack); OpHelpers.globalSetV128(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_Table_Get(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Table_Get(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Table_Get", pc, code, stack); try OpHelpers.tableGet(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_Table_Set(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Table_Set(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Table_Set", pc, code, stack); try OpHelpers.tableSet(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_Load(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_Load(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_Load", pc, code, stack); try OpHelpers.i32Load(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Load(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Load(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Load", pc, code, stack); try OpHelpers.i64Load(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32_Load(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32_Load(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32_Load", pc, code, stack); try OpHelpers.f32Load(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64_Load(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64_Load(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64_Load", pc, code, stack); try OpHelpers.f64Load(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_Load8_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_Load8_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_Load8_S", pc, code, stack); try OpHelpers.i32Load8S(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_Load8_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_Load8_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_Load8_U", pc, code, stack); try OpHelpers.i32Load8U(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_Load16_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_Load16_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_Load16_S", pc, code, stack); try OpHelpers.i32Load16S(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_Load16_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_Load16_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_Load16_U", pc, code, stack); try OpHelpers.i32Load16U(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Load8_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Load8_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Load8_S", pc, code, stack); try OpHelpers.i64Load8S(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Load8_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Load8_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Load8_U", pc, code, stack); try OpHelpers.i64Load8U(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Load16_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Load16_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Load16_S", pc, code, stack); try OpHelpers.i64Load16S(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Load16_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Load16_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Load16_U", pc, code, stack); try OpHelpers.i64Load16U(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Load32_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Load32_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Load32_S", pc, code, stack); try OpHelpers.i64Load32S(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Load32_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Load32_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Load32_U", pc, code, stack); try OpHelpers.i64Load32U(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_Store(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_Store(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_Store", pc, code, stack); try OpHelpers.i32Store(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Store(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Store(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Store", pc, code, stack); try OpHelpers.i64Store(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32_Store(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32_Store(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32_Store", pc, code, stack); try OpHelpers.f32Store(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64_Store(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64_Store(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64_Store", pc, code, stack); try OpHelpers.f64Store(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_Store8(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_Store8(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_Store8", pc, code, stack); try OpHelpers.i32Store8(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_Store16(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_Store16(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_Store16", pc, code, stack); try OpHelpers.i32Store16(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Store8(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Store8(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Store8", pc, code, stack); try OpHelpers.i64Store8(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Store16(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Store16(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Store16", pc, code, stack); try OpHelpers.i64Store16(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Store32(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Store32(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Store32", pc, code, stack); try OpHelpers.i64Store32(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_Memory_Size(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Memory_Size(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Memory_Size", pc, code, stack); OpHelpers.memorySize(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_Memory_Grow(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Memory_Grow(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Memory_Grow", pc, code, stack); OpHelpers.memoryGrow(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_Const(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_Const(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_Const", pc, code, stack); OpHelpers.i32Const(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Const(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Const(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Const", pc, code, stack); OpHelpers.i64Const(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32_Const(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32_Const(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32_Const", pc, code, stack); OpHelpers.f32Const(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64_Const(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64_Const(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64_Const", pc, code, stack); OpHelpers.f64Const(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_Eqz(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_Eqz(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_Eqz", pc, code, stack); OpHelpers.i32Eqz(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_Eq(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_Eq(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_Eq", pc, code, stack); OpHelpers.i32Eq(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_NE(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_NE(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_NE", pc, code, stack); OpHelpers.i32NE(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_LT_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_LT_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_LT_S", pc, code, stack); OpHelpers.i32LTS(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_LT_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_LT_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_LT_U", pc, code, stack); OpHelpers.i32LTU(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_GT_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_GT_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_GT_S", pc, code, stack); OpHelpers.i32GTS(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_GT_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_GT_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_GT_U", pc, code, stack); OpHelpers.i32GTU(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_LE_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_LE_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_LE_S", pc, code, stack); OpHelpers.i32LES(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_LE_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_LE_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_LE_U", pc, code, stack); OpHelpers.i32LEU(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_GE_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_GE_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_GE_S", pc, code, stack); OpHelpers.i32GES(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_GE_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_GE_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_GE_U", pc, code, stack); OpHelpers.i32GEU(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Eqz(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Eqz(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Eqz", pc, code, stack); OpHelpers.i64Eqz(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Eq(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Eq(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Eq", pc, code, stack); OpHelpers.i64Eq(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_NE(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_NE(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_NE", pc, code, stack); OpHelpers.i64NE(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_LT_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_LT_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_LT_S", pc, code, stack); OpHelpers.i64LTS(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_LT_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_LT_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_LT_U", pc, code, stack); OpHelpers.i64LTU(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_GT_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_GT_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_GT_S", pc, code, stack); OpHelpers.i64GTS(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_GT_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_GT_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_GT_U", pc, code, stack); OpHelpers.i64GTU(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_LE_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_LE_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_LE_S", pc, code, stack); OpHelpers.i64LES(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_LE_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_LE_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_LE_U", pc, code, stack); OpHelpers.i64LEU(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_GE_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_GE_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_GE_S", pc, code, stack); OpHelpers.i64GES(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_GE_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_GE_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_GE_U", pc, code, stack); OpHelpers.i64GEU(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32_EQ(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32_EQ(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32_EQ", pc, code, stack); OpHelpers.f32EQ(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32_NE(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32_NE(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32_NE", pc, code, stack); OpHelpers.f32NE(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32_LT(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32_LT(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32_LT", pc, code, stack); OpHelpers.f32LT(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32_GT(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32_GT(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32_GT", pc, code, stack); OpHelpers.f32GT(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32_LE(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32_LE(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32_LE", pc, code, stack); OpHelpers.f32LE(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32_GE(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32_GE(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32_GE", pc, code, stack); OpHelpers.f32GE(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64_EQ(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64_EQ(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64_EQ", pc, code, stack); OpHelpers.f64EQ(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64_NE(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64_NE(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64_NE", pc, code, stack); OpHelpers.f64NE(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64_LT(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64_LT(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64_LT", pc, code, stack); OpHelpers.f64LT(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64_GT(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64_GT(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64_GT", pc, code, stack); OpHelpers.f64GT(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64_LE(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64_LE(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64_LE", pc, code, stack); OpHelpers.f64LE(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64_GE(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64_GE(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64_GE", pc, code, stack); OpHelpers.f64GE(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_Clz(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_Clz(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_Clz", pc, code, stack); OpHelpers.i32Clz(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_Ctz(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_Ctz(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_Ctz", pc, code, stack); OpHelpers.i32Ctz(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_Popcnt(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_Popcnt(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_Popcnt", pc, code, stack); OpHelpers.i32Popcnt(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_Add(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_Add(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_Add", pc, code, stack); OpHelpers.i32Add(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_Sub(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_Sub(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_Sub", pc, code, stack); OpHelpers.i32Sub(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_Mul(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_Mul(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_Mul", pc, code, stack); OpHelpers.i32Mul(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_Div_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_Div_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_Div_S", pc, code, stack); try OpHelpers.i32DivS(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_Div_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_Div_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_Div_U", pc, code, stack); try OpHelpers.i32DivU(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_Rem_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_Rem_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_Rem_S", pc, code, stack); try OpHelpers.i32RemS(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_Rem_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_Rem_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_Rem_U", pc, code, stack); try OpHelpers.i32RemU(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_And(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_And(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_And", pc, code, stack); OpHelpers.i32And(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_Or(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_Or(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_Or", pc, code, stack); OpHelpers.i32Or(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_Xor(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_Xor(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_Xor", pc, code, stack); OpHelpers.i32Xor(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_Shl(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_Shl(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_Shl", pc, code, stack); try OpHelpers.i32Shl(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_Shr_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_Shr_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_Shr_S", pc, code, stack); try OpHelpers.i32ShrS(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_Shr_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_Shr_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_Shr_U", pc, code, stack); try OpHelpers.i32ShrU(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_Rotl(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_Rotl(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_Rotl", pc, code, stack); OpHelpers.i32Rotl(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_Rotr(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_Rotr(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_Rotr", pc, code, stack); OpHelpers.i32Rotr(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Clz(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Clz(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Clz", pc, code, stack); OpHelpers.i64Clz(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Ctz(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Ctz(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Ctz", pc, code, stack); OpHelpers.i64Ctz(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Popcnt(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Popcnt(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Popcnt", pc, code, stack); OpHelpers.i64Popcnt(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Add(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Add(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Add", pc, code, stack); OpHelpers.i64Add(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Sub(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Sub(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Sub", pc, code, stack); OpHelpers.i64Sub(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Mul(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Mul(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Mul", pc, code, stack); OpHelpers.i64Mul(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Div_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Div_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Div_S", pc, code, stack); try OpHelpers.i64DivS(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Div_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Div_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Div_U", pc, code, stack); try OpHelpers.i64DivU(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Rem_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Rem_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Rem_S", pc, code, stack); try OpHelpers.i64RemS(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Rem_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Rem_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Rem_U", pc, code, stack); try OpHelpers.i64RemU(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_And(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_And(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_And", pc, code, stack); OpHelpers.i64And(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Or(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Or(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Or", pc, code, stack); OpHelpers.i64Or(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Xor(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Xor(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Xor", pc, code, stack); OpHelpers.i64Xor(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Shl(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Shl(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Shl", pc, code, stack); try OpHelpers.i64Shl(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Shr_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Shr_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Shr_S", pc, code, stack); try OpHelpers.i64ShrS(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Shr_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Shr_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Shr_U", pc, code, stack); try OpHelpers.i64ShrU(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Rotl(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Rotl(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Rotl", pc, code, stack); OpHelpers.i64Rotl(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Rotr(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Rotr(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Rotr", pc, code, stack); OpHelpers.i64Rotr(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32_Abs(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32_Abs(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32_Abs", pc, code, stack); OpHelpers.f32Abs(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32_Neg(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32_Neg(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32_Neg", pc, code, stack); OpHelpers.f32Neg(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32_Ceil(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32_Ceil(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32_Ceil", pc, code, stack); OpHelpers.f32Ceil(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32_Floor(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32_Floor(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32_Floor", pc, code, stack); OpHelpers.f32Floor(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32_Trunc(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32_Trunc(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32_Trunc", pc, code, stack); OpHelpers.f32Trunc(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32_Nearest(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32_Nearest(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32_Nearest", pc, code, stack); OpHelpers.f32Nearest(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32_Sqrt(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32_Sqrt(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32_Sqrt", pc, code, stack); OpHelpers.f32Sqrt(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32_Add(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32_Add(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32_Add", pc, code, stack); OpHelpers.f32Add(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32_Sub(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32_Sub(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32_Sub", pc, code, stack); OpHelpers.f32Sub(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32_Mul(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32_Mul(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32_Mul", pc, code, stack); OpHelpers.f32Mul(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32_Div(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32_Div(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32_Div", pc, code, stack); OpHelpers.f32Div(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32_Min(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32_Min(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32_Min", pc, code, stack); OpHelpers.f32Min(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32_Max(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32_Max(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32_Max", pc, code, stack); OpHelpers.f32Max(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32_Copysign(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32_Copysign(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32_Copysign", pc, code, stack); OpHelpers.f32Copysign(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64_Abs(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64_Abs(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64_Abs", pc, code, stack); OpHelpers.f64Abs(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64_Neg(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64_Neg(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64_Neg", pc, code, stack); OpHelpers.f64Neg(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64_Ceil(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64_Ceil(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64_Ceil", pc, code, stack); OpHelpers.f64Ceil(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64_Floor(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64_Floor(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64_Floor", pc, code, stack); OpHelpers.f64Floor(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64_Trunc(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64_Trunc(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64_Trunc", pc, code, stack); OpHelpers.f64Trunc(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64_Nearest(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64_Nearest(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64_Nearest", pc, code, stack); OpHelpers.f64Nearest(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64_Sqrt(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64_Sqrt(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64_Sqrt", pc, code, stack); OpHelpers.f64Sqrt(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64_Add(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64_Add(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64_Add", pc, code, stack); OpHelpers.f64Add(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64_Sub(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64_Sub(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64_Sub", pc, code, stack); OpHelpers.f64Sub(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64_Mul(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64_Mul(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64_Mul", pc, code, stack); OpHelpers.f64Mul(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64_Div(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64_Div(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64_Div", pc, code, stack); OpHelpers.f64Div(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64_Min(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64_Min(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64_Min", pc, code, stack); OpHelpers.f64Min(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64_Max(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64_Max(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64_Max", pc, code, stack); OpHelpers.f64Max(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64_Copysign(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64_Copysign(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64_Copysign", pc, code, stack); OpHelpers.f64Copysign(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_Wrap_I64(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_Wrap_I64(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_Wrap_I64", pc, code, stack); OpHelpers.i32WrapI64(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_Trunc_F32_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_Trunc_F32_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_Trunc_F32_S", pc, code, stack); try OpHelpers.i32TruncF32S(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_Trunc_F32_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_Trunc_F32_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_Trunc_F32_U", pc, code, stack); try OpHelpers.i32TruncF32U(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_Trunc_F64_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_Trunc_F64_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_Trunc_F64_S", pc, code, stack); try OpHelpers.i32TruncF64S(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_Trunc_F64_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_Trunc_F64_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_Trunc_F64_U", pc, code, stack); try OpHelpers.i32TruncF64U(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Extend_I32_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Extend_I32_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Extend_I32_S", pc, code, stack); OpHelpers.i64ExtendI32S(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Extend_I32_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Extend_I32_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Extend_I32_U", pc, code, stack); OpHelpers.i64ExtendI32U(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Trunc_F32_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Trunc_F32_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Trunc_F32_S", pc, code, stack); try OpHelpers.i64TruncF32S(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Trunc_F32_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Trunc_F32_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Trunc_F32_U", pc, code, stack); try OpHelpers.i64TruncF32U(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Trunc_F64_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Trunc_F64_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Trunc_F64_S", pc, code, stack); try OpHelpers.i64TruncF64S(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Trunc_F64_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Trunc_F64_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Trunc_F64_U", pc, code, stack); try OpHelpers.i64TruncF64U(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32_Convert_I32_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32_Convert_I32_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32_Convert_I32_S", pc, code, stack); OpHelpers.f32ConvertI32S(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32_Convert_I32_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32_Convert_I32_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32_Convert_I32_U", pc, code, stack); OpHelpers.f32ConvertI32U(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32_Convert_I64_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32_Convert_I64_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32_Convert_I64_S", pc, code, stack); OpHelpers.f32ConvertI64S(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32_Convert_I64_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32_Convert_I64_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32_Convert_I64_U", pc, code, stack); OpHelpers.f32ConvertI64U(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32_Demote_F64(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32_Demote_F64(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32_Demote_F64", pc, code, stack); OpHelpers.f32DemoteF64(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64_Convert_I32_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64_Convert_I32_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64_Convert_I32_S", pc, code, stack); OpHelpers.f64ConvertI32S(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64_Convert_I32_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64_Convert_I32_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64_Convert_I32_U", pc, code, stack); OpHelpers.f64ConvertI32U(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64_Convert_I64_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64_Convert_I64_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64_Convert_I64_S", pc, code, stack); OpHelpers.f64ConvertI64S(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64_Convert_I64_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64_Convert_I64_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64_Convert_I64_U", pc, code, stack); OpHelpers.f64ConvertI64U(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64_Promote_F32(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64_Promote_F32(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64_Promote_F32", pc, code, stack); OpHelpers.f64PromoteF32(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_Reinterpret_F32(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_Reinterpret_F32(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_Reinterpret_F32", pc, code, stack); OpHelpers.i32ReinterpretF32(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Reinterpret_F64(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Reinterpret_F64(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Reinterpret_F64", pc, code, stack); OpHelpers.i64ReinterpretF64(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32_Reinterpret_I32(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32_Reinterpret_I32(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32_Reinterpret_I32", pc, code, stack); OpHelpers.f32ReinterpretI32(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64_Reinterpret_I64(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64_Reinterpret_I64(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64_Reinterpret_I64", pc, code, stack); OpHelpers.f64ReinterpretI64(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_Extend8_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_Extend8_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_Extend8_S", pc, code, stack); OpHelpers.i32Extend8S(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_Extend16_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_Extend16_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_Extend16_S", pc, code, stack); OpHelpers.i32Extend16S(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Extend8_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Extend8_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Extend8_S", pc, code, stack); OpHelpers.i64Extend8S(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Extend16_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Extend16_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Extend16_S", pc, code, stack); OpHelpers.i64Extend16S(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Extend32_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Extend32_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Extend32_S", pc, code, stack); OpHelpers.i64Extend32S(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_Ref_Null(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Ref_Null(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Ref_Null", pc, code, stack); try OpHelpers.refNull(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_Ref_Is_Null(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Ref_Is_Null(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Ref_Is_Null", pc, code, stack); OpHelpers.refIsNull(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_Ref_Func(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Ref_Func(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Ref_Func", pc, code, stack); OpHelpers.refFunc(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_Trunc_Sat_F32_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_Trunc_Sat_F32_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_Trunc_Sat_F32_S", pc, code, stack); OpHelpers.i32TruncSatF32S(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_Trunc_Sat_F32_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_Trunc_Sat_F32_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_Trunc_Sat_F32_U", pc, code, stack); OpHelpers.i32TruncSatF32U(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_Trunc_Sat_F64_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_Trunc_Sat_F64_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_Trunc_Sat_F64_S", pc, code, stack); OpHelpers.i32TruncSatF64S(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32_Trunc_Sat_F64_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32_Trunc_Sat_F64_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32_Trunc_Sat_F64_U", pc, code, stack); OpHelpers.i32TruncSatF64U(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Trunc_Sat_F32_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Trunc_Sat_F32_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Trunc_Sat_F32_S", pc, code, stack); OpHelpers.i64TruncSatF32S(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Trunc_Sat_F32_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Trunc_Sat_F32_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Trunc_Sat_F32_U", pc, code, stack); OpHelpers.i64TruncSatF32U(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Trunc_Sat_F64_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Trunc_Sat_F64_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Trunc_Sat_F64_S", pc, code, stack); OpHelpers.i64TruncSatF64S(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64_Trunc_Sat_F64_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64_Trunc_Sat_F64_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64_Trunc_Sat_F64_U", pc, code, stack); OpHelpers.i64TruncSatF64U(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_Memory_Init(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Memory_Init(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Memory_Init", pc, code, stack); try OpHelpers.memoryInit(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_Data_Drop(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Data_Drop(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Data_Drop", pc, code, stack); OpHelpers.dataDrop(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_Memory_Copy(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Memory_Copy(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Memory_Copy", pc, code, stack); try OpHelpers.memoryCopy(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_Memory_Fill(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Memory_Fill(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Memory_Fill", pc, code, stack); try OpHelpers.memoryFill(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_Table_Init(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Table_Init(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Table_Init", pc, code, stack); try OpHelpers.tableInit(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_Elem_Drop(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Elem_Drop(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Elem_Drop", pc, code, stack); OpHelpers.elemDrop(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_Table_Copy(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Table_Copy(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Table_Copy", pc, code, stack); try OpHelpers.tableCopy(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_Table_Grow(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Table_Grow(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Table_Grow", pc, code, stack); OpHelpers.tableGrow(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_Table_Size(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Table_Size(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Table_Size", pc, code, stack); OpHelpers.tableSize(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_Table_Fill(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_Table_Fill(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("Table_Fill", pc, code, stack); try OpHelpers.tableFill(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_V128_Load(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_V128_Load(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("V128_Load", pc, code, stack); try OpHelpers.v128Load(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_V128_Load8x8_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_V128_Load8x8_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("V128_Load8x8_S", pc, code, stack); try OpHelpers.v128Load8x8S(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_V128_Load8x8_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_V128_Load8x8_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("V128_Load8x8_S", pc, code, stack); try OpHelpers.v128Load8x8U(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_V128_Load16x4_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_V128_Load16x4_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("V128_Load16x4_S", pc, code, stack); try OpHelpers.v128Load16x4S(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_V128_Load16x4_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_V128_Load16x4_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("V128_Load16x4_U", pc, code, stack); try OpHelpers.v128Load16x4U(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_V128_Load32x2_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_V128_Load32x2_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("V128_Load32x2_S", pc, code, stack); try OpHelpers.v128Load32x2S(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_V128_Load32x2_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_V128_Load32x2_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("V128_Load32x2_U", pc, code, stack); try OpHelpers.v128Load32x2U(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_V128_Load8_Splat(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_V128_Load8_Splat(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("V128_Load8_Splat", pc, code, stack); try OpHelpers.v128Load8Splat(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_V128_Load16_Splat(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_V128_Load16_Splat(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("V128_Load16_Splat", pc, code, stack); try OpHelpers.v128Load16Splat(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_V128_Load32_Splat(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_V128_Load32_Splat(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("V128_Load32_Splat", pc, code, stack); try OpHelpers.v128Load32Splat(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_V128_Load64_Splat(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_V128_Load64_Splat(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("V128_Load64_Splat", pc, code, stack); try OpHelpers.v128Load64Splat(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I8x16_Splat(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I8x16_Splat(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I8x16_Splat", pc, code, stack); OpHelpers.i8x16Splat(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_Splat(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_Splat(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_Splat", pc, code, stack); OpHelpers.i16x8Splat(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32x4_Splat(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32x4_Splat(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32x4_Splat", pc, code, stack); OpHelpers.i32x4Splat(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64x2_Splat(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64x2_Splat(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64x2_Splat", pc, code, stack); OpHelpers.i64x2Splat(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32x4_Splat(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32x4_Splat(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32x4_Splat", pc, code, stack); OpHelpers.f32x4Splat(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64x2_Splat(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64x2_Splat(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64x2_Splat", pc, code, stack); OpHelpers.f64x2Splat(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I8x16_Extract_Lane_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I8x16_Extract_Lane_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I8x16_Extract_Lane_S", pc, code, stack); OpHelpers.i8x16ExtractLaneS(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I8x16_Extract_Lane_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I8x16_Extract_Lane_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I8x16_Extract_Lane_U", pc, code, stack); OpHelpers.i8x16ExtractLaneU(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I8x16_Replace_Lane(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I8x16_Replace_Lane(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I8x16_Replace_Lane", pc, code, stack); OpHelpers.i8x16ReplaceLane(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_Extract_Lane_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_Extract_Lane_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_Extract_Lane_S", pc, code, stack); OpHelpers.i16x8ExtractLaneS(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_Extract_Lane_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_Extract_Lane_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_Extract_Lane_U", pc, code, stack); OpHelpers.i16x8ExtractLaneU(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_Replace_Lane(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_Replace_Lane(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_Replace_Lane", pc, code, stack); OpHelpers.i16x8ReplaceLane(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32x4_Extract_Lane(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32x4_Extract_Lane(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32x4_Extract_Lane", pc, code, stack); OpHelpers.i32x4ExtractLane(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32x4_Replace_Lane(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32x4_Replace_Lane(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32x4_Replace_Lane", pc, code, stack); OpHelpers.i32x4ReplaceLane(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64x2_Extract_Lane(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64x2_Extract_Lane(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64x2_Extract_Lane", pc, code, stack); OpHelpers.i64x2ExtractLane(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64x2_Replace_Lane(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64x2_Replace_Lane(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64x2_Replace_Lane", pc, code, stack); OpHelpers.i64x2ReplaceLane(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32x4_Extract_Lane(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32x4_Extract_Lane(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32x4_Extract_Lane", pc, code, stack); OpHelpers.f32x4ExtractLane(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32x4_Replace_Lane(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32x4_Replace_Lane(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32x4_Replace_Lane", pc, code, stack); OpHelpers.f32x4ReplaceLane(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64x2_Extract_Lane(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64x2_Extract_Lane(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64x2_Extract_Lane", pc, code, stack); OpHelpers.f64x2ExtractLane(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64x2_Replace_Lane(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64x2_Replace_Lane(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64x2_Replace_Lane", pc, code, stack); OpHelpers.f64x2ReplaceLane(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I8x16_EQ(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I8x16_EQ(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I8x16_EQ", pc, code, stack); OpHelpers.i8x16EQ(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I8x16_NE(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I8x16_NE(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I8x16_NE", pc, code, stack); OpHelpers.i8x16NE(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I8x16_LT_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I8x16_LT_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I8x16_LT_S", pc, code, stack); OpHelpers.i8x16LTS(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I8x16_LT_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I8x16_LT_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I8x16_LT_U", pc, code, stack); OpHelpers.i8x16LTU(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I8x16_GT_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I8x16_GT_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I8x16_GT_S", pc, code, stack); OpHelpers.i8x16GTS(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I8x16_GT_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I8x16_GT_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I8x16_GT_U", pc, code, stack); OpHelpers.i8x16GTU(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I8x16_LE_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I8x16_LE_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I8x16_LE_S", pc, code, stack); OpHelpers.i8x16LES(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I8x16_LE_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I8x16_LE_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I8x16_LE_U", pc, code, stack); OpHelpers.i8x16LEU(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I8x16_GE_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I8x16_GE_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I8x16_GE_S", pc, code, stack); OpHelpers.i8x16GES(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I8x16_GE_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I8x16_GE_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I8x16_GE_U", pc, code, stack); OpHelpers.i8x16GEU(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_EQ(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_EQ(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_EQ", pc, code, stack); OpHelpers.i16x8EQ(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_NE(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_NE(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_NE", pc, code, stack); OpHelpers.i16x8NE(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_LT_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_LT_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_LT_S", pc, code, stack); OpHelpers.i16x8LTS(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_LT_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_LT_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_LT_U", pc, code, stack); OpHelpers.i16x8LTU(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_GT_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_GT_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_GT_S", pc, code, stack); OpHelpers.i16x8GTS(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_GT_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_GT_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_GT_U", pc, code, stack); OpHelpers.i16x8GTU(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_LE_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_LE_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_LE_S", pc, code, stack); OpHelpers.i16x8LES(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_LE_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_LE_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_LE_U", pc, code, stack); OpHelpers.i16x8LEU(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_GE_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_GE_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_GE_S", pc, code, stack); OpHelpers.i16x8GES(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_GE_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_GE_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_GE_U", pc, code, stack); OpHelpers.i16x8GEU(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32x4_EQ(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32x4_EQ(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32x4_EQ", pc, code, stack); OpHelpers.i32x4EQ(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32x4_NE(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32x4_NE(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32x4_NE", pc, code, stack); OpHelpers.i32x4NE(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32x4_LT_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32x4_LT_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32x4_LT_S", pc, code, stack); OpHelpers.i32x4LTS(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32x4_LT_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32x4_LT_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32x4_LT_U", pc, code, stack); OpHelpers.i32x4LTU(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32x4_GT_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32x4_GT_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32x4_GT_S", pc, code, stack); OpHelpers.i32x4GTS(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32x4_GT_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32x4_GT_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32x4_GT_U", pc, code, stack); OpHelpers.i32x4GTU(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32x4_LE_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32x4_LE_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32x4_LE_S", pc, code, stack); OpHelpers.i32x4LES(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32x4_LE_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32x4_LE_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32x4_LE_U", pc, code, stack); OpHelpers.i32x4LEU(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32x4_GE_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32x4_GE_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32x4_GE_S", pc, code, stack); OpHelpers.i32x4GES(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32x4_GE_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32x4_GE_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32x4_GE_U", pc, code, stack); OpHelpers.i32x4GEU(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32x4_EQ(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32x4_EQ(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32x4_EQ", pc, code, stack); OpHelpers.f32x4EQ(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32x4_NE(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32x4_NE(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32x4_NE", pc, code, stack); OpHelpers.f32x4NE(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32x4_LT(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32x4_LT(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32x4_LT", pc, code, stack); OpHelpers.f32x4LT(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32x4_GT(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32x4_GT(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32x4_GT", pc, code, stack); OpHelpers.f32x4GT(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32x4_LE(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32x4_LE(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32x4_LE", pc, code, stack); OpHelpers.f32x4LE(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32x4_GE(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32x4_GE(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32x4_GE", pc, code, stack); OpHelpers.f32x4GE(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64x2_EQ(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64x2_EQ(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64x2_EQ", pc, code, stack); OpHelpers.f64x2EQ(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64x2_NE(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64x2_NE(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64x2_NE", pc, code, stack); OpHelpers.f64x2NE(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64x2_LT(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64x2_LT(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64x2_LT", pc, code, stack); OpHelpers.f64x2LT(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64x2_GT(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64x2_GT(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64x2_GT", pc, code, stack); OpHelpers.f64x2GT(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64x2_LE(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64x2_LE(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64x2_LE", pc, code, stack); OpHelpers.f64x2LE(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64x2_GE(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64x2_GE(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64x2_GE", pc, code, stack); OpHelpers.f64x2GE(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_V128_Store(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_V128_Store(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("V128_Store", pc, code, stack); try OpHelpers.v128Store(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_V128_Const(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_V128_Const(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("V128_Const", pc, code, stack); OpHelpers.v128Const(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I8x16_Shuffle(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I8x16_Shuffle(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I8x16_Shuffle", pc, code, stack); OpHelpers.i8x16Shuffle(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I8x16_Swizzle(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I8x16_Swizzle(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I8x16_Swizzle", pc, code, stack); OpHelpers.i8x16Swizzle(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_V128_Not(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_V128_Not(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("V128_Not", pc, code, stack); OpHelpers.v128Not(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_V128_And(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_V128_And(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("V128_And", pc, code, stack); OpHelpers.v128And(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_V128_AndNot(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_V128_AndNot(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("V128_AndNot", pc, code, stack); OpHelpers.v128AndNot(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_V128_Or(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_V128_Or(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("V128_Or", pc, code, stack); OpHelpers.v128Or(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_V128_Xor(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_V128_Xor(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("V128_Xor", pc, code, stack); OpHelpers.v128Xor(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_V128_Bitselect(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_V128_Bitselect(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("V128_Bitselect", pc, code, stack); OpHelpers.v128Bitselect(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_V128_AnyTrue(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_V128_AnyTrue(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("V128_AnyTrue", pc, code, stack); OpHelpers.v128AnyTrue(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_V128_Load8_Lane(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_V128_Load8_Lane(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("V128_Load8_Lane", pc, code, stack); try OpHelpers.v128Load8Lane(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_V128_Load16_Lane(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_V128_Load16_Lane(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("V128_Load16_Lane", pc, code, stack); try OpHelpers.v128Load16Lane(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_V128_Load32_Lane(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_V128_Load32_Lane(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("V128_Load32_Lane", pc, code, stack); try OpHelpers.v128Load32Lane(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_V128_Load64_Lane(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_V128_Load64_Lane(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("V128_Load64_Lane", pc, code, stack); try OpHelpers.v128Load64Lane(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_V128_Store8_Lane(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_V128_Store8_Lane(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("V128_Store8_Lane", pc, code, stack); try OpHelpers.v128Store8Lane(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_V128_Store16_Lane(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_V128_Store16_Lane(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("V128_Store16_Lane", pc, code, stack); try OpHelpers.v128Store16Lane(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_V128_Store32_Lane(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_V128_Store32_Lane(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("V128_Store32_Lane", pc, code, stack); try OpHelpers.v128Store32Lane(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_V128_Store64_Lane(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_V128_Store64_Lane(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("V128_Store64_Lane", pc, code, stack); try OpHelpers.v128Store64Lane(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_V128_Load32_Zero(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_V128_Load32_Zero(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("V128_Load32_Zero", pc, code, stack); try OpHelpers.v128Load32Zero(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_V128_Load64_Zero(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_V128_Load64_Zero(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("V128_Load64_Zero", pc, code, stack); try OpHelpers.v128Load64Zero(pc, code, stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32x4_Demote_F64x2_Zero(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32x4_Demote_F64x2_Zero(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32x4_Demote_F64x2_Zero", pc, code, stack); OpHelpers.f32x4DemoteF64x2Zero(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64x2_Promote_Low_F32x4(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64x2_Promote_Low_F32x4(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64x2_Promote_Low_F32x4", pc, code, stack); OpHelpers.f64x2PromoteLowF32x4(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I8x16_Abs(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I8x16_Abs(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I8x16_Abs", pc, code, stack); OpHelpers.i8x16Abs(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I8x16_Neg(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I8x16_Neg(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I8x16_Neg", pc, code, stack); OpHelpers.i8x16Neg(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I8x16_Popcnt(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I8x16_Popcnt(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I8x16_Popcnt", pc, code, stack); OpHelpers.i8x16Popcnt(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I8x16_AllTrue(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I8x16_AllTrue(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I8x16_AllTrue", pc, code, stack); OpHelpers.i8x16AllTrue(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I8x16_Bitmask(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I8x16_Bitmask(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I8x16_Bitmask", pc, code, stack); OpHelpers.i8x16Bitmask(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I8x16_Narrow_I16x8_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I8x16_Narrow_I16x8_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I8x16_Narrow_I16x8_S", pc, code, stack); OpHelpers.i8x16NarrowI16x8S(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I8x16_Narrow_I16x8_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I8x16_Narrow_I16x8_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I8x16_Narrow_I16x8_U", pc, code, stack); OpHelpers.i8x16NarrowI16x8U(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32x4_Ceil(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32x4_Ceil(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32x4_Ceil", pc, code, stack); OpHelpers.f32x4Ceil(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32x4_Floor(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32x4_Floor(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32x4_Floor", pc, code, stack); OpHelpers.f32x4Floor(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32x4_Trunc(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32x4_Trunc(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32x4_Trunc", pc, code, stack); OpHelpers.f32x4Trunc(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32x4_Nearest(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32x4_Nearest(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32x4_Nearest", pc, code, stack); OpHelpers.f32x4Nearest(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I8x16_Shl(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I8x16_Shl(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I8x16_Shl", pc, code, stack); OpHelpers.i8x16Shl(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I8x16_Shr_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I8x16_Shr_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I8x16_Shr_S", pc, code, stack); OpHelpers.i8x16ShrS(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I8x16_Shr_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I8x16_Shr_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I8x16_Shr_U", pc, code, stack); OpHelpers.i8x16ShrU(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I8x16_Add(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I8x16_Add(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I8x16_Add", pc, code, stack); OpHelpers.i8x16Add(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I8x16_Add_Sat_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I8x16_Add_Sat_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I8x16_Add_Sat_S", pc, code, stack); OpHelpers.i8x16AddSatS(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I8x16_Add_Sat_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I8x16_Add_Sat_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I8x16_Add_Sat_U", pc, code, stack); OpHelpers.i8x16AddSatU(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I8x16_Sub(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I8x16_Sub(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I8x16_Sub", pc, code, stack); OpHelpers.i8x16Sub(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I8x16_Sub_Sat_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I8x16_Sub_Sat_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I8x16_Sub_Sat_S", pc, code, stack); OpHelpers.i8x16SubSatS(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I8x16_Sub_Sat_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I8x16_Sub_Sat_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I8x16_Sub_Sat_U", pc, code, stack); OpHelpers.i8x16SubSatU(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64x2_Ceil(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64x2_Ceil(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64x2_Ceil", pc, code, stack); OpHelpers.f64x2Ceil(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64x2_Floor(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64x2_Floor(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64x2_Floor", pc, code, stack); OpHelpers.f64x2Floor(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I8x16_Min_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I8x16_Min_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I8x16_Min_S", pc, code, stack); OpHelpers.i8x16MinS(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I8x16_Min_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I8x16_Min_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I8x16_Min_U", pc, code, stack); OpHelpers.i8x16MinU(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I8x16_Max_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I8x16_Max_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I8x16_Max_S", pc, code, stack); OpHelpers.i8x16MaxS(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I8x16_Max_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I8x16_Max_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I8x16_Max_U", pc, code, stack); OpHelpers.i8x16MaxU(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64x2_Trunc(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64x2_Trunc(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64x2_Trunc", pc, code, stack); OpHelpers.f64x2Trunc(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I8x16_Avgr_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I8x16_Avgr_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I8x16_Avgr_U", pc, code, stack); OpHelpers.i8x16AvgrU(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_Extadd_Pairwise_I8x16_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_Extadd_Pairwise_I8x16_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_Extadd_Pairwise_I8x16_S", pc, code, stack); OpHelpers.i16x8ExtaddPairwiseI8x16S(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_Extadd_Pairwise_I8x16_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_Extadd_Pairwise_I8x16_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_Extadd_Pairwise_I8x16_U", pc, code, stack); OpHelpers.i16x8ExtaddPairwiseI8x16U(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32x4_Extadd_Pairwise_I16x8_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32x4_Extadd_Pairwise_I16x8_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32x4_Extadd_Pairwise_I16x8_S", pc, code, stack); OpHelpers.i32x4ExtaddPairwiseI16x8S(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32x4_Extadd_Pairwise_I16x8_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32x4_Extadd_Pairwise_I16x8_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32x4_Extadd_Pairwise_I16x8_U", pc, code, stack); OpHelpers.i32x4ExtaddPairwiseI16x8U(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_Abs(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_Abs(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_Abs", pc, code, stack); OpHelpers.i16x8Abs(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_Neg(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_Neg(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_Neg", pc, code, stack); OpHelpers.i16x8Neg(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_Q15mulr_Sat_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_Q15mulr_Sat_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_Q15mulr_Sat_S", pc, code, stack); OpHelpers.i16x8Q15mulrSatS(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_AllTrue(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_AllTrue(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_AllTrue", pc, code, stack); OpHelpers.i16x8AllTrue(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_Bitmask(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_Bitmask(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_Bitmask", pc, code, stack); OpHelpers.i16x8Bitmask(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_Narrow_I32x4_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_Narrow_I32x4_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_Narrow_I32x4_S", pc, code, stack); OpHelpers.i16x8NarrowI32x4S(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_Narrow_I32x4_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_Narrow_I32x4_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_Narrow_I32x4_U", pc, code, stack); OpHelpers.i16x8NarrowI32x4U(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_Extend_Low_I8x16_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_Extend_Low_I8x16_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_Extend_Low_I8x16_S", pc, code, stack); OpHelpers.i16x8ExtendLowI8x16S(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_Extend_High_I8x16_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_Extend_High_I8x16_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_Extend_High_I8x16_S", pc, code, stack); OpHelpers.i16x8ExtendHighI8x16S(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_Extend_Low_I8x16_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_Extend_Low_I8x16_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_Extend_Low_I8x16_U", pc, code, stack); OpHelpers.i16x8ExtendLowI8x16U(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_Extend_High_I8x16_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_Extend_High_I8x16_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_Extend_High_I8x16_U", pc, code, stack); OpHelpers.i16x8ExtendHighI8x16U(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_Shl(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_Shl(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_Shl", pc, code, stack); OpHelpers.i16x8Shl(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_Shr_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_Shr_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_Shr_S", pc, code, stack); OpHelpers.i16x8ShrS(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_Shr_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_Shr_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_Shr_U", pc, code, stack); OpHelpers.i16x8ShrU(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_Add(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_Add(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_Add", pc, code, stack); OpHelpers.i16x8Add(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_Add_Sat_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_Add_Sat_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_Add_Sat_S", pc, code, stack); OpHelpers.i16x8AddSatS(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_Add_Sat_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_Add_Sat_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_Add_Sat_U", pc, code, stack); OpHelpers.i16x8AddSatU(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_Sub(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_Sub(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_Sub", pc, code, stack); OpHelpers.i16x8Sub(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_Sub_Sat_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_Sub_Sat_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_Sub_Sat_S", pc, code, stack); OpHelpers.i16x8SubSatS(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_Sub_Sat_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_Sub_Sat_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_Sub_Sat_U", pc, code, stack); OpHelpers.i16x8SubSatU(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64x2_Nearest(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64x2_Nearest(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64x2_Nearest", pc, code, stack); OpHelpers.f64x2Nearest(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_Mul(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_Mul(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_Mul", pc, code, stack); OpHelpers.i16x8Mul(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_Min_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_Min_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_Min_S", pc, code, stack); OpHelpers.i16x8MinS(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_Min_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_Min_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_Min_U", pc, code, stack); OpHelpers.i16x8MinU(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_Max_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_Max_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_Max_S", pc, code, stack); OpHelpers.i16x8MaxS(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_Max_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_Max_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_Max_U", pc, code, stack); OpHelpers.i16x8MaxU(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_Avgr_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_Avgr_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_Avgr_U", pc, code, stack); OpHelpers.i16x8AvgrU(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_Extmul_Low_I8x16_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_Extmul_Low_I8x16_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_Extmul_Low_I8x16_S", pc, code, stack); OpHelpers.i16x8ExtmulLowI8x16S(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_Extmul_High_I8x16_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_Extmul_High_I8x16_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_Extmul_High_I8x16_S", pc, code, stack); OpHelpers.i16x8ExtmulHighI8x16S(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_Extmul_Low_I8x16_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_Extmul_Low_I8x16_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_Extmul_Low_I8x16_U", pc, code, stack); OpHelpers.i16x8ExtmulLowI8x16U(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I16x8_Extmul_High_I8x16_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I16x8_Extmul_High_I8x16_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I16x8_Extmul_High_I8x16_U", pc, code, stack); OpHelpers.i16x8ExtmulHighI8x16U(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32x4_Abs(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32x4_Abs(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32x4_Abs", pc, code, stack); OpHelpers.i32x4Abs(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32x4_Neg(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32x4_Neg(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32x4_Neg", pc, code, stack); OpHelpers.i32x4Neg(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32x4_AllTrue(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32x4_AllTrue(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32x4_AllTrue", pc, code, stack); OpHelpers.i32x4AllTrue(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32x4_Bitmask(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32x4_Bitmask(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32x4_Bitmask", pc, code, stack); OpHelpers.i32x4Bitmask(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32x4_Extend_Low_I16x8_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32x4_Extend_Low_I16x8_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32x4_Extend_Low_I16x8_S", pc, code, stack); OpHelpers.i32x4ExtendLowI16x8S(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32x4_Extend_High_I16x8_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32x4_Extend_High_I16x8_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32x4_Extend_High_I16x8_S", pc, code, stack); OpHelpers.i32x4ExtendHighI16x8S(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32x4_Extend_Low_I16x8_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32x4_Extend_Low_I16x8_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32x4_Extend_Low_I16x8_U", pc, code, stack); OpHelpers.i32x4ExtendLowI16x8U(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32x4_Extend_High_I16x8_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32x4_Extend_High_I16x8_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32x4_Extend_High_I16x8_U", pc, code, stack); OpHelpers.i32x4ExtendHighI16x8U(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32x4_Shl(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32x4_Shl(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32x4_Shl", pc, code, stack); OpHelpers.i32x4Shl(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32x4_Shr_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32x4_Shr_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32x4_Shr_S", pc, code, stack); OpHelpers.i32x4ShrS(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32x4_Shr_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32x4_Shr_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32x4_Shr_U", pc, code, stack); OpHelpers.i32x4ShrU(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64x2_Abs(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64x2_Abs(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64x2_Abs", pc, code, stack); OpHelpers.i64x2Abs(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64x2_Neg(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64x2_Neg(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64x2_Neg", pc, code, stack); OpHelpers.i64x2Neg(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64x2_AllTrue(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64x2_AllTrue(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64x2_AllTrue", pc, code, stack); OpHelpers.i64x2AllTrue(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64x2_Bitmask(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64x2_Bitmask(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64x2_Bitmask", pc, code, stack); OpHelpers.i64x2Bitmask(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64x2_Extend_Low_I32x4_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64x2_Extend_Low_I32x4_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64x2_Extend_Low_I32x4_S", pc, code, stack); OpHelpers.i64x2ExtendLowI32x4S(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64x2_Extend_High_I32x4_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64x2_Extend_High_I32x4_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64x2_Extend_High_I32x4_S", pc, code, stack); OpHelpers.i64x2ExtendHighI32x4S(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64x2_Extend_Low_I32x4_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64x2_Extend_Low_I32x4_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64x2_Extend_Low_I32x4_U", pc, code, stack); OpHelpers.i64x2ExtendLowI32x4U(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64x2_Extend_High_I32x4_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64x2_Extend_High_I32x4_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64x2_Extend_High_I32x4_U", pc, code, stack); OpHelpers.i64x2ExtendHighI32x4U(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64x2_Shl(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64x2_Shl(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64x2_Shl", pc, code, stack); OpHelpers.i64x2Shl(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64x2_Shr_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64x2_Shr_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64x2_Shr_S", pc, code, stack); OpHelpers.i64x2ShrS(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64x2_Shr_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64x2_Shr_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64x2_Shr_U", pc, code, stack); OpHelpers.i64x2ShrU(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32x4_Add(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32x4_Add(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32x4_Add", pc, code, stack); OpHelpers.i32x4Add(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32x4_Sub(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32x4_Sub(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32x4_Sub", pc, code, stack); OpHelpers.i32x4Sub(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32x4_Mul(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32x4_Mul(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32x4_Mul", pc, code, stack); OpHelpers.i32x4Mul(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32x4_Min_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32x4_Min_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32x4_Min_S", pc, code, stack); OpHelpers.i32x4MinS(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32x4_Min_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32x4_Min_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32x4_Min_U", pc, code, stack); OpHelpers.i32x4MinU(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32x4_Max_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32x4_Max_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32x4_Max_S", pc, code, stack); OpHelpers.i32x4MaxS(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32x4_Max_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32x4_Max_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32x4_Max_U", pc, code, stack); OpHelpers.i32x4MaxU(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32x4_Dot_I16x8_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32x4_Dot_I16x8_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32x4_Dot_I16x8_S", pc, code, stack); OpHelpers.i32x4DotI16x8S(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32x4_Extmul_Low_I16x8_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32x4_Extmul_Low_I16x8_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32x4_Extmul_Low_I16x8_S", pc, code, stack); OpHelpers.i32x4ExtmulLowI16x8S(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32x4_Extmul_High_I16x8_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32x4_Extmul_High_I16x8_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32x4_Extmul_High_I16x8_S", pc, code, stack); OpHelpers.i32x4ExtmulHighI16x8S(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32x4_Extmul_Low_I16x8_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32x4_Extmul_Low_I16x8_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32x4_Extmul_Low_I16x8_U", pc, code, stack); OpHelpers.i32x4ExtmulLowI16x8U(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32x4_Extmul_High_I16x8_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32x4_Extmul_High_I16x8_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32x4_Extmul_High_I16x8_U", pc, code, stack); OpHelpers.i32x4ExtmulHighI16x8U(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64x2_Add(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64x2_Add(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64x2_Add", pc, code, stack); OpHelpers.i64x2Add(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64x2_Sub(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64x2_Sub(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64x2_Sub", pc, code, stack); OpHelpers.i64x2Sub(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64x2_Mul(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64x2_Mul(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64x2_Mul", pc, code, stack); OpHelpers.i64x2Mul(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64x2_EQ(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64x2_EQ(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64x2_EQ", pc, code, stack); OpHelpers.i64x2EQ(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64x2_NE(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64x2_NE(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64x2_NE", pc, code, stack); OpHelpers.i64x2NE(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64x2_LT_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64x2_LT_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64x2_LT_S", pc, code, stack); OpHelpers.i64x2LTS(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64x2_GT_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64x2_GT_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64x2_GT_S", pc, code, stack); OpHelpers.i64x2GTS(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64x2_LE_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64x2_LE_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64x2_LE_S", pc, code, stack); OpHelpers.i64x2LES(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64x2_GE_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64x2_GE_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64x2_GE_S", pc, code, stack); OpHelpers.i64x2GES(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64x2_Extmul_Low_I32x4_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64x2_Extmul_Low_I32x4_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64x2_GE_S", pc, code, stack); OpHelpers.i64x2ExtmulLowI32x4S(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64x2_Extmul_High_I32x4_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64x2_Extmul_High_I32x4_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64x2_GE_S", pc, code, stack); OpHelpers.i64x2ExtmulHighI32x4S(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64x2_Extmul_Low_I32x4_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64x2_Extmul_Low_I32x4_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64x2_GE_S", pc, code, stack); OpHelpers.i64x2ExtmulLowI32x4U(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I64x2_Extmul_High_I32x4_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I64x2_Extmul_High_I32x4_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I64x2_GE_S", pc, code, stack); OpHelpers.i64x2ExtmulHighI32x4U(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32x4_Abs(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32x4_Abs(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32x4_Abs", pc, code, stack); OpHelpers.f32x4Abs(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32x4_Neg(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32x4_Neg(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32x4_Neg", pc, code, stack); OpHelpers.f32x4Neg(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32x4_Sqrt(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32x4_Sqrt(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32x4_Sqrt", pc, code, stack); OpHelpers.f32x4Sqrt(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32x4_Add(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32x4_Add(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32x4_Add", pc, code, stack); OpHelpers.f32x4Add(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32x4_Sub(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32x4_Sub(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32x4_Sub", pc, code, stack); OpHelpers.f32x4Sub(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32x4_Mul(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32x4_Mul(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32x4_Mul", pc, code, stack); OpHelpers.f32x4Mul(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32x4_Div(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32x4_Div(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32x4_Div", pc, code, stack); OpHelpers.f32x4Div(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32x4_Min(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32x4_Min(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32x4_Min", pc, code, stack); OpHelpers.f32x4Min(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32x4_Max(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32x4_Max(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32x4_Max", pc, code, stack); OpHelpers.f32x4Max(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32x4_PMin(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32x4_PMin(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32x4_PMin", pc, code, stack); OpHelpers.f32x4PMin(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32x4_PMax(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32x4_PMax(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32x4_PMax", pc, code, stack); OpHelpers.f32x4PMax(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64x2_Abs(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64x2_Abs(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64x2_Abs", pc, code, stack); OpHelpers.f64x2Abs(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64x2_Neg(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64x2_Neg(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64x2_Neg", pc, code, stack); OpHelpers.f64x2Neg(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64x2_Sqrt(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64x2_Sqrt(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64x2_Sqrt", pc, code, stack); OpHelpers.f64x2Sqrt(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64x2_Add(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64x2_Add(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64x2_Add", pc, code, stack); OpHelpers.f64x2Add(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64x2_Sub(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64x2_Sub(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64x2_Sub", pc, code, stack); OpHelpers.f64x2Sub(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64x2_Mul(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64x2_Mul(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64x2_Mul", pc, code, stack); OpHelpers.f64x2Mul(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64x2_Div(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64x2_Div(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64x2_Div", pc, code, stack); OpHelpers.f64x2Div(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64x2_Min(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64x2_Min(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64x2_Min", pc, code, stack); OpHelpers.f64x2Min(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64x2_Max(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64x2_Max(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64x2_Max", pc, code, stack); OpHelpers.f64x2Max(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64x2_PMin(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64x2_PMin(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64x2_PMin", pc, code, stack); OpHelpers.f64x2PMin(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64x2_PMax(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64x2_PMax(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64x2_PMax", pc, code, stack); OpHelpers.f64x2PMax(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32x4_Trunc_Sat_F32x4_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32x4_Trunc_Sat_F32x4_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32x4_Trunc_Sat_F32x4_S", pc, code, stack); OpHelpers.f32x4TruncSatF32x4S(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32x4_Trunc_Sat_F32x4_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32x4_Trunc_Sat_F32x4_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32x4_Trunc_Sat_F32x4_U", pc, code, stack); OpHelpers.f32x4TruncSatF32x4U(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32x4_Convert_I32x4_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32x4_Convert_I32x4_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32x4_Convert_I32x4_S", pc, code, stack); OpHelpers.f32x4ConvertI32x4S(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F32x4_Convert_I32x4_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F32x4_Convert_I32x4_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F32x4_Convert_I32x4_U", pc, code, stack); OpHelpers.f32x4ConvertI32x4U(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32x4_Trunc_Sat_F64x2_S_Zero(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32x4_Trunc_Sat_F64x2_S_Zero(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32x4_Trunc_Sat_F64x2_S_Zero", pc, code, stack); OpHelpers.i32x4TruncSatF64x2SZero(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_I32x4_Trunc_Sat_F64x2_U_Zero(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_I32x4_Trunc_Sat_F64x2_U_Zero(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("I32x4_Trunc_Sat_F64x2_U_Zero", pc, code, stack); OpHelpers.i32x4TruncSatF64x2UZero(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64x2_Convert_Low_I32x4_S(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64x2_Convert_Low_I32x4_S(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64x2_Convert_Low_I32x4_S", pc, code, stack); OpHelpers.f64x2ConvertLowI32x4S(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); } - fn op_F64x2_Convert_Low_I32x4_U(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void { + fn op_F64x2_Convert_Low_I32x4_U(pc: u32, code: [*]const Instruction, stack: *Stack) TrapError!void { try preamble("F64x2_Convert_Low_I32x4_U", pc, code, stack); OpHelpers.f64x2ConvertLowI32x4U(stack); try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack }); @@ -3346,7 +3348,7 @@ pub const StackVM = struct { } } - pub fn instantiate(vm: *VM, module: *ModuleInstance, opts: ModuleInstantiateOpts) anyerror!void { + pub fn instantiate(vm: *VM, module: *ModuleInstance, opts: ModuleInstantiateOpts) InstantiateError!void { var self: *StackVM = fromVM(vm); if (opts.enable_debug) { @@ -3474,7 +3476,7 @@ pub const StackVM = struct { } } - pub fn invoke(vm: *VM, module: *ModuleInstance, handle: FunctionHandle, params: [*]const Val, returns: [*]Val, opts: InvokeOpts) anyerror!void { + pub fn invoke(vm: *VM, module: *ModuleInstance, handle: FunctionHandle, params: [*]const Val, returns: [*]Val, opts: InvokeOpts) TrapError!void { var self: *StackVM = fromVM(vm); if (self.debug_state) |*debug_state| { @@ -3523,7 +3525,7 @@ pub const StackVM = struct { } try self.stack.pushFrame(func, module); - try self.stack.pushLabel(func.num_returns, @intCast(func_def.continuation)); + self.stack.pushLabel(func.num_returns, @intCast(func_def.continuation)); DebugTrace.traceFunction(module, self.stack.num_frames, func.def_index); @@ -3560,7 +3562,7 @@ pub const StackVM = struct { } } - pub fn resumeInvoke(vm: *VM, module: *ModuleInstance, returns: []Val, opts: ResumeInvokeOpts) anyerror!void { + pub fn resumeInvoke(vm: *VM, module: *ModuleInstance, returns: []Val, opts: ResumeInvokeOpts) TrapError!void { var self: *StackVM = fromVM(vm); var pc: u32 = 0; @@ -3626,7 +3628,7 @@ pub const StackVM = struct { } } - pub fn step(vm: *VM, module: *ModuleInstance, returns: []Val) !void { + pub fn step(vm: *VM, module: *ModuleInstance, returns: []Val) TrapError!void { var self: *StackVM = fromVM(vm); const debug_state = &self.debug_state.?; @@ -3642,7 +3644,7 @@ pub const StackVM = struct { try vm.resumeInvoke(module, returns, .{}); } - pub fn setDebugTrap(vm: *VM, module: *ModuleInstance, wasm_address: u32, mode: DebugTrapInstructionMode) !bool { + pub fn setDebugTrap(vm: *VM, module: *ModuleInstance, wasm_address: u32, mode: DebugTrapInstructionMode) AllocError!bool { var self: *StackVM = fromVM(vm); std.debug.assert(self.debug_state != null); @@ -3718,7 +3720,7 @@ pub const StackVM = struct { return if (func.isNull()) func else FuncRef{ .func = &self.functions.items[func.index] }; } - fn run(self: *StackVM, start_pc: u32, start_code: [*]const Instruction) anyerror!void { + fn run(self: *StackVM, start_pc: u32, start_code: [*]const Instruction) TrapError!void { var pc: u32 = start_pc; var code: [*]const Instruction = start_code; const stack = &self.stack; @@ -3747,21 +3749,20 @@ pub const StackVM = struct { Opcode.Block => { try preamble("Block", pc, code, stack); - try OpHelpers.block(pc, code, stack); + OpHelpers.block(pc, code, stack); pc += 1; continue :interpret code[pc].opcode; }, Opcode.Loop => { try preamble("Loop", pc, code, stack); - try OpHelpers.loop(pc, code, stack); + OpHelpers.loop(pc, code, stack); pc += 1; continue :interpret code[pc].opcode; }, Opcode.If => { try preamble("If", pc, code, stack); - pc = OpHelpers.@"if"(pc, code, stack); continue :interpret code[pc].opcode; },