diff options
author | Kartik Agaram <vc@akkartik.com> | 2018-06-16 23:19:59 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2018-06-16 23:19:59 -0700 |
commit | b89b822439f47a490a1b764e14a1ed1b73059cba (patch) | |
tree | 8c01baef90f26f7797e2feb535bb8ccd4decd27e /037abandon.cc | |
parent | 5859d7056c951e56e3db760202801135784b4e5c (diff) | |
download | mu-b89b822439f47a490a1b764e14a1ed1b73059cba.tar.gz |
4260 - make address coercions explicit
'deaddress' is a terrible name. Hopefully I'll come up with something better.
Diffstat (limited to '037abandon.cc')
-rw-r--r-- | 037abandon.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/037abandon.cc b/037abandon.cc index 5a4adbd1..d863b819 100644 --- a/037abandon.cc +++ b/037abandon.cc @@ -3,10 +3,10 @@ :(scenario new_reclaim) def main [ 1:address:num <- new number:type - 2:num <- copy 1:address:num # because 1 will get reset during abandon below + 2:num <- deaddress 1:address:num # because 1 will get reset during abandon below abandon 1:address:num 3:address:num <- new number:type # must be same size as abandoned memory to reuse - 4:num <- copy 3:address:num + 4:num <- deaddress 3:address:num 5:bool <- equal 2:num, 4:num ] # both allocations should have returned the same address @@ -80,10 +80,10 @@ if (get_or_insert(Current_routine->free_list, size)) { :(scenario new_differing_size_no_reclaim) def main [ 1:address:num <- new number:type - 2:num <- copy 1:address:num + 2:num <- deaddress 1:address:num abandon 1:address:num 3:address:array:num <- new number:type, 2 # different size - 4:num <- copy 3:address:array:num + 4:num <- deaddress 3:address:array:num 5:bool <- equal 2:num, 4:num ] # no reuse @@ -92,10 +92,10 @@ def main [ :(scenario new_reclaim_array) def main [ 1:address:array:num <- new number:type, 2 - 2:num <- copy 1:address:array:num + 2:num <- deaddress 1:address:array:num abandon 1:address:array:num 3:address:array:num <- new number:type, 2 # same size - 4:num <- copy 3:address:array:num + 4:num <- deaddress 3:address:array:num 5:bool <- equal 2:num, 4:num ] # both calls to new returned identical addresses |