about summary refs log tree commit diff stats
path: root/020run.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-05-12 13:10:23 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-05-12 17:00:19 -0700
commit3663ca6c2d4c42c4a7bf6af4b2edf71dd8d10dd7 (patch)
tree330d04974b9d30bff1b16adc8d14a3d9fd77643d /020run.cc
parenta70d593dfb8eea87a898a69adeb9689a21199edf (diff)
downloadmu-3663ca6c2d4c42c4a7bf6af4b2edf71dd8d10dd7.tar.gz
1356 - snapshot #2: floating point support
I added one test to check that divide can return a float, then hacked at
the rippling failures across the entire entire codebase until all tests
pass. Now I need to look at the changes I made and see if there's a
system to them, identify other places that I missed, and figure out the
best way to cover all cases. I also need to show real rather than
encoded values in the traces, but I can't use value() inside reagent
methods because of the name clash with the member variable. So let's
take a snapshot before we attempt any refactoring. This was non-trivial
to get right.

Even if I convince myself that I've gotten it right, I might back this
all out if I can't easily *persuade others* that I've gotten it right.
Diffstat (limited to '020run.cc')
-rw-r--r--020run.cc24
1 files changed, 21 insertions, 3 deletions
diff --git a/020run.cc b/020run.cc
index 3f3237e8..ff23200e 100644
--- a/020run.cc
+++ b/020run.cc
@@ -78,7 +78,11 @@ void run_current_routine()
     switch (current_instruction().operation) {
       // Primitive Recipe Implementations
       case COPY: {
-        copy(ingredients.begin(), ingredients.end(), inserter(products, products.begin()));
+        products.resize(ingredients.size());
+        for (index_t i = 0; i < ingredients.size(); ++i) {
+          copy(ingredients.at(i).begin(), ingredients.at(i).end(), inserter(products.at(i), products.at(i).begin()));
+        }
+//?         copy(ingredients.begin(), ingredients.end(), inserter(products, products.begin()));
         break;
       }
       // End Primitive Recipe Implementations
@@ -121,6 +125,7 @@ inline bool routine::completed() const {
 }
 
 :(before "End Commandline Parsing")
+// Loading Commandline Files
 if (argc > 1) {
   for (int i = 1; i < argc; ++i) {
     load_permanently(argv[i]);
@@ -183,10 +188,14 @@ vector<long long int> read_memory(reagent x) {
     return result;
   }
   index_t base = x.value;
+//?   cerr << "AAA " << base << '\n'; //? 1
+  assert(!is_negative(base));
+  base = value(base);
   size_t size = size_of(x);
   for (index_t offset = 0; offset < size; ++offset) {
     long long int val = Memory[base+offset];
-    trace("mem") << "location " << base+offset << " is " << val;
+//?     cerr << "AAA2 " << val << '\n'; //? 1
+    trace("mem") << "location " << base+offset << " is " << value(val);
     result.push_back(val);
   }
   return result;
@@ -194,11 +203,20 @@ vector<long long int> read_memory(reagent x) {
 
 void write_memory(reagent x, vector<long long int> data) {
   if (is_dummy(x)) return;
+  // Preprocess x.
+  // End Preprocess x.
   index_t base = x.value;
+  assert(!is_negative(base));
+  base = value(base);
   if (size_of(x) != data.size())
     raise << "size mismatch in storing to " << x.to_string() << '\n';
+//?   cerr << "BBB " << base << '\n'; //? 1
   for (index_t offset = 0; offset < data.size(); ++offset) {
-    trace("mem") << "storing " << data.at(offset) << " in location " << base+offset;
+    trace("mem") << "storing " << value(data.at(offset)) << " in location " << base+offset;
+//?     if (base+offset > 99999) { //? 1
+//?       raise << "AAAAAAAAAAAAAAAAAAAAA\n"; //? 1
+//?       Trace_stream->newline(), exit(0); //? 1
+//?     } //? 1
     Memory[base+offset] = data.at(offset);
   }
 }