diff options
author | Kartik Agaram <vc@akkartik.com> | 2018-06-15 22:12:03 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2018-06-15 22:12:03 -0700 |
commit | 0edd9b9fc60440213e4df926ea511419ee291f1e (patch) | |
tree | 84b22f7afdeb9110ad7105c5fc070dacff178502 /055shape_shifting_container.cc | |
parent | 3f34ac9369978b396d00a4fd02c9fb06b8eea621 (diff) | |
download | mu-0edd9b9fc60440213e4df926ea511419ee291f1e.tar.gz |
4257 - abortive attempt at safe fat pointers
I've been working on this slowly over several weeks, but it's too hard to support 0 as the null value for addresses. I constantly have to add exceptions for scalar value corresponding to an address type (now occupying 2 locations). The final straw is the test for 'reload': x:num <- reload text 'reload' returns an address. But there's no way to know that for arbitrary instructions. New plan: let's put this off for a bit and first create support for literals. Then use 'null' instead of '0' for addresses everywhere. Then it'll be easy to just change what 'null' means.
Diffstat (limited to '055shape_shifting_container.cc')
-rw-r--r-- | 055shape_shifting_container.cc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/055shape_shifting_container.cc b/055shape_shifting_container.cc index 0e7409d8..3bf1fe80 100644 --- a/055shape_shifting_container.cc +++ b/055shape_shifting_container.cc @@ -295,12 +295,12 @@ container foo:_a:_b [ y:_b ] def main [ - 1:text <- new [abc] - {2: (foo number (address array character))} <- merge 34/x, 1:text/y - 3:text <- get {2: (foo number (address array character))}, y:offset - 4:bool <- equal 1:text, 3:text + 10:text <- new [abc] + {20: (foo number (address array character))} <- merge 34/x, 10:text/y + 30:text <- get {20: (foo number (address array character))}, y:offset + 40:bool <- equal 10:text, 30:text ] -+mem: storing 1 in location 4 ++mem: storing 1 in location 40 :(before "End element_type Special-cases") replace_type_ingredients(element, type, info, " while computing element type of container"); @@ -346,8 +346,8 @@ exclusive-container foo:_a [ ] def main [ 1:text <- new [abc] - 2:foo:point <- merge 0/variant, 34/xx, 35/xy - 10:point, 20:bool <- maybe-convert 2:foo:point, 0/variant + 3:foo:point <- merge 0/variant, 34/xx, 35/xy + 10:point, 20:bool <- maybe-convert 3:foo:point, 0/variant ] +mem: storing 1 in location 20 +mem: storing 35 in location 11 |