cjit update

This commit is contained in:
2026-01-20 21:40:47 +01:00
parent fa42b20136
commit eb3c3814ec
8 changed files with 576 additions and 85 deletions

View File

@@ -3,7 +3,7 @@ const std = @import("std");
text: Section = .{ .read_only = true, .executable = true },
data: Section = .{ .read_only = false, .executable = false },
rodata: Section = .{ .read_only = true, .executable = false },
bss: usize,
bss: usize = 0,
pub const Section = struct {
data: std.ArrayList(u8) = .{},
@@ -14,12 +14,13 @@ pub const Section = struct {
const T = @TypeOf(value);
std.debug.assert(std.meta.hasUniqueRepresentation(T));
const bytes = std.mem.asBytes(&value);
const alignment = @alignOf(T);
try self.alignForward(alignment, allocator);
try self.writeBytes(bytes, allocator);
}
pub fn writeByte(self: *Section, byte: u8, allocator: std.mem.Allocator) !void {
try self.data.append(allocator, byte);
}
pub fn writeBytes(self: *Section, data: []const u8, allocator: std.mem.Allocator) !void {
try self.data.appendSlice(allocator, data);
}