about summary refs log tree commit diff stats
path: root/028call_return.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 /028call_return.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 '028call_return.cc')
-rw-r--r--028call_return.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/028call_return.cc b/028call_return.cc
index c8c1bca6..aa5cb584 100644
--- a/028call_return.cc
+++ b/028call_return.cc
@@ -52,6 +52,10 @@ case RETURN: {
     trace(9998, "run") << "result " << i << " is " << to_string(ingredients.at(i)) << end();
   // make return products available to caller
   copy(ingredients.begin(), ingredients.end(), inserter(products, products.begin()));
+  for (int i = 0;  i < SIZE(current_instruction().products);  ++i) {
+    if (is_mu_address(current_instruction().products.at(i)) && scalar(ingredients.at(i)))
+      products.at(i).insert(products.at(i).begin(), /*alloc id*/0);
+  }
   // End Return
   break;  // continue to process rest of *caller* instruction
 }