about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-05-07 09:45:13 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-05-07 09:45:13 -0700
commitca604f1af76a9333bb0bd0b2379cff0ec609222f (patch)
treea1a4a41d6d3d45105d707dc8a0942670363eca78
parent5937f1af0ccf8be12ca4a02fde26734ad8380906 (diff)
downloadmu-ca604f1af76a9333bb0bd0b2379cff0ec609222f.tar.gz
2934 - all layers running again
Since I switched to a Mac laptop (commit 2725) I've been lax in running
test_all_layers because I have to ssh into a server and whatnot. I
should just get CI setup somewhere..
-rw-r--r--030container.cc26
-rw-r--r--033exclusive_container.cc2
-rw-r--r--036refcount.cc4
-rwxr-xr-xbuild_and_test_until4
4 files changed, 29 insertions, 7 deletions
diff --git a/030container.cc b/030container.cc
index a31d409e..8f8abbf6 100644
--- a/030container.cc
+++ b/030container.cc
@@ -118,7 +118,31 @@ vector<pair<type_tree*, container_metadata> > Container_metadata, Container_meta
 :(before "End save_snapshots")
 Container_metadata_snapshot = Container_metadata;
 :(before "End restore_snapshots")
-Container_metadata = Container_metadata_snapshot;
+restore_container_metadata();
+:(before "End One-time Setup")
+atexit(clear_container_metadata);
+:(code)
+// invariant: Container_metadata always contains a superset of Container_metadata_snapshot
+void restore_container_metadata() {
+  for (int i = 0; i < SIZE(Container_metadata); ++i) {
+    assert(Container_metadata.at(i).first);
+    if (i < SIZE(Container_metadata_snapshot)) {
+      assert(Container_metadata.at(i).first == Container_metadata_snapshot.at(i).first);
+      continue;
+    }
+    delete Container_metadata.at(i).first;
+    Container_metadata.at(i).first = NULL;
+  }
+  Container_metadata.resize(SIZE(Container_metadata_snapshot));
+}
+void clear_container_metadata() {
+  Container_metadata_snapshot.clear();
+  for (int i = 0; i < SIZE(Container_metadata); ++i) {
+    delete Container_metadata.at(i).first;
+    Container_metadata.at(i).first = NULL;
+  }
+  Container_metadata.clear();
+}
 
 //: do no work in size_of, simply lookup Container_metadata
 
diff --git a/033exclusive_container.cc b/033exclusive_container.cc
index e978ca80..b5ba93c3 100644
--- a/033exclusive_container.cc
+++ b/033exclusive_container.cc
@@ -405,12 +405,10 @@ container foo [
   x:number
   y:number
 ]
-
 exclusive-container bar [
   x:number
   y:foo
 ]
-
 def main [
   1:number <- copy 34
   2:number <- copy 35
diff --git a/036refcount.cc b/036refcount.cc
index a0088dfc..e7d3efc1 100644
--- a/036refcount.cc
+++ b/036refcount.cc
@@ -148,12 +148,12 @@ exclusive-container foo [
 def main [
   1:address:number <- new number:type
   2:foo <- merge 1/p, 1:address:number
-  4:address:number, 5:boolean <- maybe-convert 2:foo, p:variant
+  4:address:number, 5:boolean <- maybe-convert 2:foo, 1:variant/p
 ]
 +run: {1: ("address" "number")} <- new {number: "type"}
 +mem: incrementing refcount of 1000: 0 -> 1
 +run: {2: "foo"} <- merge {1: "literal", "p": ()}, {1: ("address" "number")}
-+run: {4: ("address" "number")}, {5: "boolean"} <- maybe-convert {2: "foo"}, {p: "variant"}
++run: {4: ("address" "number")}, {5: "boolean"} <- maybe-convert {2: "foo"}, {1: "variant", "p": ()}
 # maybe-convert increments refcount on success
 +mem: incrementing refcount of 1000: 1 -> 2
 
diff --git a/build_and_test_until b/build_and_test_until
index 96eb9e43..b86249c6 100755
--- a/build_and_test_until
+++ b/build_and_test_until
@@ -10,7 +10,7 @@ make --no-print-directory enumerate/enumerate
 cat /dev/null $(./enumerate/enumerate --until $1 |grep '.mu$') > core.mu
 make --no-print-directory autogenerated_lists
 set +v
-if [ `uname` == "Darwin" ]
+if [ `uname` = "Darwin" ]
 then
   # Darwin is shit and otherwise thinks mu_bin is newer than the files it just
   # generated when called from test_all_layers.
@@ -20,5 +20,5 @@ then
   CFLAGS=${CFLAGS:-"-g -O3"} make test
 else
   set -v
-  CXX=${CXX:-clang++} CFLAGS=${CFLAGS:-"-O3 -fsanitize=undefined -Wno-tautological-constant-out-of-range-compare"} make ${2:-valgrind}
+  CXX=${CXX:-clang++} CFLAGS=${CFLAGS:-"-g -O3 -fsanitize=undefined -Wno-tautological-constant-out-of-range-compare"} make ${2:-valgrind}
 fi