-
-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unstable zig package for tooling #86
Comments
That would be nice to have! I would appreciate a PR even if it's just a barebones api over the zon package (just reading about it now). I'm not sure what kind of endpoints would be needed for an LSP but I'd be happy to add them when the time comes. To get started, there is currently https://github.com/fubark/cyber/blob/master/src/capi.zig. It's not comprehensive but it can be used as a reference. |
I was more thinking of exposing |
Yea that's fine too. A lot of the data types do not map to C structs so that would be easier to expose. The only issue is it would require a particular Zig version when writing an extension but it's better than nothing. |
Now that 0.13 is released, we can cleanly use the Zig build system to depend on the upstream sources for mimalloc and tcc. @fubark Do you know what Git commit the vendored mimalloc is on? I was able to get tcc working, but I don't see mimalloc's hash mentioned anywhere. |
I forgot to record the hash so I ended up upgrading mimalloc to latest. Also, I'm not sure 0.13.0 is stable for Cyber. I saw tests fail from what looked like packed struct miscompilations. (Although it's probably fixed on master) Edit: Mimalloc is now at 03020fbf81541651e24289d2f7033a772a50f480 |
Thanks for upgrading mimalloc, and I see what you mean by the failing tests. Here is my branch, although I didn't commit the tcc module migration. https://github.com/sno2/cyber/tree/upgrade-zig Definitely some UB happening in the tests, so I'll probably wait until 0.14 releases and try again then. |
I got cyber building on 0.14, but we are still getting the same error on the ARC test. https://github.com/sno2/cyber/tree/upgrade-zig-0.14 What steps did you take to figure out that this was most likely a packed struct miscompilation? I wonder if explicitly stating the size of the packed struct like |
I got more tests to pass when I removed the |
Here is a MRE:
The issue seems to be passing a packed struct where the first field is initialized as undefined. |
Nice find! I have also been looking into this issue this morning although I hadn't been able to deduce that. It seems like using pub const Foo = packed struct(i32) {
a: u31,
b: bool,
pub fn init() Foo {
return .{ .a = undefined, .b = true };
}
};
|
Neither works for me on 0.14.0-dev.839+a931bfada or 0.13.0. I'm on arm64 so perhaps it's also architecture specific issue. |
Ah, sorry seems to be non-deterministic. I should've ran more than 3 times. (Zig 0.13, Windows) $ zig run foo.zig
true 10000001010110101010010010100000
$ zig run foo.zig
true 10110001000000111010010010100000
$ zig run foo.zig
true 10101111010011011010010010100000
$ zig run foo.zig
true 11101011000100111010010010100000
$ zig run foo.zig
false 110100111001010010010100000 |
It would be great to have an unstable zig package available. A tokenizer/parser and semantic analyzing API would make tooling (e.g. lsp, formatter, documentation generator) fairly straightforward to implement. I would be willing to add a PR for this.
The text was updated successfully, but these errors were encountered: