stage2: eliminate the "compiler id" concept

Instead, append a "dirty suffix" to the version string when there are
dirty git changes and use the version string as the compiler id.

This avoids a dependency on the cache hash system, and saves time on
first invocation of the compiler since it does not have to compute its
compiler id. It also saves time by not having to check the cache for a
saved compiler id.
This commit is contained in:
Andrew Kelley
2020-09-08 11:15:32 -07:00
parent 35f334ae0f
commit c99e34a00e
5 changed files with 87 additions and 80 deletions

View File

@@ -952,7 +952,6 @@ pub const InitOptions = struct {
linker_z_nodelete: bool = false,
linker_z_defs: bool = false,
stack_size_override: u64 = 0,
compiler_id: [16]u8,
};
pub fn init(gpa: *Allocator, options: InitOptions) !Module {
@@ -1056,7 +1055,7 @@ pub fn init(gpa: *Allocator, options: InitOptions) !Module {
// Now we will prepare hash state initializations to avoid redundantly computing hashes.
// First we add common things between things that apply to zig source and all c source files.
cache.add(options.compiler_id);
cache.addBytes(build_options.version);
cache.add(options.optimize_mode);
cache.add(options.target.cpu.arch);
cache.addBytes(options.target.cpu.model.name);