Skip to content

Commit c9aa45f

Browse files
committed
Update Zig to 0.16.0
it complains about its own generated code with ReleaseSafe optimize option, therefore we use ReleaseFast -- YOLO
1 parent 7931bfe commit c9aa45f

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ env:
1111
ICE_ADAPTER_VERSION: 3.3.12
1212
BUILD_VERSION: ${{ github.event.inputs.version }}
1313
PYTHON_VERSION: 3.14
14-
ZIG_VERSION: 0.15.2
14+
ZIG_VERSION: 0.16.0
1515
JAVA_DISTRIBUTION: "oracle"
1616
JAVA_VERSION: 25
1717

@@ -67,7 +67,7 @@ jobs:
6767
Write-Host "LIBPY=$LIBPY"
6868
$INCLUDEPY = $(python -c "import sysconfig; print(sysconfig.get_config_var('INCLUDEPY'))")
6969
Write-Host "INCLUDEPY=$INCLUDEPY"
70-
zig build-lib -dynamic -lc -lpython3 -I"$INCLUDEPY" -L"$LIBPY" -O ReleaseSafe --name zigfafreplay src/replays/zigparser/zigfafreplay.zig
70+
zig build-lib -dynamic -lc -lpython3 -I"$INCLUDEPY" -L"$LIBPY" -O ReleaseFast --name zigfafreplay src/replays/zigparser/zigfafreplay.zig
7171
move zigfafreplay.dll zigfafreplay.pyd
7272
7373
@@ -167,7 +167,7 @@ jobs:
167167
echo "LIBPY=$LIBPY"
168168
INCLUDEPY=$(python3 -c "import sysconfig; print(sysconfig.get_config_var('INCLUDEPY'))")
169169
echo "INCLUDEPY=$INCLUDEPY"
170-
zig build-lib -dynamic -lc -lpython$PYTHON_VERSION -I$INCLUDEPY -L$LIBPY -O ReleaseSafe --name zigfafreplay src/replays/zigparser/zigfafreplay.zig
170+
zig build-lib -dynamic -lc -lpython$PYTHON_VERSION -I$INCLUDEPY -L$LIBPY -O ReleaseFast --name zigfafreplay src/replays/zigparser/zigfafreplay.zig
171171
mv libzigfafreplay.so zigfafreplay.so
172172
173173
- name: Shrink scipy dependency

src/replays/zigparser/decompressor.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ pub fn decompress(compressed: []u8, allocator: Allocator) !structs.Preprocessed
3333
return .{ .metadata = metadata, .data = data };
3434
}
3535

36-
pub fn decompress_file(path: []const u8, allocator: Allocator) !structs.Preprocessed {
37-
const replay = try std.fs.cwd().readFileAlloc(allocator, path, 0x20000000);
36+
pub fn decompress_file(io: std.Io, path: []const u8, allocator: Allocator) !structs.Preprocessed {
37+
const replay = try std.Io.Dir.cwd().readFileAlloc(io, path, allocator, .limited(0x20000000));
3838
defer allocator.free(replay);
3939
return try decompress(replay, allocator);
4040
}

src/replays/zigparser/zigfafreplay.zig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ const decompressor = @import("decompressor.zig");
66
const parser = @import("parser.zig");
77
const structs = @import("structs.zig");
88

9+
var threaded: std.Io.Threaded = .init_single_threaded;
10+
const io = threaded.io();
11+
912
fn parse_replaydata(_: [*c]py.PyObject, args: [*c]py.PyObject) callconv(.c) [*c]py.PyObject {
1013
var buf: py.Py_buffer = undefined;
1114
if (py.PyArg_ParseTuple(args, "y*", &buf) == 0) {
@@ -74,7 +77,7 @@ fn parse_file(_: [*c]py.PyObject, args: [*c]py.PyObject) callconv(.c) [*c]py.PyO
7477
const size: usize = @intCast(buf.len);
7578
const path: []u8 = @as([*]u8, @ptrCast(buf.buf))[0..size];
7679

77-
const preprocessed = decompressor.decompress_file(path, allocator) catch return py.Py_BuildValue("");
80+
const preprocessed = decompressor.decompress_file(io, path, allocator) catch return py.Py_BuildValue("");
7881
defer preprocessed.deinit(allocator);
7982

8083
var replay_parser = parser.parse(preprocessed.data, allocator) catch |err| {

0 commit comments

Comments
 (0)