about summary refs log tree commit diff stats
path: root/030container.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-05-03 17:38:33 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-05-03 17:38:33 -0700
commit6e793202e3dd9a89b88ab291cebbcb788337c592 (patch)
tree964576ac4bca556076c5fe09c4f0323f6e78f774 /030container.cc
parent191e9bb224cad7c3ea62d986a89a9aa6301c1966 (diff)
downloadmu-6e793202e3dd9a89b88ab291cebbcb788337c592.tar.gz
2898 - start filling in missing refcounts
This commit covers instructions 'put', 'put-index' and 'maybe-convert'.
Next up are the harder ones: 'copy' and 'merge'. In these cases there's
a non-scalar being copied, and we need to figure out which locations
within it need to update their refcount.
Diffstat (limited to '030container.cc')
-rw-r--r--030container.cc5
1 files changed, 2 insertions, 3 deletions
diff --git a/030container.cc b/030container.cc
index 071cc461..8018cb91 100644
--- a/030container.cc
+++ b/030container.cc
@@ -425,12 +425,11 @@ case PUT: {
   type_ordinal base_type = base.type->value;
   int offset = ingredients.at(1).at(0);
   if (offset < 0 || offset >= SIZE(get(Type, base_type).elements)) break;  // copied from Check above
-  int address = base_address;
-  for (int i = 0; i < offset; ++i)
-    address += size_of(element_type(base.type, i));
+  int address = base_address + base.metadata.offset.at(offset);
   trace(9998, "run") << "address to copy to is " << address << end();
   // optimization: directly write the element rather than updating 'product'
   // and writing the entire container
+  // Write Memory in PUT in Run
   for (int i = 0; i < SIZE(ingredients.at(2)); ++i) {
     trace(9999, "mem") << "storing " << no_scientific(ingredients.at(2).at(i)) << " in location " << address+i << end();
     put(Memory, address+i, ingredients.at(2).at(i));