profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/andrewrk/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.
Andrew Kelley andrewrk @ziglang Portland, Oregon https://andrewkelley.me/ Lead developer & president of Zig Software Foundation

AndreaOrru/zen 205

Experimental operating system written in Zig

andrewrk/chem 170

2d canvas-based rapid prototyping game engine

andrewrk/clashos 151

multiplayer arcade game for bare metal Raspberry Pi 3 B+

andrewrk/connect-sse 28

connect middleware for server sent events (EventSource)

andrewrk/connect-static 19

static file server middleware for connect. loads files once at startup and saves gzipped versions in memory

andrewrk/dotfiles 15

linux yo

andrewrk/browserify-lite 13

browserify, minus some of the advanced features and heavy dependencies

andrewrk/connect-nocache 11

connect middleware to insert no cache headers

andrewrk/evo 10

specification, reference implementation, and examples of Evo, the programming language made for being the DNA of genetic algorithms

andrewrk/andrewkelley.me 7

my personal site

push eventziglang/zig

Andrew Kelley

commit sha dbe9a5114e2d56f847b674539ffa0d28fc57ea78

stage2: implement `@setAlignStack` and 128-bit cmpxchg * test runner is improved to respect `error.SkipZigTest` * start code is improved to `@setAlignStack(16)` before calling main() * the newly passing behavior test has a workaround for the fact that stage2 cannot yet call `std.Target.x86.featureSetHas()` at comptime. This is blocking on comptime closures. The workaround is that there is a new decl `@import("builtin").stage2_x86_cx16` which is a `bool`. * Implement `@setAlignStack`. This language feature should be re-evaluated at some point - I'll file an issue for it. * LLVM backend: apply/remove the cold attribute and noinline attribute where appropriate. * LLVM backend: loads and stores are properly annotated with alignment and volatile attributes. * LLVM backend: allocas are properly annotated with alignment. * Type: fix integers reporting wrong alignment for 256-bit integers and beyond. Once you get to 16 byte aligned, there is no further alignment for larger integers.

view details

push time in 14 minutes

push eventziglang/zig

Andrew Kelley

commit sha d11f42c2b24e80388e1ea648ee97fae612fd76a4

zig cc: support -S and -emit-llvm CLI parameters closes #6425

view details

Andrew Kelley

commit sha dc9d76b630e0fe9a465cec67dc4dc66e8cce7c58

ci: go back to passing state for linux This commit reverts 6d37ae95edc06f15e4e77f64e8e637dd5d269183 and 8f8294a809f9d975735377e7bfcc2c47ccfc4cb7. I don't know why they caused a failure but that investigation can happen while the CI is green.

view details

push time in 5 hours

issue closedziglang/zig

`zig c++ -emit-llvm` error

Got an error trying to emit-llvm with zig c++:

./zig c++ -emit-llvm ~/test.cpp
Build Dependencies... c++ [2] Compile C Objects [37/37] vector.cpp... Cannot open zig-cache/o/Cw6OiveYOXWyQvD-DwLoiWkkFZJv2JkU4YBLyE9TDsqW380Ykye6jaX_UDvCYTs1/test.o: Exec format error

I'm using Zig version: zig-macos-x86_64-0.6.0+a50260470. Same thing happens with 0.6.0.

This is the simple hello world I'm testing:

#include <iostream>
using namespace std;

int main()
{
  cout << "Hello world.\n";
  return 0;
}

Other options

./zig c++ -emit-llvm -S ~/test.cpp

Works but it prints the output to the stdout instead of generating a file ( like clang does ). Clang supports to write to a specific output with:

clang++ -emit-llvm -S ~/test.cpp -o outputfile.ll

This is not supported too.

closed time in 5 hours

lolgab

issue closedziglang/zig

std.ChildProcess can deadlock if both stdout and stderr are long and interleaved

Related: #938 but this needs to work with blocking I/O too.

https://github.com/ziglang/zig/blob/d073836894df8b9fb56f24f577a51dd09a85a932/lib/std/child_process.zig#L216-L220

This is a flaw in the API design because this example code above will be duplicated many times in users of this API. We need to eliminate this footgun.

closed time in 6 hours

andrewrk

issue commentziglang/zig

std.ChildProcess can deadlock if both stdout and stderr are long and interleaved

Fixed by @marler8997 and the fix landed in 0.8.1.

andrewrk

comment created time in 6 hours

push eventziglang/zig

Andrew Kelley

commit sha 6d37ae95edc06f15e4e77f64e8e637dd5d269183

