From 0edd9b9fc60440213e4df926ea511419ee291f1e Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Fri, 15 Jun 2018 22:12:03 -0700 Subject: 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. --- 055shape_shifting_container.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to '055shape_shifting_container.cc') 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 -- cgit 1.4.1-2-gfad0