about summary refs log tree commit diff stats
path: root/033exclusive_container.cc
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-06-15 22:12:03 -0700
committerKartik Agaram <vc@akkartik.com>2018-06-15 22:12:03 -0700
commit0edd9b9fc60440213e4df926ea511419ee291f1e (patch)
tree84b22f7afdeb9110ad7105c5fc070dacff178502 /033exclusive_container.cc
parent3f34ac9369978b396d00a4fd02c9fb06b8eea621 (diff)
downloadmu-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 '033exclusive_container.cc')
-rw-r--r--033exclusive_container.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/033exclusive_container.cc b/033exclusive_container.cc
index 44161d7c..e4fa6398 100644
--- a/033exclusive_container.cc
+++ b/033exclusive_container.cc
@@ -12,12 +12,14 @@ get_or_insert(Type, tmp);  // initialize
 get(Type, tmp).kind = EXCLUSIVE_CONTAINER;
 get(Type, tmp).name = "number-or-point";
 get(Type, tmp).elements.push_back(reagent("i:number"));
+get(Type, tmp).elements.back().set_value(0);
 get(Type, tmp).elements.push_back(reagent("p:point"));
+get(Type, tmp).elements.back().set_value(1);
 }
 
-//: Tests in this layer often explicitly set up memory before reading it as a
-//: container. Don't do this in general. I'm tagging such cases with /unsafe;
-//: they'll be exceptions to later checks.
+//: Tests in this layer often explicitly set up memory before reading it as an
+//: array. Don't do this in general. I'm tagging exceptions with /raw to keep
+//: checks in future layers from flagging them.
 :(scenario copy_exclusive_container)
 # Copying exclusive containers copies all their contents and an extra location for the tag.
 def main [