Skip to content

Instantly share code, notes, and snippets.

View mikdusan's full-sized avatar

Michael Dusan mikdusan

View GitHub Profile
@mikdusan
mikdusan / .diff
Created March 2, 2021 22:54
zig test test/stage1/behavior.zig -target aarch64-linux-none --verbose-llvm-cpu-features
--- a1.flags 2021-03-02 17:52:38.811747918 -0500
+++ b1.flags 2021-03-02 17:52:43.179991504 -0500
@@ -1,4 +1,3 @@
--a35
-a65
-a76
-aes
@@ -7,8 +6,6 @@
-altnzcv
-am
@mikdusan
mikdusan / gist:33adbe85a030ff57f56d4a2c2167cb1e
Created March 2, 2021 00:11
llvm12: os.linux.io_uring.test "std-native-Debug-bare-single timeout
Test [476/1747] os.linux.io_uring.test "std-native-Debug-bare-single timeout (af... panic: actual 1.6e+01, not within margin 5.0e+00 of expected 1.0e+01
/home/mike/project/zig/work/llvm12/lib/std/testing.zig:215:32: 0x4d56e2 in testing.expectWithinMargin (test)
std.debug.panic("actual {}, not within margin {} of expected {}", .{ actual, margin, expected });
^
/home/mike/project/zig/work/llvm12/lib/std/os/linux/io_uring.zig:1356:31: 0x3ef471 in os.linux.io_uring.test "std-native-Debug-bare-single timeout (after a relative time)" (test)
testing.expectWithinMargin(@intToFloat(f64, ms), @intToFloat(f64, stopped - started), margin);
^
/home/mike/project/zig/work/llvm12/lib/std/special/test_runner.zig:69:28: 0x497d7c in std.special.main (test)
} else test_fn.func();
^
@mikdusan
mikdusan / doit.zig
Last active February 26, 2021 05:31
const Foo = struct {
a: u32 = 0,
b: u32 = 0,
c: u32 = 0,
d: u32 = 0,
e: u32 = 0,
f: u32 = 0,
g: u32 = 0,
};
@mikdusan
mikdusan / tryimport.zig
Last active February 25, 2021 05:01
tryImport musings
// A future version of zig is self-hosting and has a low-latency backend
// for x86_64 and arch64.
//
// A variant of zig may be built with LLVM-backend and this is our
// use-case: build zig w/ LLVM-backend.
// start point:
// → zig binary installation `/opt/zig/{bin,lib}`
// → zig source git worktree `/project/zig`
@mikdusan
mikdusan / package_01.md
Last active February 24, 2021 17:03
package musings
// Example where we are intending to publish ourselves as a package,
// and are using another published package commonly called "alt".
//
// For this proposal we select ed25519 with SIGN and AUTHENTICATE capabilities to use
// as the basis for universal identities. The pubkey _IS_ the identifier of this package.
// Any .zig `@package()` statements contained in our sources will be SIGNED by out pubkey.
//
// The idea is any person anywhere can generate their own ed25519 identity and self-sign
[01e89c917] tiberius▸ zig version
0.8.0-dev.1296+01e89c917
[01e89c917] tiberius▸ zig build test-translate-c test-run-translated-c
thread 200933 panic: reached unreachable code
/Users/mike/project/zig/work/main/lib/std/zig/ast.zig:1821:13: 0x10e138042 in std.zig.ast.Tree.fullFnProto (zig1)
.lib_name = null,
^
/Users/mike/project/zig/work/main/lib/std/fmt.zig:219:13: 0x10e6d53d6 in std.fmt.format (zig1)
try writer.writeAll(fmt[start_index..end_index]);
^
@mikdusan
mikdusan / 7812.md
Last active February 13, 2021 04:59

REVISION 3 - Friday 2021-02-12

note: changelog is at bottom of document
note: co-author @marler8997

The primary goal of this proposal is to lexically distinguish error control-flow from regular flow-control:

  1. return statements do not effect error flow-control or error-stack changes
  2. replace current return error.BadValue; with throw error.BadValue;
diff --git a/lib/std/target/powerpc.zig b/lib/std/target/powerpc.zig
index 2ec559ca6..2db7d30e8 100644
--- a/lib/std/target/powerpc.zig
+++ b/lib/std/target/powerpc.zig
@@ -760,7 +760,7 @@ pub const cpu = struct {
};
pub const ppc32 = CpuModel{
.name = "ppc32",
- .llvm_name = "ppc32",
+ .llvm_name = "ppc",
@mikdusan
mikdusan / archlinux.sh
Created January 18, 2021 16:30
build minimal llvm+clang+lld - needs a big llvm-project clone at __SOURCE
#!/usr/bin/env bash
set -e
################################################################################
#
# note: if building with gcc you might need ~1.5-2.0 GiB per concurrent job
#
# apt install git vim ruby cmake ninja-build
#
@mikdusan
mikdusan / foo.zig
Last active January 17, 2021 13:27
raw test harness
const std = @import("std");
const tester = @import("tester.zig");
pub fn main() !void {
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer arena.deinit();
const allocator = &arena.allocator;
var tests = tester.TestList.init(allocator);