aboutsummaryrefslogtreecommitdiff
path: root/src/Package/Module.zig
diff options
context:
space:
mode:
authorJacob Young <jacobly0@users.noreply.github.com>2025-06-13 04:46:30 -0400
committerJacob Young <jacobly0@users.noreply.github.com>2025-06-19 11:45:06 -0400
commit917640810e7f3e18daff9e75b5ecefe761a1896c (patch)
tree579e627d695f898d411a3cb1fbc0578d1a763cc2 /src/Package/Module.zig
parent16d78bc0c024da307c7ab5f6b94622e6b4b37397 (diff)
downloadzig-917640810e7f3e18daff9e75b5ecefe761a1896c.tar.gz
zig-917640810e7f3e18daff9e75b5ecefe761a1896c.zip
Target: pass and use locals by pointer instead of by value
This struct is larger than 256 bytes and code that copies it consistently shows up in profiles of the compiler.
Diffstat (limited to 'src/Package/Module.zig')
-rw-r--r--src/Package/Module.zig6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Package/Module.zig b/src/Package/Module.zig
index bcab39415f..d829b397ba 100644
--- a/src/Package/Module.zig
+++ b/src/Package/Module.zig
@@ -102,7 +102,7 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Package.Module {
if (options.inherited.error_tracing == true) assert(options.global.any_error_tracing);
const resolved_target = options.inherited.resolved_target orelse options.parent.?.resolved_target;
- const target = resolved_target.result;
+ const target = &resolved_target.result;
const optimize_mode = options.inherited.optimize_mode orelse
if (options.parent) |p| p.optimize_mode else options.global.root_optimize_mode;
@@ -363,7 +363,7 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Package.Module {
.root_src_path = options.paths.root_src_path,
.fully_qualified_name = options.fully_qualified_name,
.resolved_target = .{
- .result = target,
+ .result = target.*,
.is_native_os = resolved_target.is_native_os,
.is_native_abi = resolved_target.is_native_abi,
.is_explicit_dynamic_linker = resolved_target.is_explicit_dynamic_linker,
@@ -474,7 +474,7 @@ pub fn getBuiltinOptions(m: Module, global: Compilation.Config) Builtin {
assert(global.have_zcu);
return .{
.target = m.resolved_target.result,
- .zig_backend = target_util.zigBackend(m.resolved_target.result, global.use_llvm),
+ .zig_backend = target_util.zigBackend(&m.resolved_target.result, global.use_llvm),
.output_mode = global.output_mode,
.link_mode = global.link_mode,
.unwind_tables = m.unwind_tables,