mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
Compare commits
1 commit
9e56be97c6
...
b751e4a450
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b751e4a450 |
4 changed files with 10 additions and 171 deletions
123
build.zig
123
build.zig
|
|
@ -459,29 +459,7 @@ pub fn build(b: *std.Build) !void {
|
||||||
.skip_linux = skip_linux,
|
.skip_linux = skip_linux,
|
||||||
.skip_llvm = skip_llvm,
|
.skip_llvm = skip_llvm,
|
||||||
.skip_libc = skip_libc,
|
.skip_libc = skip_libc,
|
||||||
.max_rss = switch (b.graph.host.result.os.tag) {
|
.max_rss = 1,
|
||||||
.freebsd => switch (b.graph.host.result.cpu.arch) {
|
|
||||||
.x86_64 => 1, // TODO
|
|
||||||
else => 0,
|
|
||||||
},
|
|
||||||
.linux => switch (b.graph.host.result.cpu.arch) {
|
|
||||||
.aarch64 => 659809075,
|
|
||||||
.loongarch64 => 598902374,
|
|
||||||
.riscv64 => 1, // TODO
|
|
||||||
.s390x => 580596121,
|
|
||||||
.x86_64 => 3290894745,
|
|
||||||
else => 0,
|
|
||||||
},
|
|
||||||
.macos => switch (b.graph.host.result.cpu.arch) {
|
|
||||||
.aarch64 => 767736217,
|
|
||||||
else => 0,
|
|
||||||
},
|
|
||||||
.windows => switch (b.graph.host.result.cpu.arch) {
|
|
||||||
.x86_64 => 603070054,
|
|
||||||
else => 0,
|
|
||||||
},
|
|
||||||
else => 0,
|
|
||||||
},
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
test_modules_step.dependOn(tests.addModuleTests(b, .{
|
test_modules_step.dependOn(tests.addModuleTests(b, .{
|
||||||
|
|
@ -504,29 +482,7 @@ pub fn build(b: *std.Build) !void {
|
||||||
.skip_llvm = skip_llvm,
|
.skip_llvm = skip_llvm,
|
||||||
.skip_libc = true,
|
.skip_libc = true,
|
||||||
.no_builtin = true,
|
.no_builtin = true,
|
||||||
.max_rss = switch (b.graph.host.result.os.tag) {
|
.max_rss = 1,
|
||||||
.freebsd => switch (b.graph.host.result.cpu.arch) {
|
|
||||||
.x86_64 => 1, // TODO
|
|
||||||
else => 0,
|
|
||||||
},
|
|
||||||
.linux => switch (b.graph.host.result.cpu.arch) {
|
|
||||||
.aarch64 => 639565414,
|
|
||||||
.loongarch64 => 598884352,
|
|
||||||
.riscv64 => 1, // TODO
|
|
||||||
.s390x => 574166630,
|
|
||||||
.x86_64 => 764861644,
|
|
||||||
else => 0,
|
|
||||||
},
|
|
||||||
.macos => switch (b.graph.host.result.cpu.arch) {
|
|
||||||
.aarch64 => 701413785,
|
|
||||||
else => 0,
|
|
||||||
},
|
|
||||||
.windows => switch (b.graph.host.result.cpu.arch) {
|
|
||||||
.x86_64 => 536414208,
|
|
||||||
else => 0,
|
|
||||||
},
|
|
||||||
else => 0,
|
|
||||||
},
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
test_modules_step.dependOn(tests.addModuleTests(b, .{
|
test_modules_step.dependOn(tests.addModuleTests(b, .{
|
||||||
|
|
@ -549,29 +505,7 @@ pub fn build(b: *std.Build) !void {
|
||||||
.skip_llvm = skip_llvm,
|
.skip_llvm = skip_llvm,
|
||||||
.skip_libc = true,
|
.skip_libc = true,
|
||||||
.no_builtin = true,
|
.no_builtin = true,
|
||||||
.max_rss = switch (b.graph.host.result.os.tag) {
|
.max_rss = 1,
|
||||||
.freebsd => switch (b.graph.host.result.cpu.arch) {
|
|
||||||
.x86_64 => 1, // TODO
|
|
||||||
else => 0,
|
|
||||||
},
|
|
||||||
.linux => switch (b.graph.host.result.cpu.arch) {
|
|
||||||
.aarch64 => 615302758,
|
|
||||||
.loongarch64 => 598974464,
|
|
||||||
.riscv64 => 1, // TODO
|
|
||||||
.s390x => 395555635,
|
|
||||||
.x86_64 => 528128409,
|
|
||||||
else => 0,
|
|
||||||
},
|
|
||||||
.macos => switch (b.graph.host.result.cpu.arch) {
|
|
||||||
.aarch64 => 451389030,
|
|
||||||
else => 0,
|
|
||||||
},
|
|
||||||
.windows => switch (b.graph.host.result.cpu.arch) {
|
|
||||||
.x86_64 => 317852057,
|
|
||||||
else => 0,
|
|
||||||
},
|
|
||||||
else => 0,
|
|
||||||
},
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
test_modules_step.dependOn(tests.addModuleTests(b, .{
|
test_modules_step.dependOn(tests.addModuleTests(b, .{
|
||||||
|
|
@ -593,29 +527,7 @@ pub fn build(b: *std.Build) !void {
|
||||||
.skip_linux = skip_linux,
|
.skip_linux = skip_linux,
|
||||||
.skip_llvm = skip_llvm,
|
.skip_llvm = skip_llvm,
|
||||||
.skip_libc = skip_libc,
|
.skip_libc = skip_libc,
|
||||||
.max_rss = switch (b.graph.host.result.os.tag) {
|
.max_rss = 1,
|
||||||
.freebsd => switch (b.graph.host.result.cpu.arch) {
|
|
||||||
.x86_64 => 1, // TODO
|
|
||||||
else => 0,
|
|
||||||
},
|
|
||||||
.linux => switch (b.graph.host.result.cpu.arch) {
|
|
||||||
.aarch64 => 6732817203,
|
|
||||||
.loongarch64 => 3216349593,
|
|
||||||
.riscv64 => 1, // TODO
|
|
||||||
.s390x => 3652514201,
|
|
||||||
.x86_64 => 5554053120,
|
|
||||||
else => 0,
|
|
||||||
},
|
|
||||||
.macos => switch (b.graph.host.result.cpu.arch) {
|
|
||||||
.aarch64 => 8273795481,
|
|
||||||
else => 0,
|
|
||||||
},
|
|
||||||
.windows => switch (b.graph.host.result.cpu.arch) {
|
|
||||||
.x86_64 => 3750236160,
|
|
||||||
else => 0,
|
|
||||||
},
|
|
||||||
else => 0,
|
|
||||||
},
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const unit_tests_step = b.step("test-unit", "Run the compiler source unit tests");
|
const unit_tests_step = b.step("test-unit", "Run the compiler source unit tests");
|
||||||
|
|
@ -631,7 +543,6 @@ pub fn build(b: *std.Build) !void {
|
||||||
.use_llvm = use_llvm,
|
.use_llvm = use_llvm,
|
||||||
.use_lld = use_llvm,
|
.use_lld = use_llvm,
|
||||||
.zig_lib_dir = b.path("lib"),
|
.zig_lib_dir = b.path("lib"),
|
||||||
.max_rss = 1,
|
|
||||||
});
|
});
|
||||||
if (link_libc) {
|
if (link_libc) {
|
||||||
unit_tests.root_module.link_libc = true;
|
unit_tests.root_module.link_libc = true;
|
||||||
|
|
@ -810,29 +721,7 @@ fn addCompilerMod(b: *std.Build, options: AddCompilerModOptions) *std.Build.Modu
|
||||||
fn addCompilerStep(b: *std.Build, options: AddCompilerModOptions) *std.Build.Step.Compile {
|
fn addCompilerStep(b: *std.Build, options: AddCompilerModOptions) *std.Build.Step.Compile {
|
||||||
const exe = b.addExecutable(.{
|
const exe = b.addExecutable(.{
|
||||||
.name = "zig",
|
.name = "zig",
|
||||||
.max_rss = switch (b.graph.host.result.os.tag) {
|
.max_rss = 1,
|
||||||
.freebsd => switch (b.graph.host.result.cpu.arch) {
|
|
||||||
.x86_64 => 1, // TODO
|
|
||||||
else => 0,
|
|
||||||
},
|
|
||||||
.linux => switch (b.graph.host.result.cpu.arch) {
|
|
||||||
.aarch64 => 6240805683,
|
|
||||||
.loongarch64 => 5024158515,
|
|
||||||
.riscv64 => 1, // TODO
|
|
||||||
.s390x => 4997174476,
|
|
||||||
.x86_64 => 5486090649,
|
|
||||||
else => 0,
|
|
||||||
},
|
|
||||||
.macos => switch (b.graph.host.result.cpu.arch) {
|
|
||||||
.aarch64 => 6639145779,
|
|
||||||
else => 0,
|
|
||||||
},
|
|
||||||
.windows => switch (b.graph.host.result.cpu.arch) {
|
|
||||||
.x86_64 => 5770394009,
|
|
||||||
else => 0,
|
|
||||||
},
|
|
||||||
else => 0,
|
|
||||||
},
|
|
||||||
.root_module = addCompilerMod(b, options),
|
.root_module = addCompilerMod(b, options),
|
||||||
});
|
});
|
||||||
exe.stack_size = stack_size;
|
exe.stack_size = stack_size;
|
||||||
|
|
@ -909,7 +798,7 @@ fn addCmakeCfgOptionsToExe(
|
||||||
};
|
};
|
||||||
mod.linkSystemLibrary("unwind", .{});
|
mod.linkSystemLibrary("unwind", .{});
|
||||||
},
|
},
|
||||||
.driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => {
|
.ios, .macos, .watchos, .tvos, .visionos => {
|
||||||
mod.link_libcpp = true;
|
mod.link_libcpp = true;
|
||||||
},
|
},
|
||||||
.windows => {
|
.windows => {
|
||||||
|
|
|
||||||
|
|
@ -4471,7 +4471,7 @@ pub const rusage = switch (native_os) {
|
||||||
pub const SELF = 1;
|
pub const SELF = 1;
|
||||||
pub const CHILDREN = 2;
|
pub const CHILDREN = 2;
|
||||||
},
|
},
|
||||||
.freebsd, .openbsd => extern struct {
|
.freebsd => extern struct {
|
||||||
utime: timeval,
|
utime: timeval,
|
||||||
stime: timeval,
|
stime: timeval,
|
||||||
maxrss: c_long,
|
maxrss: c_long,
|
||||||
|
|
@ -4493,27 +4493,6 @@ pub const rusage = switch (native_os) {
|
||||||
pub const CHILDREN = -1;
|
pub const CHILDREN = -1;
|
||||||
pub const THREAD = 1;
|
pub const THREAD = 1;
|
||||||
},
|
},
|
||||||
.dragonfly, .netbsd => extern struct {
|
|
||||||
utime: timeval,
|
|
||||||
stime: timeval,
|
|
||||||
maxrss: c_long,
|
|
||||||
ixrss: c_long,
|
|
||||||
idrss: c_long,
|
|
||||||
isrss: c_long,
|
|
||||||
minflt: c_long,
|
|
||||||
majflt: c_long,
|
|
||||||
nswap: c_long,
|
|
||||||
inblock: c_long,
|
|
||||||
oublock: c_long,
|
|
||||||
msgsnd: c_long,
|
|
||||||
msgrcv: c_long,
|
|
||||||
nsignals: c_long,
|
|
||||||
nvcsw: c_long,
|
|
||||||
nivcsw: c_long,
|
|
||||||
|
|
||||||
pub const SELF = 0;
|
|
||||||
pub const CHILDREN = -1;
|
|
||||||
},
|
|
||||||
else => void,
|
else => void,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ pub const ResourceUsageStatistics = struct {
|
||||||
/// if available.
|
/// if available.
|
||||||
pub inline fn getMaxRss(rus: ResourceUsageStatistics) ?usize {
|
pub inline fn getMaxRss(rus: ResourceUsageStatistics) ?usize {
|
||||||
switch (native_os) {
|
switch (native_os) {
|
||||||
.dragonfly, .freebsd, .netbsd, .openbsd, .illumos, .linux, .serenity => {
|
.linux => {
|
||||||
if (rus.rusage) |ru| {
|
if (rus.rusage) |ru| {
|
||||||
return @as(usize, @intCast(ru.maxrss)) * 1024;
|
return @as(usize, @intCast(ru.maxrss)) * 1024;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -149,21 +149,7 @@ pub const ResourceUsageStatistics = struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
const rusage_init = switch (native_os) {
|
const rusage_init = switch (native_os) {
|
||||||
.dragonfly,
|
.linux, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => @as(?posix.rusage, null),
|
||||||
.freebsd,
|
|
||||||
.netbsd,
|
|
||||||
.openbsd,
|
|
||||||
.illumos,
|
|
||||||
.linux,
|
|
||||||
.serenity,
|
|
||||||
.driverkit,
|
|
||||||
.ios,
|
|
||||||
.maccatalyst,
|
|
||||||
.macos,
|
|
||||||
.tvos,
|
|
||||||
.visionos,
|
|
||||||
.watchos,
|
|
||||||
=> @as(?posix.rusage, null),
|
|
||||||
.windows => @as(?windows.VM_COUNTERS, null),
|
.windows => @as(?windows.VM_COUNTERS, null),
|
||||||
else => {},
|
else => {},
|
||||||
};
|
};
|
||||||
|
|
@ -500,21 +486,7 @@ fn waitUnwrappedPosix(self: *ChildProcess) void {
|
||||||
const res: posix.WaitPidResult = res: {
|
const res: posix.WaitPidResult = res: {
|
||||||
if (self.request_resource_usage_statistics) {
|
if (self.request_resource_usage_statistics) {
|
||||||
switch (native_os) {
|
switch (native_os) {
|
||||||
.dragonfly,
|
.linux, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => {
|
||||||
.freebsd,
|
|
||||||
.netbsd,
|
|
||||||
.openbsd,
|
|
||||||
.illumos,
|
|
||||||
.linux,
|
|
||||||
.serenity,
|
|
||||||
.driverkit,
|
|
||||||
.ios,
|
|
||||||
.maccatalyst,
|
|
||||||
.macos,
|
|
||||||
.tvos,
|
|
||||||
.visionos,
|
|
||||||
.watchos,
|
|
||||||
=> {
|
|
||||||
var ru: posix.rusage = undefined;
|
var ru: posix.rusage = undefined;
|
||||||
const res = posix.wait4(self.id, 0, &ru);
|
const res = posix.wait4(self.id, 0, &ru);
|
||||||
self.resource_usage_statistics.rusage = ru;
|
self.resource_usage_statistics.rusage = ru;
|
||||||
|
|
|
||||||
|
|
@ -2595,7 +2595,6 @@ pub fn addCAbiTests(b: *std.Build, options: CAbiTestOptions) *Step {
|
||||||
.root_module = test_mod,
|
.root_module = test_mod,
|
||||||
.use_llvm = c_abi_target.use_llvm,
|
.use_llvm = c_abi_target.use_llvm,
|
||||||
.use_lld = c_abi_target.use_lld,
|
.use_lld = c_abi_target.use_lld,
|
||||||
.max_rss = 1,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// This test is intentionally trying to check if the external ABI is
|
// This test is intentionally trying to check if the external ABI is
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue