| author | |
| committer | |
| log | 4983da40d02632217e606098fd8a94bd7732bf0c |
| tree | c70fcfe533b5ec55ca60592815afdfb27fd57d4d |
| parent | e675af06984d0709d308e3faf60b33cadadf2bbf |
12 files changed, 49 insertions(+), 139 deletions(-)
src/arch/aarch64/CodeGen.zig+9-9| ... | ... | @@ -24,7 +24,7 @@ const log = std.log.scoped(.codegen); |
| 24 | 24 | const build_options = @import("build_options"); |
| 25 | 25 | |
| 26 | 26 | const GenerateSymbolError = codegen.GenerateSymbolError; |
| 27 | const FnResult = codegen.FnResult; | |
| 27 | const Result = codegen.Result; | |
| 28 | 28 | const DebugInfoOutput = codegen.DebugInfoOutput; |
| 29 | 29 | |
| 30 | 30 | const bits = @import("bits.zig"); |
| ... | ... | @@ -349,7 +349,7 @@ pub fn generate( |
| 349 | 349 | liveness: Liveness, |
| 350 | 350 | code: *std.ArrayList(u8), |
| 351 | 351 | debug_output: DebugInfoOutput, |
| 352 | ) GenerateSymbolError!FnResult { | |
| 352 | ) GenerateSymbolError!Result { | |
| 353 | 353 | if (build_options.skip_non_native and builtin.cpu.arch != bin_file.options.target.cpu.arch) { |
| 354 | 354 | @panic("Attempted to compile for architecture that was disabled by build configuration"); |
| 355 | 355 | } |
| ... | ... | @@ -392,8 +392,8 @@ pub fn generate( |
| 392 | 392 | defer function.dbg_info_relocs.deinit(bin_file.allocator); |
| 393 | 393 | |
| 394 | 394 | var call_info = function.resolveCallingConventionValues(fn_type) catch |err| switch (err) { |
| 395 | error.CodegenFail => return FnResult{ .fail = function.err_msg.? }, | |
| 396 | error.OutOfRegisters => return FnResult{ | |
| 395 | error.CodegenFail => return Result{ .fail = function.err_msg.? }, | |
| 396 | error.OutOfRegisters => return Result{ | |
| 397 | 397 | .fail = try ErrorMsg.create(bin_file.allocator, src_loc, "CodeGen ran out of registers. This is a bug in the Zig compiler.", .{}), |
| 398 | 398 | }, |
| 399 | 399 | else => |e| return e, |
| ... | ... | @@ -406,8 +406,8 @@ pub fn generate( |
| 406 | 406 | function.max_end_stack = call_info.stack_byte_count; |
| 407 | 407 | |
| 408 | 408 | function.gen() catch |err| switch (err) { |
| 409 | error.CodegenFail => return FnResult{ .fail = function.err_msg.? }, | |
| 410 | error.OutOfRegisters => return FnResult{ | |
| 409 | error.CodegenFail => return Result{ .fail = function.err_msg.? }, | |
| 410 | error.OutOfRegisters => return Result{ | |
| 411 | 411 | .fail = try ErrorMsg.create(bin_file.allocator, src_loc, "CodeGen ran out of registers. This is a bug in the Zig compiler.", .{}), |
| 412 | 412 | }, |
| 413 | 413 | else => |e| return e, |
| ... | ... | @@ -439,14 +439,14 @@ pub fn generate( |
| 439 | 439 | defer emit.deinit(); |
| 440 | 440 | |
| 441 | 441 | emit.emitMir() catch |err| switch (err) { |
| 442 | error.EmitFail => return FnResult{ .fail = emit.err_msg.? }, | |
| 442 | error.EmitFail => return Result{ .fail = emit.err_msg.? }, | |
| 443 | 443 | else => |e| return e, |
| 444 | 444 | }; |
| 445 | 445 | |
| 446 | 446 | if (function.err_msg) |em| { |
| 447 | return FnResult{ .fail = em }; | |
| 447 | return Result{ .fail = em }; | |
| 448 | 448 | } else { |
| 449 | return FnResult{ .appended = {} }; | |
| 449 | return Result{ .appended = {} }; | |
| 450 | 450 | } |
| 451 | 451 | } |
| 452 | 452 |
src/arch/arm/CodeGen.zig+9-9| ... | ... | @@ -23,7 +23,7 @@ const leb128 = std.leb; |
| 23 | 23 | const log = std.log.scoped(.codegen); |
| 24 | 24 | const build_options = @import("build_options"); |
| 25 | 25 | |
| 26 | const FnResult = codegen.FnResult; | |
| 26 | const Result = codegen.Result; | |
| 27 | 27 | const GenerateSymbolError = codegen.GenerateSymbolError; |
| 28 | 28 | const DebugInfoOutput = codegen.DebugInfoOutput; |
| 29 | 29 | |
| ... | ... | @@ -356,7 +356,7 @@ pub fn generate( |
| 356 | 356 | liveness: Liveness, |
| 357 | 357 | code: *std.ArrayList(u8), |
| 358 | 358 | debug_output: DebugInfoOutput, |
| 359 | ) GenerateSymbolError!FnResult { | |
| 359 | ) GenerateSymbolError!Result { | |
| 360 | 360 | if (build_options.skip_non_native and builtin.cpu.arch != bin_file.options.target.cpu.arch) { |
| 361 | 361 | @panic("Attempted to compile for architecture that was disabled by build configuration"); |
| 362 | 362 | } |
| ... | ... | @@ -399,8 +399,8 @@ pub fn generate( |
| 399 | 399 | defer function.dbg_info_relocs.deinit(bin_file.allocator); |
| 400 | 400 | |
| 401 | 401 | var call_info = function.resolveCallingConventionValues(fn_type) catch |err| switch (err) { |
| 402 | error.CodegenFail => return FnResult{ .fail = function.err_msg.? }, | |
| 403 | error.OutOfRegisters => return FnResult{ | |
| 402 | error.CodegenFail => return Result{ .fail = function.err_msg.? }, | |
| 403 | error.OutOfRegisters => return Result{ | |
| 404 | 404 | .fail = try ErrorMsg.create(bin_file.allocator, src_loc, "CodeGen ran out of registers. This is a bug in the Zig compiler.", .{}), |
| 405 | 405 | }, |
| 406 | 406 | else => |e| return e, |
| ... | ... | @@ -413,8 +413,8 @@ pub fn generate( |
| 413 | 413 | function.max_end_stack = call_info.stack_byte_count; |
| 414 | 414 | |
| 415 | 415 | function.gen() catch |err| switch (err) { |
| 416 | error.CodegenFail => return FnResult{ .fail = function.err_msg.? }, | |
| 417 | error.OutOfRegisters => return FnResult{ | |
| 416 | error.CodegenFail => return Result{ .fail = function.err_msg.? }, | |
| 417 | error.OutOfRegisters => return Result{ | |
| 418 | 418 | .fail = try ErrorMsg.create(bin_file.allocator, src_loc, "CodeGen ran out of registers. This is a bug in the Zig compiler.", .{}), |
| 419 | 419 | }, |
| 420 | 420 | else => |e| return e, |
| ... | ... | @@ -446,14 +446,14 @@ pub fn generate( |
| 446 | 446 | defer emit.deinit(); |
| 447 | 447 | |
| 448 | 448 | emit.emitMir() catch |err| switch (err) { |
| 449 | error.EmitFail => return FnResult{ .fail = emit.err_msg.? }, | |
| 449 | error.EmitFail => return Result{ .fail = emit.err_msg.? }, | |
| 450 | 450 | else => |e| return e, |
| 451 | 451 | }; |
| 452 | 452 | |
| 453 | 453 | if (function.err_msg) |em| { |
| 454 | return FnResult{ .fail = em }; | |
| 454 | return Result{ .fail = em }; | |
| 455 | 455 | } else { |
| 456 | return FnResult{ .appended = {} }; | |
| 456 | return Result{ .appended = {} }; | |
| 457 | 457 | } |
| 458 | 458 | } |
| 459 | 459 |
src/arch/riscv64/CodeGen.zig+9-9| ... | ... | @@ -22,7 +22,7 @@ const leb128 = std.leb; |
| 22 | 22 | const log = std.log.scoped(.codegen); |
| 23 | 23 | const build_options = @import("build_options"); |
| 24 | 24 | |
| 25 | const FnResult = @import("../../codegen.zig").FnResult; | |
| 25 | const Result = @import("../../codegen.zig").Result; | |
| 26 | 26 | const GenerateSymbolError = @import("../../codegen.zig").GenerateSymbolError; |
| 27 | 27 | const DebugInfoOutput = @import("../../codegen.zig").DebugInfoOutput; |
| 28 | 28 | |
| ... | ... | @@ -225,7 +225,7 @@ pub fn generate( |
| 225 | 225 | liveness: Liveness, |
| 226 | 226 | code: *std.ArrayList(u8), |
| 227 | 227 | debug_output: DebugInfoOutput, |
| 228 | ) GenerateSymbolError!FnResult { | |
| 228 | ) GenerateSymbolError!Result { | |
| 229 | 229 | if (build_options.skip_non_native and builtin.cpu.arch != bin_file.options.target.cpu.arch) { |
| 230 | 230 | @panic("Attempted to compile for architecture that was disabled by build configuration"); |
| 231 | 231 | } |
| ... | ... | @@ -268,8 +268,8 @@ pub fn generate( |
| 268 | 268 | defer function.exitlude_jump_relocs.deinit(bin_file.allocator); |
| 269 | 269 | |
| 270 | 270 | var call_info = function.resolveCallingConventionValues(fn_type) catch |err| switch (err) { |
| 271 | error.CodegenFail => return FnResult{ .fail = function.err_msg.? }, | |
| 272 | error.OutOfRegisters => return FnResult{ | |
| 271 | error.CodegenFail => return Result{ .fail = function.err_msg.? }, | |
| 272 | error.OutOfRegisters => return Result{ | |
| 273 | 273 | .fail = try ErrorMsg.create(bin_file.allocator, src_loc, "CodeGen ran out of registers. This is a bug in the Zig compiler.", .{}), |
| 274 | 274 | }, |
| 275 | 275 | else => |e| return e, |
| ... | ... | @@ -282,8 +282,8 @@ pub fn generate( |
| 282 | 282 | function.max_end_stack = call_info.stack_byte_count; |
| 283 | 283 | |
| 284 | 284 | function.gen() catch |err| switch (err) { |
| 285 | error.CodegenFail => return FnResult{ .fail = function.err_msg.? }, | |
| 286 | error.OutOfRegisters => return FnResult{ | |
| 285 | error.CodegenFail => return Result{ .fail = function.err_msg.? }, | |
| 286 | error.OutOfRegisters => return Result{ | |
| 287 | 287 | .fail = try ErrorMsg.create(bin_file.allocator, src_loc, "CodeGen ran out of registers. This is a bug in the Zig compiler.", .{}), |
| 288 | 288 | }, |
| 289 | 289 | else => |e| return e, |
| ... | ... | @@ -309,14 +309,14 @@ pub fn generate( |
| 309 | 309 | defer emit.deinit(); |
| 310 | 310 | |
| 311 | 311 | emit.emitMir() catch |err| switch (err) { |
| 312 | error.EmitFail => return FnResult{ .fail = emit.err_msg.? }, | |
| 312 | error.EmitFail => return Result{ .fail = emit.err_msg.? }, | |
| 313 | 313 | else => |e| return e, |
| 314 | 314 | }; |
| 315 | 315 | |
| 316 | 316 | if (function.err_msg) |em| { |
| 317 | return FnResult{ .fail = em }; | |
| 317 | return Result{ .fail = em }; | |
| 318 | 318 | } else { |
| 319 | return FnResult{ .appended = {} }; | |
| 319 | return Result{ .appended = {} }; | |
| 320 | 320 | } |
| 321 | 321 | } |
| 322 | 322 |
src/arch/sparc64/CodeGen.zig+9-9| ... | ... | @@ -20,7 +20,7 @@ const Emit = @import("Emit.zig"); |
| 20 | 20 | const Liveness = @import("../../Liveness.zig"); |
| 21 | 21 | const Type = @import("../../type.zig").Type; |
| 22 | 22 | const GenerateSymbolError = @import("../../codegen.zig").GenerateSymbolError; |
| 23 | const FnResult = @import("../../codegen.zig").FnResult; | |
| 23 | const Result = @import("../../codegen.zig").Result; | |
| 24 | 24 | const DebugInfoOutput = @import("../../codegen.zig").DebugInfoOutput; |
| 25 | 25 | |
| 26 | 26 | const build_options = @import("build_options"); |
| ... | ... | @@ -265,7 +265,7 @@ pub fn generate( |
| 265 | 265 | liveness: Liveness, |
| 266 | 266 | code: *std.ArrayList(u8), |
| 267 | 267 | debug_output: DebugInfoOutput, |
| 268 | ) GenerateSymbolError!FnResult { | |
| 268 | ) GenerateSymbolError!Result { | |
| 269 | 269 | if (build_options.skip_non_native and builtin.cpu.arch != bin_file.options.target.cpu.arch) { |
| 270 | 270 | @panic("Attempted to compile for architecture that was disabled by build configuration"); |
| 271 | 271 | } |
| ... | ... | @@ -310,8 +310,8 @@ pub fn generate( |
| 310 | 310 | defer function.exitlude_jump_relocs.deinit(bin_file.allocator); |
| 311 | 311 | |
| 312 | 312 | var call_info = function.resolveCallingConventionValues(fn_type, .callee) catch |err| switch (err) { |
| 313 | error.CodegenFail => return FnResult{ .fail = function.err_msg.? }, | |
| 314 | error.OutOfRegisters => return FnResult{ | |
| 313 | error.CodegenFail => return Result{ .fail = function.err_msg.? }, | |
| 314 | error.OutOfRegisters => return Result{ | |
| 315 | 315 | .fail = try ErrorMsg.create(bin_file.allocator, src_loc, "CodeGen ran out of registers. This is a bug in the Zig compiler.", .{}), |
| 316 | 316 | }, |
| 317 | 317 | else => |e| return e, |
| ... | ... | @@ -324,8 +324,8 @@ pub fn generate( |
| 324 | 324 | function.max_end_stack = call_info.stack_byte_count; |
| 325 | 325 | |
| 326 | 326 | function.gen() catch |err| switch (err) { |
| 327 | error.CodegenFail => return FnResult{ .fail = function.err_msg.? }, | |
| 328 | error.OutOfRegisters => return FnResult{ | |
| 327 | error.CodegenFail => return Result{ .fail = function.err_msg.? }, | |
| 328 | error.OutOfRegisters => return Result{ | |
| 329 | 329 | .fail = try ErrorMsg.create(bin_file.allocator, src_loc, "CodeGen ran out of registers. This is a bug in the Zig compiler.", .{}), |
| 330 | 330 | }, |
| 331 | 331 | else => |e| return e, |
| ... | ... | @@ -351,14 +351,14 @@ pub fn generate( |
| 351 | 351 | defer emit.deinit(); |
| 352 | 352 | |
| 353 | 353 | emit.emitMir() catch |err| switch (err) { |
| 354 | error.EmitFail => return FnResult{ .fail = emit.err_msg.? }, | |
| 354 | error.EmitFail => return Result{ .fail = emit.err_msg.? }, | |
| 355 | 355 | else => |e| return e, |
| 356 | 356 | }; |
| 357 | 357 | |
| 358 | 358 | if (function.err_msg) |em| { |
| 359 | return FnResult{ .fail = em }; | |
| 359 | return Result{ .fail = em }; | |
| 360 | 360 | } else { |
| 361 | return FnResult{ .appended = {} }; | |
| 361 | return Result{ .appended = {} }; | |
| 362 | 362 | } |
| 363 | 363 | } |
| 364 | 364 |
src/arch/wasm/CodeGen.zig+3-10| ... | ... | @@ -627,13 +627,6 @@ test "Wasm - buildOpcode" { |
| 627 | 627 | try testing.expectEqual(@as(wasm.Opcode, .f64_reinterpret_i64), f64_reinterpret_i64); |
| 628 | 628 | } |
| 629 | 629 | |
| 630 | pub const Result = union(enum) { | |
| 631 | /// The codegen bytes have been appended to `Context.code` | |
| 632 | appended: void, | |
| 633 | /// The data is managed externally and are part of the `Result` | |
| 634 | externally_managed: []const u8, | |
| 635 | }; | |
| 636 | ||
| 637 | 630 | /// Hashmap to store generated `WValue` for each `Air.Inst.Ref` |
| 638 | 631 | pub const ValueTable = std.AutoArrayHashMapUnmanaged(Air.Inst.Ref, WValue); |
| 639 | 632 | |
| ... | ... | @@ -1171,7 +1164,7 @@ pub fn generate( |
| 1171 | 1164 | liveness: Liveness, |
| 1172 | 1165 | code: *std.ArrayList(u8), |
| 1173 | 1166 | debug_output: codegen.DebugInfoOutput, |
| 1174 | ) codegen.GenerateSymbolError!codegen.FnResult { | |
| 1167 | ) codegen.GenerateSymbolError!codegen.Result { | |
| 1175 | 1168 | _ = src_loc; |
| 1176 | 1169 | var code_gen: CodeGen = .{ |
| 1177 | 1170 | .gpa = bin_file.allocator, |
| ... | ... | @@ -1190,11 +1183,11 @@ pub fn generate( |
| 1190 | 1183 | defer code_gen.deinit(); |
| 1191 | 1184 | |
| 1192 | 1185 | genFunc(&code_gen) catch |err| switch (err) { |
| 1193 | error.CodegenFail => return codegen.FnResult{ .fail = code_gen.err_msg }, | |
| 1186 | error.CodegenFail => return codegen.Result{ .fail = code_gen.err_msg }, | |
| 1194 | 1187 | else => |e| return e, |
| 1195 | 1188 | }; |
| 1196 | 1189 | |
| 1197 | return codegen.FnResult{ .appended = {} }; | |
| 1190 | return codegen.Result{ .appended = {} }; | |
| 1198 | 1191 | } |
| 1199 | 1192 | |
| 1200 | 1193 | fn genFunc(func: *CodeGen) InnerError!void { |
src/arch/x86_64/CodeGen.zig+9-9| ... | ... | @@ -16,7 +16,7 @@ const Compilation = @import("../../Compilation.zig"); |
| 16 | 16 | const DebugInfoOutput = codegen.DebugInfoOutput; |
| 17 | 17 | const DW = std.dwarf; |
| 18 | 18 | const ErrorMsg = Module.ErrorMsg; |
| 19 | const FnResult = codegen.FnResult; | |
| 19 | const Result = codegen.Result; | |
| 20 | 20 | const GenerateSymbolError = codegen.GenerateSymbolError; |
| 21 | 21 | const Emit = @import("Emit.zig"); |
| 22 | 22 | const Liveness = @import("../../Liveness.zig"); |
| ... | ... | @@ -257,7 +257,7 @@ pub fn generate( |
| 257 | 257 | liveness: Liveness, |
| 258 | 258 | code: *std.ArrayList(u8), |
| 259 | 259 | debug_output: DebugInfoOutput, |
| 260 | ) GenerateSymbolError!FnResult { | |
| 260 | ) GenerateSymbolError!Result { | |
| 261 | 261 | if (build_options.skip_non_native and builtin.cpu.arch != bin_file.options.target.cpu.arch) { |
| 262 | 262 | @panic("Attempted to compile for architecture that was disabled by build configuration"); |
| 263 | 263 | } |
| ... | ... | @@ -305,8 +305,8 @@ pub fn generate( |
| 305 | 305 | defer if (builtin.mode == .Debug) function.mir_to_air_map.deinit(); |
| 306 | 306 | |
| 307 | 307 | var call_info = function.resolveCallingConventionValues(fn_type) catch |err| switch (err) { |
| 308 | error.CodegenFail => return FnResult{ .fail = function.err_msg.? }, | |
| 309 | error.OutOfRegisters => return FnResult{ | |
| 308 | error.CodegenFail => return Result{ .fail = function.err_msg.? }, | |
| 309 | error.OutOfRegisters => return Result{ | |
| 310 | 310 | .fail = try ErrorMsg.create(bin_file.allocator, src_loc, "CodeGen ran out of registers. This is a bug in the Zig compiler.", .{}), |
| 311 | 311 | }, |
| 312 | 312 | else => |e| return e, |
| ... | ... | @@ -319,8 +319,8 @@ pub fn generate( |
| 319 | 319 | function.max_end_stack = call_info.stack_byte_count; |
| 320 | 320 | |
| 321 | 321 | function.gen() catch |err| switch (err) { |
| 322 | error.CodegenFail => return FnResult{ .fail = function.err_msg.? }, | |
| 323 | error.OutOfRegisters => return FnResult{ | |
| 322 | error.CodegenFail => return Result{ .fail = function.err_msg.? }, | |
| 323 | error.OutOfRegisters => return Result{ | |
| 324 | 324 | .fail = try ErrorMsg.create(bin_file.allocator, src_loc, "CodeGen ran out of registers. This is a bug in the Zig compiler.", .{}), |
| 325 | 325 | }, |
| 326 | 326 | else => |e| return e, |
| ... | ... | @@ -345,14 +345,14 @@ pub fn generate( |
| 345 | 345 | }; |
| 346 | 346 | defer emit.deinit(); |
| 347 | 347 | emit.lowerMir() catch |err| switch (err) { |
| 348 | error.EmitFail => return FnResult{ .fail = emit.err_msg.? }, | |
| 348 | error.EmitFail => return Result{ .fail = emit.err_msg.? }, | |
| 349 | 349 | else => |e| return e, |
| 350 | 350 | }; |
| 351 | 351 | |
| 352 | 352 | if (function.err_msg) |em| { |
| 353 | return FnResult{ .fail = em }; | |
| 353 | return Result{ .fail = em }; | |
| 354 | 354 | } else { |
| 355 | return FnResult{ .appended = {} }; | |
| 355 | return Result{ .appended = {} }; | |
| 356 | 356 | } |
| 357 | 357 | } |
| 358 | 358 |
src/codegen.zig+1-74| ... | ... | @@ -21,16 +21,9 @@ const TypedValue = @import("TypedValue.zig"); |
| 21 | 21 | const Value = @import("value.zig").Value; |
| 22 | 22 | const Zir = @import("Zir.zig"); |
| 23 | 23 | |
| 24 | pub const FnResult = union(enum) { | |
| 25 | /// The `code` parameter passed to `generateSymbol` has the value appended. | |
| 26 | appended: void, | |
| 27 | fail: *ErrorMsg, | |
| 28 | }; | |
| 29 | 24 | pub const Result = union(enum) { |
| 30 | 25 | /// The `code` parameter passed to `generateSymbol` has the value appended. |
| 31 | 26 | appended: void, |
| 32 | /// The value is available externally, `code` is unused. | |
| 33 | externally_managed: []const u8, | |
| 34 | 27 | fail: *ErrorMsg, |
| 35 | 28 | }; |
| 36 | 29 | |
| ... | ... | @@ -89,7 +82,7 @@ pub fn generateFunction( |
| 89 | 82 | liveness: Liveness, |
| 90 | 83 | code: *std.ArrayList(u8), |
| 91 | 84 | debug_output: DebugInfoOutput, |
| 92 | ) GenerateSymbolError!FnResult { | |
| 85 | ) GenerateSymbolError!Result { | |
| 93 | 86 | switch (bin_file.options.target.cpu.arch) { |
| 94 | 87 | .arm, |
| 95 | 88 | .armeb, |
| ... | ... | @@ -209,9 +202,6 @@ pub fn generateSymbol( |
| 209 | 202 | .val = elem_val, |
| 210 | 203 | }, code, debug_output, reloc_info)) { |
| 211 | 204 | .appended => {}, |
| 212 | .externally_managed => |slice| { | |
| 213 | code.appendSliceAssumeCapacity(slice); | |
| 214 | }, | |
| 215 | 205 | .fail => |em| return Result{ .fail = em }, |
| 216 | 206 | } |
| 217 | 207 | } |
| ... | ... | @@ -230,9 +220,6 @@ pub fn generateSymbol( |
| 230 | 220 | .val = array, |
| 231 | 221 | }, code, debug_output, reloc_info)) { |
| 232 | 222 | .appended => {}, |
| 233 | .externally_managed => |slice| { | |
| 234 | code.appendSliceAssumeCapacity(slice); | |
| 235 | }, | |
| 236 | 223 | .fail => |em| return Result{ .fail = em }, |
| 237 | 224 | } |
| 238 | 225 | } |
| ... | ... | @@ -243,9 +230,6 @@ pub fn generateSymbol( |
| 243 | 230 | .val = sentinel_val, |
| 244 | 231 | }, code, debug_output, reloc_info)) { |
| 245 | 232 | .appended => {}, |
| 246 | .externally_managed => |slice| { | |
| 247 | code.appendSliceAssumeCapacity(slice); | |
| 248 | }, | |
| 249 | 233 | .fail => |em| return Result{ .fail = em }, |
| 250 | 234 | } |
| 251 | 235 | } |
| ... | ... | @@ -260,9 +244,6 @@ pub fn generateSymbol( |
| 260 | 244 | .val = sentinel_val, |
| 261 | 245 | }, code, debug_output, reloc_info)) { |
| 262 | 246 | .appended => {}, |
| 263 | .externally_managed => |slice| { | |
| 264 | code.appendSliceAssumeCapacity(slice); | |
| 265 | }, | |
| 266 | 247 | .fail => |em| return Result{ .fail = em }, |
| 267 | 248 | } |
| 268 | 249 | return Result{ .appended = {} }; |
| ... | ... | @@ -310,9 +291,6 @@ pub fn generateSymbol( |
| 310 | 291 | .val = slice.ptr, |
| 311 | 292 | }, code, debug_output, reloc_info)) { |
| 312 | 293 | .appended => {}, |
| 313 | .externally_managed => |external_slice| { | |
| 314 | code.appendSliceAssumeCapacity(external_slice); | |
| 315 | }, | |
| 316 | 294 | .fail => |em| return Result{ .fail = em }, |
| 317 | 295 | } |
| 318 | 296 | |
| ... | ... | @@ -322,9 +300,6 @@ pub fn generateSymbol( |
| 322 | 300 | .val = slice.len, |
| 323 | 301 | }, code, debug_output, reloc_info)) { |
| 324 | 302 | .appended => {}, |
| 325 | .externally_managed => |external_slice| { | |
| 326 | code.appendSliceAssumeCapacity(external_slice); | |
| 327 | }, | |
| 328 | 303 | .fail => |em| return Result{ .fail = em }, |
| 329 | 304 | } |
| 330 | 305 | |
| ... | ... | @@ -376,9 +351,6 @@ pub fn generateSymbol( |
| 376 | 351 | .val = container_ptr, |
| 377 | 352 | }, code, debug_output, reloc_info)) { |
| 378 | 353 | .appended => {}, |
| 379 | .externally_managed => |external_slice| { | |
| 380 | code.appendSliceAssumeCapacity(external_slice); | |
| 381 | }, | |
| 382 | 354 | .fail => |em| return Result{ .fail = em }, |
| 383 | 355 | } |
| 384 | 356 | return Result{ .appended = {} }; |
| ... | ... | @@ -552,9 +524,6 @@ pub fn generateSymbol( |
| 552 | 524 | .appended => { |
| 553 | 525 | mem.copy(u8, code.items[current_pos..], tmp_list.items); |
| 554 | 526 | }, |
| 555 | .externally_managed => |external_slice| { | |
| 556 | mem.copy(u8, code.items[current_pos..], external_slice); | |
| 557 | }, | |
| 558 | 527 | .fail => |em| return Result{ .fail = em }, |
| 559 | 528 | } |
| 560 | 529 | } else { |
| ... | ... | @@ -577,9 +546,6 @@ pub fn generateSymbol( |
| 577 | 546 | .val = field_val, |
| 578 | 547 | }, code, debug_output, reloc_info)) { |
| 579 | 548 | .appended => {}, |
| 580 | .externally_managed => |external_slice| { | |
| 581 | code.appendSliceAssumeCapacity(external_slice); | |
| 582 | }, | |
| 583 | 549 | .fail => |em| return Result{ .fail = em }, |
| 584 | 550 | } |
| 585 | 551 | const unpadded_field_end = code.items.len - struct_begin; |
| ... | ... | @@ -613,9 +579,6 @@ pub fn generateSymbol( |
| 613 | 579 | .val = union_obj.tag, |
| 614 | 580 | }, code, debug_output, reloc_info)) { |
| 615 | 581 | .appended => {}, |
| 616 | .externally_managed => |external_slice| { | |
| 617 | code.appendSliceAssumeCapacity(external_slice); | |
| 618 | }, | |
| 619 | 582 | .fail => |em| return Result{ .fail = em }, |
| 620 | 583 | } |
| 621 | 584 | } |
| ... | ... | @@ -633,9 +596,6 @@ pub fn generateSymbol( |
| 633 | 596 | .val = union_obj.val, |
| 634 | 597 | }, code, debug_output, reloc_info)) { |
| 635 | 598 | .appended => {}, |
| 636 | .externally_managed => |external_slice| { | |
| 637 | code.appendSliceAssumeCapacity(external_slice); | |
| 638 | }, | |
| 639 | 599 | .fail => |em| return Result{ .fail = em }, |
| 640 | 600 | } |
| 641 | 601 | |
| ... | ... | @@ -651,9 +611,6 @@ pub fn generateSymbol( |
| 651 | 611 | .val = union_obj.tag, |
| 652 | 612 | }, code, debug_output, reloc_info)) { |
| 653 | 613 | .appended => {}, |
| 654 | .externally_managed => |external_slice| { | |
| 655 | code.appendSliceAssumeCapacity(external_slice); | |
| 656 | }, | |
| 657 | 614 | .fail => |em| return Result{ .fail = em }, |
| 658 | 615 | } |
| 659 | 616 | } |
| ... | ... | @@ -679,9 +636,6 @@ pub fn generateSymbol( |
| 679 | 636 | .val = payload.data, |
| 680 | 637 | }, code, debug_output, reloc_info)) { |
| 681 | 638 | .appended => {}, |
| 682 | .externally_managed => |external_slice| { | |
| 683 | code.appendSliceAssumeCapacity(external_slice); | |
| 684 | }, | |
| 685 | 639 | .fail => |em| return Result{ .fail = em }, |
| 686 | 640 | } |
| 687 | 641 | } else if (!typed_value.val.isNull()) { |
| ... | ... | @@ -690,9 +644,6 @@ pub fn generateSymbol( |
| 690 | 644 | .val = typed_value.val, |
| 691 | 645 | }, code, debug_output, reloc_info)) { |
| 692 | 646 | .appended => {}, |
| 693 | .externally_managed => |external_slice| { | |
| 694 | code.appendSliceAssumeCapacity(external_slice); | |
| 695 | }, | |
| 696 | 647 | .fail => |em| return Result{ .fail = em }, |
| 697 | 648 | } |
| 698 | 649 | } else { |
| ... | ... | @@ -709,9 +660,6 @@ pub fn generateSymbol( |
| 709 | 660 | .val = value, |
| 710 | 661 | }, code, debug_output, reloc_info)) { |
| 711 | 662 | .appended => {}, |
| 712 | .externally_managed => |external_slice| { | |
| 713 | code.appendSliceAssumeCapacity(external_slice); | |
| 714 | }, | |
| 715 | 663 | .fail => |em| return Result{ .fail = em }, |
| 716 | 664 | } |
| 717 | 665 | |
| ... | ... | @@ -741,9 +689,6 @@ pub fn generateSymbol( |
| 741 | 689 | .val = if (is_payload) Value.initTag(.zero) else typed_value.val, |
| 742 | 690 | }, code, debug_output, reloc_info)) { |
| 743 | 691 | .appended => {}, |
| 744 | .externally_managed => |external_slice| { | |
| 745 | code.appendSliceAssumeCapacity(external_slice); | |
| 746 | }, | |
| 747 | 692 | .fail => |em| return Result{ .fail = em }, |
| 748 | 693 | } |
| 749 | 694 | } |
| ... | ... | @@ -757,9 +702,6 @@ pub fn generateSymbol( |
| 757 | 702 | .val = payload_val, |
| 758 | 703 | }, code, debug_output, reloc_info)) { |
| 759 | 704 | .appended => {}, |
| 760 | .externally_managed => |external_slice| { | |
| 761 | code.appendSliceAssumeCapacity(external_slice); | |
| 762 | }, | |
| 763 | 705 | .fail => |em| return Result{ .fail = em }, |
| 764 | 706 | } |
| 765 | 707 | const unpadded_end = code.items.len - begin; |
| ... | ... | @@ -779,9 +721,6 @@ pub fn generateSymbol( |
| 779 | 721 | .val = if (is_payload) Value.initTag(.zero) else typed_value.val, |
| 780 | 722 | }, code, debug_output, reloc_info)) { |
| 781 | 723 | .appended => {}, |
| 782 | .externally_managed => |external_slice| { | |
| 783 | code.appendSliceAssumeCapacity(external_slice); | |
| 784 | }, | |
| 785 | 724 | .fail => |em| return Result{ .fail = em }, |
| 786 | 725 | } |
| 787 | 726 | const unpadded_end = code.items.len - begin; |
| ... | ... | @@ -826,9 +765,6 @@ pub fn generateSymbol( |
| 826 | 765 | .val = elem_val, |
| 827 | 766 | }, code, debug_output, reloc_info)) { |
| 828 | 767 | .appended => {}, |
| 829 | .externally_managed => |slice| { | |
| 830 | code.appendSliceAssumeCapacity(slice); | |
| 831 | }, | |
| 832 | 768 | .fail => |em| return Result{ .fail = em }, |
| 833 | 769 | } |
| 834 | 770 | } |
| ... | ... | @@ -846,9 +782,6 @@ pub fn generateSymbol( |
| 846 | 782 | .val = array, |
| 847 | 783 | }, code, debug_output, reloc_info)) { |
| 848 | 784 | .appended => {}, |
| 849 | .externally_managed => |slice| { | |
| 850 | code.appendSliceAssumeCapacity(slice); | |
| 851 | }, | |
| 852 | 785 | .fail => |em| return Result{ .fail = em }, |
| 853 | 786 | } |
| 854 | 787 | } |
| ... | ... | @@ -902,9 +835,6 @@ fn lowerDeclRef( |
| 902 | 835 | .val = typed_value.val, |
| 903 | 836 | }, code, debug_output, reloc_info)) { |
| 904 | 837 | .appended => {}, |
| 905 | .externally_managed => |external_slice| { | |
| 906 | code.appendSliceAssumeCapacity(external_slice); | |
| 907 | }, | |
| 908 | 838 | .fail => |em| return Result{ .fail = em }, |
| 909 | 839 | } |
| 910 | 840 | |
| ... | ... | @@ -918,9 +848,6 @@ fn lowerDeclRef( |
| 918 | 848 | .val = Value.initPayload(&slice_len.base), |
| 919 | 849 | }, code, debug_output, reloc_info)) { |
| 920 | 850 | .appended => {}, |
| 921 | .externally_managed => |external_slice| { | |
| 922 | code.appendSliceAssumeCapacity(external_slice); | |
| 923 | }, | |
| 924 | 851 | .fail => |em| return Result{ .fail = em }, |
| 925 | 852 | } |
| 926 | 853 |
src/link/Coff.zig-2| ... | ... | @@ -981,7 +981,6 @@ pub fn lowerUnnamedConst(self: *Coff, tv: TypedValue, decl_index: Module.Decl.In |
| 981 | 981 | .parent_atom_index = atom.sym_index, |
| 982 | 982 | }); |
| 983 | 983 | const code = switch (res) { |
| 984 | .externally_managed => |x| x, | |
| 985 | 984 | .appended => code_buffer.items, |
| 986 | 985 | .fail => |em| { |
| 987 | 986 | decl.analysis = .codegen_failure; |
| ... | ... | @@ -1042,7 +1041,6 @@ pub fn updateDecl(self: *Coff, module: *Module, decl_index: Module.Decl.Index) ! |
| 1042 | 1041 | .parent_atom_index = decl.link.coff.sym_index, |
| 1043 | 1042 | }); |
| 1044 | 1043 | const code = switch (res) { |
| 1045 | .externally_managed => |x| x, | |
| 1046 | 1044 | .appended => code_buffer.items, |
| 1047 | 1045 | .fail => |em| { |
| 1048 | 1046 | decl.analysis = .codegen_failure; |
src/link/Elf.zig-2| ... | ... | @@ -2553,7 +2553,6 @@ pub fn updateDecl(self: *Elf, module: *Module, decl_index: Module.Decl.Index) !v |
| 2553 | 2553 | }); |
| 2554 | 2554 | |
| 2555 | 2555 | const code = switch (res) { |
| 2556 | .externally_managed => |x| x, | |
| 2557 | 2556 | .appended => code_buffer.items, |
| 2558 | 2557 | .fail => |em| { |
| 2559 | 2558 | decl.analysis = .codegen_failure; |
| ... | ... | @@ -2618,7 +2617,6 @@ pub fn lowerUnnamedConst(self: *Elf, typed_value: TypedValue, decl_index: Module |
| 2618 | 2617 | .parent_atom_index = atom.local_sym_index, |
| 2619 | 2618 | }); |
| 2620 | 2619 | const code = switch (res) { |
| 2621 | .externally_managed => |x| x, | |
| 2622 | 2620 | .appended => code_buffer.items, |
| 2623 | 2621 | .fail => |em| { |
| 2624 | 2622 | decl.analysis = .codegen_failure; |
src/link/MachO.zig-2| ... | ... | @@ -2082,7 +2082,6 @@ pub fn lowerUnnamedConst(self: *MachO, typed_value: TypedValue, decl_index: Modu |
| 2082 | 2082 | .parent_atom_index = atom.sym_index, |
| 2083 | 2083 | }); |
| 2084 | 2084 | const code = switch (res) { |
| 2085 | .externally_managed => |x| x, | |
| 2086 | 2085 | .appended => code_buffer.items, |
| 2087 | 2086 | .fail => |em| { |
| 2088 | 2087 | decl.analysis = .codegen_failure; |
| ... | ... | @@ -2167,7 +2166,6 @@ pub fn updateDecl(self: *MachO, module: *Module, decl_index: Module.Decl.Index) |
| 2167 | 2166 | }); |
| 2168 | 2167 | |
| 2169 | 2168 | const code = switch (res) { |
| 2170 | .externally_managed => |x| x, | |
| 2171 | 2169 | .appended => code_buffer.items, |
| 2172 | 2170 | .fail => |em| { |
| 2173 | 2171 | decl.analysis = .codegen_failure; |
src/link/Plan9.zig-2| ... | ... | @@ -358,7 +358,6 @@ pub fn lowerUnnamedConst(self: *Plan9, tv: TypedValue, decl_index: Module.Decl.I |
| 358 | 358 | .parent_atom_index = @enumToInt(decl_index), |
| 359 | 359 | }); |
| 360 | 360 | const code = switch (res) { |
| 361 | .externally_managed => |x| x, | |
| 362 | 361 | .appended => code_buffer.items, |
| 363 | 362 | .fail => |em| { |
| 364 | 363 | decl.analysis = .codegen_failure; |
| ... | ... | @@ -403,7 +402,6 @@ pub fn updateDecl(self: *Plan9, module: *Module, decl_index: Module.Decl.Index) |
| 403 | 402 | .parent_atom_index = @enumToInt(decl_index), |
| 404 | 403 | }); |
| 405 | 404 | const code = switch (res) { |
| 406 | .externally_managed => |x| x, | |
| 407 | 405 | .appended => code_buffer.items, |
| 408 | 406 | .fail => |em| { |
| 409 | 407 | decl.analysis = .codegen_failure; |
src/link/Wasm.zig-2| ... | ... | @@ -1113,7 +1113,6 @@ pub fn updateDecl(wasm: *Wasm, mod: *Module, decl_index: Module.Decl.Index) !voi |
| 1113 | 1113 | ); |
| 1114 | 1114 | |
| 1115 | 1115 | const code = switch (res) { |
| 1116 | .externally_managed => |x| x, | |
| 1117 | 1116 | .appended => code_writer.items, |
| 1118 | 1117 | .fail => |em| { |
| 1119 | 1118 | decl.analysis = .codegen_failure; |
| ... | ... | @@ -1250,7 +1249,6 @@ pub fn lowerUnnamedConst(wasm: *Wasm, tv: TypedValue, decl_index: Module.Decl.In |
| 1250 | 1249 | }, |
| 1251 | 1250 | ); |
| 1252 | 1251 | const code = switch (result) { |
| 1253 | .externally_managed => |x| x, | |
| 1254 | 1252 | .appended => value_bytes.items, |
| 1255 | 1253 | .fail => |em| { |
| 1256 | 1254 | decl.analysis = .codegen_failure; |