x86_64: fix behavior of getValue

Old behavior renamed to `getValueIfFree`.
This commit is contained in:
Jacob Young 2023-10-26 02:11:54 -04:00
parent 3faa4ea959
commit 98cd378208
16 changed files with 334 additions and 62 deletions

View File

@ -295,8 +295,6 @@ const Arg = struct {
test Options {
if (builtin.os.tag == .wasi) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
var arena = std.heap.ArenaAllocator.init(std.testing.allocator);
defer arena.deinit();

View File

@ -2294,8 +2294,6 @@ test "popOrNull" {
}
test "reIndex" {
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
var map = ArrayHashMap(i32, i32, AutoContext(i32), true).init(std.testing.allocator);
defer map.deinit();

View File

@ -764,8 +764,6 @@ test "y_number_simple_real.json" {
try ok("[123.456789]");
}
test "y_object.json" {
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
try ok("{\"asd\":\"sdf\", \"dfg\":\"fgh\"}");
}
test "y_object_basic.json" {
@ -787,13 +785,9 @@ test "y_object_escaped_null_in_key.json" {
try ok("{\"foo\\u0000bar\": 42}");
}
test "y_object_extreme_numbers.json" {
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
try ok("{ \"min\": -1.0e+28, \"max\": 1.0e+28 }");
}
test "y_object_long_strings.json" {
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
try ok("{\"x\":[{\"id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}], \"id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}");
}
test "y_object_simple.json" {

View File

@ -1,5 +1,4 @@
const std = @import("std");
const builtin = @import("builtin");
const mem = std.mem;
const testing = std.testing;
const ArenaAllocator = std.heap.ArenaAllocator;
@ -19,8 +18,6 @@ const jsonReader = @import("scanner.zig").reader;
const JsonReader = @import("scanner.zig").Reader;
test "json.parser.dynamic" {
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
const s =
\\{
\\ "Image": {
@ -75,8 +72,6 @@ test "json.parser.dynamic" {
const writeStream = @import("./stringify.zig").writeStream;
test "write json then parse it" {
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
var out_buffer: [1000]u8 = undefined;
var fixed_buffer_stream = std.io.fixedBufferStream(&out_buffer);
@ -143,8 +138,6 @@ test "Value.array allocator should still be usable after parsing" {
}
test "integer after float has proper type" {
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator);
defer arena_allocator.deinit();
const parsed = try testParse(arena_allocator.allocator(),
@ -157,8 +150,6 @@ test "integer after float has proper type" {
}
test "escaped characters" {
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator);
defer arena_allocator.deinit();
const input =
@ -238,8 +229,6 @@ test "Value.jsonStringify" {
}
test "parseFromValue(std.json.Value,...)" {
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
const str =
\\{
\\ "int": 32,
@ -328,8 +317,6 @@ test "ParseOptions.max_value_len" {
}
test "many object keys" {
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
const doc =
\\{
\\ "k1": "v1",

View File

@ -1,5 +1,4 @@
const std = @import("std");
const builtin = @import("builtin");
const testing = std.testing;
const ArrayHashMap = @import("hashmap.zig").ArrayHashMap;
@ -19,8 +18,6 @@ const T = struct {
};
test "parse json hashmap" {
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
const doc =
\\{
\\ "abc": {"i": 0, "s": "d"},
@ -36,8 +33,6 @@ test "parse json hashmap" {
}
test "parse json hashmap while streaming" {
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
const doc =
\\{
\\ "abc": {"i": 0, "s": "d"},
@ -63,8 +58,6 @@ test "parse json hashmap while streaming" {
}
test "parse json hashmap duplicate fields" {
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
var arena = std.heap.ArenaAllocator.init(std.testing.allocator);
defer arena.deinit();
@ -93,8 +86,6 @@ test "parse json hashmap duplicate fields" {
}
test "stringify json hashmap" {
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
var value = ArrayHashMap(T){};
defer value.deinit(testing.allocator);
{
@ -132,8 +123,6 @@ test "stringify json hashmap" {
}
test "stringify json hashmap whitespace" {
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
var value = ArrayHashMap(T){};
defer value.deinit(testing.allocator);
try value.map.put(testing.allocator, "abc", .{ .i = 0, .s = "d" });
@ -158,8 +147,6 @@ test "stringify json hashmap whitespace" {
}
test "json parse from value hashmap" {
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
const doc =
\\{
\\ "abc": {"i": 0, "s": "d"},

View File

@ -1,5 +1,4 @@
const std = @import("std");
const builtin = @import("builtin");
const testing = std.testing;
const ArenaAllocator = std.heap.ArenaAllocator;
const Allocator = std.mem.Allocator;
@ -786,7 +785,7 @@ test "max_value_len" {
}
test "parse into vector" {
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
const T = struct {
vec_i32: @Vector(4, i32),

View File

@ -1,5 +1,4 @@
const std = @import("std");
const builtin = @import("builtin");
const mem = std.mem;
const testing = std.testing;
@ -16,8 +15,6 @@ const writeStreamMaxDepth = @import("stringify.zig").writeStreamMaxDepth;
const writeStreamArbitraryDepth = @import("stringify.zig").writeStreamArbitraryDepth;
test "json write stream" {
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
var out_buf: [1024]u8 = undefined;
var slice_stream = std.io.fixedBufferStream(&out_buf);
const out = slice_stream.writer();

View File

@ -34,8 +34,6 @@ fn testHighLevelDynamicParser(s: []const u8) !void {
// Additional tests not part of test JSONTestSuite.
test "y_trailing_comma_after_empty" {
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
try roundTrip(
\\{"1":[],"2":{},"3":"4"}
);

View File

@ -6,7 +6,6 @@
// https://git.musl-libc.org/cgit/musl/tree/src/math/ilogb.c
const std = @import("../std.zig");
const builtin = @import("builtin");
const math = std.math;
const expect = std.testing.expect;
const maxInt = std.math.maxInt;
@ -109,7 +108,7 @@ test "64" {
}
test "80" {
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
try expect(ilogbX(f80, 0.0) == fp_ilogb0);
try expect(ilogbX(f80, 0.5) == -1);

View File

@ -4661,10 +4661,8 @@ pub fn alignInSlice(slice: anytype, comptime new_alignment: usize) ?AlignedSlice
}
test "read/write(Var)PackedInt" {
switch (builtin.zig_backend) {
.stage2_c, .stage2_x86_64 => return error.SkipZigTest,
else => {},
}
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
switch (builtin.cpu.arch) {
// This test generates too much code to execute on WASI.

View File

@ -107,7 +107,6 @@ test "parse and render UNIX addresses" {
}
test "resolve DNS" {
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
if (builtin.os.tag == .wasi) return error.SkipZigTest;
if (builtin.os.tag == .windows) {

View File

@ -2268,8 +2268,6 @@ test "timeout (after a number of completions)" {
test "timeout_remove" {
if (builtin.os.tag != .linux) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
var ring = IO_Uring.init(2, 0) catch |err| switch (err) {
error.SystemOutdated => return error.SkipZigTest,
error.PermissionDenied => return error.SkipZigTest,

View File

@ -90,10 +90,8 @@ pub fn fill(self: *Xoshiro256, buf: []u8) void {
}
test "xoroshiro sequence" {
switch (@import("builtin").zig_backend) {
.stage2_c, .stage2_x86_64 => return error.SkipZigTest,
else => {},
}
if (@import("builtin").zig_backend == .stage2_c) return error.SkipZigTest;
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
var r = Xoshiro256.init(0);

View File

@ -4102,7 +4102,5 @@ const TokenIndex = Ast.TokenIndex;
const Token = std.zig.Token;
test {
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
_ = @import("parser_test.zig");
}

File diff suppressed because it is too large Load Diff

View File

@ -2293,7 +2293,11 @@ fn genLazy(self: *Self, lazy_sym: link.File.LazySymbol) InnerError!void {
}
}
fn getValue(self: *Self, value: MCValue, inst: ?Air.Inst.Index) void {
fn getValue(self: *Self, value: MCValue, inst: ?Air.Inst.Index) !void {
for (value.getRegs()) |reg| try self.register_manager.getReg(reg, inst);
}
fn getValueIfFree(self: *Self, value: MCValue, inst: ?Air.Inst.Index) void {
for (value.getRegs()) |reg| if (self.register_manager.isRegFree(reg))
self.register_manager.getRegAssumeFree(reg, inst);
}
@ -2341,7 +2345,7 @@ fn finishAirResult(self: *Self, inst: Air.Inst.Index, result: MCValue) void {
// In some cases, an operand may be reused as the result.
// If that operand died and was a register, it was freed by
// processDeath, so we have to "re-allocate" the register.
self.getValue(result, inst);
self.getValueIfFree(result, inst);
}
self.finishAirBookkeeping();
}
@ -11017,7 +11021,7 @@ fn airBlock(self: *Self, inst: Air.Inst.Index) !void {
if (std.debug.runtime_safety) assert(self.inst_tracking.getIndex(inst).? == inst_tracking_i);
const tracking = &self.inst_tracking.values()[inst_tracking_i];
if (self.liveness.isUnused(inst)) try tracking.die(self, inst);
self.getValue(tracking.short, inst);
self.getValueIfFree(tracking.short, inst);
self.finishAirBookkeeping();
}
@ -11131,7 +11135,7 @@ fn airBr(self: *Self, inst: Air.Inst.Index) !void {
}
const dst_mcv = if (first_br) try self.allocRegOrMem(br.block_inst, true) else dst: {
self.getValue(block_tracking.short, br.block_inst);
try self.getValue(block_tracking.short, br.block_inst);
break :dst block_tracking.short;
};
try self.genCopy(block_ty, dst_mcv, src_mcv);