adjust runtime page size APIs
* fix merge conflicts * rename the declarations * reword documentation * extract FixedBufferAllocator to separate file * take advantage of locals * remove the assertion about max alignment in Allocator API, leaving it Allocator implementation defined * fix non-inline function call in start logic The GeneralPurposeAllocator implementation is totally broken because it uses global state but I didn't address that in this commit.
This commit is contained in:
@@ -7,7 +7,7 @@ const native_os = builtin.os.tag;
|
||||
const std = @import("../std.zig");
|
||||
const posix = std.posix;
|
||||
const File = std.fs.File;
|
||||
const min_page_size = std.heap.min_page_size;
|
||||
const page_size_min = std.heap.page_size_min;
|
||||
|
||||
const MemoryAccessor = @This();
|
||||
|
||||
@@ -96,7 +96,7 @@ pub fn isValidMemory(address: usize) bool {
|
||||
const page_size = std.heap.pageSize();
|
||||
const aligned_address = address & ~(page_size - 1);
|
||||
if (aligned_address == 0) return false;
|
||||
const aligned_memory = @as([*]align(min_page_size) u8, @ptrFromInt(aligned_address))[0..page_size];
|
||||
const aligned_memory = @as([*]align(page_size_min) u8, @ptrFromInt(aligned_address))[0..page_size];
|
||||
|
||||
if (native_os == .windows) {
|
||||
const windows = std.os.windows;
|
||||
|
||||
Reference in New Issue
Block a user