authorgravatar for kcbanner@gmail.comCasey Banner <kcbanner@gmail.com> 2023-07-24 02:07:59-04:00
committergravatar for kcbanner@gmail.comCasey Banner <kcbanner@gmail.com> 2023-07-24 02:07:59-04:00
log20ce7455b9acea004e985b4f4d4b1133899ea77b
treee85e657565774d3d73a734aa055e965d0b8f5832
parent23a806102a5a3d5b28b2e5ab5ec30e191daea6f4

fixup inline switch


1 files changed, 29 insertions(+), 12 deletions(-)

lib/std/dwarf/call_frame.zig+29-12
......@@ -203,23 +203,40 @@ pub const Instruction = union(Opcode) {
203203 stream: *std.io.FixedBufferStream([]const u8),
204204 addr_size_bytes: u8,
205205 endian: std.builtin.Endian,
206
206207 ) !Instruction {
207 return switch (try stream.reader().readByte()) {
208 inline Opcode.lo_inline...Opcode.hi_inline => |opcode| blk: {
208 switch (try stream.reader().readByte()) {
209 Opcode.lo_inline...Opcode.hi_inline => |opcode| {
209210 const e: Opcode = @enumFromInt(opcode & 0b11000000);
210 var result = @unionInit(Instruction, @tagName(e), undefined);
211 try result.readOperands(stream, @as(u6, @intCast(opcode & 0b111111)), addr_size_bytes, endian);
212 break :blk result;
211 switch (e) {
212 inline .advance_loc,
213 .offset,
214 .restore,
215 => |tag| {
216 var result = @unionInit(Instruction, @tagName(tag), undefined);
217 try result.readOperands(stream, @as(u6, @intCast(opcode & 0b111111)), addr_size_bytes, endian);
218 return result;
219 },
220 else => unreachable,
221 }
213222 },
214 inline Opcode.lo_reserved...Opcode.hi_reserved => |opcode| blk: {
223 Opcode.lo_reserved...Opcode.hi_reserved => |opcode| {
215224 const e: Opcode = @enumFromInt(opcode);
216 var result = @unionInit(Instruction, @tagName(e), undefined);
217 try result.readOperands(stream, null, addr_size_bytes, endian);
218 break :blk result;
225 switch (e) {
226 .advance_loc,
227 .offset,
228 .restore,
229 => unreachable,
230 inline else => |tag| {
231 var result = @unionInit(Instruction, @tagName(tag), undefined);
232 try result.readOperands(stream, null, addr_size_bytes, endian);
233 return result;
234 },
235 }
219236 },
220 Opcode.lo_user...Opcode.hi_user => error.UnimplementedUserOpcode,
221 else => error.InvalidOpcode,
222 };
237 Opcode.lo_user...Opcode.hi_user => return error.UnimplementedUserOpcode,
238 else => return error.InvalidOpcode,
239 }
223240 }
224241};
225242