| author | |
| committer | |
| log | e2c3920fb178a7e785036238a7c8207539b08902 |
| tree | 0cd3ebe9366309a0bf3eef1e17c0815a5afabf9e |
| parent | 6d40d374d8d2c0eef0c0c6c557461f35b385d085 |
23 files changed, 193 insertions(+), 315 deletions(-)
lib/compiler/aro/aro/CodeGen.zig+3-3| ... | @@ -54,9 +54,9 @@ return_label: Ir.Ref = undefined, | ... | @@ -54,9 +54,9 @@ return_label: Ir.Ref = undefined, |
| 54 | compound_assign_dummy: ?Ir.Ref = null, | 54 | compound_assign_dummy: ?Ir.Ref = null, |
| 55 | 55 | ||
| 56 | fn fail(c: *CodeGen, comptime fmt: []const u8, args: anytype) error{ FatalError, OutOfMemory } { | 56 | fn fail(c: *CodeGen, comptime fmt: []const u8, args: anytype) error{ FatalError, OutOfMemory } { |
| 57 | var sf_buf: [u8]1024 = undefined; | 57 | var bfa_buf: [u8]1024 = undefined; |
| 58 | var sf: std.heap.StackFallbackAllocator = .init(&sf_buf, c.comp.gpa); | 58 | var bfa: std.heap.BufferFirstAllocator = .init(&bfa_buf, c.comp.gpa); |
| 59 | const allocator = sf.allocator(); | 59 | const allocator = bfa.allocator(); |
| 60 | var buf: std.ArrayList(u8) = .empty; | 60 | var buf: std.ArrayList(u8) = .empty; |
| 61 | defer buf.deinit(allocator); | 61 | defer buf.deinit(allocator); |
| 62 | 62 |
lib/compiler/aro/aro/Compilation.zig+15-15| ... | @@ -1761,9 +1761,9 @@ fn addToSearchPath(comp: *Compilation, include: Include, verbose: bool) !void { | ... | @@ -1761,9 +1761,9 @@ fn addToSearchPath(comp: *Compilation, include: Include, verbose: bool) !void { |
| 1761 | try comp.search_path.append(comp.gpa, include); | 1761 | try comp.search_path.append(comp.gpa, include); |
| 1762 | } | 1762 | } |
| 1763 | fn removeDuplicateSearchPaths(comp: *Compilation, start: usize, verbose: bool) !void { | 1763 | fn removeDuplicateSearchPaths(comp: *Compilation, start: usize, verbose: bool) !void { |
| 1764 | var sf_buf: [1024]u8 = undefined; | 1764 | var bfa_buf: [1024]u8 = undefined; |
| 1765 | var sf: std.heap.StackFallbackAllocator = .init(&sf_buf, comp.gpa); | 1765 | var bfa: std.heap.BufferFirstAllocator = .init(&bfa_buf, comp.gpa); |
| 1766 | const allocator = sf.allocator(); | 1766 | const allocator = bfa.allocator(); |
| 1767 | var seen_includes: std.StringHashMapUnmanaged(void) = .empty; | 1767 | var seen_includes: std.StringHashMapUnmanaged(void) = .empty; |
| 1768 | defer seen_includes.deinit(allocator); | 1768 | defer seen_includes.deinit(allocator); |
| 1769 | var seen_frameworks: std.StringHashMapUnmanaged(void) = .empty; | 1769 | var seen_frameworks: std.StringHashMapUnmanaged(void) = .empty; |
| ... | @@ -1977,11 +1977,11 @@ const FindInclude = struct { | ... | @@ -1977,11 +1977,11 @@ const FindInclude = struct { |
| 1977 | ) Allocator.Error!?Result { | 1977 | ) Allocator.Error!?Result { |
| 1978 | const comp = find.comp; | 1978 | const comp = find.comp; |
| 1979 | 1979 | ||
| 1980 | var stack_fallback_buf: [path_buf_stack_limit]u8 = undefined; | 1980 | var bfa_buf: [path_buf_stack_limit]u8 = undefined; |
| 1981 | var stack_fallback: std.heap.StackFallbackAllocator = .init(&stack_fallback_buf, comp.gpa); | 1981 | var bfa_state: std.heap.BufferFirstAllocator = .init(&bfa_buf, comp.gpa); |
| 1982 | const sfa = stack_fallback.allocator(); | 1982 | const bfa = bfa_state.allocator(); |
| 1983 | const header_path = try std.fmt.allocPrint(sfa, format, args); | 1983 | const header_path = try std.fmt.allocPrint(bfa, format, args); |
| 1984 | defer sfa.free(header_path); | 1984 | defer bfa.free(header_path); |
| 1985 | find.comp.normalizePath(header_path); | 1985 | find.comp.normalizePath(header_path); |
| 1986 | 1986 | ||
| 1987 | const source = comp.addSourceFromPathExtra(header_path, kind) catch |err| switch (err) { | 1987 | const source = comp.addSourceFromPathExtra(header_path, kind) catch |err| switch (err) { |
| ... | @@ -2070,15 +2070,15 @@ pub fn findEmbed( | ... | @@ -2070,15 +2070,15 @@ pub fn findEmbed( |
| 2070 | } | 2070 | } |
| 2071 | } | 2071 | } |
| 2072 | 2072 | ||
| 2073 | var stack_fallback_buf: [path_buf_stack_limit]u8 = undefined; | 2073 | var bfa_buf: [path_buf_stack_limit]u8 = undefined; |
| 2074 | var stack_fallback: std.heap.StackFallbackAllocator = .init(&stack_fallback_buf, comp.gpa); | 2074 | var bfa_state: std.heap.BufferFirstAllocator = .init(&bfa_buf, comp.gpa); |
| 2075 | const sf_allocator = stack_fallback.allocator(); | 2075 | const bfa = bfa_state.allocator(); |
| 2076 | 2076 | ||
| 2077 | switch (include_type) { | 2077 | switch (include_type) { |
| 2078 | .quotes, .cli => { | 2078 | .quotes, .cli => { |
| 2079 | const dir = std.fs.path.dirname(comp.getSource(includer_token_source).path) orelse "."; | 2079 | const dir = std.fs.path.dirname(comp.getSource(includer_token_source).path) orelse "."; |
| 2080 | const path = try std.fs.path.join(sf_allocator, &.{ dir, filename }); | 2080 | const path = try std.fs.path.join(bfa, &.{ dir, filename }); |
| 2081 | defer sf_allocator.free(path); | 2081 | defer bfa.free(path); |
| 2082 | comp.normalizePath(path); | 2082 | comp.normalizePath(path); |
| 2083 | if (comp.getPathContents(path, limit)) |some| { | 2083 | if (comp.getPathContents(path, limit)) |some| { |
| 2084 | errdefer comp.gpa.free(some); | 2084 | errdefer comp.gpa.free(some); |
| ... | @@ -2092,8 +2092,8 @@ pub fn findEmbed( | ... | @@ -2092,8 +2092,8 @@ pub fn findEmbed( |
| 2092 | .angle_brackets => {}, | 2092 | .angle_brackets => {}, |
| 2093 | } | 2093 | } |
| 2094 | for (comp.embed_dirs.items) |embed_dir| { | 2094 | for (comp.embed_dirs.items) |embed_dir| { |
| 2095 | const path = try std.fs.path.join(sf_allocator, &.{ embed_dir, filename }); | 2095 | const path = try std.fs.path.join(bfa, &.{ embed_dir, filename }); |
| 2096 | defer sf_allocator.free(path); | 2096 | defer bfa.free(path); |
| 2097 | comp.normalizePath(path); | 2097 | comp.normalizePath(path); |
| 2098 | if (comp.getPathContents(path, limit)) |some| { | 2098 | if (comp.getPathContents(path, limit)) |some| { |
| 2099 | errdefer comp.gpa.free(some); | 2099 | errdefer comp.gpa.free(some); |
lib/compiler/aro/aro/Driver.zig+9-9| ... | @@ -947,9 +947,9 @@ fn addImacros(d: *Driver, path: []const u8) !void { | ... | @@ -947,9 +947,9 @@ fn addImacros(d: *Driver, path: []const u8) !void { |
| 947 | } | 947 | } |
| 948 | 948 | ||
| 949 | pub fn err(d: *Driver, fmt: []const u8, args: anytype) Compilation.Error!void { | 949 | pub fn err(d: *Driver, fmt: []const u8, args: anytype) Compilation.Error!void { |
| 950 | var sf_buf: [1024]u8 = undefined; | 950 | var bfa_buf: [1024]u8 = undefined; |
| 951 | var sf: std.heap.StackFallbackAllocator = .init(&sf_buf, d.comp.gpa); | 951 | var bfa: std.heap.BufferFirstAllocator = .init(&bfa_buf, d.comp.gpa); |
| 952 | var allocating: std.Io.Writer.Allocating = .init(sf.allocator()); | 952 | var allocating: std.Io.Writer.Allocating = .init(bfa.allocator()); |
| 953 | defer allocating.deinit(); | 953 | defer allocating.deinit(); |
| 954 | 954 | ||
| 955 | Diagnostics.formatArgs(&allocating.writer, fmt, args) catch return error.OutOfMemory; | 955 | Diagnostics.formatArgs(&allocating.writer, fmt, args) catch return error.OutOfMemory; |
| ... | @@ -957,9 +957,9 @@ pub fn err(d: *Driver, fmt: []const u8, args: anytype) Compilation.Error!void { | ... | @@ -957,9 +957,9 @@ pub fn err(d: *Driver, fmt: []const u8, args: anytype) Compilation.Error!void { |
| 957 | } | 957 | } |
| 958 | 958 | ||
| 959 | pub fn warn(d: *Driver, fmt: []const u8, args: anytype) Compilation.Error!void { | 959 | pub fn warn(d: *Driver, fmt: []const u8, args: anytype) Compilation.Error!void { |
| 960 | var sf_buf: [1024]u8 = undefined; | 960 | var bfa_buf: [1024]u8 = undefined; |
| 961 | var sf: std.heap.StackFallbackAllocator = .init(&sf_buf, d.comp.gpa); | 961 | var bfa: std.heap.BufferFirstAllocator = .init(&bfa_buf, d.comp.gpa); |
| 962 | var allocating: std.Io.Writer.Allocating = .init(sf.allocator()); | 962 | var allocating: std.Io.Writer.Allocating = .init(bfa.allocator()); |
| 963 | defer allocating.deinit(); | 963 | defer allocating.deinit(); |
| 964 | 964 | ||
| 965 | Diagnostics.formatArgs(&allocating.writer, fmt, args) catch return error.OutOfMemory; | 965 | Diagnostics.formatArgs(&allocating.writer, fmt, args) catch return error.OutOfMemory; |
| ... | @@ -1103,9 +1103,9 @@ fn parseTarget(d: *Driver, arch_os_abi: []const u8, opt_cpu_features: ?[]const u | ... | @@ -1103,9 +1103,9 @@ fn parseTarget(d: *Driver, arch_os_abi: []const u8, opt_cpu_features: ?[]const u |
| 1103 | } | 1103 | } |
| 1104 | 1104 | ||
| 1105 | pub fn fatal(d: *Driver, comptime fmt: []const u8, args: anytype) error{ FatalError, OutOfMemory } { | 1105 | pub fn fatal(d: *Driver, comptime fmt: []const u8, args: anytype) error{ FatalError, OutOfMemory } { |
| 1106 | var sf_buf: [1024]u8 = undefined; | 1106 | var bfa_buf: [1024]u8 = undefined; |
| 1107 | var sf: std.heap.StackFallbackAllocator = .init(&sf_buf, d.comp.gpa); | 1107 | var bfa: std.heap.BufferFirstAllocator = .init(&bfa_buf, d.comp.gpa); |
| 1108 | var allocating: std.Io.Writer.Allocating = .init(sf.allocator()); | 1108 | var allocating: std.Io.Writer.Allocating = .init(bfa.allocator()); |
| 1109 | defer allocating.deinit(); | 1109 | defer allocating.deinit(); |
| 1110 | 1110 | ||
| 1111 | Diagnostics.formatArgs(&allocating.writer, fmt, args) catch return error.OutOfMemory; | 1111 | Diagnostics.formatArgs(&allocating.writer, fmt, args) catch return error.OutOfMemory; |
lib/compiler/aro/aro/Parser.zig+18-18| ... | @@ -215,9 +215,9 @@ fn checkIdentifierCodepointWarnings(p: *Parser, codepoint: u21, loc: Source.Loca | ... | @@ -215,9 +215,9 @@ fn checkIdentifierCodepointWarnings(p: *Parser, codepoint: u21, loc: Source.Loca |
| 215 | assert(codepoint >= 0x80); | 215 | assert(codepoint >= 0x80); |
| 216 | 216 | ||
| 217 | const prev_total = p.diagnostics.total; | 217 | const prev_total = p.diagnostics.total; |
| 218 | var sf_buf: [1024]u8 = undefined; | 218 | var bfa_buf: [1024]u8 = undefined; |
| 219 | var sf: std.heap.StackFallbackAllocator = .init(&sf_buf, p.comp.gpa); | 219 | var bfa: std.heap.BufferFirstAllocator = .init(&bfa_buf, p.comp.gpa); |
| 220 | var allocating: std.Io.Writer.Allocating = .init(sf.allocator()); | 220 | var allocating: std.Io.Writer.Allocating = .init(bfa.allocator()); |
| 221 | defer allocating.deinit(); | 221 | defer allocating.deinit(); |
| 222 | 222 | ||
| 223 | if (!char_info.isC99IdChar(codepoint)) { | 223 | if (!char_info.isC99IdChar(codepoint)) { |
| ... | @@ -430,9 +430,9 @@ pub fn err(p: *Parser, tok_i: TokenIndex, diagnostic: Diagnostic, args: anytype) | ... | @@ -430,9 +430,9 @@ pub fn err(p: *Parser, tok_i: TokenIndex, diagnostic: Diagnostic, args: anytype) |
| 430 | if (diagnostic.suppress_unless_version) |some| if (!p.comp.langopts.standard.atLeast(some)) return; | 430 | if (diagnostic.suppress_unless_version) |some| if (!p.comp.langopts.standard.atLeast(some)) return; |
| 431 | if (p.diagnostics.effectiveKind(diagnostic) == .off) return; | 431 | if (p.diagnostics.effectiveKind(diagnostic) == .off) return; |
| 432 | 432 | ||
| 433 | var sf_buf: [1024]u8 = undefined; | 433 | var bfa_buf: [1024]u8 = undefined; |
| 434 | var sf: std.heap.StackFallbackAllocator = .init(&sf_buf, p.comp.gpa); | 434 | var bfa: std.heap.BufferFirstAllocator = .init(&bfa_buf, p.comp.gpa); |
| 435 | var allocating: std.Io.Writer.Allocating = .init(sf.allocator()); | 435 | var allocating: std.Io.Writer.Allocating = .init(bfa.allocator()); |
| 436 | defer allocating.deinit(); | 436 | defer allocating.deinit(); |
| 437 | 437 | ||
| 438 | p.formatArgs(&allocating.writer, diagnostic.fmt, args) catch return error.OutOfMemory; | 438 | p.formatArgs(&allocating.writer, diagnostic.fmt, args) catch return error.OutOfMemory; |
| ... | @@ -1539,9 +1539,9 @@ fn staticAssert(p: *Parser) Error!bool { | ... | @@ -1539,9 +1539,9 @@ fn staticAssert(p: *Parser) Error!bool { |
| 1539 | } | 1539 | } |
| 1540 | } else { | 1540 | } else { |
| 1541 | if (!res.val.toBool(p.comp)) { | 1541 | if (!res.val.toBool(p.comp)) { |
| 1542 | var sf_buf: [1024]u8 = undefined; | 1542 | var bfa_buf: [1024]u8 = undefined; |
| 1543 | var sf: std.heap.StackFallbackAllocator = .init(&sf_buf, gpa); | 1543 | var bfa: std.heap.BufferFirstAllocator = .init(&bfa_buf, gpa); |
| 1544 | var allocating: std.Io.Writer.Allocating = .init(sf.allocator()); | 1544 | var allocating: std.Io.Writer.Allocating = .init(bfa.allocator()); |
| 1545 | defer allocating.deinit(); | 1545 | defer allocating.deinit(); |
| 1546 | 1546 | ||
| 1547 | if (p.staticAssertMessage(res_node, str, &allocating) catch return error.OutOfMemory) |message| { | 1547 | if (p.staticAssertMessage(res_node, str, &allocating) catch return error.OutOfMemory) |message| { |
| ... | @@ -4840,9 +4840,9 @@ fn gnuAsmStmt(p: *Parser, quals: Tree.GNUAssemblyQualifiers, asm_tok: TokenIndex | ... | @@ -4840,9 +4840,9 @@ fn gnuAsmStmt(p: *Parser, quals: Tree.GNUAssemblyQualifiers, asm_tok: TokenIndex |
| 4840 | const expected_items = 8; // arbitrarily chosen, most assembly will have fewer than 8 inputs/outputs/constraints/names | 4840 | const expected_items = 8; // arbitrarily chosen, most assembly will have fewer than 8 inputs/outputs/constraints/names |
| 4841 | const bytes_needed = expected_items * @sizeOf(Tree.Node.AsmStmt.Operand) + expected_items * 2 * @sizeOf(Node.Index); | 4841 | const bytes_needed = expected_items * @sizeOf(Tree.Node.AsmStmt.Operand) + expected_items * 2 * @sizeOf(Node.Index); |
| 4842 | 4842 | ||
| 4843 | var stack_fallback_buf: [bytes_needed]u8 = undefined; | 4843 | var bfa_buf: [bytes_needed]u8 = undefined; |
| 4844 | var stack_fallback: std.heap.StackFallbackAllocator = .init(&stack_fallback_buf, gpa); | 4844 | var bfa: std.heap.BufferFirstAllocator = .init(&bfa_buf, gpa); |
| 4845 | const allocator = stack_fallback.allocator(); | 4845 | const allocator = bfa.allocator(); |
| 4846 | 4846 | ||
| 4847 | var operands: std.ArrayList(Tree.Node.AsmStmt.Operand) = .empty; | 4847 | var operands: std.ArrayList(Tree.Node.AsmStmt.Operand) = .empty; |
| 4848 | defer operands.deinit(allocator); | 4848 | defer operands.deinit(allocator); |
| ... | @@ -9926,9 +9926,9 @@ fn primaryExpr(p: *Parser) Error!?Result { | ... | @@ -9926,9 +9926,9 @@ fn primaryExpr(p: *Parser) Error!?Result { |
| 9926 | if (p.func.pretty_ident) |some| { | 9926 | if (p.func.pretty_ident) |some| { |
| 9927 | qt = some.qt; | 9927 | qt = some.qt; |
| 9928 | } else if (p.func.qt) |func_qt| { | 9928 | } else if (p.func.qt) |func_qt| { |
| 9929 | var sf_buf: [1024]u8 = undefined; | 9929 | var bfa_buf: [1024]u8 = undefined; |
| 9930 | var sf: std.heap.StackFallbackAllocator = .init(&sf_buf, gpa); | 9930 | var bfa: std.heap.BufferFirstAllocator = .init(&bfa_buf, gpa); |
| 9931 | var allocating: std.Io.Writer.Allocating = .init(sf.allocator()); | 9931 | var allocating: std.Io.Writer.Allocating = .init(bfa.allocator()); |
| 9932 | defer allocating.deinit(); | 9932 | defer allocating.deinit(); |
| 9933 | 9933 | ||
| 9934 | func_qt.printNamed(p.tokSlice(p.func.name), p.comp, &allocating.writer) catch return error.OutOfMemory; | 9934 | func_qt.printNamed(p.tokSlice(p.func.name), p.comp, &allocating.writer) catch return error.OutOfMemory; |
| ... | @@ -10217,9 +10217,9 @@ fn charLiteral(p: *Parser) Error!?Result { | ... | @@ -10217,9 +10217,9 @@ fn charLiteral(p: *Parser) Error!?Result { |
| 10217 | }; | 10217 | }; |
| 10218 | 10218 | ||
| 10219 | const max_chars_expected = 4; | 10219 | const max_chars_expected = 4; |
| 10220 | var sf_buf: [max_chars_expected]u32 = undefined; | 10220 | var bfa_buf: [max_chars_expected]u32 = undefined; |
| 10221 | var sf: std.heap.StackFallbackAllocator = .init(@ptrCast(&sf_buf), gpa); | 10221 | var bfa: std.heap.BufferFirstAllocator = .init(@ptrCast(&bfa_buf), gpa); |
| 10222 | const allocator = sf.allocator(); | 10222 | const allocator = bfa.allocator(); |
| 10223 | var chars: std.ArrayList(u32) = .empty; | 10223 | var chars: std.ArrayList(u32) = .empty; |
| 10224 | defer chars.deinit(allocator); | 10224 | defer chars.deinit(allocator); |
| 10225 | 10225 |
lib/compiler/aro/aro/Pragma.zig+3-3| ... | @@ -212,9 +212,9 @@ pub const Diagnostic = struct { | ... | @@ -212,9 +212,9 @@ pub const Diagnostic = struct { |
| 212 | }; | 212 | }; |
| 213 | 213 | ||
| 214 | pub fn err(pp: *Preprocessor, tok_i: TokenIndex, diagnostic: Diagnostic, args: anytype) Compilation.Error!void { | 214 | pub fn err(pp: *Preprocessor, tok_i: TokenIndex, diagnostic: Diagnostic, args: anytype) Compilation.Error!void { |
| 215 | var sf_buf: [1024]u8 = undefined; | 215 | var buf: [1024]u8 = undefined; |
| 216 | var sf: std.heap.StackFallbackAllocator = .init(&sf_buf, pp.comp.gpa); | 216 | var bfa: std.heap.BufferFirstAllocator = .init(&buf, pp.comp.gpa); |
| 217 | var allocating: std.Io.Writer.Allocating = .init(sf.allocator()); | 217 | var allocating: std.Io.Writer.Allocating = .init(bfa.allocator()); |
| 218 | defer allocating.deinit(); | 218 | defer allocating.deinit(); |
| 219 | 219 | ||
| 220 | Diagnostics.formatArgs(&allocating.writer, diagnostic.fmt, args) catch return error.OutOfMemory; | 220 | Diagnostics.formatArgs(&allocating.writer, diagnostic.fmt, args) catch return error.OutOfMemory; |
lib/compiler/aro/aro/Preprocessor.zig+9-9| ... | @@ -1023,9 +1023,9 @@ fn err(pp: *Preprocessor, loc: anytype, diagnostic: Diagnostic, args: anytype) C | ... | @@ -1023,9 +1023,9 @@ fn err(pp: *Preprocessor, loc: anytype, diagnostic: Diagnostic, args: anytype) C |
| 1023 | defer pp.diagnostics.state.suppress_system_headers = old_suppress_system; | 1023 | defer pp.diagnostics.state.suppress_system_headers = old_suppress_system; |
| 1024 | if (diagnostic.show_in_system_headers) pp.diagnostics.state.suppress_system_headers = false; | 1024 | if (diagnostic.show_in_system_headers) pp.diagnostics.state.suppress_system_headers = false; |
| 1025 | 1025 | ||
| 1026 | var sf_buf: [1024]u8 = undefined; | 1026 | var bfa_buf: [1024]u8 = undefined; |
| 1027 | var sf: std.heap.StackFallbackAllocator = .init(&sf_buf, pp.comp.gpa); | 1027 | var bfa: std.heap.BufferFirstAllocator = .init(&bfa_buf, pp.comp.gpa); |
| 1028 | var allocating: std.Io.Writer.Allocating = .init(sf.allocator()); | 1028 | var allocating: std.Io.Writer.Allocating = .init(bfa.allocator()); |
| 1029 | defer allocating.deinit(); | 1029 | defer allocating.deinit(); |
| 1030 | 1030 | ||
| 1031 | Diagnostics.formatArgs(&allocating.writer, diagnostic.fmt, args) catch return error.OutOfMemory; | 1031 | Diagnostics.formatArgs(&allocating.writer, diagnostic.fmt, args) catch return error.OutOfMemory; |
| ... | @@ -1053,9 +1053,9 @@ fn err(pp: *Preprocessor, loc: anytype, diagnostic: Diagnostic, args: anytype) C | ... | @@ -1053,9 +1053,9 @@ fn err(pp: *Preprocessor, loc: anytype, diagnostic: Diagnostic, args: anytype) C |
| 1053 | } | 1053 | } |
| 1054 | 1054 | ||
| 1055 | fn fatal(pp: *Preprocessor, raw: RawToken, comptime fmt: []const u8, args: anytype) Compilation.Error { | 1055 | fn fatal(pp: *Preprocessor, raw: RawToken, comptime fmt: []const u8, args: anytype) Compilation.Error { |
| 1056 | var sf_buf: [1024]u8 = undefined; | 1056 | var bfa_buf: [1024]u8 = undefined; |
| 1057 | var sf: std.heap.StackFallbackAllocator = .init(&sf_buf, pp.comp.gpa); | 1057 | var bfa: std.heap.BufferFirstAllocator = .init(&bfa_buf, pp.comp.gpa); |
| 1058 | var allocating: std.Io.Writer.Allocating = .init(sf.allocator()); | 1058 | var allocating: std.Io.Writer.Allocating = .init(bfa.allocator()); |
| 1059 | defer allocating.deinit(); | 1059 | defer allocating.deinit(); |
| 1060 | 1060 | ||
| 1061 | Diagnostics.formatArgs(&allocating.writer, fmt, args) catch return error.OutOfMemory; | 1061 | Diagnostics.formatArgs(&allocating.writer, fmt, args) catch return error.OutOfMemory; |
| ... | @@ -1076,9 +1076,9 @@ fn fatalNotFound(pp: *Preprocessor, tok: TokenWithExpansionLocs, filename: []con | ... | @@ -1076,9 +1076,9 @@ fn fatalNotFound(pp: *Preprocessor, tok: TokenWithExpansionLocs, filename: []con |
| 1076 | pp.diagnostics.state.fatal_errors = true; | 1076 | pp.diagnostics.state.fatal_errors = true; |
| 1077 | defer pp.diagnostics.state.fatal_errors = old; | 1077 | defer pp.diagnostics.state.fatal_errors = old; |
| 1078 | 1078 | ||
| 1079 | var sf_buf: [1024]u8 = undefined; | 1079 | var bfa_buf: [1024]u8 = undefined; |
| 1080 | var sf: std.heap.StackFallbackAllocator = .init(&sf_buf, pp.comp.gpa); | 1080 | var bfa: std.heap.BufferFirstAllocator = .init(&bfa_buf, pp.comp.gpa); |
| 1081 | const allocator = sf.allocator(); | 1081 | const allocator = bfa.allocator(); |
| 1082 | var buf: std.ArrayList(u8) = .empty; | 1082 | var buf: std.ArrayList(u8) = .empty; |
| 1083 | defer buf.deinit(allocator); | 1083 | defer buf.deinit(allocator); |
| 1084 | 1084 |
lib/compiler/aro/aro/pragmas/message.zig+3-3| ... | @@ -44,9 +44,9 @@ fn preprocessorHandler(_: *Pragma, pp: *Preprocessor, start_idx: TokenIndex) Pra | ... | @@ -44,9 +44,9 @@ fn preprocessorHandler(_: *Pragma, pp: *Preprocessor, start_idx: TokenIndex) Pra |
| 44 | 44 | ||
| 45 | const diagnostic: Pragma.Diagnostic = .pragma_message; | 45 | const diagnostic: Pragma.Diagnostic = .pragma_message; |
| 46 | 46 | ||
| 47 | var sf_buf: [1024]u8 = undefined; | 47 | var bfa_buf: [1024]u8 = undefined; |
| 48 | var sf: std.heap.StackFallbackAllocator = .init(&sf_buf, pp.comp.gpa); | 48 | var bfa: std.heap.BufferFirstAllocator = .init(&bfa_buf, pp.comp.gpa); |
| 49 | var allocating: std.Io.Writer.Allocating = .init(sf.allocator()); | 49 | var allocating: std.Io.Writer.Allocating = .init(bfa.allocator()); |
| 50 | defer allocating.deinit(); | 50 | defer allocating.deinit(); |
| 51 | 51 | ||
| 52 | Diagnostics.formatArgs(&allocating.writer, diagnostic.fmt, .{str}) catch return error.OutOfMemory; | 52 | Diagnostics.formatArgs(&allocating.writer, diagnostic.fmt, .{str}) catch return error.OutOfMemory; |
lib/compiler/aro/aro/text_literal.zig+3-3| ... | @@ -315,9 +315,9 @@ pub const Parser = struct { | ... | @@ -315,9 +315,9 @@ pub const Parser = struct { |
| 315 | if (p.errored) return; | 315 | if (p.errored) return; |
| 316 | if (p.comp.diagnostics.effectiveKind(diagnostic) == .off) return; | 316 | if (p.comp.diagnostics.effectiveKind(diagnostic) == .off) return; |
| 317 | 317 | ||
| 318 | var sf_buf: [1024]u8 = undefined; | 318 | var bfa_buf: [1024]u8 = undefined; |
| 319 | var sf: std.heap.StackFallbackAllocator = .init(&sf_buf, p.comp.gpa); | 319 | var bfa: std.heap.BufferFirstAllocator = .init(&bfa_buf, p.comp.gpa); |
| 320 | var allocating: std.Io.Writer.Allocating = .init(sf.allocator()); | 320 | var allocating: std.Io.Writer.Allocating = .init(bfa.allocator()); |
| 321 | defer allocating.deinit(); | 321 | defer allocating.deinit(); |
| 322 | 322 | ||
| 323 | formatArgs(&allocating.writer, diagnostic.fmt, args) catch return error.OutOfMemory; | 323 | formatArgs(&allocating.writer, diagnostic.fmt, args) catch return error.OutOfMemory; |
lib/compiler/aro/assembly_backend/x86_64.zig+3-3| ... | @@ -68,9 +68,9 @@ fn serializeFloat(comptime T: type, value: T, w: *std.Io.Writer) !void { | ... | @@ -68,9 +68,9 @@ fn serializeFloat(comptime T: type, value: T, w: *std.Io.Writer) !void { |
| 68 | pub fn todo(c: *AsmCodeGen, msg: []const u8, tok: Tree.TokenIndex) Error { | 68 | pub fn todo(c: *AsmCodeGen, msg: []const u8, tok: Tree.TokenIndex) Error { |
| 69 | const loc: Source.Location = c.tree.tokens.items(.loc)[tok]; | 69 | const loc: Source.Location = c.tree.tokens.items(.loc)[tok]; |
| 70 | 70 | ||
| 71 | var sf_buf: [u8]1024 = undefined; | 71 | var bfa_buf: [u8]1024 = undefined; |
| 72 | var sf: std.heap.StackFallbackAllocator = .init(&sf_buf, c.comp.gpa); | 72 | var bfa: std.heap.BufferFirstAllocator = .init(&bfa_buf, c.comp.gpa); |
| 73 | const allocator = sf.allocator(); | 73 | const allocator = bfa.allocator(); |
| 74 | var buf: std.ArrayList(u8) = .empty; | 74 | var buf: std.ArrayList(u8) = .empty; |
| 75 | defer buf.deinit(allocator); | 75 | defer buf.deinit(allocator); |
| 76 | 76 |
lib/std/debug.zig+3-2| ... | @@ -1197,8 +1197,9 @@ fn printSourceAtAddress( | ... | @@ -1197,8 +1197,9 @@ fn printSourceAtAddress( |
| 1197 | 1197 | ||
| 1198 | // Initialize the symbol array with space for at least one element, allocating this on the stack | 1198 | // Initialize the symbol array with space for at least one element, allocating this on the stack |
| 1199 | // in the common case where only one element is needed | 1199 | // in the common case where only one element is needed |
| 1200 | var symbol_fallback_allocator = std.heap.stackFallback(@sizeOf(Symbol) + @alignOf(Symbol) - 1, getDebugInfoAllocator()); | 1200 | var buf: [1]Symbol = undefined; |
| 1201 | const symbol_allocator = symbol_fallback_allocator.get(); | 1201 | var bfa: std.heap.BufferFirstAllocator = .init(@ptrCast(&buf), getDebugInfoAllocator()); |
| 1202 | const symbol_allocator = bfa.allocator(); | ||
| 1202 | var symbols = std.ArrayList(Symbol).initCapacity(symbol_allocator, 1) catch unreachable; | 1203 | var symbols = std.ArrayList(Symbol).initCapacity(symbol_allocator, 1) catch unreachable; |
| 1203 | defer symbols.deinit(symbol_allocator); | 1204 | defer symbols.deinit(symbol_allocator); |
| 1204 | 1205 |
lib/std/fs/path.zig+2-2| ... | @@ -895,7 +895,7 @@ pub fn resolveWindows(allocator: Allocator, paths: []const []const u8) Allocator | ... | @@ -895,7 +895,7 @@ pub fn resolveWindows(allocator: Allocator, paths: []const []const u8) Allocator |
| 895 | // Avoid heap allocation when paths.len is <= @bitSizeOf(usize) * 2 | 895 | // Avoid heap allocation when paths.len is <= @bitSizeOf(usize) * 2 |
| 896 | // (we use `* 3` because stackFallback uses 1 usize as a length) | 896 | // (we use `* 3` because stackFallback uses 1 usize as a length) |
| 897 | var buf: [3]usize = undefined; | 897 | var buf: [3]usize = undefined; |
| 898 | var bit_set_allocator_state: std.heap.StackFallbackAllocator = .init(@ptrCast(&buf), allocator); | 898 | var bit_set_allocator_state: std.heap.BufferFirstAllocator = .init(@ptrCast(&buf), allocator); |
| 899 | const bit_set_allocator = bit_set_allocator_state.allocator(); | 899 | const bit_set_allocator = bit_set_allocator_state.allocator(); |
| 900 | var relevant_paths = try std.bit_set.DynamicBitSetUnmanaged.initEmpty(bit_set_allocator, paths.len); | 900 | var relevant_paths = try std.bit_set.DynamicBitSetUnmanaged.initEmpty(bit_set_allocator, paths.len); |
| 901 | defer relevant_paths.deinit(bit_set_allocator); | 901 | defer relevant_paths.deinit(bit_set_allocator); |
| ... | @@ -1644,7 +1644,7 @@ fn windowsResolveAgainstCwd( | ... | @@ -1644,7 +1644,7 @@ fn windowsResolveAgainstCwd( |
| 1644 | ) ![]u8 { | 1644 | ) ![]u8 { |
| 1645 | // Space for 256 WTF-16 code units; potentially 3 WTF-8 bytes per WTF-16 code unit | 1645 | // Space for 256 WTF-16 code units; potentially 3 WTF-8 bytes per WTF-16 code unit |
| 1646 | var buf: [256 * 3]u8 = undefined; | 1646 | var buf: [256 * 3]u8 = undefined; |
| 1647 | var temp_allocator_state: std.heap.StackFallbackAllocator = .init(&buf, gpa); | 1647 | var temp_allocator_state: std.heap.BufferFirstAllocator = .init(&buf, gpa); |
| 1648 | return switch (parsed.kind) { | 1648 | return switch (parsed.kind) { |
| 1649 | .drive_absolute, | 1649 | .drive_absolute, |
| 1650 | .unc_absolute, | 1650 | .unc_absolute, |
lib/std/heap/StackFirstAllocator.zig deleted-123| ... | @@ -1,123 +0,0 @@ | ||
| 1 | //! A "composite" allocator that attempts to allocate first on the stack, using | ||
| 2 | //! the provided FixedBufferAllocator; upon failure, the provided secondary | ||
| 3 | //! allocator is used. reset() is NOT provided, even though available for the | ||
| 4 | //! (primary) FixedBufferAllocator, because it may not be available for the | ||
| 5 | //! provided secondary allocator (so callers must call reset() on underlying | ||
| 6 | //! allocators, themselves, when desirable). | ||
| 7 | |||
| 8 | const std = @import("../std.zig"); | ||
| 9 | const mem = std.mem; | ||
| 10 | const Allocator = mem.Allocator; | ||
| 11 | const FixedBufferAllocator = std.heap.FixedBufferAllocator; | ||
| 12 | const assert = std.debug.assert; | ||
| 13 | |||
| 14 | const StackFirstAllocator = @This(); | ||
| 15 | |||
| 16 | primary: FixedBufferAllocator, | ||
| 17 | secondary: Allocator, | ||
| 18 | |||
| 19 | pub fn init(buffer: []u8, secondary_allocator: Allocator) StackFirstAllocator { | ||
| 20 | return .{ | ||
| 21 | .primary = .init(buffer), | ||
| 22 | .secondary = secondary_allocator, | ||
| 23 | }; | ||
| 24 | } | ||
| 25 | |||
| 26 | pub fn allocator(self: *StackFirstAllocator) Allocator { | ||
| 27 | return .{ | ||
| 28 | .ptr = self, | ||
| 29 | .vtable = &.{ | ||
| 30 | .alloc = alloc, | ||
| 31 | .resize = resize, | ||
| 32 | .remap = remap, | ||
| 33 | .free = free, | ||
| 34 | }, | ||
| 35 | }; | ||
| 36 | } | ||
| 37 | |||
| 38 | pub fn alloc(ctx: *anyopaque, len: usize, alignment: mem.Alignment, ret_addr: usize) ?[*]u8 { | ||
| 39 | const self: *StackFirstAllocator = @ptrCast(@alignCast(ctx)); | ||
| 40 | return FixedBufferAllocator.alloc(&self.primary, len, alignment, ret_addr) orelse | ||
| 41 | self.secondary.rawAlloc(len, alignment, ret_addr); | ||
| 42 | } | ||
| 43 | |||
| 44 | pub fn resize(ctx: *anyopaque, memory: []u8, alignment: mem.Alignment, new_len: usize, ret_addr: usize) bool { | ||
| 45 | const self: *StackFirstAllocator = @ptrCast(@alignCast(ctx)); | ||
| 46 | return if (self.primary.ownsPtr(memory.ptr)) | ||
| 47 | FixedBufferAllocator.resize(&self.primary, memory, alignment, new_len, ret_addr) | ||
| 48 | else | ||
| 49 | self.secondary.rawResize(memory, alignment, new_len, ret_addr); | ||
| 50 | } | ||
| 51 | |||
| 52 | pub fn remap(ctx: *anyopaque, memory: []u8, alignment: mem.Alignment, new_len: usize, ret_addr: usize) ?[*]u8 { | ||
| 53 | const self: *StackFirstAllocator = @ptrCast(@alignCast(ctx)); | ||
| 54 | return if (self.primary.ownsPtr(memory.ptr)) | ||
| 55 | FixedBufferAllocator.remap(&self.primary, memory, alignment, new_len, ret_addr) | ||
| 56 | else | ||
| 57 | self.secondary.rawRemap(memory, alignment, new_len, ret_addr); | ||
| 58 | } | ||
| 59 | |||
| 60 | pub fn free(ctx: *anyopaque, memory: []u8, alignment: mem.Alignment, ret_addr: usize) void { | ||
| 61 | const self: *StackFirstAllocator = @ptrCast(@alignCast(ctx)); | ||
| 62 | return if (self.primary.ownsPtr(memory.ptr)) | ||
| 63 | FixedBufferAllocator.free(&self.primary, memory, alignment, ret_addr) | ||
| 64 | else | ||
| 65 | self.secondary.rawFree(memory, alignment, ret_addr); | ||
| 66 | } | ||
| 67 | |||
| 68 | test StackFirstAllocator { | ||
| 69 | var arena = std.heap.ArenaAllocator.init(std.testing.allocator); | ||
| 70 | defer arena.deinit(); | ||
| 71 | var buffer: [10]u8 = undefined; | ||
| 72 | var sfa = StackFirstAllocator.init(&buffer, arena.allocator()); | ||
| 73 | |||
| 74 | const expect = std.testing.expect; | ||
| 75 | const expectEqualStrings = std.testing.expectEqualStrings; | ||
| 76 | |||
| 77 | const al = sfa.allocator(); | ||
| 78 | const txt = "0123456789"; | ||
| 79 | |||
| 80 | const dest = try al.alloc(u8, txt.len); | ||
| 81 | @memcpy(dest, txt); | ||
| 82 | try expectEqualStrings(txt, dest); | ||
| 83 | try expect(sfa.primary.ownsPtr(dest.ptr)); | ||
| 84 | |||
| 85 | const txt2 = "abcde"; | ||
| 86 | const dest2 = try al.alloc(u8, txt2.len); | ||
| 87 | @memcpy(dest2, txt2); | ||
| 88 | try expectEqualStrings(txt2, dest2); | ||
| 89 | try expect(!sfa.primary.ownsPtr(dest2.ptr)); | ||
| 90 | |||
| 91 | sfa.primary.reset(); | ||
| 92 | |||
| 93 | const txt3 = "0123"; | ||
| 94 | const dest3 = try al.alloc(u8, txt3.len); | ||
| 95 | @memcpy(dest3, txt3); | ||
| 96 | try expectEqualStrings(txt3, dest3); | ||
| 97 | try expect(sfa.primary.ownsPtr(dest3.ptr)); | ||
| 98 | |||
| 99 | sfa.primary.reset(); | ||
| 100 | //arena.reset(); // unnecessary, but allowed (note `defer arena.deinit()` above) | ||
| 101 | |||
| 102 | // stock tests: | ||
| 103 | { | ||
| 104 | var buf: [16]u8 = undefined; | ||
| 105 | var a = StackFirstAllocator.init(&buf, std.testing.allocator); | ||
| 106 | try std.heap.testAllocator(a.allocator()); | ||
| 107 | } | ||
| 108 | { | ||
| 109 | var buf: [16]u8 = undefined; | ||
| 110 | var a = StackFirstAllocator.init(&buf, std.testing.allocator); | ||
| 111 | try std.heap.testAllocatorAligned(a.allocator()); | ||
| 112 | } | ||
| 113 | { | ||
| 114 | var buf: [16]u8 = undefined; | ||
| 115 | var a = StackFirstAllocator.init(&buf, std.testing.allocator); | ||
| 116 | try std.heap.testAllocatorLargeAlignment(a.allocator()); | ||
| 117 | } | ||
| 118 | { | ||
| 119 | var buf: [16]u8 = undefined; | ||
| 120 | var a = StackFirstAllocator.init(&buf, std.testing.allocator); | ||
| 121 | try std.heap.testAllocatorAlignedShrink(a.allocator()); | ||
| 122 | } | ||
| 123 | } | ||
lib/std/zig/AstGen.zig+21-21| ... | @@ -1776,12 +1776,12 @@ fn structInitExpr( | ... | @@ -1776,12 +1776,12 @@ fn structInitExpr( |
| 1776 | } | 1776 | } |
| 1777 | 1777 | ||
| 1778 | { | 1778 | { |
| 1779 | var sfba_buf: [256]u8 = undefined; | 1779 | var bfa_buf: [256]u8 = undefined; |
| 1780 | var sfba: std.heap.StackFallbackAllocator = .init(&sfba_buf, astgen.arena); | 1780 | var bfa_state: std.heap.BufferFirstAllocator = .init(&bfa_buf, astgen.arena); |
| 1781 | const sfba_allocator = sfba.allocator(); | 1781 | const bfa = bfa_state.allocator(); |
| 1782 | 1782 | ||
| 1783 | var duplicate_names: std.array_hash_map.Auto(Zir.NullTerminatedString, ArrayList(Ast.TokenIndex)) = .empty; | 1783 | var duplicate_names: std.array_hash_map.Auto(Zir.NullTerminatedString, ArrayList(Ast.TokenIndex)) = .empty; |
| 1784 | try duplicate_names.ensureTotalCapacity(sfba_allocator, @intCast(struct_init.ast.fields.len)); | 1784 | try duplicate_names.ensureTotalCapacity(bfa, @intCast(struct_init.ast.fields.len)); |
| 1785 | 1785 | ||
| 1786 | // When there aren't errors, use this to avoid a second iteration. | 1786 | // When there aren't errors, use this to avoid a second iteration. |
| 1787 | var any_duplicate = false; | 1787 | var any_duplicate = false; |
| ... | @@ -1790,14 +1790,14 @@ fn structInitExpr( | ... | @@ -1790,14 +1790,14 @@ fn structInitExpr( |
| 1790 | const name_token = tree.firstToken(field) - 2; | 1790 | const name_token = tree.firstToken(field) - 2; |
| 1791 | const name_index = try astgen.identAsString(name_token); | 1791 | const name_index = try astgen.identAsString(name_token); |
| 1792 | 1792 | ||
| 1793 | const gop = try duplicate_names.getOrPut(sfba_allocator, name_index); | 1793 | const gop = try duplicate_names.getOrPut(bfa, name_index); |
| 1794 | 1794 | ||
| 1795 | if (gop.found_existing) { | 1795 | if (gop.found_existing) { |
| 1796 | try gop.value_ptr.append(sfba_allocator, name_token); | 1796 | try gop.value_ptr.append(bfa, name_token); |
| 1797 | any_duplicate = true; | 1797 | any_duplicate = true; |
| 1798 | } else { | 1798 | } else { |
| 1799 | gop.value_ptr.* = .empty; | 1799 | gop.value_ptr.* = .empty; |
| 1800 | try gop.value_ptr.append(sfba_allocator, name_token); | 1800 | try gop.value_ptr.append(bfa, name_token); |
| 1801 | } | 1801 | } |
| 1802 | } | 1802 | } |
| 1803 | 1803 | ||
| ... | @@ -8405,10 +8405,10 @@ fn tunnelThroughClosure( | ... | @@ -8405,10 +8405,10 @@ fn tunnelThroughClosure( |
| 8405 | 8405 | ||
| 8406 | // Otherwise we need a tunnel. First, figure out the path of namespaces we | 8406 | // Otherwise we need a tunnel. First, figure out the path of namespaces we |
| 8407 | // are tunneling through. This is usually only going to be one or two, so | 8407 | // are tunneling through. This is usually only going to be one or two, so |
| 8408 | // use an SFBA to optimize for the common case. | 8408 | // use an BFA to optimize for the common case. |
| 8409 | var sfba_buf: [2]usize = undefined; | 8409 | var bfa_buf: [2]usize = undefined; |
| 8410 | var sfba: std.heap.StackFallbackAllocator = .init(@ptrCast(&sfba_buf), astgen.arena); | 8410 | var bfa: std.heap.BufferFirstAllocator = .init(@ptrCast(&bfa_buf), astgen.arena); |
| 8411 | var intermediate_tunnels = try sfba.allocator().alloc(*Scope.Namespace, num_tunnels - 1); | 8411 | var intermediate_tunnels = try bfa.allocator().alloc(*Scope.Namespace, num_tunnels - 1); |
| 8412 | 8412 | ||
| 8413 | const root_ns = ns: { | 8413 | const root_ns = ns: { |
| 8414 | var i: usize = num_tunnels - 1; | 8414 | var i: usize = num_tunnels - 1; |
| ... | @@ -12928,18 +12928,18 @@ fn scanContainer( | ... | @@ -12928,18 +12928,18 @@ fn scanContainer( |
| 12928 | next: ?*@This(), | 12928 | next: ?*@This(), |
| 12929 | }; | 12929 | }; |
| 12930 | 12930 | ||
| 12931 | // The maps below are allocated into this SFBA to avoid using the GPA for small namespaces. | 12931 | // The maps below are allocated into this BFA to avoid using the GPA for small namespaces. |
| 12932 | var sfba_buf: [512]u8 = undefined; | 12932 | var bfa_buf: [512]u8 = undefined; |
| 12933 | var sfba_state: std.heap.StackFallbackAllocator = .init(&sfba_buf, astgen.gpa); | 12933 | var bfa_state: std.heap.BufferFirstAllocator = .init(&bfa_buf, astgen.gpa); |
| 12934 | const sfba = sfba_state.allocator(); | 12934 | const bfa = bfa_state.allocator(); |
| 12935 | 12935 | ||
| 12936 | var names: std.AutoArrayHashMapUnmanaged(Zir.NullTerminatedString, NameEntry) = .empty; | 12936 | var names: std.AutoArrayHashMapUnmanaged(Zir.NullTerminatedString, NameEntry) = .empty; |
| 12937 | var test_names: std.AutoArrayHashMapUnmanaged(Zir.NullTerminatedString, NameEntry) = .empty; | 12937 | var test_names: std.AutoArrayHashMapUnmanaged(Zir.NullTerminatedString, NameEntry) = .empty; |
| 12938 | var decltest_names: std.AutoArrayHashMapUnmanaged(Zir.NullTerminatedString, NameEntry) = .empty; | 12938 | var decltest_names: std.AutoArrayHashMapUnmanaged(Zir.NullTerminatedString, NameEntry) = .empty; |
| 12939 | defer { | 12939 | defer { |
| 12940 | names.deinit(sfba); | 12940 | names.deinit(bfa); |
| 12941 | test_names.deinit(sfba); | 12941 | test_names.deinit(bfa); |
| 12942 | decltest_names.deinit(sfba); | 12942 | decltest_names.deinit(bfa); |
| 12943 | } | 12943 | } |
| 12944 | 12944 | ||
| 12945 | var any_duplicates = false; | 12945 | var any_duplicates = false; |
| ... | @@ -13011,7 +13011,7 @@ fn scanContainer( | ... | @@ -13011,7 +13011,7 @@ fn scanContainer( |
| 13011 | else => {}, // unnamed test | 13011 | else => {}, // unnamed test |
| 13012 | .string_literal => { | 13012 | .string_literal => { |
| 13013 | const name = try astgen.strLitAsString(test_name_token); | 13013 | const name = try astgen.strLitAsString(test_name_token); |
| 13014 | const gop = try test_names.getOrPut(sfba, name.index); | 13014 | const gop = try test_names.getOrPut(bfa, name.index); |
| 13015 | if (gop.found_existing) { | 13015 | if (gop.found_existing) { |
| 13016 | var e = gop.value_ptr; | 13016 | var e = gop.value_ptr; |
| 13017 | while (e.next) |n| e = n; | 13017 | while (e.next) |n| e = n; |
| ... | @@ -13024,7 +13024,7 @@ fn scanContainer( | ... | @@ -13024,7 +13024,7 @@ fn scanContainer( |
| 13024 | }, | 13024 | }, |
| 13025 | .identifier => { | 13025 | .identifier => { |
| 13026 | const name = try astgen.identAsString(test_name_token); | 13026 | const name = try astgen.identAsString(test_name_token); |
| 13027 | const gop = try decltest_names.getOrPut(sfba, name); | 13027 | const gop = try decltest_names.getOrPut(bfa, name); |
| 13028 | if (gop.found_existing) { | 13028 | if (gop.found_existing) { |
| 13029 | var e = gop.value_ptr; | 13029 | var e = gop.value_ptr; |
| 13030 | while (e.next) |n| e = n; | 13030 | while (e.next) |n| e = n; |
| ... | @@ -13051,7 +13051,7 @@ fn scanContainer( | ... | @@ -13051,7 +13051,7 @@ fn scanContainer( |
| 13051 | } | 13051 | } |
| 13052 | 13052 | ||
| 13053 | { | 13053 | { |
| 13054 | const gop = try names.getOrPut(sfba, name_str_index); | 13054 | const gop = try names.getOrPut(bfa, name_str_index); |
| 13055 | const new_ent: NameEntry = .{ | 13055 | const new_ent: NameEntry = .{ |
| 13056 | .tok = name_token, | 13056 | .tok = name_token, |
| 13057 | .next = null, | 13057 | .next = null, |
lib/std/zig/ZonGen.zig+5-5| ... | @@ -427,11 +427,11 @@ fn expr(zg: *ZonGen, node: Ast.Node.Index, dest_node: Zoir.Node.Index) Allocator | ... | @@ -427,11 +427,11 @@ fn expr(zg: *ZonGen, node: Ast.Node.Index, dest_node: Zoir.Node.Index) Allocator |
| 427 | }); | 427 | }); |
| 428 | 428 | ||
| 429 | // For short initializers, track the names on the stack rather than going through gpa. | 429 | // For short initializers, track the names on the stack rather than going through gpa. |
| 430 | var sfba_buf: [256]u8 = undefined; | 430 | var bfa_buf: [256]u8 = undefined; |
| 431 | var sfba_state: std.heap.StackFallbackAllocator = .init(&sfba_buf, gpa); | 431 | var bfa_state: std.heap.BufferFirstAllocator = .init(&bfa_buf, gpa); |
| 432 | const sfba = sfba_state.allocator(); | 432 | const bfa = bfa_state.allocator(); |
| 433 | var field_names: std.AutoHashMapUnmanaged(Zoir.NullTerminatedString, Ast.TokenIndex) = .empty; | 433 | var field_names: std.AutoHashMapUnmanaged(Zoir.NullTerminatedString, Ast.TokenIndex) = .empty; |
| 434 | defer field_names.deinit(sfba); | 434 | defer field_names.deinit(bfa); |
| 435 | 435 | ||
| 436 | var reported_any_duplicate = false; | 436 | var reported_any_duplicate = false; |
| 437 | 437 | ||
| ... | @@ -439,7 +439,7 @@ fn expr(zg: *ZonGen, node: Ast.Node.Index, dest_node: Zoir.Node.Index) Allocator | ... | @@ -439,7 +439,7 @@ fn expr(zg: *ZonGen, node: Ast.Node.Index, dest_node: Zoir.Node.Index) Allocator |
| 439 | const name_token = tree.firstToken(elem_node) - 2; | 439 | const name_token = tree.firstToken(elem_node) - 2; |
| 440 | if (zg.identAsString(name_token)) |name_str| { | 440 | if (zg.identAsString(name_token)) |name_str| { |
| 441 | zg.extra.items[extra_name_idx] = @intFromEnum(name_str); | 441 | zg.extra.items[extra_name_idx] = @intFromEnum(name_str); |
| 442 | const gop = try field_names.getOrPut(sfba, name_str); | 442 | const gop = try field_names.getOrPut(bfa, name_str); |
| 443 | if (gop.found_existing and !reported_any_duplicate) { | 443 | if (gop.found_existing and !reported_any_duplicate) { |
| 444 | reported_any_duplicate = true; | 444 | reported_any_duplicate = true; |
| 445 | const earlier_token = gop.value_ptr.*; | 445 | const earlier_token = gop.value_ptr.*; |
lib/std/zig/llvm/Builder.zig+12-12| ... | @@ -7638,9 +7638,9 @@ pub const Constant = enum(u32) { | ... | @@ -7638,9 +7638,9 @@ pub const Constant = enum(u32) { |
| 7638 | std.math.big.int.calcToStringLimbsBufferLen(expected_limbs, 10) | 7638 | std.math.big.int.calcToStringLimbsBufferLen(expected_limbs, 10) |
| 7639 | ]std.math.big.Limb, | 7639 | ]std.math.big.Limb, |
| 7640 | }; | 7640 | }; |
| 7641 | var stack_buf: ExpectedContents = undefined; | 7641 | var bfa_buf: ExpectedContents = undefined; |
| 7642 | var stack: std.heap.StackFallbackAllocator = .init(@ptrCast(&stack_buf), data.builder.gpa); | 7642 | var bfa: std.heap.BufferFirstAllocator = .init(@ptrCast(&bfa_buf), data.builder.gpa); |
| 7643 | const allocator = stack.allocator(); | 7643 | const allocator = bfa.allocator(); |
| 7644 | const str = bigint.toStringAlloc(allocator, 10, undefined) catch return error.WriteFailed; | 7644 | const str = bigint.toStringAlloc(allocator, 10, undefined) catch return error.WriteFailed; |
| 7645 | defer allocator.free(str); | 7645 | defer allocator.free(str); |
| 7646 | try w.writeAll(str); | 7646 | try w.writeAll(str); |
| ... | @@ -9209,9 +9209,9 @@ pub fn getIntrinsic( | ... | @@ -9209,9 +9209,9 @@ pub fn getIntrinsic( |
| 9209 | fields: [expected_fields_len]Type, | 9209 | fields: [expected_fields_len]Type, |
| 9210 | }, | 9210 | }, |
| 9211 | }; | 9211 | }; |
| 9212 | var stack_buf: ExpectedContents = undefined; | 9212 | var bfa_buf: ExpectedContents = undefined; |
| 9213 | var stack: std.heap.StackFallbackAllocator = .init(@ptrCast(&stack_buf), self.gpa); | 9213 | var bfa: std.heap.BufferFirstAllocator = .init(@ptrCast(&bfa_buf), self.gpa); |
| 9214 | const allocator = stack.allocator(); | 9214 | const allocator = bfa.allocator(); |
| 9215 | 9215 | ||
| 9216 | const name = name: { | 9216 | const name = name: { |
| 9217 | { | 9217 | { |
| ... | @@ -10607,9 +10607,9 @@ pub fn print(self: *Builder, w: *Writer) (Writer.Error || Allocator.Error)!void | ... | @@ -10607,9 +10607,9 @@ pub fn print(self: *Builder, w: *Writer) (Writer.Error || Allocator.Error)!void |
| 10607 | std.math.big.int.calcToStringLimbsBufferLen(expected_limbs, 10) | 10607 | std.math.big.int.calcToStringLimbsBufferLen(expected_limbs, 10) |
| 10608 | ]std.math.big.Limb, | 10608 | ]std.math.big.Limb, |
| 10609 | }; | 10609 | }; |
| 10610 | var stack_buf: ExpectedContents = undefined; | 10610 | var bfa_buf: ExpectedContents = undefined; |
| 10611 | var stack: std.heap.StackFallbackAllocator = .init(@ptrCast(&stack_buf), self.gpa); | 10611 | var bfa: std.heap.BufferFirstAllocator = .init(@ptrCast(&bfa_buf), self.gpa); |
| 10612 | const allocator = stack.allocator(); | 10612 | const allocator = bfa.allocator(); |
| 10613 | 10613 | ||
| 10614 | const limbs = self.metadata_limbs.items[extra.limbs_index..][0..extra.limbs_len]; | 10614 | const limbs = self.metadata_limbs.items[extra.limbs_index..][0..extra.limbs_len]; |
| 10615 | const bigint: std.math.big.int.Const = .{ | 10615 | const bigint: std.math.big.int.Const = .{ |
| ... | @@ -11129,9 +11129,9 @@ fn bigIntConstAssumeCapacity( | ... | @@ -11129,9 +11129,9 @@ fn bigIntConstAssumeCapacity( |
| 11129 | const bits = type_item.data; | 11129 | const bits = type_item.data; |
| 11130 | 11130 | ||
| 11131 | const ExpectedContents = [64 / @sizeOf(std.math.big.Limb)]std.math.big.Limb; | 11131 | const ExpectedContents = [64 / @sizeOf(std.math.big.Limb)]std.math.big.Limb; |
| 11132 | var stack_buf: ExpectedContents = undefined; | 11132 | var bfa_buf: ExpectedContents = undefined; |
| 11133 | var stack: std.heap.StackFallbackAllocator = .init(@ptrCast(&stack_buf), self.gpa); | 11133 | var bfa: std.heap.BufferFirstAllocator = .init(@ptrCast(&bfa_buf), self.gpa); |
| 11134 | const allocator = stack.allocator(); | 11134 | const allocator = bfa.allocator(); |
| 11135 | 11135 | ||
| 11136 | var limbs: []std.math.big.Limb = &.{}; | 11136 | var limbs: []std.math.big.Limb = &.{}; |
| 11137 | defer allocator.free(limbs); | 11137 | defer allocator.free(limbs); |
src/Air/Legalize.zig+24-24| ... | @@ -1122,15 +1122,15 @@ fn scalarizeShuffleOneBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Erro | ... | @@ -1122,15 +1122,15 @@ fn scalarizeShuffleOneBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Erro |
| 1122 | // | 1122 | // |
| 1123 | // So we must first compute `out_idxs` and `in_idxs`. | 1123 | // So we must first compute `out_idxs` and `in_idxs`. |
| 1124 | 1124 | ||
| 1125 | var sfba_buf: [512]u8 = undefined; | 1125 | var bfa_buf: [512]u8 = undefined; |
| 1126 | var sfba_state: std.heap.StackFallbackAllocator = .init(&sfba_buf, gpa); | 1126 | var bfa_state: std.heap.BufferFirstAllocator = .init(&bfa_buf, gpa); |
| 1127 | const sfba = sfba_state.allocator(); | 1127 | const bfa = bfa_state.allocator(); |
| 1128 | 1128 | ||
| 1129 | const out_idxs_buf = try sfba.alloc(InternPool.Index, shuffle.mask.len); | 1129 | const out_idxs_buf = try bfa.alloc(InternPool.Index, shuffle.mask.len); |
| 1130 | defer sfba.free(out_idxs_buf); | 1130 | defer bfa.free(out_idxs_buf); |
| 1131 | 1131 | ||
| 1132 | const in_idxs_buf = try sfba.alloc(InternPool.Index, shuffle.mask.len); | 1132 | const in_idxs_buf = try bfa.alloc(InternPool.Index, shuffle.mask.len); |
| 1133 | defer sfba.free(in_idxs_buf); | 1133 | defer bfa.free(in_idxs_buf); |
| 1134 | 1134 | ||
| 1135 | var n: usize = 0; | 1135 | var n: usize = 0; |
| 1136 | for (shuffle.mask, 0..) |mask, out_idx| switch (mask.unwrap()) { | 1136 | for (shuffle.mask, 0..) |mask, out_idx| switch (mask.unwrap()) { |
| ... | @@ -1144,8 +1144,8 @@ fn scalarizeShuffleOneBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Erro | ... | @@ -1144,8 +1144,8 @@ fn scalarizeShuffleOneBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Erro |
| 1144 | 1144 | ||
| 1145 | const init_val: Value = init: { | 1145 | const init_val: Value = init: { |
| 1146 | const undef_val = try pt.undefValue(shuffle.result_ty.childType(zcu)); | 1146 | const undef_val = try pt.undefValue(shuffle.result_ty.childType(zcu)); |
| 1147 | const elems = try sfba.alloc(InternPool.Index, shuffle.mask.len); | 1147 | const elems = try bfa.alloc(InternPool.Index, shuffle.mask.len); |
| 1148 | defer sfba.free(elems); | 1148 | defer bfa.free(elems); |
| 1149 | for (shuffle.mask, elems) |mask, *elem| elem.* = switch (mask.unwrap()) { | 1149 | for (shuffle.mask, elems) |mask, *elem| elem.* = switch (mask.unwrap()) { |
| 1150 | .value => |ip_index| ip_index, | 1150 | .value => |ip_index| ip_index, |
| 1151 | .elem => undef_val.toIntern(), | 1151 | .elem => undef_val.toIntern(), |
| ... | @@ -1213,15 +1213,15 @@ fn scalarizeShuffleTwoBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Erro | ... | @@ -1213,15 +1213,15 @@ fn scalarizeShuffleTwoBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Erro |
| 1213 | // %8 = br(%1, %7) | 1213 | // %8 = br(%1, %7) |
| 1214 | // }) | 1214 | // }) |
| 1215 | 1215 | ||
| 1216 | var sfba_buf: [512]u8 = undefined; | 1216 | var bfa_buf: [512]u8 = undefined; |
| 1217 | var sfba_state: std.heap.StackFallbackAllocator = .init(&sfba_buf, gpa); | 1217 | var bfa_state: std.heap.BufferFirstAllocator = .init(&bfa_buf, gpa); |
| 1218 | const sfba = sfba_state.allocator(); | 1218 | const bfa = bfa_state.allocator(); |
| 1219 | 1219 | ||
| 1220 | const out_idxs_buf = try sfba.alloc(InternPool.Index, shuffle.mask.len); | 1220 | const out_idxs_buf = try bfa.alloc(InternPool.Index, shuffle.mask.len); |
| 1221 | defer sfba.free(out_idxs_buf); | 1221 | defer bfa.free(out_idxs_buf); |
| 1222 | 1222 | ||
| 1223 | const in_idxs_buf = try sfba.alloc(InternPool.Index, shuffle.mask.len); | 1223 | const in_idxs_buf = try bfa.alloc(InternPool.Index, shuffle.mask.len); |
| 1224 | defer sfba.free(in_idxs_buf); | 1224 | defer bfa.free(in_idxs_buf); |
| 1225 | 1225 | ||
| 1226 | // Iterate `shuffle.mask` before doing anything, because modifying AIR invalidates it. | 1226 | // Iterate `shuffle.mask` before doing anything, because modifying AIR invalidates it. |
| 1227 | const out_idxs_a, const in_idxs_a, const out_idxs_b, const in_idxs_b = idxs: { | 1227 | const out_idxs_a, const in_idxs_a, const out_idxs_b, const in_idxs_b = idxs: { |
| ... | @@ -2396,9 +2396,9 @@ fn packedStoreBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!Air.In | ... | @@ -2396,9 +2396,9 @@ fn packedStoreBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!Air.In |
| 2396 | }).toRef(), | 2396 | }).toRef(), |
| 2397 | .rhs = Air.internedToRef((keep_mask: { | 2397 | .rhs = Air.internedToRef((keep_mask: { |
| 2398 | const ExpectedContents = [std.math.big.int.calcTwosCompLimbCount(256)]std.math.big.Limb; | 2398 | const ExpectedContents = [std.math.big.int.calcTwosCompLimbCount(256)]std.math.big.Limb; |
| 2399 | var buf: ExpectedContents = undefined; | 2399 | var bfa_buf: ExpectedContents = undefined; |
| 2400 | var stack: std.heap.StackFallbackAllocator = .init(@ptrCast(&buf), zcu.gpa); | 2400 | var bfa: std.heap.BufferFirstAllocator = .init(@ptrCast(&bfa_buf), zcu.gpa); |
| 2401 | const gpa = stack.allocator(); | 2401 | const gpa = bfa.allocator(); |
| 2402 | 2402 | ||
| 2403 | var mask_big_int: std.math.big.int.Mutable = .{ | 2403 | var mask_big_int: std.math.big.int.Mutable = .{ |
| 2404 | .limbs = try gpa.alloc( | 2404 | .limbs = try gpa.alloc( |
| ... | @@ -2491,12 +2491,12 @@ fn packedAggregateInitBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Erro | ... | @@ -2491,12 +2491,12 @@ fn packedAggregateInitBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Erro |
| 2491 | const agg_ty = orig_ty_pl.ty.toType(); | 2491 | const agg_ty = orig_ty_pl.ty.toType(); |
| 2492 | const agg_field_count = agg_ty.structFieldCount(zcu); | 2492 | const agg_field_count = agg_ty.structFieldCount(zcu); |
| 2493 | 2493 | ||
| 2494 | var sfba_buf: [4 * 32 + 2]Air.Inst.Index = undefined; | 2494 | var bfa_buf: [4 * 32 + 2]Air.Inst.Index = undefined; |
| 2495 | var sfba_state: std.heap.StackFallbackAllocator = .init(@ptrCast(&sfba_buf), gpa); | 2495 | var bfa_state: std.heap.BufferFirstAllocator = .init(@ptrCast(&bfa_buf), gpa); |
| 2496 | const sfba = sfba_state.allocator(); | 2496 | const bfa = bfa_state.allocator(); |
| 2497 | 2497 | ||
| 2498 | const inst_buf = try sfba.alloc(Air.Inst.Index, 4 * agg_field_count + 2); | 2498 | const inst_buf = try bfa.alloc(Air.Inst.Index, 4 * agg_field_count + 2); |
| 2499 | defer sfba.free(inst_buf); | 2499 | defer bfa.free(inst_buf); |
| 2500 | 2500 | ||
| 2501 | var main_block: Block = .init(inst_buf); | 2501 | var main_block: Block = .init(inst_buf); |
| 2502 | try l.air_instructions.ensureUnusedCapacity(gpa, inst_buf.len); | 2502 | try l.air_instructions.ensureUnusedCapacity(gpa, inst_buf.len); |
src/Value.zig+6-6| ... | @@ -882,16 +882,16 @@ pub fn fieldValue(val: Value, pt: Zcu.PerThread, index: usize) !Value { | ... | @@ -882,16 +882,16 @@ pub fn fieldValue(val: Value, pt: Zcu.PerThread, index: usize) !Value { |
| 882 | else => unreachable, | 882 | else => unreachable, |
| 883 | }; | 883 | }; |
| 884 | // Avoid hitting gpa for accesses to small packed structs | 884 | // Avoid hitting gpa for accesses to small packed structs |
| 885 | var sfba_buf: [128]u8 = undefined; | 885 | var bfa_buf: [128]u8 = undefined; |
| 886 | var sfba_state: std.heap.StackFallbackAllocator = .init(&sfba_buf, zcu.comp.gpa); | 886 | var bfa_state: std.heap.BufferFirstAllocator = .init(&bfa_buf, zcu.comp.gpa); |
| 887 | const sfba = sfba_state.allocator(); | 887 | const bfa = bfa_state.allocator(); |
| 888 | const buf = try sfba.alloc(u8, @intCast((ty.bitSize(zcu) + 7) / 8)); | 888 | const buf = try bfa.alloc(u8, @intCast((ty.bitSize(zcu) + 7) / 8)); |
| 889 | defer sfba.free(buf); | 889 | defer bfa.free(buf); |
| 890 | int_val.writeToPackedMemory(zcu, buf, 0) catch |err| switch (err) { | 890 | int_val.writeToPackedMemory(zcu, buf, 0) catch |err| switch (err) { |
| 891 | error.ReinterpretDeclRef => unreachable, // it's an integer | 891 | error.ReinterpretDeclRef => unreachable, // it's an integer |
| 892 | error.OutOfMemory => |e| return e, | 892 | error.OutOfMemory => |e| return e, |
| 893 | }; | 893 | }; |
| 894 | return Value.readFromPackedMemory(field_ty, pt, buf, field_bit_offset, sfba) catch |err| switch (err) { | 894 | return Value.readFromPackedMemory(field_ty, pt, buf, field_bit_offset, bfa) catch |err| switch (err) { |
| 895 | error.IllDefinedMemoryLayout => unreachable, // it's a bitpack | 895 | error.IllDefinedMemoryLayout => unreachable, // it's a bitpack |
| 896 | error.OutOfMemory => |e| return e, | 896 | error.OutOfMemory => |e| return e, |
| 897 | }; | 897 | }; |
src/codegen/c.zig+3-3| ... | @@ -4841,9 +4841,9 @@ fn airAsm(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -4841,9 +4841,9 @@ fn airAsm(f: *Function, inst: Air.Inst.Index) !CValue { |
| 4841 | { | 4841 | { |
| 4842 | const asm_source = unwrapped_asm.source; | 4842 | const asm_source = unwrapped_asm.source; |
| 4843 | 4843 | ||
| 4844 | var stack_buf: [256]u8 = undefined; | 4844 | var bfa_buf: [256]u8 = undefined; |
| 4845 | var stack: std.heap.StackFallbackAllocator = .init(&stack_buf, f.dg.gpa); | 4845 | var bfa: std.heap.BufferFirstAllocator = .init(&bfa_buf, f.dg.gpa); |
| 4846 | const allocator = stack.allocator(); | 4846 | const allocator = bfa.allocator(); |
| 4847 | const fixed_asm_source = try allocator.alloc(u8, asm_source.len); | 4847 | const fixed_asm_source = try allocator.alloc(u8, asm_source.len); |
| 4848 | defer allocator.free(fixed_asm_source); | 4848 | defer allocator.free(fixed_asm_source); |
| 4849 | 4849 |
src/codegen/llvm.zig+15-15| ... | @@ -3605,9 +3605,9 @@ pub const Object = struct { | ... | @@ -3605,9 +3605,9 @@ pub const Object = struct { |
| 3605 | vals: [Builder.expected_fields_len]Builder.Constant, | 3605 | vals: [Builder.expected_fields_len]Builder.Constant, |
| 3606 | fields: [Builder.expected_fields_len]Builder.Type, | 3606 | fields: [Builder.expected_fields_len]Builder.Type, |
| 3607 | }; | 3607 | }; |
| 3608 | var stack_buf: ExpectedContents = undefined; | 3608 | var bfa_buf: ExpectedContents = undefined; |
| 3609 | var stack: std.heap.StackFallbackAllocator = .init(@ptrCast(&stack_buf), o.gpa); | 3609 | var bfa: std.heap.BufferFirstAllocator = .init(@ptrCast(&bfa_buf), o.gpa); |
| 3610 | const allocator = stack.allocator(); | 3610 | const allocator = bfa.allocator(); |
| 3611 | const vals = try allocator.alloc(Builder.Constant, elems.len); | 3611 | const vals = try allocator.alloc(Builder.Constant, elems.len); |
| 3612 | defer allocator.free(vals); | 3612 | defer allocator.free(vals); |
| 3613 | const fields = try allocator.alloc(Builder.Type, elems.len); | 3613 | const fields = try allocator.alloc(Builder.Type, elems.len); |
| ... | @@ -3634,9 +3634,9 @@ pub const Object = struct { | ... | @@ -3634,9 +3634,9 @@ pub const Object = struct { |
| 3634 | vals: [Builder.expected_fields_len]Builder.Constant, | 3634 | vals: [Builder.expected_fields_len]Builder.Constant, |
| 3635 | fields: [Builder.expected_fields_len]Builder.Type, | 3635 | fields: [Builder.expected_fields_len]Builder.Type, |
| 3636 | }; | 3636 | }; |
| 3637 | var stack_buf: ExpectedContents = undefined; | 3637 | var bfa_buf: ExpectedContents = undefined; |
| 3638 | var stack: std.heap.StackFallbackAllocator = .init(@ptrCast(&stack_buf), o.gpa); | 3638 | var bfa: std.heap.BufferFirstAllocator = .init(@ptrCast(&bfa_buf), o.gpa); |
| 3639 | const allocator = stack.allocator(); | 3639 | const allocator = bfa.allocator(); |
| 3640 | const vals = try allocator.alloc(Builder.Constant, len_including_sentinel); | 3640 | const vals = try allocator.alloc(Builder.Constant, len_including_sentinel); |
| 3641 | defer allocator.free(vals); | 3641 | defer allocator.free(vals); |
| 3642 | const fields = try allocator.alloc(Builder.Type, len_including_sentinel); | 3642 | const fields = try allocator.alloc(Builder.Type, len_including_sentinel); |
| ... | @@ -3664,9 +3664,9 @@ pub const Object = struct { | ... | @@ -3664,9 +3664,9 @@ pub const Object = struct { |
| 3664 | switch (aggregate.storage) { | 3664 | switch (aggregate.storage) { |
| 3665 | .bytes, .elems => { | 3665 | .bytes, .elems => { |
| 3666 | const ExpectedContents = [Builder.expected_fields_len]Builder.Constant; | 3666 | const ExpectedContents = [Builder.expected_fields_len]Builder.Constant; |
| 3667 | var stack_buf: ExpectedContents = undefined; | 3667 | var bfa_buf: ExpectedContents = undefined; |
| 3668 | var stack: std.heap.StackFallbackAllocator = .init(@ptrCast(&stack_buf), o.gpa); | 3668 | var bfa: std.heap.BufferFirstAllocator = .init(@ptrCast(&bfa_buf), o.gpa); |
| 3669 | const allocator = stack.allocator(); | 3669 | const allocator = bfa.allocator(); |
| 3670 | const vals = try allocator.alloc(Builder.Constant, vector_type.len); | 3670 | const vals = try allocator.alloc(Builder.Constant, vector_type.len); |
| 3671 | defer allocator.free(vals); | 3671 | defer allocator.free(vals); |
| 3672 | 3672 | ||
| ... | @@ -3695,9 +3695,9 @@ pub const Object = struct { | ... | @@ -3695,9 +3695,9 @@ pub const Object = struct { |
| 3695 | vals: [Builder.expected_fields_len]Builder.Constant, | 3695 | vals: [Builder.expected_fields_len]Builder.Constant, |
| 3696 | fields: [Builder.expected_fields_len]Builder.Type, | 3696 | fields: [Builder.expected_fields_len]Builder.Type, |
| 3697 | }; | 3697 | }; |
| 3698 | var stack_buf: ExpectedContents = undefined; | 3698 | var bfa_buf: ExpectedContents = undefined; |
| 3699 | var stack: std.heap.StackFallbackAllocator = .init(@ptrCast(&stack_buf), o.gpa); | 3699 | var bfa: std.heap.BufferFirstAllocator = .init(@ptrCast(&bfa_buf), o.gpa); |
| 3700 | const allocator = stack.allocator(); | 3700 | const allocator = bfa.allocator(); |
| 3701 | const vals = try allocator.alloc(Builder.Constant, llvm_len); | 3701 | const vals = try allocator.alloc(Builder.Constant, llvm_len); |
| 3702 | defer allocator.free(vals); | 3702 | defer allocator.free(vals); |
| 3703 | const fields = try allocator.alloc(Builder.Type, llvm_len); | 3703 | const fields = try allocator.alloc(Builder.Type, llvm_len); |
| ... | @@ -3771,9 +3771,9 @@ pub const Object = struct { | ... | @@ -3771,9 +3771,9 @@ pub const Object = struct { |
| 3771 | vals: [Builder.expected_fields_len]Builder.Constant, | 3771 | vals: [Builder.expected_fields_len]Builder.Constant, |
| 3772 | fields: [Builder.expected_fields_len]Builder.Type, | 3772 | fields: [Builder.expected_fields_len]Builder.Type, |
| 3773 | }; | 3773 | }; |
| 3774 | var stack_buf: ExpectedContents = undefined; | 3774 | var bfa_buf: ExpectedContents = undefined; |
| 3775 | var stack: std.heap.StackFallbackAllocator = .init(@ptrCast(&stack_buf), o.gpa); | 3775 | var bfa: std.heap.BufferFirstAllocator = .init(@ptrCast(&bfa_buf), o.gpa); |
| 3776 | const allocator = stack.allocator(); | 3776 | const allocator = bfa.allocator(); |
| 3777 | const vals = try allocator.alloc(Builder.Constant, llvm_len); | 3777 | const vals = try allocator.alloc(Builder.Constant, llvm_len); |
| 3778 | defer allocator.free(vals); | 3778 | defer allocator.free(vals); |
| 3779 | const fields = try allocator.alloc(Builder.Type, llvm_len); | 3779 | const fields = try allocator.alloc(Builder.Type, llvm_len); |
src/codegen/llvm/FuncGen.zig+6-6| ... | @@ -3530,9 +3530,9 @@ fn airDivFloor(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) | ... | @@ -3530,9 +3530,9 @@ fn airDivFloor(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) |
| 3530 | const inst_llvm_ty = try o.lowerType(inst_ty); | 3530 | const inst_llvm_ty = try o.lowerType(inst_ty); |
| 3531 | 3531 | ||
| 3532 | const ExpectedContents = [std.math.big.int.calcTwosCompLimbCount(256)]std.math.big.Limb; | 3532 | const ExpectedContents = [std.math.big.int.calcTwosCompLimbCount(256)]std.math.big.Limb; |
| 3533 | var stack_buf: ExpectedContents = undefined; | 3533 | var bfa_buf: ExpectedContents = undefined; |
| 3534 | var stack: std.heap.StackFallbackAllocator = .init(@ptrCast(&stack_buf), self.gpa); | 3534 | var bfa: std.heap.BufferFirstAllocator = .init(@ptrCast(&bfa_buf), self.gpa); |
| 3535 | const allocator = stack.allocator(); | 3535 | const allocator = bfa.allocator(); |
| 3536 | 3536 | ||
| 3537 | const scalar_bits = scalar_ty.intInfo(zcu).bits; | 3537 | const scalar_bits = scalar_ty.intInfo(zcu).bits; |
| 3538 | var smin_big_int: std.math.big.int.Mutable = .{ | 3538 | var smin_big_int: std.math.big.int.Mutable = .{ |
| ... | @@ -3614,9 +3614,9 @@ fn airMod(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allo | ... | @@ -3614,9 +3614,9 @@ fn airMod(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allo |
| 3614 | } | 3614 | } |
| 3615 | if (scalar_ty.isSignedInt(zcu)) { | 3615 | if (scalar_ty.isSignedInt(zcu)) { |
| 3616 | const ExpectedContents = [std.math.big.int.calcTwosCompLimbCount(256)]std.math.big.Limb; | 3616 | const ExpectedContents = [std.math.big.int.calcTwosCompLimbCount(256)]std.math.big.Limb; |
| 3617 | var stack_buf: ExpectedContents = undefined; | 3617 | var bfa_buf: ExpectedContents = undefined; |
| 3618 | var stack: std.heap.StackFallbackAllocator = .init(@ptrCast(&stack_buf), self.gpa); | 3618 | var bfa: std.heap.BufferFirstAllocator = .init(@ptrCast(&bfa_buf), self.gpa); |
| 3619 | const allocator = stack.allocator(); | 3619 | const allocator = bfa.allocator(); |
| 3620 | 3620 | ||
| 3621 | const scalar_bits = scalar_ty.intInfo(zcu).bits; | 3621 | const scalar_bits = scalar_ty.intInfo(zcu).bits; |
| 3622 | var smin_big_int: std.math.big.int.Mutable = .{ | 3622 | var smin_big_int: std.math.big.int.Mutable = .{ |
src/codegen/riscv64/CodeGen.zig+6-6| ... | @@ -672,11 +672,11 @@ fn restoreState(func: *Func, state: State, deaths: []const Air.Inst.Index, compt | ... | @@ -672,11 +672,11 @@ fn restoreState(func: *Func, state: State, deaths: []const Air.Inst.Index, compt |
| 672 | 672 | ||
| 673 | const ExpectedContents = [@typeInfo(RegisterManager.TrackedRegisters).array.len]RegisterLock; | 673 | const ExpectedContents = [@typeInfo(RegisterManager.TrackedRegisters).array.len]RegisterLock; |
| 674 | const stack_buf_len = if (opts.update_tracking) 0 else 1; | 674 | const stack_buf_len = if (opts.update_tracking) 0 else 1; |
| 675 | var stack_buf: [stack_buf_len]ExpectedContents = undefined; | 675 | var bfa_buf: [stack_buf_len]ExpectedContents = undefined; |
| 676 | var stack = if (opts.update_tracking) {} else std.heap.StackFallbackAllocator.init(@ptrCast(&stack_buf), func.gpa); | 676 | var bfa = if (opts.update_tracking) {} else std.heap.BufferFirstAllocator.init(@ptrCast(&bfa_buf), func.gpa); |
| 677 | 677 | ||
| 678 | var reg_locks = if (opts.update_tracking) {} else try std.array_list.Managed(RegisterLock).initCapacity( | 678 | var reg_locks = if (opts.update_tracking) {} else try std.array_list.Managed(RegisterLock).initCapacity( |
| 679 | stack.allocator(), | 679 | bfa.allocator(), |
| 680 | @typeInfo(ExpectedContents).array.len, | 680 | @typeInfo(ExpectedContents).array.len, |
| 681 | ); | 681 | ); |
| 682 | defer if (!opts.update_tracking) { | 682 | defer if (!opts.update_tracking) { |
| ... | @@ -4808,9 +4808,9 @@ fn airCall(func: *Func, inst: Air.Inst.Index, modifier: std.builtin.CallModifier | ... | @@ -4808,9 +4808,9 @@ fn airCall(func: *Func, inst: Air.Inst.Index, modifier: std.builtin.CallModifier |
| 4808 | const ExpectedContents = extern struct { | 4808 | const ExpectedContents = extern struct { |
| 4809 | vals: [expected_num_args][@sizeOf(MCValue)]u8 align(@alignOf(MCValue)), | 4809 | vals: [expected_num_args][@sizeOf(MCValue)]u8 align(@alignOf(MCValue)), |
| 4810 | }; | 4810 | }; |
| 4811 | var stack_buf: ExpectedContents = undefined; | 4811 | var bfa_buf: ExpectedContents = undefined; |
| 4812 | var stack: std.heap.StackFallbackAllocator = .init(@ptrCast(&stack_buf), func.gpa); | 4812 | var bfa: std.heap.BufferFirstAllocator = .init(@ptrCast(&bfa_buf), func.gpa); |
| 4813 | const allocator = stack.allocator(); | 4813 | const allocator = bfa.allocator(); |
| 4814 | 4814 | ||
| 4815 | const arg_tys = try allocator.alloc(Type, arg_refs.len); | 4815 | const arg_tys = try allocator.alloc(Type, arg_refs.len); |
| 4816 | defer allocator.free(arg_tys); | 4816 | defer allocator.free(arg_tys); |
src/codegen/x86_64/CodeGen.zig+21-21| ... | @@ -173820,9 +173820,9 @@ fn genLazy(cg: *CodeGen, lazy_sym: link.File.LazySymbol) InnerError!void { | ... | @@ -173820,9 +173820,9 @@ fn genLazy(cg: *CodeGen, lazy_sym: link.File.LazySymbol) InnerError!void { |
| 173820 | var err_temp = try cg.tempInit(err_ty, err_mcv); | 173820 | var err_temp = try cg.tempInit(err_ty, err_mcv); |
| 173821 | 173821 | ||
| 173822 | const ExpectedContents = [32]Mir.Inst.Index; | 173822 | const ExpectedContents = [32]Mir.Inst.Index; |
| 173823 | var stack_buf: ExpectedContents = undefined; | 173823 | var bfa_buf: ExpectedContents = undefined; |
| 173824 | var stack: std.heap.StackFallbackAllocator = .init(@ptrCast(&stack_buf), cg.gpa); | 173824 | var bfa: std.heap.BufferFirstAllocator = .init(@ptrCast(&bfa_buf), cg.gpa); |
| 173825 | const allocator = stack.allocator(); | 173825 | const allocator = bfa.allocator(); |
| 173826 | 173826 | ||
| 173827 | const relocs = try allocator.alloc(Mir.Inst.Index, error_set_type.names.len); | 173827 | const relocs = try allocator.alloc(Mir.Inst.Index, error_set_type.names.len); |
| 173828 | defer allocator.free(relocs); | 173828 | defer allocator.free(relocs); |
| ... | @@ -174220,9 +174220,9 @@ fn restoreState(self: *CodeGen, state: State, deaths: []const Air.Inst.Index, co | ... | @@ -174220,9 +174220,9 @@ fn restoreState(self: *CodeGen, state: State, deaths: []const Air.Inst.Index, co |
| 174220 | for (deaths) |death| try self.processDeath(death, .{ .emit_instructions = opts.emit_instructions }); | 174220 | for (deaths) |death| try self.processDeath(death, .{ .emit_instructions = opts.emit_instructions }); |
| 174221 | 174221 | ||
| 174222 | const ExpectedContents = [@typeInfo(RegisterManager.TrackedRegisters).array.len]RegisterLock; | 174222 | const ExpectedContents = [@typeInfo(RegisterManager.TrackedRegisters).array.len]RegisterLock; |
| 174223 | const stack_buf_len = if (opts.update_tracking) 0 else 1; | 174223 | const bfa_buf_len = if (opts.update_tracking) 0 else 1; |
| 174224 | var stack_buf: [stack_buf_len]ExpectedContents = undefined; | 174224 | var bfa_buf: [bfa_buf_len]ExpectedContents = undefined; |
| 174225 | var stack = if (opts.update_tracking) {} else std.heap.StackFallbackAllocator.init(@ptrCast(&stack_buf), self.gpa); | 174225 | var stack = if (opts.update_tracking) {} else std.heap.BufferFirstAllocator.init(@ptrCast(&bfa_buf), self.gpa); |
| 174226 | 174226 | ||
| 174227 | var reg_locks = if (opts.update_tracking) {} else try std.array_list.Managed(RegisterLock).initCapacity( | 174227 | var reg_locks = if (opts.update_tracking) {} else try std.array_list.Managed(RegisterLock).initCapacity( |
| 174228 | stack.allocator(), | 174228 | stack.allocator(), |
| ... | @@ -175930,9 +175930,9 @@ fn airCall(self: *CodeGen, inst: Air.Inst.Index, modifier: std.builtin.CallModif | ... | @@ -175930,9 +175930,9 @@ fn airCall(self: *CodeGen, inst: Air.Inst.Index, modifier: std.builtin.CallModif |
| 175930 | tys: [32][@sizeOf(Type)]u8 align(@alignOf(Type)), | 175930 | tys: [32][@sizeOf(Type)]u8 align(@alignOf(Type)), |
| 175931 | vals: [32][@sizeOf(MCValue)]u8 align(@alignOf(MCValue)), | 175931 | vals: [32][@sizeOf(MCValue)]u8 align(@alignOf(MCValue)), |
| 175932 | }; | 175932 | }; |
| 175933 | var stack_buf: [1]ExpectedContents = undefined; | 175933 | var bfa_buf: [1]ExpectedContents = undefined; |
| 175934 | var stack: std.heap.StackFallbackAllocator = .init(@ptrCast(&stack_buf), self.gpa); | 175934 | var bfa: std.heap.BufferFirstAllocator = .init(@ptrCast(&bfa_buf), self.gpa); |
| 175935 | const allocator = stack.allocator(); | 175935 | const allocator = bfa.allocator(); |
| 175936 | 175936 | ||
| 175937 | const arg_tys = try allocator.alloc(Type, arg_refs.len); | 175937 | const arg_tys = try allocator.alloc(Type, arg_refs.len); |
| 175938 | defer allocator.free(arg_tys); | 175938 | defer allocator.free(arg_tys); |
| ... | @@ -175986,9 +175986,9 @@ fn genCall(self: *CodeGen, info: union(enum) { | ... | @@ -175986,9 +175986,9 @@ fn genCall(self: *CodeGen, info: union(enum) { |
| 175986 | frame_indices: [32]FrameIndex, | 175986 | frame_indices: [32]FrameIndex, |
| 175987 | reg_locks: [32][@sizeOf(?RegisterLock)]u8 align(@alignOf(?RegisterLock)), | 175987 | reg_locks: [32][@sizeOf(?RegisterLock)]u8 align(@alignOf(?RegisterLock)), |
| 175988 | }; | 175988 | }; |
| 175989 | var stack_buf: ExpectedContents = undefined; | 175989 | var bfa_buf: ExpectedContents = undefined; |
| 175990 | var stack: std.heap.StackFallbackAllocator = .init(@ptrCast(&stack_buf), self.gpa); | 175990 | var bfa: std.heap.BufferFirstAllocator = .init(@ptrCast(&bfa_buf), self.gpa); |
| 175991 | const allocator = stack.allocator(); | 175991 | const allocator = bfa.allocator(); |
| 175992 | 175992 | ||
| 175993 | const var_args = try allocator.alloc(Type, args.len - fn_info.param_types.len); | 175993 | const var_args = try allocator.alloc(Type, args.len - fn_info.param_types.len); |
| 175994 | defer allocator.free(var_args); | 175994 | defer allocator.free(var_args); |
| ... | @@ -176589,9 +176589,9 @@ fn lowerSwitchBr( | ... | @@ -176589,9 +176589,9 @@ fn lowerSwitchBr( |
| 176589 | bigint_limbs: [std.math.big.int.calcTwosCompLimbCount(1 << 10)]std.math.big.Limb, | 176589 | bigint_limbs: [std.math.big.int.calcTwosCompLimbCount(1 << 10)]std.math.big.Limb, |
| 176590 | relocs: [1 << 6]Mir.Inst.Index, | 176590 | relocs: [1 << 6]Mir.Inst.Index, |
| 176591 | }; | 176591 | }; |
| 176592 | var stack_buf: ExpectedContents = undefined; | 176592 | var bfa_buf: ExpectedContents = undefined; |
| 176593 | var stack: std.heap.StackFallbackAllocator = .init(@ptrCast(&stack_buf), cg.gpa); | 176593 | var bfa: std.heap.BufferFirstAllocator = .init(@ptrCast(&bfa_buf), cg.gpa); |
| 176594 | const allocator = stack.allocator(); | 176594 | const allocator = bfa.allocator(); |
| 176595 | 176595 | ||
| 176596 | const state = try cg.saveState(); | 176596 | const state = try cg.saveState(); |
| 176597 | 176597 | ||
| ... | @@ -181155,9 +181155,9 @@ fn resolveCallingConventionValues( | ... | @@ -181155,9 +181155,9 @@ fn resolveCallingConventionValues( |
| 181155 | const ExpectedContents = extern struct { | 181155 | const ExpectedContents = extern struct { |
| 181156 | param_types: [32][@sizeOf(Type)]u8 align(@alignOf(Type)), | 181156 | param_types: [32][@sizeOf(Type)]u8 align(@alignOf(Type)), |
| 181157 | }; | 181157 | }; |
| 181158 | var stack_buf: ExpectedContents = undefined; | 181158 | var bfa_buf: ExpectedContents = undefined; |
| 181159 | var stack: std.heap.StackFallbackAllocator = .init(@ptrCast(&stack_buf), cg.gpa); | 181159 | var bfa: std.heap.BufferFirstAllocator = .init(@ptrCast(&bfa_buf), cg.gpa); |
| 181160 | const allocator = stack.allocator(); | 181160 | const allocator = bfa.allocator(); |
| 181161 | 181161 | ||
| 181162 | const param_types = try allocator.alloc(Type, fn_info.param_types.len + var_args.len); | 181162 | const param_types = try allocator.alloc(Type, fn_info.param_types.len + var_args.len); |
| 181163 | defer allocator.free(param_types); | 181163 | defer allocator.free(param_types); |
| ... | @@ -188707,9 +188707,9 @@ const Select = struct { | ... | @@ -188707,9 +188707,9 @@ const Select = struct { |
| 188707 | } | 188707 | } |
| 188708 | 188708 | ||
| 188709 | const ExpectedContents = [std.math.big.int.calcTwosCompLimbCount(1 << 10)]std.math.big.Limb; | 188709 | const ExpectedContents = [std.math.big.int.calcTwosCompLimbCount(1 << 10)]std.math.big.Limb; |
| 188710 | var stack_buf: ExpectedContents = undefined; | 188710 | var bfa_buf: ExpectedContents = undefined; |
| 188711 | var stack: std.heap.StackFallbackAllocator = .init(@ptrCast(&stack_buf), cg.gpa); | 188711 | var bfa: std.heap.BufferFirstAllocator = .init(@ptrCast(&bfa_buf), cg.gpa); |
| 188712 | const allocator = stack.allocator(); | 188712 | const allocator = bfa.allocator(); |
| 188713 | var res_big_int: std.math.big.int.Mutable = .{ | 188713 | var res_big_int: std.math.big.int.Mutable = .{ |
| 188714 | .limbs = try allocator.alloc( | 188714 | .limbs = try allocator.alloc( |
| 188715 | std.math.big.Limb, | 188715 | std.math.big.Limb, |
src/link/Elf2.zig+3-3| ... | @@ -2690,9 +2690,9 @@ pub fn ensureUnusedRelocCapacity(elf: *Elf, loc_si: Symbol.Index, len: usize) !v | ... | @@ -2690,9 +2690,9 @@ pub fn ensureUnusedRelocCapacity(elf: *Elf, loc_si: Symbol.Index, len: usize) !v |
| 2690 | const shndx = loc_si.shndx(elf); | 2690 | const shndx = loc_si.shndx(elf); |
| 2691 | const sh = shndx.get(elf); | 2691 | const sh = shndx.get(elf); |
| 2692 | if (sh.rela_si == .null) { | 2692 | if (sh.rela_si == .null) { |
| 2693 | var stack_buf: [32]u8 = undefined; | 2693 | var bfa_buf: [32]u8 = undefined; |
| 2694 | var stack: std.heap.StackFallbackAllocator = .init(&stack_buf, gpa); | 2694 | var bfa: std.heap.BufferFirstAllocator = .init(&bfa_buf, gpa); |
| 2695 | const allocator = stack.allocator(); | 2695 | const allocator = bfa.allocator(); |
| 2696 | 2696 | ||
| 2697 | const rela_name = | 2697 | const rela_name = |
| 2698 | try std.fmt.allocPrint(allocator, ".rela{s}", .{elf.sectionName(sh.si)}); | 2698 | try std.fmt.allocPrint(allocator, ".rela{s}", .{elf.sectionName(sh.si)}); |