build.zig: support -Duse-zig-libcxx This supports the case when it is known that LLVM, Clang, LLD were built with Clang (or `zig c++`). This commit updates the Linux CI script to pass this since we build using a zig tarball.

view details

push time in 8 hours

push eventziglang/zig

Andrew Kelley

commit sha ab84ba39d03f59599ddfad91c00edf78a40edd70

move behavior test to "passing for stage2" section

view details

Andrew Kelley

commit sha 2c8b201d057b556edaf8688a4e53b25cd90198f3

build: make -Dskip-stage2-tests not build stage2 for the test-toolchain step

view details

Andrew Kelley

commit sha 8f8294a809f9d975735377e7bfcc2c47ccfc4cb7

ci: linux: enable LLVM stage2 tests

view details

push time in 10 hours

push eventziglang/zig

Andrew Kelley

commit sha d5c1d24964b0ee8ad37beb8e2a907e8caa645e07

stage2: fix "cmpxchg with ptr" test case * Sema: fix atomic operand checking to allow pointers. * LLVM backend: implement pointer-like optional constants. * LLVM backend: fix `is_non_null` and `optional_payload` instructions to support pointer-like optionals. * Type: introduce `isPtrAtRuntime` method. * Type: fix `isPtrLikeOptional` to get the correct answer for allowzero pointers and slices.

view details

push time in a day

push eventziglang/zig

Andrew Kelley

commit sha b67d1810be3234c363ee2929ffcc91083bfb0ae5

stage2: implement `@atomicRmw` and `@atomicLoad` * langref: add some more "see also" links for atomics * Add the following AIR instructions - atomic_load - atomic_store_unordered - atomic_store_monotonic - atomic_store_release - atomic_store_seq_cst - atomic_rmw * Implement those AIR instructions in LLVM and C backends. * AstGen: make the `ty` result locations for `@atomicRmw`, `@atomicLoad`, and `@atomicStore` be `coerced_ty` to avoid unnecessary ZIR instructions when Sema will be doing the coercions redundantly. * Sema for `@atomicLoad` and `@atomicRmw` is done, however Sema for `@atomicStore` is not yet implemented. - comptime eval for `@atomicRmw` is not yet implemented. * Sema: flesh out `coerceInMemoryAllowed` a little bit more. It can now handle pointers.

view details

push time in a day

push eventziglang/zig

Jonathan Marler

commit sha f83a4b444c4c2fca7086fe6dbdaccc7b6d8f35ca

fix __chkstk on aarch64

view details

push time in a day

PR merged ziglang/zig

fix __chkstk on aarch64

This is a follow up on changes to support aarch64-windows. A previous change added the missing __chkstk symbol, but that symbol wasn't hooked up properly in stack_probe.zig, which resulted in the implementation just being an unreachable. Now it's hooked up properly and it's been tested through a dll that was compiled for and then executed on a Hololens 2 platform.

Note, the __chkstk function is executed during alloca which is called during DllMainCRTStartup in the mingw-w64 implementation.

+18 -14

1 comment

1 changed file

marler8997

pr closed time in a day

push eventziglang/zig

Andrew Kelley

commit sha 1f653b7f8e9e358a5bfe2695a11c01da56f3d5ee

update install_raw_hex standalone test for llvm13

view details

push time in a day

push eventziglang/zig

Jakub Konka

commit sha 819ef521042e7e21db4ab5dd7a0dbe180bd31c57

macho: merge linkWithZld with flush

view details

Jakub Konka

commit sha b20b6d7da9b63783a4f481fd0a4b48a47843abc8

macho: move bit adding rpaths to common codepath

view details

Jakub Konka

commit sha 4c90c1ff63883c2bb8d2baa40e952674daba6814

Merge remote-tracking branch 'origin/master' into zld-incr

view details

Jakub Konka

commit sha a51edc978f90fa3b96e4b1d4886030848f97a7b0

macho: converge populateMetadata with populateMissingMetadata

view details

Jakub Konka

commit sha 52f9b283a77e79f64d3a3b9faf31a07fe350fd8a

macho: fix writeSymbolTable() function After merging `populateMetadata` with `populateMissingMetadata`, it is imperative we clear the number of symbols in `writeSymbolTable`. However, this is hopefully just a temp measure until the convergence of incremental with traditional is complete.

view details

Jakub Konka

commit sha c6ea181e75cc6822edbaceccb11bc3a39484d116

macho: dedup setting entry point logic

view details

Jakub Konka

commit sha 69f42817745a13fc3cc69896cb628a7028696a88

macho: memorize if dyld_stub_binder was already resolved

view details

Jakub Konka

commit sha 8b795fe2ac17466d0bc9de7b494f0cf076d7c46d

macho: parse input files and libs in incremental This converges parsing of linker line in incremental; however, still doesn't save the parsing state between updates.

view details

Jakub Konka

commit sha 790633a2a09164db5985d1c8302a60d3809e5002

macho: use common codepath for resolving dyld_stub_binder

view details

Jakub Konka

commit sha 8167456c58270fe9586ac93dbd6a6ee1a8ae7915

macho: resolve undefs in incremental properly Instead of assuming that every undef extern symbol comes from libSystem, actually perform the check!

view details

Jakub Konka

commit sha 30247fbb6a46231154f051119228829c6a0dfd90

macho: remove redundant writeStubHelperCommon codepath

view details

Jakub Konka

commit sha 153e2317748cff7d59d2709f72fe8b22c14f2a7b

macho: track unresolved externs globally this way we share state between incremental and traditional paths.

view details

Jakub Konka

commit sha 792fd9c4a362f44f900007562504bfaceffbcc82

macho: extract logic for creating and tracking atoms into fn

view details

Jakub Konka

commit sha 2d10c52b3cfac9516f5548b04528bb7c31a0a6e7

macho: create an explicit symbol and atom for dyld entry in __data This way, we will be able to refer to that atom dynamically via relocations rather than requiring hardcoded addressing upfront.

view details

Jakub Konka

commit sha d63d8ae1c00c240ac20836f1b54bff0093edcb61

macho: create __stub_helper preamble atom with relocations to `dyld_private` and `__dyld_stub_binder` symbols making the routine properly dynamic (i.e., making it possible to call the routine before VM allocation takes place).

view details

Jakub Konka

commit sha d61d85abd2b998fea438e7317568537f927fa6a1

macho: implement aarch64 prong of createStubHelperAtom

view details

Jakub Konka

commit sha ea499203fe22dd3cd40753c020794790f32b91be

macho: incrementally write dyld_private and stub_helper atoms By incrementally I mean using the incremental linker machinery and concepts. Currently, lots of repetition but already highlighted a potential problem with resolving relocations for symbols that weren't seen yet but wanting to write the atom to file (before seeing the relevant atoms).

view details

Jakub Konka

commit sha 799c5bb9551dafd76f9d1fce7d3f5a01ac55da83

macho: add routine for creating a dynamic stub_helper atom With this routine, we are now able to freely shift stub_helper section in memory and in file since the VM addressing is now dynamically dependent on the positioning of `__stub_helper` preamble and other sections generated by the linker.

view details

Jakub Konka

commit sha 9e7b2fb894cf4021ec188fbb64b11d750f4354fa

macho: add routine for creating lazy pointer for stub

view details

Jakub Konka

commit sha 876071b50b1d23a59b3d3e5acedf4161029f5f2b

macho: fix writing stubs (on x86_64 only) and lazy ptrs

view details

push time in a day

push eventziglang/zig

Andrew Kelley

commit sha 19691c0b174f283ffe5b6c3fe8533ef458736064

stage2: implement `@fence`

view details

push time in a day

push eventziglang/zig

Jonathan Marler

commit sha e5fd45003e56f152364a4bdc609fda07a6b524fd

azure pipeline fix removal of recently run exe The following is an azure failure that occured Sep 13: del : Cannot remove item D:\a\1\s\sfx.exe: The process cannot access the file 'D:\a\1\s\sfx.exe' because it is being used by another process. Windows will keep a hold of recently run exeutables even after their process has exited. To avoid this I've just removed the deletion of the exe file. It's about 70 MB so it's probably OK.

view details

push time in a day

PR merged ziglang/zig

azure pipeline fix removal of recently run exe

Recently there's been an intermittent build issue on windows, the following are all runs that reproduced it recently:

https://dev.azure.com/ziglang/zig/_build/results?buildId=16801&view=logs&j=3e8797c7-5b0a-5f2c-07a4-1bc5e60a122e&t=e20ebee5-9d72-5103-f7c4-43227f669eab&l=137 https://dev.azure.com/ziglang/zig/_build/results?buildId=16799&view=logs&j=3e8797c7-5b0a-5f2c-07a4-1bc5e60a122e&t=e20ebee5-9d72-5103-f7c4-43227f669eab https://dev.azure.com/ziglang/zig/_build/results?buildId=16798&view=logs&j=3e8797c7-5b0a-5f2c-07a4-1bc5e60a122e&t=e20ebee5-9d72-5103-f7c4-43227f669eab https://dev.azure.com/ziglang/zig/_build/results?buildId=16797&view=logs&j=3e8797c7-5b0a-5f2c-07a4-1bc5e60a122e&t=e20ebee5-9d72-5103-f7c4-43227f669eab https://dev.azure.com/ziglang/zig/_build/results?buildId=16792&view=logs&j=3e8797c7-5b0a-5f2c-07a4-1bc5e60a122e&t=e20ebee5-9d72-5103-f7c4-43227f669eab

