Compare commits
22 commits
master
...
writergate
Author | SHA1 | Date | |
---|---|---|---|
b60cd8907e | |||
e638862997 | |||
bc298e96d5 | |||
724dc9200d | |||
4cb6d0af05 | |||
891945bab1 | |||
4ee7a26817 | |||
625c89ab95 | |||
e5b20974e8 | |||
4e80bae8b8 | |||
8fb3602594 | |||
0a4c1a57b1 | |||
b258b2bb54 | |||
1fdfd41a4c | |||
e28169458e | |||
3e3bc2cd17 | |||
697ad50e1c | |||
eece7202b1 | |||
4d608d413a | |||
c21a673163 | |||
6fb364d64b | |||
0e3806ab98 |
8 changed files with 72 additions and 53 deletions
|
@ -1 +1 @@
|
|||
0.14.1
|
||||
0.15.0-dev.1034+bd97b6618
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
.hash = "dizzy-1.0.0-AAAAAM1wAAAiDbx_6RwcVEOBk8p2XOu8t9WPNc3K7kBK",
|
||||
},
|
||||
.thespian = .{
|
||||
.url = "https://github.com/neurocyte/thespian/archive/ccdcbbff09f945eec063ebf889581db3e1312107.tar.gz",
|
||||
.hash = "thespian-0.0.1-owFOjlgaBgCqc3FCnB4Xyg8-9jyIDWgHSJMGx_nt5Kcc",
|
||||
.url = "git+https://github.com/neurocyte/thespian#4d317d7bf02eef26da56eddd2d49e46984b50572",
|
||||
.hash = "thespian-0.0.1-owFOjuEaBgA9zNohtfOqnA8alObpvYjJNNDjEV8dKvLj",
|
||||
},
|
||||
.themes = .{
|
||||
.url = "https://github.com/neurocyte/flow-themes/releases/download/master-952f9f630ea9544088fd30293666ee0650b7a690/flow-themes.tar.gz",
|
||||
|
@ -27,12 +27,12 @@
|
|||
.hash = "fuzzig-0.1.1-AAAAALNIAQBmbHr-MPalGuR393Vem2pTQXI7_LXeNJgX",
|
||||
},
|
||||
.vaxis = .{
|
||||
.url = "https://github.com/neurocyte/libvaxis/archive/6137cb4c44a7350996f0946a069739e5075d1f23.tar.gz",
|
||||
.hash = "vaxis-0.1.0-BWNV_HwOCQCw5wTV63hQGSc1QJzsNcytH6sGf1GBc0hP",
|
||||
.url = "https://github.com/neurocyte/libvaxis/archive/2a4137dadbe560b13b712fd3aa8a1c313fdd8c6e.tar.gz",
|
||||
.hash = "vaxis-0.1.0-BWNV_KMOCQAe8oPD6cCn62Rg7oIVgF8FEWLpcAi7xDZQ",
|
||||
},
|
||||
.zeit = .{
|
||||
.url = "https://github.com/rockorager/zeit/archive/8fd203f85f597f16e0a525c1f1ca1e0bffded809.tar.gz",
|
||||
.hash = "zeit-0.0.0-AAAAACVbAgAiIzg1rccZU1qOfO_dKQKme7-37xmEQcqc",
|
||||
.url = "https://github.com/rockorager/zeit/archive/991f38266f86535e68431675e8feb84efa1f011b.tar.gz",
|
||||
.hash = "zeit-0.6.0-5I6bk0t7AgCPM_cY1DoqJB2pnmG7MMtpdO5IxNpryJDy",
|
||||
},
|
||||
.win32 = .{
|
||||
.url = "https://github.com/marlersoft/zigwin32/archive/e8739b32a33ce48a3286aba31918b26a9dfc6ef0.tar.gz",
|
||||
|
|
|
@ -1222,6 +1222,7 @@ pub const LoadFromFileError = error{
|
|||
LockViolation,
|
||||
ProcessNotFound,
|
||||
Canceled,
|
||||
PermissionDenied,
|
||||
};
|
||||
|
||||
pub fn load_from_file(
|
||||
|
@ -1327,6 +1328,8 @@ pub const StoreToFileError = error{
|
|||
SystemResources,
|
||||
Unexpected,
|
||||
WouldBlock,
|
||||
PermissionDenied,
|
||||
MessageTooBig,
|
||||
};
|
||||
|
||||
pub fn store_to_existing_file_const(self: *const Self, file_path: []const u8) StoreToFileError!void {
|
||||
|
|
22
src/log.zig
22
src/log.zig
|
@ -10,9 +10,14 @@ receiver: Receiver,
|
|||
subscriber: ?tp.pid,
|
||||
heap: [32 + 1024]u8,
|
||||
fba: std.heap.FixedBufferAllocator,
|
||||
msg_store: MsgStoreT,
|
||||
msg_store: MsgStore,
|
||||
|
||||
const MsgStore = std.DoublyLinkedList;
|
||||
const MsgStoreEntry = struct {
|
||||
data: []u8,
|
||||
node: MsgStore.Node,
|
||||
};
|
||||
|
||||
const MsgStoreT = std.DoublyLinkedList([]u8);
|
||||
const Receiver = tp.Receiver(*Self);
|
||||
|
||||
const StartArgs = struct {
|
||||
|
@ -38,7 +43,7 @@ fn init(args: StartArgs) !*Self {
|
|||
.subscriber = null,
|
||||
.heap = undefined,
|
||||
.fba = std.heap.FixedBufferAllocator.init(&p.heap),
|
||||
.msg_store = MsgStoreT{},
|
||||
.msg_store = MsgStore{},
|
||||
};
|
||||
return p;
|
||||
}
|
||||
|
@ -55,17 +60,18 @@ fn log(msg: []const u8) void {
|
|||
fn store(self: *Self, m: tp.message) void {
|
||||
const allocator: std.mem.Allocator = self.fba.allocator();
|
||||
const buf: []u8 = allocator.alloc(u8, m.len()) catch return;
|
||||
var node: *MsgStoreT.Node = allocator.create(MsgStoreT.Node) catch return;
|
||||
node.data = buf;
|
||||
var msg: *MsgStoreEntry = allocator.create(MsgStoreEntry) catch return;
|
||||
msg.data = buf;
|
||||
@memcpy(buf, m.buf);
|
||||
self.msg_store.append(node);
|
||||
self.msg_store.append(&msg.node);
|
||||
}
|
||||
|
||||
fn store_send(self: *Self) void {
|
||||
var node = self.msg_store.first;
|
||||
if (self.subscriber) |sub| {
|
||||
while (node) |node_| {
|
||||
sub.send_raw(tp.message{ .buf = node_.data }) catch return;
|
||||
const msg: *MsgStoreEntry = @fieldParentPtr("node", node_);
|
||||
sub.send_raw(tp.message{ .buf = msg.data }) catch return;
|
||||
node = node_.next;
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +79,7 @@ fn store_send(self: *Self) void {
|
|||
}
|
||||
|
||||
fn store_reset(self: *Self) void {
|
||||
self.msg_store = MsgStoreT{};
|
||||
self.msg_store = MsgStore{};
|
||||
self.fba.reset();
|
||||
}
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ pub fn install_crash_handler() void {
|
|||
}
|
||||
const act = std.posix.Sigaction{
|
||||
.handler = .{ .sigaction = handle_crash },
|
||||
.mask = std.posix.empty_sigset,
|
||||
.mask = std.posix.sigemptyset(),
|
||||
.flags = (std.posix.SA.SIGINFO | std.posix.SA.RESTART),
|
||||
};
|
||||
|
||||
|
|
|
@ -78,13 +78,9 @@ pub fn FullPanic(comptime panicFn: fn ([]const u8, ?usize) noreturn) type {
|
|||
@branchHint(.cold);
|
||||
call("invalid error code", @returnAddress());
|
||||
}
|
||||
pub fn castTruncatedData() noreturn {
|
||||
pub fn integerOutOfBounds() noreturn {
|
||||
@branchHint(.cold);
|
||||
call("integer cast truncated bits", @returnAddress());
|
||||
}
|
||||
pub fn negativeToUnsigned() noreturn {
|
||||
@branchHint(.cold);
|
||||
call("attempt to cast negative value to unsigned integer", @returnAddress());
|
||||
call("integer does not fit in destination type", @returnAddress());
|
||||
}
|
||||
pub fn integerOverflow() noreturn {
|
||||
@branchHint(.cold);
|
||||
|
@ -126,9 +122,9 @@ pub fn FullPanic(comptime panicFn: fn ([]const u8, ?usize) noreturn) type {
|
|||
@branchHint(.cold);
|
||||
call("for loop over objects with non-equal lengths", @returnAddress());
|
||||
}
|
||||
pub fn memcpyLenMismatch() noreturn {
|
||||
pub fn copyLenMismatch() noreturn {
|
||||
@branchHint(.cold);
|
||||
call("@memcpy arguments have non-equal lengths", @returnAddress());
|
||||
call("source and destination arguments have non-equal lengths", @returnAddress());
|
||||
}
|
||||
pub fn memcpyAlias() noreturn {
|
||||
@branchHint(.cold);
|
||||
|
@ -165,9 +161,11 @@ pub const sys_can_stack_trace = switch (builtin.cpu.arch) {
|
|||
|
||||
// `@returnAddress()` in LLVM 10 gives
|
||||
// "Non-Emscripten WebAssembly hasn't implemented __builtin_return_address".
|
||||
// On Emscripten, Zig only supports `@returnAddress()` in debug builds
|
||||
// because Emscripten's implementation is very slow.
|
||||
.wasm32,
|
||||
.wasm64,
|
||||
=> native_os == .emscripten,
|
||||
=> native_os == .emscripten and builtin.mode == .Debug,
|
||||
|
||||
// `@returnAddress()` is unsupported in LLVM 13.
|
||||
.bpfel,
|
||||
|
@ -586,15 +584,20 @@ pub fn defaultPanic(
|
|||
|
||||
// For backends that cannot handle the language features depended on by the
|
||||
// default panic handler, we have a simpler panic handler:
|
||||
if (builtin.zig_backend == .stage2_wasm or
|
||||
builtin.zig_backend == .stage2_arm or
|
||||
builtin.zig_backend == .stage2_aarch64 or
|
||||
builtin.zig_backend == .stage2_x86 or
|
||||
(builtin.zig_backend == .stage2_x86_64 and (builtin.target.ofmt != .elf and builtin.target.ofmt != .macho)) or
|
||||
builtin.zig_backend == .stage2_sparc64 or
|
||||
builtin.zig_backend == .stage2_spirv64)
|
||||
{
|
||||
@trap();
|
||||
switch (builtin.zig_backend) {
|
||||
.stage2_aarch64,
|
||||
.stage2_arm,
|
||||
.stage2_powerpc,
|
||||
.stage2_riscv64,
|
||||
.stage2_spirv,
|
||||
.stage2_wasm,
|
||||
.stage2_x86,
|
||||
=> @trap(),
|
||||
.stage2_x86_64 => switch (builtin.target.ofmt) {
|
||||
.elf, .macho => {},
|
||||
else => @trap(),
|
||||
},
|
||||
else => {},
|
||||
}
|
||||
|
||||
switch (builtin.os.tag) {
|
||||
|
@ -615,9 +618,9 @@ pub fn defaultPanic(
|
|||
// isn't visible on actual hardware if directly booted into
|
||||
inline for ([_]?*uefi.protocol.SimpleTextOutput{ uefi.system_table.std_err, uefi.system_table.con_out }) |o| {
|
||||
if (o) |out| {
|
||||
_ = out.setAttribute(uefi.protocol.SimpleTextOutput.red);
|
||||
_ = out.outputString(exit_msg);
|
||||
_ = out.setAttribute(uefi.protocol.SimpleTextOutput.white);
|
||||
out.setAttribute(.{ .foreground = .red }) catch {};
|
||||
_ = out.outputString(exit_msg) catch {};
|
||||
out.setAttribute(.{ .foreground = .white }) catch {};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -752,7 +755,7 @@ pub const StackIterator = struct {
|
|||
pub fn init(first_address: ?usize, fp: ?usize) StackIterator {
|
||||
if (native_arch.isSPARC()) {
|
||||
// Flush all the register windows on stack.
|
||||
asm volatile (if (std.Target.sparc.featureSetHas(builtin.cpu.features, .v9))
|
||||
asm volatile (if (builtin.cpu.has(.sparc, .v9))
|
||||
"flushw"
|
||||
else
|
||||
"ta 3" // ST_FLUSH_WINDOWS
|
||||
|
@ -905,6 +908,8 @@ pub const StackIterator = struct {
|
|||
}
|
||||
}
|
||||
|
||||
if (builtin.omit_frame_pointer) return null;
|
||||
|
||||
const fp = if (comptime native_arch.isSPARC())
|
||||
// On SPARC the offset is positive. (!)
|
||||
math.add(usize, it.fp, fp_offset) catch return null
|
||||
|
@ -1371,12 +1376,11 @@ pub fn attachSegfaultHandler() void {
|
|||
windows_segfault_handle = windows.kernel32.AddVectoredExceptionHandler(0, handleSegfaultWindows);
|
||||
return;
|
||||
}
|
||||
var act = posix.Sigaction{
|
||||
const act = posix.Sigaction{
|
||||
.handler = .{ .sigaction = handleSegfaultPosix },
|
||||
.mask = posix.empty_sigset,
|
||||
.mask = posix.sigemptyset(),
|
||||
.flags = (posix.SA.SIGINFO | posix.SA.RESTART | posix.SA.RESETHAND),
|
||||
};
|
||||
|
||||
updateSegfaultHandler(&act);
|
||||
}
|
||||
|
||||
|
@ -1388,9 +1392,9 @@ pub fn resetSegfaultHandler() void {
|
|||
}
|
||||
return;
|
||||
}
|
||||
var act = posix.Sigaction{
|
||||
const act = posix.Sigaction{
|
||||
.handler = .{ .handler = posix.SIG.DFL },
|
||||
.mask = posix.empty_sigset,
|
||||
.mask = posix.sigemptyset(),
|
||||
.flags = 0,
|
||||
};
|
||||
updateSegfaultHandler(&act);
|
||||
|
@ -1504,6 +1508,12 @@ fn handleSegfaultWindows(info: *windows.EXCEPTION_POINTERS) callconv(.winapi) c_
|
|||
}
|
||||
|
||||
fn handleSegfaultWindowsExtra(info: *windows.EXCEPTION_POINTERS, msg: u8, label: ?[]const u8) noreturn {
|
||||
// For backends that cannot handle the language features used by this segfault handler, we have a simpler one,
|
||||
switch (builtin.zig_backend) {
|
||||
.stage2_x86_64 => if (builtin.target.ofmt == .coff) @trap(),
|
||||
else => {},
|
||||
}
|
||||
|
||||
comptime assert(windows.CONTEXT != void);
|
||||
nosuspend switch (panic_stage) {
|
||||
0 => {
|
||||
|
|
|
@ -14,10 +14,7 @@ pub fn build(b: *std.Build) void {
|
|||
.optimize = optimize,
|
||||
});
|
||||
|
||||
const tree_sitter_host_dep = b.dependency("tree_sitter", .{
|
||||
.target = b.graph.host,
|
||||
.optimize = optimize,
|
||||
});
|
||||
const tree_sitter_host_dep = b.dependency("tree_sitter", .{});
|
||||
|
||||
const cbor_dep = b.dependency("cbor", .{
|
||||
.target = target,
|
||||
|
@ -26,8 +23,11 @@ pub fn build(b: *std.Build) void {
|
|||
|
||||
const ts_bin_query_gen = b.addExecutable(.{
|
||||
.name = "ts_bin_query_gen",
|
||||
.target = b.graph.host,
|
||||
.root_module = b.createModule(.{
|
||||
.root_source_file = b.path("src/ts_bin_query_gen.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
}),
|
||||
});
|
||||
ts_bin_query_gen.linkLibC();
|
||||
ts_bin_query_gen.root_module.addImport("cbor", cbor_dep.module("cbor"));
|
||||
|
|
|
@ -6,12 +6,12 @@
|
|||
|
||||
.dependencies = .{
|
||||
.tree_sitter = .{
|
||||
.url = "https://github.com/neurocyte/tree-sitter/releases/download/master-1c3ad59bd98ee430b166054030dac4c46d641e39/source.tar.gz",
|
||||
.hash = "N-V-__8AANMzUiemOR2eNnrtlMmAGHFqij6VYtDUiaFfn6Dw",
|
||||
.url = "https://github.com/neurocyte/tree-sitter/releases/download/master-f1f032d24f621e2ee4deab1c424d3bf9fb809f6e/source.tar.gz",
|
||||
.hash = "tree_sitter-0.22.4-150-g7e3f5726-z0LhyN88UicDHlr22vQnOZ3DW9NWN1gOhDwLuCRXvrh2",
|
||||
},
|
||||
.cbor = .{
|
||||
.url = "https://github.com/neurocyte/cbor/archive/1fccb83c70cd84e1dff57cc53f7db8fb99909a94.tar.gz",
|
||||
.hash = "cbor-1.0.0-RcQE_HvqAACcrLH7t3IDZOshgY2xqJA_UX330MvwSepb",
|
||||
.url = "git+https://github.com/neurocyte/cbor#6eccce0b984296e7d05c20d83933cb31530e4fac",
|
||||
.hash = "cbor-1.0.0-RcQE_N3yAADXjbyvhsmTQ6lf22l1nYgePq5FT8NaC4ic",
|
||||
},
|
||||
},
|
||||
.paths = .{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue