| ... | @@ -20,23 +20,20 @@ ptr: *anyopaque, | ... | @@ -20,23 +20,20 @@ ptr: *anyopaque, |
| 20 | vtable: *const VTable, | 20 | vtable: *const VTable, |
| 21 | | 21 | |
| 22 | pub const VTable = struct { | 22 | pub const VTable = struct { |
| 23 | /// Allocate exactly `len` bytes aligned to `alignment`, or return `null` | 23 | /// Return a pointer to `len` bytes with specified `alignment`, or return |
| 24 | /// indicating the allocation failed. | 24 | /// `null` indicating the allocation failed. |
| 25 | /// | 25 | /// |
| 26 | /// `ret_addr` is optionally provided as the first return address of the | 26 | /// `ret_addr` is optionally provided as the first return address of the |
| 27 | /// allocation call stack. If the value is `0` it means no return address | 27 | /// allocation call stack. If the value is `0` it means no return address |
| 28 | /// has been provided. | 28 | /// has been provided. |
| 29 | /// | | |
| 30 | /// The returned slice of memory must have been `@memset` to `undefined` | | |
| 31 | /// by the allocator implementation. | | |
| 32 | alloc: *const fn (*anyopaque, len: usize, alignment: Alignment, ret_addr: usize) ?[*]u8, | 29 | alloc: *const fn (*anyopaque, len: usize, alignment: Alignment, ret_addr: usize) ?[*]u8, |
| 33 | | 30 | |
| 34 | /// Attempt to expand or shrink memory in place. | 31 | /// Attempt to expand or shrink memory in place. |
| 35 | /// | 32 | /// |
| 36 | /// `memory.len` must equal the length requested from the most recent | 33 | /// `memory.len` must equal the length requested from the most recent |
| 37 | /// successful call to `alloc` or `resize`. `alignment` must equal the same | 34 | /// successful call to `alloc`, `resize`, or `remap`. `alignment` must |
| 38 | /// value that was passed as the `alignment` parameter to the original | 35 | /// equal the same value that was passed as the `alignment` parameter to |
| 39 | /// `alloc` call. | 36 | /// the original `alloc` call. |
| 40 | /// | 37 | /// |
| 41 | /// A result of `true` indicates the resize was successful and the | 38 | /// A result of `true` indicates the resize was successful and the |
| 42 | /// allocation now has the same address but a size of `new_len`. `false` | 39 | /// allocation now has the same address but a size of `new_len`. `false` |
| ... | @@ -53,9 +50,9 @@ pub const VTable = struct { | ... | @@ -53,9 +50,9 @@ pub const VTable = struct { |
| 53 | /// Attempt to expand or shrink memory, allowing relocation. | 50 | /// Attempt to expand or shrink memory, allowing relocation. |
| 54 | /// | 51 | /// |
| 55 | /// `memory.len` must equal the length requested from the most recent | 52 | /// `memory.len` must equal the length requested from the most recent |
| 56 | /// successful call to `alloc` or `resize`. `alignment` must equal the same | 53 | /// successful call to `alloc`, `resize`, or `remap`. `alignment` must |
| 57 | /// value that was passed as the `alignment` parameter to the original | 54 | /// equal the same value that was passed as the `alignment` parameter to |
| 58 | /// `alloc` call. | 55 | /// the original `alloc` call. |
| 59 | /// | 56 | /// |
| 60 | /// A non-`null` return value indicates the resize was successful. The | 57 | /// A non-`null` return value indicates the resize was successful. The |
| 61 | /// allocation may have same address, or may have been relocated. In either | 58 | /// allocation may have same address, or may have been relocated. In either |
| ... | @@ -73,11 +70,10 @@ pub const VTable = struct { | ... | @@ -73,11 +70,10 @@ pub const VTable = struct { |
| 73 | | 70 | |
| 74 | /// Free and invalidate a region of memory. | 71 | /// Free and invalidate a region of memory. |
| 75 | /// | 72 | /// |
| 76 | /// `memory.len` must equal the most recent length returned by `alloc` or | 73 | /// `memory.len` must equal the length requested from the most recent |
| 77 | /// given to a successful `resize` call. | 74 | /// successful call to `alloc`, `resize`, or `remap`. `alignment` must |
| 78 | /// | 75 | /// equal the same value that was passed as the `alignment` parameter to |
| 79 | /// `alignment` must equal the same value that was passed as the | 76 | /// the original `alloc` call. |
| 80 | /// `alignment` parameter to the original `alloc` call. | | |
| 81 | /// | 77 | /// |
| 82 | /// `ret_addr` is optionally provided as the first return address of the | 78 | /// `ret_addr` is optionally provided as the first return address of the |
| 83 | /// allocation call stack. If the value is `0` it means no return address | 79 | /// allocation call stack. If the value is `0` it means no return address |