aboutsummaryrefslogtreecommitdiff
path: root/lib/std/debug/Dwarf/expression.zig
diff options
context:
space:
mode:
authorMeghan Denny <hello@nektro.net>2025-02-09 20:21:31 -0800
committerGitHub <noreply@github.com>2025-02-10 04:21:31 +0000
commit91424823724de866776c8b6a999ea45f1ca9d374 (patch)
tree43c794431c7e5d83dc434117cca5884d8e01c672 /lib/std/debug/Dwarf/expression.zig
parent75df7e502c05e7e6a9b00a5a28854ae4a1aa8ea6 (diff)
downloadzig-91424823724de866776c8b6a999ea45f1ca9d374.tar.gz
zig-91424823724de866776c8b6a999ea45f1ca9d374.zip
std.ArrayList: popOrNull() -> pop() [v2] (#22720)
Diffstat (limited to 'lib/std/debug/Dwarf/expression.zig')
-rw-r--r--lib/std/debug/Dwarf/expression.zig136
1 files changed, 68 insertions, 68 deletions
diff --git a/lib/std/debug/Dwarf/expression.zig b/lib/std/debug/Dwarf/expression.zig
index 38bce2614c..c0ebea7504 100644
--- a/lib/std/debug/Dwarf/expression.zig
+++ b/lib/std/debug/Dwarf/expression.zig
@@ -527,14 +527,14 @@ pub fn StackMachine(comptime options: Options) type {
},
OP.@"and" => {
if (self.stack.items.len < 2) return error.InvalidExpression;
- const a = try self.stack.pop().asIntegral();
+ const a = try self.stack.pop().?.asIntegral();
self.stack.items[self.stack.items.len - 1] = .{
.generic = a & try self.stack.items[self.stack.items.len - 1].asIntegral(),
};
},
OP.div => {
if (self.stack.items.len < 2) return error.InvalidExpression;
- const a: isize = @bitCast(try self.stack.pop().asIntegral());
+ const a: isize = @bitCast(try self.stack.pop().?.asIntegral());
const b: isize = @bitCast(try self.stack.items[self.stack.items.len - 1].asIntegral());
self.stack.items[self.stack.items.len - 1] = .{
.generic = @bitCast(try std.math.divTrunc(isize, b, a)),
@@ -542,14 +542,14 @@ pub fn StackMachine(comptime options: Options) type {
},
OP.minus => {
if (self.stack.items.len < 2) return error.InvalidExpression;
- const b = try self.stack.pop().asIntegral();
+ const b = try self.stack.pop().?.asIntegral();
self.stack.items[self.stack.items.len - 1] = .{
.generic = try std.math.sub(addr_type, try self.stack.items[self.stack.items.len - 1].asIntegral(), b),
};
},
OP.mod => {
if (self.stack.items.len < 2) return error.InvalidExpression;
- const a: isize = @bitCast(try self.stack.pop().asIntegral());
+ const a: isize = @bitCast(try self.stack.pop().?.asIntegral());
const b: isize = @bitCast(try self.stack.items[self.stack.items.len - 1].asIntegral());
self.stack.items[self.stack.items.len - 1] = .{
.generic = @bitCast(@mod(b, a)),
@@ -557,7 +557,7 @@ pub fn StackMachine(comptime options: Options) type {
},
OP.mul => {
if (self.stack.items.len < 2) return error.InvalidExpression;
- const a: isize = @bitCast(try self.stack.pop().asIntegral());
+ const a: isize = @bitCast(try self.stack.pop().?.asIntegral());
const b: isize = @bitCast(try self.stack.items[self.stack.items.len - 1].asIntegral());
self.stack.items[self.stack.items.len - 1] = .{
.generic = @bitCast(@mulWithOverflow(a, b)[0]),
@@ -581,14 +581,14 @@ pub fn StackMachine(comptime options: Options) type {
},
OP.@"or" => {
if (self.stack.items.len < 2) return error.InvalidExpression;
- const a = try self.stack.pop().asIntegral();
+ const a = try self.stack.pop().?.asIntegral();
self.stack.items[self.stack.items.len - 1] = .{
.generic = a | try self.stack.items[self.stack.items.len - 1].asIntegral(),
};
},
OP.plus => {
if (self.stack.items.len < 2) return error.InvalidExpression;
- const b = try self.stack.pop().asIntegral();
+ const b = try self.stack.pop().?.asIntegral();
self.stack.items[self.stack.items.len - 1] = .{
.generic = try std.math.add(addr_type, try self.stack.items[self.stack.items.len - 1].asIntegral(), b),
};
@@ -602,7 +602,7 @@ pub fn StackMachine(comptime options: Options) type {
},
OP.shl => {
if (self.stack.items.len < 2) return error.InvalidExpression;
- const a = try self.stack.pop().asIntegral();
+ const a = try self.stack.pop().?.asIntegral();
const b = try self.stack.items[self.stack.items.len - 1].asIntegral();
self.stack.items[self.stack.items.len - 1] = .{
.generic = std.math.shl(usize, b, a),
@@ -610,7 +610,7 @@ pub fn StackMachine(comptime options: Options) type {
},
OP.shr => {
if (self.stack.items.len < 2) return error.InvalidExpression;
- const a = try self.stack.pop().asIntegral();
+ const a = try self.stack.pop().?.asIntegral();
const b = try self.stack.items[self.stack.items.len - 1].asIntegral();
self.stack.items[self.stack.items.len - 1] = .{
.generic = std.math.shr(usize, b, a),
@@ -618,7 +618,7 @@ pub fn StackMachine(comptime options: Options) type {
},
OP.shra => {
if (self.stack.items.len < 2) return error.InvalidExpression;
- const a = try self.stack.pop().asIntegral();
+ const a = try self.stack.pop().?.asIntegral();
const b: isize = @bitCast(try self.stack.items[self.stack.items.len - 1].asIntegral());
self.stack.items[self.stack.items.len - 1] = .{
.generic = @bitCast(std.math.shr(isize, b, a)),
@@ -626,7 +626,7 @@ pub fn StackMachine(comptime options: Options) type {
},
OP.xor => {
if (self.stack.items.len < 2) return error.InvalidExpression;
- const a = try self.stack.pop().asIntegral();
+ const a = try self.stack.pop().?.asIntegral();
self.stack.items[self.stack.items.len - 1] = .{
.generic = a ^ try self.stack.items[self.stack.items.len - 1].asIntegral(),
};
@@ -641,7 +641,7 @@ pub fn StackMachine(comptime options: Options) type {
OP.ne,
=> {
if (self.stack.items.len < 2) return error.InvalidExpression;
- const a = self.stack.pop();
+ const a = self.stack.pop().?;
const b = self.stack.items[self.stack.items.len - 1];
if (a == .generic and b == .generic) {
@@ -667,7 +667,7 @@ pub fn StackMachine(comptime options: Options) type {
const branch_offset = operand.?.branch_offset;
const condition = if (opcode == OP.bra) blk: {
if (self.stack.items.len == 0) return error.InvalidExpression;
- break :blk try self.stack.pop().asIntegral() != 0;
+ break :blk try self.stack.pop().?.asIntegral() != 0;
} else true;
if (condition) {
@@ -1080,7 +1080,7 @@ test "DWARF expressions" {
for (0..32) |i| {
const expected = 31 - i;
- try testing.expectEqual(expected, stack_machine.stack.popOrNull().?.generic);
+ try testing.expectEqual(expected, stack_machine.stack.pop().?.generic);
}
}
@@ -1141,7 +1141,7 @@ test "DWARF expressions" {
_ = try stack_machine.run(program.items, allocator, context, 0);
- const const_type = stack_machine.stack.popOrNull().?.const_type;
+ const const_type = stack_machine.stack.pop().?.const_type;
try testing.expectEqual(die_offset, const_type.type_offset);
try testing.expectEqualSlices(u8, type_bytes, const_type.value_bytes);
@@ -1162,7 +1162,7 @@ test "DWARF expressions" {
};
inline for (expected) |e| {
- try testing.expectEqual(@as(e[0], e[1]), @as(e[2], @bitCast(stack_machine.stack.popOrNull().?.generic)));
+ try testing.expectEqual(@as(e[0], e[1]), @as(e[2], @bitCast(stack_machine.stack.pop().?.generic)));
}
}
@@ -1199,14 +1199,14 @@ test "DWARF expressions" {
_ = try stack_machine.run(program.items, allocator, context, 0);
- const regval_type = stack_machine.stack.popOrNull().?.regval_type;
+ const regval_type = stack_machine.stack.pop().?.regval_type;
try testing.expectEqual(@as(usize, 400), regval_type.type_offset);
try testing.expectEqual(@as(u8, @sizeOf(usize)), regval_type.type_size);
try testing.expectEqual(@as(usize, 0xee), regval_type.value);
- try testing.expectEqual(@as(usize, 303), stack_machine.stack.popOrNull().?.generic);
- try testing.expectEqual(@as(usize, 202), stack_machine.stack.popOrNull().?.generic);
- try testing.expectEqual(@as(usize, 101), stack_machine.stack.popOrNull().?.generic);
+ try testing.expectEqual(@as(usize, 303), stack_machine.stack.pop().?.generic);
+ try testing.expectEqual(@as(usize, 202), stack_machine.stack.pop().?.generic);
+ try testing.expectEqual(@as(usize, 101), stack_machine.stack.pop().?.generic);
} else |err| {
switch (err) {
error.UnimplementedArch,
@@ -1227,15 +1227,15 @@ test "DWARF expressions" {
try b.writeConst(writer, u8, 1);
try b.writeOpcode(writer, OP.dup);
_ = try stack_machine.run(program.items, allocator, context, null);
- try testing.expectEqual(@as(usize, 1), stack_machine.stack.popOrNull().?.generic);
- try testing.expectEqual(@as(usize, 1), stack_machine.stack.popOrNull().?.generic);
+ try testing.expectEqual(@as(usize, 1), stack_machine.stack.pop().?.generic);
+ try testing.expectEqual(@as(usize, 1), stack_machine.stack.pop().?.generic);
stack_machine.reset();
program.clearRetainingCapacity();
try b.writeConst(writer, u8, 1);
try b.writeOpcode(writer, OP.drop);
_ = try stack_machine.run(program.items, allocator, context, null);
- try testing.expect(stack_machine.stack.popOrNull() == null);
+ try testing.expect(stack_machine.stack.pop() == null);
stack_machine.reset();
program.clearRetainingCapacity();
@@ -1244,7 +1244,7 @@ test "DWARF expressions" {
try b.writeConst(writer, u8, 6);
try b.writePick(writer, 2);
_ = try stack_machine.run(program.items, allocator, context, null);
- try testing.expectEqual(@as(usize, 4), stack_machine.stack.popOrNull().?.generic);
+ try testing.expectEqual(@as(usize, 4), stack_machine.stack.pop().?.generic);
stack_machine.reset();
program.clearRetainingCapacity();
@@ -1253,7 +1253,7 @@ test "DWARF expressions" {
try b.writeConst(writer, u8, 6);
try b.writeOpcode(writer, OP.over);
_ = try stack_machine.run(program.items, allocator, context, null);
- try testing.expectEqual(@as(usize, 5), stack_machine.stack.popOrNull().?.generic);
+ try testing.expectEqual(@as(usize, 5), stack_machine.stack.pop().?.generic);
stack_machine.reset();
program.clearRetainingCapacity();
@@ -1261,8 +1261,8 @@ test "DWARF expressions" {
try b.writeConst(writer, u8, 6);
try b.writeOpcode(writer, OP.swap);
_ = try stack_machine.run(program.items, allocator, context, null);
- try testing.expectEqual(@as(usize, 5), stack_machine.stack.popOrNull().?.generic);
- try testing.expectEqual(@as(usize, 6), stack_machine.stack.popOrNull().?.generic);
+ try testing.expectEqual(@as(usize, 5), stack_machine.stack.pop().?.generic);
+ try testing.expectEqual(@as(usize, 6), stack_machine.stack.pop().?.generic);
stack_machine.reset();
program.clearRetainingCapacity();
@@ -1271,9 +1271,9 @@ test "DWARF expressions" {
try b.writeConst(writer, u8, 6);
try b.writeOpcode(writer, OP.rot);
_ = try stack_machine.run(program.items, allocator, context, null);
- try testing.expectEqual(@as(usize, 5), stack_machine.stack.popOrNull().?.generic);
- try testing.expectEqual(@as(usize, 4), stack_machine.stack.popOrNull().?.generic);
- try testing.expectEqual(@as(usize, 6), stack_machine.stack.popOrNull().?.generic);
+ try testing.expectEqual(@as(usize, 5), stack_machine.stack.pop().?.generic);
+ try testing.expectEqual(@as(usize, 4), stack_machine.stack.pop().?.generic);
+ try testing.expectEqual(@as(usize, 6), stack_machine.stack.pop().?.generic);
const deref_target: usize = @truncate(0xffeeffee_ffeeffee);
@@ -1282,7 +1282,7 @@ test "DWARF expressions" {
try b.writeAddr(writer, @intFromPtr(&deref_target));
try b.writeOpcode(writer, OP.deref);
_ = try stack_machine.run(program.items, allocator, context, null);
- try testing.expectEqual(deref_target, stack_machine.stack.popOrNull().?.generic);
+ try testing.expectEqual(deref_target, stack_machine.stack.pop().?.generic);
stack_machine.reset();
program.clearRetainingCapacity();
@@ -1290,14 +1290,14 @@ test "DWARF expressions" {
try b.writeAddr(writer, @intFromPtr(&deref_target));
try b.writeOpcode(writer, OP.xderef);
_ = try stack_machine.run(program.items, allocator, context, null);
- try testing.expectEqual(deref_target, stack_machine.stack.popOrNull().?.generic);
+ try testing.expectEqual(deref_target, stack_machine.stack.pop().?.generic);
stack_machine.reset();
program.clearRetainingCapacity();
try b.writeAddr(writer, @intFromPtr(&deref_target));
try b.writeDerefSize(writer, 1);
_ = try stack_machine.run(program.items, allocator, context, null);
- try testing.expectEqual(@as(usize, @as(*const u8, @ptrCast(&deref_target)).*), stack_machine.stack.popOrNull().?.generic);
+ try testing.expectEqual(@as(usize, @as(*const u8, @ptrCast(&deref_target)).*), stack_machine.stack.pop().?.generic);
stack_machine.reset();
program.clearRetainingCapacity();
@@ -1305,7 +1305,7 @@ test "DWARF expressions" {
try b.writeAddr(writer, @intFromPtr(&deref_target));
try b.writeXDerefSize(writer, 1);
_ = try stack_machine.run(program.items, allocator, context, null);
- try testing.expectEqual(@as(usize, @as(*const u8, @ptrCast(&deref_target)).*), stack_machine.stack.popOrNull().?.generic);
+ try testing.expectEqual(@as(usize, @as(*const u8, @ptrCast(&deref_target)).*), stack_machine.stack.pop().?.generic);
const type_offset: usize = @truncate(0xaabbaabb_aabbaabb);
@@ -1314,7 +1314,7 @@ test "DWARF expressions" {
try b.writeAddr(writer, @intFromPtr(&deref_target));
try b.writeDerefType(writer, 1, type_offset);
_ = try stack_machine.run(program.items, allocator, context, null);
- const deref_type = stack_machine.stack.popOrNull().?.regval_type;
+ const deref_type = stack_machine.stack.pop().?.regval_type;
try testing.expectEqual(type_offset, deref_type.type_offset);
try testing.expectEqual(@as(u8, 1), deref_type.type_size);
try testing.expectEqual(@as(usize, @as(*const u8, @ptrCast(&deref_target)).*), deref_type.value);
@@ -1325,7 +1325,7 @@ test "DWARF expressions" {
try b.writeAddr(writer, @intFromPtr(&deref_target));
try b.writeXDerefType(writer, 1, type_offset);
_ = try stack_machine.run(program.items, allocator, context, null);
- const xderef_type = stack_machine.stack.popOrNull().?.regval_type;
+ const xderef_type = stack_machine.stack.pop().?.regval_type;
try testing.expectEqual(type_offset, xderef_type.type_offset);
try testing.expectEqual(@as(u8, 1), xderef_type.type_size);
try testing.expectEqual(@as(usize, @as(*const u8, @ptrCast(&deref_target)).*), xderef_type.value);
@@ -1336,7 +1336,7 @@ test "DWARF expressions" {
program.clearRetainingCapacity();
try b.writeOpcode(writer, OP.push_object_address);
_ = try stack_machine.run(program.items, allocator, context, null);
- try testing.expectEqual(@as(usize, @intFromPtr(context.object_address.?)), stack_machine.stack.popOrNull().?.generic);
+ try testing.expectEqual(@as(usize, @intFromPtr(context.object_address.?)), stack_machine.stack.pop().?.generic);
// TODO: Test OP.form_tls_address
@@ -1346,7 +1346,7 @@ test "DWARF expressions" {
program.clearRetainingCapacity();
try b.writeOpcode(writer, OP.call_frame_cfa);
_ = try stack_machine.run(program.items, allocator, context, null);
- try testing.expectEqual(context.cfa.?, stack_machine.stack.popOrNull().?.generic);
+ try testing.expectEqual(context.cfa.?, stack_machine.stack.pop().?.generic);
}
// Arithmetic and Logical Operations
@@ -1358,7 +1358,7 @@ test "DWARF expressions" {
try b.writeConst(writer, i16, -4096);
try b.writeOpcode(writer, OP.abs);
_ = try stack_machine.run(program.items, allocator, context, null);
- try testing.expectEqual(@as(usize, 4096), stack_machine.stack.popOrNull().?.generic);
+ try testing.expectEqual(@as(usize, 4096), stack_machine.stack.pop().?.generic);
stack_machine.reset();
program.clearRetainingCapacity();
@@ -1366,7 +1366,7 @@ test "DWARF expressions" {
try b.writeConst(writer, u16, 0xf0ff);
try b.writeOpcode(writer, OP.@"and");
_ = try stack_machine.run(program.items, allocator, context, null);
- try testing.expectEqual(@as(usize, 0xf00f), stack_machine.stack.popOrNull().?.generic);
+ try testing.expectEqual(@as(usize, 0xf00f), stack_machine.stack.pop().?.generic);
stack_machine.reset();
program.clearRetainingCapacity();
@@ -1374,7 +1374,7 @@ test "DWARF expressions" {
try b.writeConst(writer, i16, 100);
try b.writeOpcode(writer, OP.div);
_ = try stack_machine.run(program.items, allocator, context, null);
- try testing.expectEqual(@as(isize, -404 / 100), @as(isize, @bitCast(stack_machine.stack.popOrNull().?.generic)));
+ try testing.expectEqual(@as(isize, -404 / 100), @as(isize, @bitCast(stack_machine.stack.pop().?.generic)));
stack_machine.reset();
program.clearRetainingCapacity();
@@ -1382,7 +1382,7 @@ test "DWARF expressions" {
try b.writeConst(writer, u16, 50);
try b.writeOpcode(writer, OP.minus);
_ = try stack_machine.run(program.items, allocator, context, null);
- try testing.expectEqual(@as(usize, 150), stack_machine.stack.popOrNull().?.generic);
+ try testing.expectEqual(@as(usize, 150), stack_machine.stack.pop().?.generic);
stack_machine.reset();
program.clearRetainingCapacity();
@@ -1390,7 +1390,7 @@ test "DWARF expressions" {
try b.writeConst(writer, u16, 100);
try b.writeOpcode(writer, OP.mod);
_ = try stack_machine.run(program.items, allocator, context, null);
- try testing.expectEqual(@as(usize, 23), stack_machine.stack.popOrNull().?.generic);
+ try testing.expectEqual(@as(usize, 23), stack_machine.stack.pop().?.generic);
stack_machine.reset();
program.clearRetainingCapacity();
@@ -1398,7 +1398,7 @@ test "DWARF expressions" {
try b.writeConst(writer, u16, 0xee);
try b.writeOpcode(writer, OP.mul);
_ = try stack_machine.run(program.items, allocator, context, null);
- try testing.expectEqual(@as(usize, 0xed12), stack_machine.stack.popOrNull().?.generic);
+ try testing.expectEqual(@as(usize, 0xed12), stack_machine.stack.pop().?.generic);
stack_machine.reset();
program.clearRetainingCapacity();
@@ -1407,15 +1407,15 @@ test "DWARF expressions" {
try b.writeConst(writer, i16, -6);
try b.writeOpcode(writer, OP.neg);
_ = try stack_machine.run(program.items, allocator, context, null);
- try testing.expectEqual(@as(usize, 6), stack_machine.stack.popOrNull().?.generic);
- try testing.expectEqual(@as(isize, -5), @as(isize, @bitCast(stack_machine.stack.popOrNull().?.generic)));
+ try testing.expectEqual(@as(usize, 6), stack_machine.stack.pop().?.generic);
+ try testing.expectEqual(@as(isize, -5), @as(isize, @bitCast(stack_machine.stack.pop().?.generic)));
stack_machine.reset();
program.clearRetainingCapacity();
try b.writeConst(writer, u16, 0xff0f);
try b.writeOpcode(writer, OP.not);
_ = try stack_machine.run(program.items, allocator, context, null);
- try testing.expectEqual(~@as(usize, 0xff0f), stack_machine.stack.popOrNull().?.generic);
+ try testing.expectEqual(~@as(usize, 0xff0f), stack_machine.stack.pop().?.generic);
stack_machine.reset();
program.clearRetainingCapacity();
@@ -1423,7 +1423,7 @@ test "DWARF expressions" {
try b.writeConst(writer, u16, 0xf0ff);
try b.writeOpcode(writer, OP.@"or");
_ = try stack_machine.run(program.items, allocator, context, null);
- try testing.expectEqual(@as(usize, 0xffff), stack_machine.stack.popOrNull().?.generic);
+ try testing.expectEqual(@as(usize, 0xffff), stack_machine.stack.pop().?.generic);
stack_machine.reset();
program.clearRetainingCapacity();
@@ -1431,14 +1431,14 @@ test "DWARF expressions" {
try b.writeConst(writer, i16, 100);
try b.writeOpcode(writer, OP.plus);
_ = try stack_machine.run(program.items, allocator, context, null);
- try testing.expectEqual(@as(usize, 502), stack_machine.stack.popOrNull().?.generic);
+ try testing.expectEqual(@as(usize, 502), stack_machine.stack.pop().?.generic);
stack_machine.reset();
program.clearRetainingCapacity();
try b.writeConst(writer, u16, 4096);
try b.writePlusUconst(writer, @as(usize, 8192));
_ = try stack_machine.run(program.items, allocator, context, null);
- try testing.expectEqual(@as(usize, 4096 + 8192), stack_machine.stack.popOrNull().?.generic);
+ try testing.expectEqual(@as(usize, 4096 + 8192), stack_machine.stack.pop().?.generic);
stack_machine.reset();
program.clearRetainingCapacity();
@@ -1446,7 +1446,7 @@ test "DWARF expressions" {
try b.writeConst(writer, u16, 1);
try b.writeOpcode(writer, OP.shl);
_ = try stack_machine.run(program.items, allocator, context, null);
- try testing.expectEqual(@as(usize, 0xfff << 1), stack_machine.stack.popOrNull().?.generic);
+ try testing.expectEqual(@as(usize, 0xfff << 1), stack_machine.stack.pop().?.generic);
stack_machine.reset();
program.clearRetainingCapacity();
@@ -1454,7 +1454,7 @@ test "DWARF expressions" {
try b.writeConst(writer, u16, 1);
try b.writeOpcode(writer, OP.shr);
_ = try stack_machine.run(program.items, allocator, context, null);
- try testing.expectEqual(@as(usize, 0xfff >> 1), stack_machine.stack.popOrNull().?.generic);
+ try testing.expectEqual(@as(usize, 0xfff >> 1), stack_machine.stack.pop().?.generic);
stack_machine.reset();
program.clearRetainingCapacity();
@@ -1462,7 +1462,7 @@ test "DWARF expressions" {
try b.writeConst(writer, u16, 1);
try b.writeOpcode(writer, OP.shr);
_ = try stack_machine.run(program.items, allocator, context, null);
- try testing.expectEqual(@as(usize, @bitCast(@as(isize, 0xfff) >> 1)), stack_machine.stack.popOrNull().?.generic);
+ try testing.expectEqual(@as(usize, @bitCast(@as(isize, 0xfff) >> 1)), stack_machine.stack.pop().?.generic);
stack_machine.reset();
program.clearRetainingCapacity();
@@ -1470,7 +1470,7 @@ test "DWARF expressions" {
try b.writeConst(writer, u16, 0xff0f);
try b.writeOpcode(writer, OP.xor);
_ = try stack_machine.run(program.items, allocator, context, null);
- try testing.expectEqual(@as(usize, 0x0ff0), stack_machine.stack.popOrNull().?.generic);
+ try testing.expectEqual(@as(usize, 0x0ff0), stack_machine.stack.pop().?.generic);
}
// Control Flow Operations
@@ -1499,9 +1499,9 @@ test "DWARF expressions" {
try b.writeConst(writer, u16, 0);
try b.writeOpcode(writer, e[0]);
_ = try stack_machine.run(program.items, allocator, context, null);
- try testing.expectEqual(@as(usize, e[3]), stack_machine.stack.popOrNull().?.generic);
- try testing.expectEqual(@as(usize, e[2]), stack_machine.stack.popOrNull().?.generic);
- try testing.expectEqual(@as(usize, e[1]), stack_machine.stack.popOrNull().?.generic);
+ try testing.expectEqual(@as(usize, e[3]), stack_machine.stack.pop().?.generic);
+ try testing.expectEqual(@as(usize, e[2]), stack_machine.stack.pop().?.generic);
+ try testing.expectEqual(@as(usize, e[1]), stack_machine.stack.pop().?.generic);
}
stack_machine.reset();
@@ -1510,7 +1510,7 @@ test "DWARF expressions" {
try b.writeSkip(writer, 1);
try b.writeLiteral(writer, 3);
_ = try stack_machine.run(program.items, allocator, context, null);
- try testing.expectEqual(@as(usize, 2), stack_machine.stack.popOrNull().?.generic);
+ try testing.expectEqual(@as(usize, 2), stack_machine.stack.pop().?.generic);
stack_machine.reset();
program.clearRetainingCapacity();
@@ -1522,9 +1522,9 @@ test "DWARF expressions" {
try b.writeLiteral(writer, 4);
try b.writeLiteral(writer, 5);
_ = try stack_machine.run(program.items, allocator, context, null);
- try testing.expectEqual(@as(usize, 5), stack_machine.stack.popOrNull().?.generic);
- try testing.expectEqual(@as(usize, 4), stack_machine.stack.popOrNull().?.generic);
- try testing.expect(stack_machine.stack.popOrNull() == null);
+ try testing.expectEqual(@as(usize, 5), stack_machine.stack.pop().?.generic);
+ try testing.expectEqual(@as(usize, 4), stack_machine.stack.pop().?.generic);
+ try testing.expect(stack_machine.stack.pop() == null);
// TODO: Test call2, call4, call_ref once implemented
@@ -1548,7 +1548,7 @@ test "DWARF expressions" {
try b.writeConstType(writer, @as(usize, 0), &value_bytes);
try b.writeConvert(writer, @as(usize, 0));
_ = try stack_machine.run(program.items, allocator, context, null);
- try testing.expectEqual(value, stack_machine.stack.popOrNull().?.generic);
+ try testing.expectEqual(value, stack_machine.stack.pop().?.generic);
// Reinterpret to generic type
stack_machine.reset();
@@ -1556,7 +1556,7 @@ test "DWARF expressions" {
try b.writeConstType(writer, @as(usize, 0), &value_bytes);
try b.writeReinterpret(writer, @as(usize, 0));
_ = try stack_machine.run(program.items, allocator, context, null);
- try testing.expectEqual(value, stack_machine.stack.popOrNull().?.generic);
+ try testing.expectEqual(value, stack_machine.stack.pop().?.generic);
// Reinterpret to new type
const die_offset: usize = 0xffee;
@@ -1566,7 +1566,7 @@ test "DWARF expressions" {
try b.writeConstType(writer, @as(usize, 0), &value_bytes);
try b.writeReinterpret(writer, die_offset);
_ = try stack_machine.run(program.items, allocator, context, null);
- const const_type = stack_machine.stack.popOrNull().?.const_type;
+ const const_type = stack_machine.stack.pop().?.const_type;
try testing.expectEqual(die_offset, const_type.type_offset);
stack_machine.reset();
@@ -1574,7 +1574,7 @@ test "DWARF expressions" {
try b.writeLiteral(writer, 0);
try b.writeReinterpret(writer, die_offset);
_ = try stack_machine.run(program.items, allocator, context, null);
- const regval_type = stack_machine.stack.popOrNull().?.regval_type;
+ const regval_type = stack_machine.stack.pop().?.regval_type;
try testing.expectEqual(die_offset, regval_type.type_offset);
}
@@ -1586,7 +1586,7 @@ test "DWARF expressions" {
program.clearRetainingCapacity();
try b.writeOpcode(writer, OP.nop);
_ = try stack_machine.run(program.items, allocator, context, null);
- try testing.expect(stack_machine.stack.popOrNull() == null);
+ try testing.expect(stack_machine.stack.pop() == null);
// Sub-expression
{
@@ -1599,7 +1599,7 @@ test "DWARF expressions" {
program.clearRetainingCapacity();
try b.writeEntryValue(writer, sub_program.items);
_ = try stack_machine.run(program.items, allocator, context, null);
- try testing.expectEqual(@as(usize, 3), stack_machine.stack.popOrNull().?.generic);
+ try testing.expectEqual(@as(usize, 3), stack_machine.stack.pop().?.generic);
}
// Register location description
@@ -1626,7 +1626,7 @@ test "DWARF expressions" {
program.clearRetainingCapacity();
try b.writeEntryValue(writer, sub_program.items);
_ = try stack_machine.run(program.items, allocator, context, null);
- try testing.expectEqual(@as(usize, 0xee), stack_machine.stack.popOrNull().?.generic);
+ try testing.expectEqual(@as(usize, 0xee), stack_machine.stack.pop().?.generic);
} else |err| {
switch (err) {
error.UnimplementedArch,