| ... | @@ -7652,7 +7652,7 @@ mem.set(u8, dest, c);{#endsyntax#}</pre> | ... | @@ -7652,7 +7652,7 @@ mem.set(u8, dest, c);{#endsyntax#}</pre> |
| 7652 | <p> | 7652 | <p> |
| 7653 | This function is a low level intrinsic with no safety mechanisms usually useful for allocator | 7653 | This function is a low level intrinsic with no safety mechanisms usually useful for allocator |
| 7654 | designers targeting Wasm. So unless you are writing a new allocator from scratch, you should use | 7654 | designers targeting Wasm. So unless you are writing a new allocator from scratch, you should use |
| 7655 | something like {#syntax#}@import("std").heap.WasmAllocator{#endsyntax#}. | 7655 | something like {#syntax#}@import("std").heap.WasmPageAllocator{#endsyntax#}. |
| 7656 | </p> | 7656 | </p> |
| 7657 | {#see_also|@wasmMemoryGrow#} | 7657 | {#see_also|@wasmMemoryGrow#} |
| 7658 | {#header_close#} | 7658 | {#header_close#} |
| ... | @@ -7668,13 +7668,16 @@ mem.set(u8, dest, c);{#endsyntax#}</pre> | ... | @@ -7668,13 +7668,16 @@ mem.set(u8, dest, c);{#endsyntax#}</pre> |
| 7668 | <p> | 7668 | <p> |
| 7669 | This function is a low level intrinsic with no safety mechanisms usually useful for allocator | 7669 | This function is a low level intrinsic with no safety mechanisms usually useful for allocator |
| 7670 | designers targeting Wasm. So unless you are writing a new allocator from scratch, you should use | 7670 | designers targeting Wasm. So unless you are writing a new allocator from scratch, you should use |
| 7671 | something like {#syntax#}@import("std").heap.WasmAllocator{#endsyntax#}. | 7671 | something like {#syntax#}@import("std").heap.WasmPageAllocator{#endsyntax#}. |
| 7672 | </p> | 7672 | </p> |
| 7673 | {#code_begin|test#} | 7673 | {#code_begin|test#} |
| 7674 | const std = @import("std"); | 7674 | const std = @import("std"); |
| | 7675 | const builtin = @import("builtin"); |
| 7675 | const assert = std.debug.assert; | 7676 | const assert = std.debug.assert; |
| 7676 | | 7677 | |
| 7677 | test "@wasmMemoryGrow" { | 7678 | test "@wasmMemoryGrow" { |
| | 7679 | if (builtin.arch != .wasm32) return error.SkipZigTest; |
| | 7680 | |
| 7678 | var prev = @wasmMemorySize(0); | 7681 | var prev = @wasmMemorySize(0); |
| 7679 | assert(prev == @wasmMemoryGrow(0, 1)); | 7682 | assert(prev == @wasmMemoryGrow(0, 1)); |
| 7680 | assert(prev + 1 == @wasmMemorySize(0)); | 7683 | assert(prev + 1 == @wasmMemorySize(0)); |