| author | |
| committer | |
| log | 6d7bbab740a8c4790fe30c63d026d72fb7556984 |
| tree | 6c8f34d1ad363fda01f0bfa6e6232f0eb44ab0d8 |
| parent | b5f3d121644031cf644271296e1ee5dbf363abeb |
| parent | 4c71d3f29e99d5fc4e69d842457933dc55fc7ac5 |
| signature |
Fix typos in code comments in `src/`13 files changed, 20 insertions(+), 20 deletions(-)
src/Air.zig+2-2| ... | @@ -271,7 +271,7 @@ pub const Inst = struct { | ... | @@ -271,7 +271,7 @@ pub const Inst = struct { |
| 271 | /// Uses the `ty_pl` field with payload `Block`. A block runs its body which always ends | 271 | /// Uses the `ty_pl` field with payload `Block`. A block runs its body which always ends |
| 272 | /// with a `noreturn` instruction, so the only way to proceed to the code after the `block` | 272 | /// with a `noreturn` instruction, so the only way to proceed to the code after the `block` |
| 273 | /// is to encounter a `br` that targets this `block`. If the `block` type is `noreturn`, | 273 | /// is to encounter a `br` that targets this `block`. If the `block` type is `noreturn`, |
| 274 | /// then there do not exist any `br` instructions targetting this `block`. | 274 | /// then there do not exist any `br` instructions targeting this `block`. |
| 275 | block, | 275 | block, |
| 276 | /// A labeled block of code that loops forever. At the end of the body it is implied | 276 | /// A labeled block of code that loops forever. At the end of the body it is implied |
| 277 | /// to repeat; no explicit "repeat" instruction terminates loop bodies. | 277 | /// to repeat; no explicit "repeat" instruction terminates loop bodies. |
| ... | @@ -357,7 +357,7 @@ pub const Inst = struct { | ... | @@ -357,7 +357,7 @@ pub const Inst = struct { |
| 357 | /// Base 10 logarithm of a floating point number. | 357 | /// Base 10 logarithm of a floating point number. |
| 358 | /// Uses the `un_op` field. | 358 | /// Uses the `un_op` field. |
| 359 | log10, | 359 | log10, |
| 360 | /// Aboslute value of an integer, floating point number or vector. | 360 | /// Absolute value of an integer, floating point number or vector. |
| 361 | /// Result type is always unsigned if the operand is an integer. | 361 | /// Result type is always unsigned if the operand is an integer. |
| 362 | /// Uses the `ty_op` field. | 362 | /// Uses the `ty_op` field. |
| 363 | abs, | 363 | abs, |
src/Sema.zig+1-1| ... | @@ -239,7 +239,7 @@ pub const InferredErrorSet = struct { | ... | @@ -239,7 +239,7 @@ pub const InferredErrorSet = struct { |
| 239 | /// Stores the mapping from `Zir.Inst.Index -> Air.Inst.Ref`, which is used by sema to resolve | 239 | /// Stores the mapping from `Zir.Inst.Index -> Air.Inst.Ref`, which is used by sema to resolve |
| 240 | /// instructions during analysis. | 240 | /// instructions during analysis. |
| 241 | /// Instead of a hash table approach, InstMap is simply a slice that is indexed into using the | 241 | /// Instead of a hash table approach, InstMap is simply a slice that is indexed into using the |
| 242 | /// zir instruction index and a start offset. An index is not pressent in the map if the value | 242 | /// zir instruction index and a start offset. An index is not present in the map if the value |
| 243 | /// at the index is `Air.Inst.Ref.none`. | 243 | /// at the index is `Air.Inst.Ref.none`. |
| 244 | /// `ensureSpaceForInstructions` can be called to force InstMap to have a mapped range that | 244 | /// `ensureSpaceForInstructions` can be called to force InstMap to have a mapped range that |
| 245 | /// includes all instructions in a slice. After calling this function, `putAssumeCapacity*` can | 245 | /// includes all instructions in a slice. After calling this function, `putAssumeCapacity*` can |
src/arch/wasm/CodeGen.zig+3-3| ... | @@ -692,7 +692,7 @@ mir_extra: std.ArrayListUnmanaged(u32) = .{}, | ... | @@ -692,7 +692,7 @@ mir_extra: std.ArrayListUnmanaged(u32) = .{}, |
| 692 | /// When a function is executing, we store the the current stack pointer's value within this local. | 692 | /// When a function is executing, we store the the current stack pointer's value within this local. |
| 693 | /// This value is then used to restore the stack pointer to the original value at the return of the function. | 693 | /// This value is then used to restore the stack pointer to the original value at the return of the function. |
| 694 | initial_stack_value: WValue = .none, | 694 | initial_stack_value: WValue = .none, |
| 695 | /// The current stack pointer substracted with the stack size. From this value, we will calculate | 695 | /// The current stack pointer subtracted with the stack size. From this value, we will calculate |
| 696 | /// all offsets of the stack values. | 696 | /// all offsets of the stack values. |
| 697 | bottom_stack_value: WValue = .none, | 697 | bottom_stack_value: WValue = .none, |
| 698 | /// Arguments of this function declaration | 698 | /// Arguments of this function declaration |
| ... | @@ -1294,7 +1294,7 @@ fn genFunc(func: *CodeGen) InnerError!void { | ... | @@ -1294,7 +1294,7 @@ fn genFunc(func: *CodeGen) InnerError!void { |
| 1294 | try prologue.append(.{ .tag = .i32_const, .data = .{ .imm32 = @intCast(aligned_stack) } }); | 1294 | try prologue.append(.{ .tag = .i32_const, .data = .{ .imm32 = @intCast(aligned_stack) } }); |
| 1295 | // subtract it from the current stack pointer | 1295 | // subtract it from the current stack pointer |
| 1296 | try prologue.append(.{ .tag = .i32_sub, .data = .{ .tag = {} } }); | 1296 | try prologue.append(.{ .tag = .i32_sub, .data = .{ .tag = {} } }); |
| 1297 | // Get negative stack aligment | 1297 | // Get negative stack alignment |
| 1298 | try prologue.append(.{ .tag = .i32_const, .data = .{ .imm32 = @as(i32, @intCast(func.stack_alignment.toByteUnits().?)) * -1 } }); | 1298 | try prologue.append(.{ .tag = .i32_const, .data = .{ .imm32 = @as(i32, @intCast(func.stack_alignment.toByteUnits().?)) * -1 } }); |
| 1299 | // Bitwise-and the value to get the new stack pointer to ensure the pointers are aligned with the abi alignment | 1299 | // Bitwise-and the value to get the new stack pointer to ensure the pointers are aligned with the abi alignment |
| 1300 | try prologue.append(.{ .tag = .i32_and, .data = .{ .tag = {} } }); | 1300 | try prologue.append(.{ .tag = .i32_and, .data = .{ .tag = {} } }); |
| ... | @@ -4921,7 +4921,7 @@ fn memset(func: *CodeGen, elem_ty: Type, ptr: WValue, len: WValue, value: WValue | ... | @@ -4921,7 +4921,7 @@ fn memset(func: *CodeGen, elem_ty: Type, ptr: WValue, len: WValue, value: WValue |
| 4921 | try func.startBlock(.block, wasm.block_empty); | 4921 | try func.startBlock(.block, wasm.block_empty); |
| 4922 | try func.startBlock(.loop, wasm.block_empty); | 4922 | try func.startBlock(.loop, wasm.block_empty); |
| 4923 | 4923 | ||
| 4924 | // check for codition for loop end | 4924 | // check for condition for loop end |
| 4925 | try func.emitWValue(new_ptr); | 4925 | try func.emitWValue(new_ptr); |
| 4926 | try func.emitWValue(end_ptr); | 4926 | try func.emitWValue(end_ptr); |
| 4927 | switch (func.arch()) { | 4927 | switch (func.arch()) { |
src/arch/x86_64/CodeGen.zig+1-1| ... | @@ -2685,7 +2685,7 @@ pub fn spillInstruction(self: *Self, reg: Register, inst: Air.Inst.Index) !void | ... | @@ -2685,7 +2685,7 @@ pub fn spillInstruction(self: *Self, reg: Register, inst: Air.Inst.Index) !void |
| 2685 | const tracking = self.inst_tracking.getPtr(inst) orelse return; | 2685 | const tracking = self.inst_tracking.getPtr(inst) orelse return; |
| 2686 | for (tracking.getRegs()) |tracked_reg| { | 2686 | for (tracking.getRegs()) |tracked_reg| { |
| 2687 | if (tracked_reg.id() == reg.id()) break; | 2687 | if (tracked_reg.id() == reg.id()) break; |
| 2688 | } else unreachable; // spilled reg not tracked with spilled instruciton | 2688 | } else unreachable; // spilled reg not tracked with spilled instruction |
| 2689 | try tracking.spill(self, inst); | 2689 | try tracking.spill(self, inst); |
| 2690 | try tracking.trackSpill(self, inst); | 2690 | try tracking.trackSpill(self, inst); |
| 2691 | } | 2691 | } |
src/codegen/c.zig+1-1| ... | @@ -1014,7 +1014,7 @@ pub const DeclGen = struct { | ... | @@ -1014,7 +1014,7 @@ pub const DeclGen = struct { |
| 1014 | try writer.writeAll(", "); | 1014 | try writer.writeAll(", "); |
| 1015 | empty = false; | 1015 | empty = false; |
| 1016 | } else { | 1016 | } else { |
| 1017 | // isSignalNan is equivalent to isNan currently, and MSVC doens't have nans, so prefer nan | 1017 | // isSignalNan is equivalent to isNan currently, and MSVC doesn't have nans, so prefer nan |
| 1018 | const operation = if (std.math.isNan(f128_val)) | 1018 | const operation = if (std.math.isNan(f128_val)) |
| 1019 | "nan" | 1019 | "nan" |
| 1020 | else if (std.math.isSignalNan(f128_val)) | 1020 | else if (std.math.isSignalNan(f128_val)) |
src/codegen/llvm.zig+1-1| ... | @@ -855,7 +855,7 @@ pub const Object = struct { | ... | @@ -855,7 +855,7 @@ pub const Object = struct { |
| 855 | /// table for every zig source field of the struct that has a corresponding | 855 | /// table for every zig source field of the struct that has a corresponding |
| 856 | /// LLVM struct field. comptime fields are not included. Zero-bit fields are | 856 | /// LLVM struct field. comptime fields are not included. Zero-bit fields are |
| 857 | /// mapped to a field at the correct byte, which may be a padding field, or | 857 | /// mapped to a field at the correct byte, which may be a padding field, or |
| 858 | /// are not mapped, in which case they are sematically at the end of the | 858 | /// are not mapped, in which case they are semantically at the end of the |
| 859 | /// struct. | 859 | /// struct. |
| 860 | /// The value is the LLVM struct field index. | 860 | /// The value is the LLVM struct field index. |
| 861 | /// This is denormalized data. | 861 | /// This is denormalized data. |
src/codegen/spirv.zig+1-1| ... | @@ -3845,7 +3845,7 @@ const DeclGen = struct { | ... | @@ -3845,7 +3845,7 @@ const DeclGen = struct { |
| 3845 | const result = try self.normalize(low_bits, info); | 3845 | const result = try self.normalize(low_bits, info); |
| 3846 | 3846 | ||
| 3847 | // Now, we need to check the overflow bits AND the sign | 3847 | // Now, we need to check the overflow bits AND the sign |
| 3848 | // bit for the expceted overflow bits. | 3848 | // bit for the expected overflow bits. |
| 3849 | // To do that, shift out everything bit the sign bit and | 3849 | // To do that, shift out everything bit the sign bit and |
| 3850 | // then check what remains. | 3850 | // then check what remains. |
| 3851 | const shift = Temporary.init(full_result.ty, try self.constInt(full_result.ty, info.bits - 1, .direct)); | 3851 | const shift = Temporary.init(full_result.ty, try self.constInt(full_result.ty, info.bits - 1, .direct)); |
src/link/SpirV/lower_invocation_globals.zig+1-1| ... | @@ -403,7 +403,7 @@ const ModuleBuilder = struct { | ... | @@ -403,7 +403,7 @@ const ModuleBuilder = struct { |
| 403 | .OpTypeFunction => { | 403 | .OpTypeFunction => { |
| 404 | // Re-emitted in `emitFunctionTypes()`. We can do this because | 404 | // Re-emitted in `emitFunctionTypes()`. We can do this because |
| 405 | // OpTypeFunction's may not currently be used anywhere that is not | 405 | // OpTypeFunction's may not currently be used anywhere that is not |
| 406 | // directly with an OpFunction. For now we igore Intels function | 406 | // directly with an OpFunction. For now we ignore Intels function |
| 407 | // pointers extension, that is not a problem with a generalized | 407 | // pointers extension, that is not a problem with a generalized |
| 408 | // pass anyway. | 408 | // pass anyway. |
| 409 | continue; | 409 | continue; |
src/link/Wasm.zig+3-3| ... | @@ -1314,7 +1314,7 @@ fn validateFeatures( | ... | @@ -1314,7 +1314,7 @@ fn validateFeatures( |
| 1314 | /// Creates synthetic linker-symbols, but only if they are being referenced from | 1314 | /// Creates synthetic linker-symbols, but only if they are being referenced from |
| 1315 | /// any object file. For instance, the `__heap_base` symbol will only be created, | 1315 | /// any object file. For instance, the `__heap_base` symbol will only be created, |
| 1316 | /// if one or multiple undefined references exist. When none exist, the symbol will | 1316 | /// if one or multiple undefined references exist. When none exist, the symbol will |
| 1317 | /// not be created, ensuring we don't unneccesarily emit unreferenced symbols. | 1317 | /// not be created, ensuring we don't unnecessarily emit unreferenced symbols. |
| 1318 | fn resolveLazySymbols(wasm: *Wasm) !void { | 1318 | fn resolveLazySymbols(wasm: *Wasm) !void { |
| 1319 | const comp = wasm.base.comp; | 1319 | const comp = wasm.base.comp; |
| 1320 | const gpa = comp.gpa; | 1320 | const gpa = comp.gpa; |
| ... | @@ -2340,10 +2340,10 @@ fn setupMemory(wasm: *Wasm) !void { | ... | @@ -2340,10 +2340,10 @@ fn setupMemory(wasm: *Wasm) !void { |
| 2340 | try wasm.addErrorWithoutNotes("Maximum memory must be {d}-byte aligned", .{page_size}); | 2340 | try wasm.addErrorWithoutNotes("Maximum memory must be {d}-byte aligned", .{page_size}); |
| 2341 | } | 2341 | } |
| 2342 | if (memory_ptr > max_memory) { | 2342 | if (memory_ptr > max_memory) { |
| 2343 | try wasm.addErrorWithoutNotes("Maxmimum memory too small, must be at least {d} bytes", .{memory_ptr}); | 2343 | try wasm.addErrorWithoutNotes("Maximum memory too small, must be at least {d} bytes", .{memory_ptr}); |
| 2344 | } | 2344 | } |
| 2345 | if (max_memory > max_memory_allowed) { | 2345 | if (max_memory > max_memory_allowed) { |
| 2346 | try wasm.addErrorWithoutNotes("Maximum memory exceeds maxmium amount {d}", .{max_memory_allowed}); | 2346 | try wasm.addErrorWithoutNotes("Maximum memory exceeds maximum amount {d}", .{max_memory_allowed}); |
| 2347 | } | 2347 | } |
| 2348 | wasm.memories.limits.max = @as(u32, @intCast(max_memory / page_size)); | 2348 | wasm.memories.limits.max = @as(u32, @intCast(max_memory / page_size)); |
| 2349 | wasm.memories.limits.setFlag(.WASM_LIMITS_FLAG_HAS_MAX); | 2349 | wasm.memories.limits.setFlag(.WASM_LIMITS_FLAG_HAS_MAX); |
src/link/Wasm/Atom.zig+1-1| ... | @@ -14,7 +14,7 @@ alignment: Wasm.Alignment = .@"1", | ... | @@ -14,7 +14,7 @@ alignment: Wasm.Alignment = .@"1", |
| 14 | /// Offset into the section where the atom lives, this already accounts | 14 | /// Offset into the section where the atom lives, this already accounts |
| 15 | /// for alignment. | 15 | /// for alignment. |
| 16 | offset: u32 = 0, | 16 | offset: u32 = 0, |
| 17 | /// The original offset within the object file. This value is substracted from | 17 | /// The original offset within the object file. This value is subtracted from |
| 18 | /// relocation offsets to determine where in the `data` to rewrite the value | 18 | /// relocation offsets to determine where in the `data` to rewrite the value |
| 19 | original_offset: u32 = 0, | 19 | original_offset: u32 = 0, |
| 20 | /// Previous atom in relation to this atom. | 20 | /// Previous atom in relation to this atom. |
src/link/Wasm/Object.zig+2-2| ... | @@ -220,7 +220,7 @@ pub fn findImport(object: *const Object, sym: Symbol) types.Import { | ... | @@ -220,7 +220,7 @@ pub fn findImport(object: *const Object, sym: Symbol) types.Import { |
| 220 | } | 220 | } |
| 221 | 221 | ||
| 222 | /// Checks if the object file is an MVP version. | 222 | /// Checks if the object file is an MVP version. |
| 223 | /// When that's the case, we check if there's an import table definiton with its name | 223 | /// When that's the case, we check if there's an import table definition with its name |
| 224 | /// set to '__indirect_function_table". When that's also the case, | 224 | /// set to '__indirect_function_table". When that's also the case, |
| 225 | /// we initialize a new table symbol that corresponds to that import and return that symbol. | 225 | /// we initialize a new table symbol that corresponds to that import and return that symbol. |
| 226 | /// | 226 | /// |
| ... | @@ -315,7 +315,7 @@ pub const ParseError = error{ | ... | @@ -315,7 +315,7 @@ pub const ParseError = error{ |
| 315 | Overflow, | 315 | Overflow, |
| 316 | /// Found table definitions but no corresponding table symbols | 316 | /// Found table definitions but no corresponding table symbols |
| 317 | MissingTableSymbols, | 317 | MissingTableSymbols, |
| 318 | /// Did not expect a table definiton, but did find one | 318 | /// Did not expect a table definition, but did find one |
| 319 | UnexpectedTable, | 319 | UnexpectedTable, |
| 320 | /// Object file contains a feature that is unknown to the linker | 320 | /// Object file contains a feature that is unknown to the linker |
| 321 | UnknownFeature, | 321 | UnknownFeature, |
src/link/Wasm/Symbol.zig+1-1| ... | @@ -57,7 +57,7 @@ pub const Tag = enum { | ... | @@ -57,7 +57,7 @@ pub const Tag = enum { |
| 57 | pub const Flag = enum(u32) { | 57 | pub const Flag = enum(u32) { |
| 58 | /// Indicates a weak symbol. | 58 | /// Indicates a weak symbol. |
| 59 | /// When linking multiple modules defining the same symbol, all weak definitions are discarded | 59 | /// When linking multiple modules defining the same symbol, all weak definitions are discarded |
| 60 | /// in favourite of the strong definition. When no strong definition exists, all weak but one definiton is discarded. | 60 | /// in favourite of the strong definition. When no strong definition exists, all weak but one definition is discarded. |
| 61 | /// If multiple definitions remain, we get an error: symbol collision. | 61 | /// If multiple definitions remain, we get an error: symbol collision. |
| 62 | WASM_SYM_BINDING_WEAK = 0x1, | 62 | WASM_SYM_BINDING_WEAK = 0x1, |
| 63 | /// Indicates a local, non-exported, non-module-linked symbol. | 63 | /// Indicates a local, non-exported, non-module-linked symbol. |
src/link/Wasm/ZigObject.zig+2-2| ... | @@ -1053,7 +1053,7 @@ fn setupErrorsLen(zig_object: *ZigObject, wasm_file: *Wasm) !void { | ... | @@ -1053,7 +1053,7 @@ fn setupErrorsLen(zig_object: *ZigObject, wasm_file: *Wasm) !void { |
| 1053 | 1053 | ||
| 1054 | const errors_len = 1 + wasm_file.base.comp.module.?.intern_pool.global_error_set.getNamesFromMainThread().len; | 1054 | const errors_len = 1 + wasm_file.base.comp.module.?.intern_pool.global_error_set.getNamesFromMainThread().len; |
| 1055 | // overwrite existing atom if it already exists (maybe the error set has increased) | 1055 | // overwrite existing atom if it already exists (maybe the error set has increased) |
| 1056 | // if not, allcoate a new atom. | 1056 | // if not, allocate a new atom. |
| 1057 | const atom_index = if (wasm_file.symbol_atom.get(.{ .file = zig_object.index, .index = sym_index })) |index| blk: { | 1057 | const atom_index = if (wasm_file.symbol_atom.get(.{ .file = zig_object.index, .index = sym_index })) |index| blk: { |
| 1058 | const atom = wasm_file.getAtomPtr(index); | 1058 | const atom = wasm_file.getAtomPtr(index); |
| 1059 | atom.prev = .null; | 1059 | atom.prev = .null; |
| ... | @@ -1179,7 +1179,7 @@ pub fn storeDeclType(zig_object: *ZigObject, gpa: std.mem.Allocator, decl_index: | ... | @@ -1179,7 +1179,7 @@ pub fn storeDeclType(zig_object: *ZigObject, gpa: std.mem.Allocator, decl_index: |
| 1179 | } | 1179 | } |
| 1180 | 1180 | ||
| 1181 | /// The symbols in ZigObject are already represented by an atom as we need to store its data. | 1181 | /// The symbols in ZigObject are already represented by an atom as we need to store its data. |
| 1182 | /// So rather than creating a new Atom and returning its index, we use this oppertunity to scan | 1182 | /// So rather than creating a new Atom and returning its index, we use this opportunity to scan |
| 1183 | /// its relocations and create any GOT symbols or function table indexes it may require. | 1183 | /// its relocations and create any GOT symbols or function table indexes it may require. |
| 1184 | pub fn parseSymbolIntoAtom(zig_object: *ZigObject, wasm_file: *Wasm, index: Symbol.Index) !Atom.Index { | 1184 | pub fn parseSymbolIntoAtom(zig_object: *ZigObject, wasm_file: *Wasm, index: Symbol.Index) !Atom.Index { |
| 1185 | const gpa = wasm_file.base.comp.gpa; | 1185 | const gpa = wasm_file.base.comp.gpa; |