summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2018-06-03 17:44:08 -0700
committerOri Bernstein <ori@eigenstate.org>2018-06-03 17:44:08 -0700
commitaa40fda4e41feafd05bf777a969aa2b4b6c7f070 (patch)
tree0d7207b586f759997558ccd32b13a5077ca86c85
parentf75a890bab649f57ee1f2cfffec8c74cc8b0ed49 (diff)
downloadmc-aa40fda4e41feafd05bf777a969aa2b4b6c7f070.tar.gz
Export bytealloc/zbytealloc for users.
It's occasionally useful.
-rw-r--r--lib/std/alloc.myr4
-rw-r--r--lib/std/bytealloc.myr18
2 files changed, 11 insertions, 11 deletions
diff --git a/lib/std/alloc.myr b/lib/std/alloc.myr
index 15c1f92..c3e64f7 100644
--- a/lib/std/alloc.myr
+++ b/lib/std/alloc.myr
@@ -120,7 +120,7 @@ const checkhdr = {p
generic slfree = {sl
var head, sz
- if (sl : byte#) == Zsliceptr
+ if (sl : byte#) == Zslicep
-> void
;;
@@ -139,7 +139,7 @@ generic slgrow = {sl : @a[:]#, len
/* if the slice doesn't need a bigger bucket, we don't need to realloc. */
cap = 0
- if (sl# : byte#) != Zsliceptr
+ if (sl# : byte#) != Zslicep
cap = slcap((sl# : byte#))
;;
if cap >= len*sizeof(@a)
diff --git a/lib/std/bytealloc.myr b/lib/std/bytealloc.myr
index 3a0d2e3..b2f828f 100644
--- a/lib/std/bytealloc.myr
+++ b/lib/std/bytealloc.myr
@@ -15,16 +15,16 @@ pkg std =
const startalloctrace : (f : byte[:] -> void)
const endalloctrace : (-> void)
+ const bytealloc : (sz:size -> byte#)
+ const zbytealloc : (sz:size -> byte#)
+ const bytefree : (m:byte#, sz:size -> void)
+
/* null pointers. only used internally. */
- pkglocal const Zsliceptr = (0 : byte#)
- pkglocal const Align = 16 /* minimum allocation alignment */
-
- /* exported for testing */
- const bytealloc : (sz:size -> byte#)
- const bytefree : (m:byte#, sz:size -> void)
- pkglocal const zbytealloc : (sz:size -> byte#)
- pkglocal const align : (m : std.size, align : std.size -> std.size)
- pkglocal const allocsz : (sz : std.size -> std.size)
+ pkglocal const Zslicep = (0 : byte#)
+ pkglocal const Align = 16 /* minimum allocation alignment */
+
+ pkglocal const align : (m : std.size, align : std.size -> std.size)
+ pkglocal const allocsz : (sz : std.size -> std.size)
;;