use zig's decref instead of an LLVM implementation

This commit is contained in:
Folkert 2021-09-01 16:58:05 +02:00
parent 59c63ef3a8
commit 5cb7dbd3cc
5 changed files with 34 additions and 104 deletions

View file

@ -104,6 +104,18 @@ pub const IntWidth = enum(u8) {
Usize,
};
pub fn decrefC(
bytes_or_null: ?[*]u8,
data_bytes: usize,
alignment: u32,
) callconv(.C) void {
// IMPORTANT: bytes_or_null is this case is expected to be a pointer to the refcount
// (NOT the start of the data, or the start of the allocation)
if (bytes_or_null) |bytes| {
return @call(.{ .modifier = always_inline }, decref, .{ bytes + @sizeOf(usize), data_bytes, alignment });
}
}
pub fn decref(
bytes_or_null: ?[*]u8,
data_bytes: usize,