diff --git a/src/backend/Assembly.zig b/src/backend/Assembly.zig index 914bffb033bfff5923a987cb6e997a23973c3155..8fd1971f2de8e6bd431b291454701885b81a2c77 100644 --- a/src/backend/Assembly.zig +++ b/src/backend/Assembly.zig @@ -6,11 +6,14 @@ text: []const u8, const Assembly = @This(); +/// Frees the memory allocated for the assembly data and text sections. pub fn deinit(self: *const Assembly, gpa: Allocator) void { gpa.free(self.data); gpa.free(self.text); } +/// Writes both the data and text sections of the assembly to a file using writev. +/// This writes all data and text sections in a single vectored I/O operation. pub fn writeToAllFile(self: Assembly, file: std.fs.File) !void { var vec: [2]std.posix.iovec_const = .{ .{ .base = self.data.ptr, .len = self.data.len },