del : Cannot remove item D:\a\1\s\sfx.exe: The process cannot access the file 'D:\a\1\s\sfx.exe' because it is being used by another process.

Windows will keep a hold of recently run exeutables even after their process has exited. To avoid this I've just removed the deletion of the exe file. It's about 70 MB so it's probably OK.

+0 -1

0 comment

1 changed file

marler8997

pr closed time in a day

push eventziglang/zig

Michal Ziulek

commit sha e06052f201a63edd772ffade74551d159c7a7784

Added implementation for _fseeki64 and _ftelli64 from mingw-w64 9.0.0 (#9402). (#9766) * Added fseeki64.c from mingw-w64 9.0.0. This file was missing in Zig distribution. This file contains implementation for _fseeki64 and _ftelli64 functions.

view details

push time in a day

issue closedziglang/zig

lld-link error with Zig 0.8.0 on Windows, undefined symbols '_fseeki64' and '_ftelli64'

I'm trying to build this library: zip and prior to 0.8.0 I had no issues, but since I get the following errors on the same system:

lld-link: error: undefined symbol: __declspec(dllimport) _fseeki64
>>> referenced by C:\Users\tiltf\dev\proj\pixi\src\deps\upaya\src\deps\zip\zip\src\zip.c
>>>               C:\Users\tiltf\dev\proj\pixi\zig-cache\o\0089258faf0b49636b95f3ebd593c111\zip.obj

lld-link: error: undefined symbol: __declspec(dllimport) _ftelli64
>>> referenced by C:\Users\tiltf\dev\proj\pixi\src\deps\upaya\src\deps\zip\zip\src\zip.c
>>>               C:\Users\tiltf\dev\proj\pixi\zig-cache\o\0089258faf0b49636b95f3ebd593c111\zip.obj
error: LLDReportedFailure

This is the project if its relevant: pixi

These errors happen regardless of if the project was built using -Dtarget=native-native-msvc or not.

Any information would be amazing! Thanks

closed time in a day

foxnne

push eventziglang/zig

Andrew Kelley

commit sha 2b90e2c2841e805ed1a1c3d16da96eb2fb8cd97d

ci: azure: update to newer msys2 release

view details

push time in a day

push eventziglang/zig

Andrew Kelley

commit sha 0395b35cee8d4082cc40b0dcd0298f797f42309d

stage2: implement cmpxchg and improve comptime eval * Implement Sema for `@cmpxchgWeak` and `@cmpxchgStrong`. Both runtime and comptime codepaths are implement. * Implement Codegen for LLVM backend and C backend. * Add LazySrcLoc.node_offset_builtin_call_argX 3...5 * Sema: rework comptime control flow. - `error.ComptimeReturn` is used to signal that a comptime function call has returned a result (stored in the Inlining struct). `analyzeCall` notices this and handles the result. - The ZIR instructions `break_inline`, `block_inline`, `condbr_inline` are now redundant and can be deleted. `break`, `block`, and `condbr` function equivalently inside a comptime scope. - The ZIR instructions `loop` and `repeat` also are modified to directly perform comptime control flow inside a comptime scope, skipping an unnecessary mechanism for analysis of runtime code. This makes Zig perform closer to an interpreter when evaluating comptime code. * Sema: zirRetErrValue looks at Sema.ret_fn_ty rather than sema.func for adding to the inferred error set. This fixes a bug for inlined/comptime function calls. * Implement ZIR printing for cmpxchg. * stage1: make cmpxchg respect --single-threaded - Our LLVM C++ API wrapper failed to expose this boolean flag before. * Fix AIR printing for struct fields showing incorrect liveness data.

view details

push time in 2 days

issue closedziglang/zig

implement ".." (parent directory) for std.fs.Dir.openDir on Windows

https://github.com/ziglang/zig/blob/e839250c5156d438f76e7b08e7053e9087fae77c/lib/std/fs.zig#L768-L772

example zig code:

const std = @import("std");

pub fn main() anyerror!void {
    var it = try std.fs.walkPath(std.heap.direct_allocator, "..");
    while (try it.next()) |entry| {
        std.debug.warn("{}\n", entry.path);
    }
}
> zig.exe build-exe test.zig
> test.exe 
TODO opening '..' with a relative directory handle is not yet implemented on Windows

closed time in 2 days

andrewrk

issue commentziglang/zig

introduce labeled continue syntax inside a switch expression

I'm inclined to accept this proposal. Regardless of performance improvements, this provides a useful, intuitive tool for control flow. Another observation is that when the operand of continue :sw operand is comptime-known, this would be lowered as a direct jump to another switch prong, effectively providing the desired control flow requested in #5950.

This even would allow someone to implement Duff's Device in zig:

fn send(to: *volatile u32, from_start: [*]u32, count: u32) void {
    var from = from_start;
    var n = (count + 7) / 8;
    sw: switch (count % 8) {
        0 => {
            to.* = from[0];
            from += 1;
            continue :sw 7;
        },
        7 => {
            to.* = from[0];
            from += 1;
            continue :sw 6;
        },
        6 => {
            to.* = from[0];
            from += 1;
            continue :sw 5;
        },
        5 => {
            to.* = from[0];
            from += 1;
            continue :sw 4;
        },
        4 => {
            to.* = from[0];
            from += 1;
            continue :sw 3;
        },
        3 => {
            to.* = from[0];
            from += 1;
            continue :sw 2;
        },
        2 => {
            to.* = from[0];
            from += 1;
            continue :sw 1;
        },
        1 => {
            to.* = from[0];
            from += 1;
            n -= 1;
            if (n > 0) continue :sw 0;
        },
    }
}

Reference example in C:

send(to, from, count)
register short *to, *from;
register count;
{
    register n = count / 8;
    do {
        *to = *from++;
        *to = *from++;
        *to = *from++;
        *to = *from++;
        *to = *from++;
        *to = *from++;
        *to = *from++;
        *to = *from++;
    } while (--n > 0);
}

With #7224 it could even be shortened to this:

fn send(to: *volatile u32, from_start: [*]u32, count: u32) void {
    var from = from_start;
    var n = (count + 7) / 8;
    sw: switch (count % 8) {
        inline 0...7 => |remainder| {
            to.* = from[0];
            from += 1;
            if (remainder == 1) {
                n -= 1;
                if (n <= 0) break :sw;
            }
            continue :sw @as(u3, remainder) -% 1;
        },
    }
}

What's interesting about this is that it lowers to the same machine code as the C version, even in debug mode.

andrewrk

comment created time in 2 days

pull request commentziglang/zig

Fix windows.WSAIoctl() OVERLAPPED argument types

Thanks!

PhaseMage

comment created time in 2 days

push eventziglang/zig

Travis Martin

commit sha 5d14590ed15ce23e7ef8032f8075dcfe76ba9dd8

Remove WIN16 version of WSAOVERLAPPED. Use LPWSAOVERLAPPED_COMPLETION_ROUTINE

view details

push time in 2 days

PR merged ziglang/zig

Fix windows.WSAIoctl() OVERLAPPED argument types

The std.os.windows.WSAIoctl() function has incorrect types and doesn't compile.

This change removes the old WIN16 version of WSAOVERLAPPED. The correct version is OVERLAPPED (with DWORD_PTR fields instead of DWORD).

Also, this fixes std.os.windows.WSAIoctl to add the required "LP" for WSAOVERLAPPED_COMPLETION_ROUTINE.

+2 -10

0 comment

2 changed files

PhaseMage

pr closed time in 2 days

push eventziglang/zig

Andrew Kelley

commit sha 264acfdf3caef663cddc39c2bf83818abb0e0073

stage2: fix incorrect spelling of AtomicOrder

view details

push time in 3 days

push eventziglang/zig

Andrew Kelley

commit sha 97d69e3352ab50f88580c383b5f375b0edadacfd

stage2: add array_to_slice AIR instruction

view details

push time in 3 days

push eventziglang/zig

Andrew Kelley

commit sha a9a21c59888905e060915dee818633110cc54cfa

stage2: Type/Value use an enum rather than usize Makes debugging nicer when you want to look at Type/Value

view details

push time in 3 days

push eventziglang/zig

Andrew Kelley

commit sha 5529febab056c870f7b2a123b0645b5e3b1146c9

stage2: implement Value.copy for structs and unions The stage2_os hack inside `@import("builtin")` is no longer needed.

view details

push time in 3 days