mirror of
https://github.com/ziglang/zig.git
synced 2024-11-16 09:03:12 +00:00
disable runtime safety in std.io.InStream
Let's not be writing 0xaa in safe modes for upwards of 4 MiB for every stream read. This is equivalent to the fact that we don't memset the entire call stack to 0xaa for every function call.
This commit is contained in:
parent
c9b2210fcf
commit
67491a4222
@ -32,10 +32,10 @@ pub fn InStream(comptime ReadError: type) type {
|
||||
/// End of stream is not an error condition.
|
||||
pub fn read(self: *Self, buffer: []u8) Error!usize {
|
||||
if (std.io.is_async) {
|
||||
// Let's not be writing 0xaa in safe modes for upwards of 4 MiB for every stream read.
|
||||
@setRuntimeSafety(false);
|
||||
var stack_frame: [stack_size]u8 align(stack_align) = undefined;
|
||||
// TODO https://github.com/ziglang/zig/issues/3068
|
||||
var result: Error!usize = undefined;
|
||||
return await @asyncCall(&stack_frame, &result, self.readFn, self, buffer);
|
||||
return await @asyncCall(&stack_frame, {}, self.readFn, self, buffer);
|
||||
} else {
|
||||
return self.readFn(self, buffer);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user