Skip to content

Instantly share code, notes, and snippets.

View kubkon's full-sized avatar

Jakub Konka kubkon

View GitHub Profile
@kubkon
kubkon / tapi.patch
Created August 9, 2023 20:22
If anyone is crazy enough to wanting to build Apple's TAPI project from source, here's the patch...
diff --git a/tools/tapi-binary-reader/CMakeLists.txt b/tools/tapi-binary-reader/CMakeLists.txt
index d3722ac..4f1f6b7 100644
--- a/tools/tapi-binary-reader/CMakeLists.txt
+++ b/tools/tapi-binary-reader/CMakeLists.txt
@@ -11,6 +11,7 @@ add_tapi_executable(tapi-binary-reader
target_link_libraries(tapi-binary-reader
PRIVATE
tapiCore
+ tapiObjCMetadata
)
@kubkon
kubkon / stage3.ll
Created March 15, 2023 18:33
Stage3 vs stage4 on x86_64-macos
; Function Attrs: nounwind
define internal fastcc void @Sema.fieldPtr(ptr noalias nonnull writeonly %0, ptr nonnull align 8 %1, ptr nonnull align 8 %2, ptr nonnull readonly align 4 %3, i32 %4, ptr nonnull readonly align 1 %5, i64 %6, ptr nonnull readonly align 4 %7, i1 %8) unnamed_addr #1 {
Entry:
%9 = alloca %Air, align 8
%10 = alloca { { ptr, i64 }, i16, [6 x i8] }, align 8
%.sroa.7.i = alloca [3 x i8], align 1
%11 = alloca %mem.Allocator, align 8
%12 = alloca { ptr, i16, [6 x i8] }, align 8
%13 = alloca %heap.arena_allocator.ArenaAllocator, align 8
%14 = alloca %heap.arena_allocator.ArenaAllocator, align 8
const std = @import("std");
const math = std.math;
pub fn main() void {
const size: u32 = 1198;
std.debug.print("{d} => {d}\n", .{ size, capacityForSize(size) });
}
fn capacityForSize(size: u32) u32 {
const min_cap = math.cast(u32, @as(u64, size) * 4 / 3) orelse unreachable;
@kubkon
kubkon / gist:ee876e5193929bb7e538b1c34a8279ab
Created August 18, 2022 14:06
test-behavior output on Windows
Test [3/1351] behavior.align.test "behavior-i386-windows-msvc-Debug-bare-multi-default slicing a... SKIP
Test [8/1351] behavior.align.test "behavior-i386-windows-msvc-Debug-bare-multi-default alignment... SKIP
Test [17/1351] behavior.align.test "behavior-i386-windows-msvc-Debug-bare-multi-default implicit... SKIP
Test [18/1351] behavior.align.test "behavior-i386-windows-msvc-Debug-bare-multi-default @alignCa... SKIP
Test [20/1351] behavior.align.test "behavior-i386-windows-msvc-Debug-bare-multi-default function... SKIP
Test [22/1351] behavior.align.test "behavior-i386-windows-msvc-Debug-bare-multi-default alignmen... SKIP
Test [27/1351] behavior.align.test "behavior-i386-windows-msvc-Debug-bare-multi-default align(N)... SKIP
Test [39/1351] behavior.array.test "behavior-i386-windows-msvc-Debug-bare-multi-default array wi... SKIP
Test [125/1351] SKIP (async test)
Test [133/1351] behavior.atomics.test "behavior-i386-windows-msvc-Debug-bare-multi-default 128-b... SKIP
@kubkon
kubkon / wasi_example.sh
Created June 5, 2021 07:28
zig cc -target wasm32-wasi example
cat > hello.c<< EOF
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
int main(int argc, char **argv) {
ssize_t n, m;
❯ cat config.h
/*
* Copyright (c) 2016 Andrew Kelley
*
* This file is part of zig, which is MIT licensed.
* See http://opensource.org/licenses/MIT
*/
#ifndef ZIG_CONFIG_H
#define ZIG_CONFIG_H
❯ cat config.h
/*
* Copyright (c) 2016 Andrew Kelley
*
* This file is part of zig, which is MIT licensed.
* See http://opensource.org/licenses/MIT
*/
#ifndef ZIG_CONFIG_H
#define ZIG_CONFIG_H
fs.test.test "std-i386-linux-none-Debug-bare-multi fs.copyFile"... FAIL (Unseekable)
/home/kubkon/dev/zig/lib/std/fs.zig:1439:25: 0x97dc6d in fs.Dir.deleteFileZ (test)
else => |e| return e,
^
/home/kubkon/dev/zig/lib/std/fs.zig:1418:13: 0x74bfac in fs.Dir.deleteFile (test)
return self.deleteFileZ(&sub_path_c);
^
/home/kubkon/dev/zig/lib/std/os.zig:1902:19: 0xa1cd87 in os.unlinkatZ (test)
EISDIR => return error.IsDir,
^
@kubkon
kubkon / fd_readdir_v0.22.1
Last active May 11, 2021 08:19
fd_readdir in wasmtime v0.22.1
DEBUG wasi_common::ctx > WasiCtx inserting entry pending=PendingEntry::Thunk(0x7ffc451ce240)
DEBUG wasi_common::sys::unix > Host fd 0 is a char device
DEBUG wasi_common::ctx > WasiCtx inserted fd=Fd(0)
DEBUG wasi_common::ctx > WasiCtx inserting entry pending=PendingEntry::Thunk(0x7ffc451ce240)
DEBUG wasi_common::sys::unix > Host fd 1 is a file
DEBUG wasi_common::ctx > WasiCtx inserted fd=Fd(1)
DEBUG wasi_common::ctx > WasiCtx inserting entry pending=PendingEntry::Thunk(0x7ffc451ce240)
DEBUG wasi_common::sys::unix > Host fd 2 is a file
DEBUG wasi_common::ctx > WasiCtx inserted fd=Fd(2)
DEBUG wasi_common::ctx > WasiCtx inserted fd=Fd(3)
@kubkon
kubkon / fd_readdir_v0.26
Created May 11, 2021 08:18
fd_readdir - wasmtime v0.26.0
TRACE wasi_common::snapshots::preview_1::wasi_snapshot_preview1 > wiggle abi; module="wasi_snapshot_preview1" function="random_get"
TRACE wasi_common::snapshots::preview_1::wasi_snapshot_preview1 > buf=*guest 0xffed0 buf_len=48
TRACE wasi_common::snapshots::preview_1::wasi_snapshot_preview1 > result=Ok(())
TRACE wasi_common::snapshots::preview_1::wasi_snapshot_preview1 > wiggle abi; module="wasi_snapshot_preview1" function="fd_prestat_get"
TRACE wasi_common::snapshots::preview_1::wasi_snapshot_preview1 > fd=Fd(3)
TRACE wasi_common::snapshots::preview_1::wasi_snapshot_preview1 > result=Ok(Dir(PrestatDir { pr_name_len: 1 }))
TRACE wasi_common::snapshots::preview_1::wasi_snapshot_preview1 > wiggle abi; module="wasi_snapshot_preview1" function="fd_prestat_dir_name"
TRACE wasi_common::snapshots::preview_1::wasi_snapshot_preview1 > fd=Fd(3) path=*guest 0x110000 path_len=1
TRACE wasi_common::snapshots::preview_1::wasi_snapshot_preview1 > result=Ok(())
TRACE wasi_common::snapshots::preview_1::wasi_sna