about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-04-24 23:41:17 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-04-24 23:41:17 -0700
commitfd41212ef655a19f5385dec38a89575a02c87d99 (patch)
treeca7f1c9950641e6d172391e7bbf6aa957114b7bd
parented78d87f2d9d4d2a7c30c156fb7c6b3094f9be01 (diff)
downloadmu-fd41212ef655a19f5385dec38a89575a02c87d99.tar.gz
1193
-rw-r--r--cpp/.traces/buffer-append-works30
-rw-r--r--cpp/.traces/closure8
-rw-r--r--cpp/.traces/integer-to-decimal-digit-negative20
-rw-r--r--cpp/.traces/integer-to-decimal-digit-positive24
-rw-r--r--cpp/.traces/integer-to-decimal-digit-zero2
-rw-r--r--cpp/.traces/interpolate-at-end6
-rw-r--r--cpp/.traces/interpolate-at-start6
-rw-r--r--cpp/.traces/interpolate-works6
-rw-r--r--cpp/.traces/new_array2
-rw-r--r--cpp/.traces/string-append-16
-rw-r--r--cpp/.traces/string-equal-common-lengths-but-distinct4
-rw-r--r--cpp/.traces/string-equal-distinct-lengths4
-rw-r--r--cpp/.traces/string-equal-identical4
-rw-r--r--cpp/.traces/string-equal-reflexive4
-rw-r--r--cpp/.traces/string-equal-with-empty4
-rw-r--r--cpp/042new.cc44
16 files changed, 94 insertions, 80 deletions
diff --git a/cpp/.traces/buffer-append-works b/cpp/.traces/buffer-append-works
index f6c308a7..99f2e90e 100644
--- a/cpp/.traces/buffer-append-works
+++ b/cpp/.traces/buffer-append-works
@@ -78,12 +78,12 @@ after-brace/0: get ...
 after-brace/0: copy ...
 schedule/0: test-buffer-append-works
 run/0: instruction test-buffer-append-works/0
-mem/0: new alloc: 1000
 mem/0: array size is 30
+mem/0: new alloc: 1000
 run/0: instruction test-buffer-append-works/1
 run/0: instruction init-buffer/0
-mem/0: new alloc: 1030
 mem/0: array size is 30
+mem/0: new alloc: 1030
 run/0: instruction init-buffer/1
 mem/0: new alloc: 1060
 mem/0: storing 1060 in location 1032
@@ -109,11 +109,11 @@ run/0: instruction init-buffer/5
 run/0: product 0 is 3
 mem/0: storing 3 in location 1035
 run/0: instruction init-buffer/6
+mem/0: location 1035 is 3
+mem/0: array size is 3
 mem/0: new alloc: 1062
 mem/0: location 1034 is 1061
 mem/0: storing 1062 in location 1061
-mem/0: location 1035 is 3
-mem/0: array size is 3
 run/0: instruction init-buffer/7
 mem/0: location 1032 is 1060
 run/0: result 0 is 1060
@@ -130,8 +130,8 @@ mem/0: storing 1062 in location 1003
 run/0: instruction test-buffer-append-works/3
 mem/0: location 1002 is 1060
 run/0: instruction buffer-append/0
-mem/0: new alloc: 1065
 mem/0: array size is 30
+mem/0: new alloc: 1065
 run/0: instruction buffer-append/1
 run/0: product 0 is 1060
 mem/0: storing 1060 in location 1067
@@ -141,8 +141,8 @@ mem/0: storing 97 in location 1068
 run/0: instruction buffer-append/4
 mem/0: location 1067 is 1060
 run/0: instruction buffer-full?/0
-mem/0: new alloc: 1095
 mem/0: array size is 30
+mem/0: new alloc: 1095
 run/0: instruction buffer-full?/1
 run/0: product 0 is 1060
 mem/0: storing 1060 in location 1097
@@ -228,8 +228,8 @@ mem/0: storing 1060 in location 1002
 run/0: instruction test-buffer-append-works/4
 mem/0: location 1002 is 1060
 run/0: instruction buffer-append/0
-mem/0: new alloc: 1125
 mem/0: array size is 30
+mem/0: new alloc: 1125
 run/0: instruction buffer-append/1
 run/0: product 0 is 1060
 mem/0: storing 1060 in location 1127
@@ -239,8 +239,8 @@ mem/0: storing 98 in location 1128
 run/0: instruction buffer-append/4
 mem/0: location 1127 is 1060
 run/0: instruction buffer-full?/0
-mem/0: new alloc: 1155
 mem/0: array size is 30
+mem/0: new alloc: 1155
 run/0: instruction buffer-full?/1
 run/0: product 0 is 1060
 mem/0: storing 1060 in location 1157
@@ -326,8 +326,8 @@ mem/0: storing 1060 in location 1002
 run/0: instruction test-buffer-append-works/5
 mem/0: location 1002 is 1060
 run/0: instruction buffer-append/0
-mem/0: new alloc: 1185
 mem/0: array size is 30
+mem/0: new alloc: 1185
 run/0: instruction buffer-append/1
 run/0: product 0 is 1060
 mem/0: storing 1060 in location 1187
@@ -337,8 +337,8 @@ mem/0: storing 99 in location 1188
 run/0: instruction buffer-append/4
 mem/0: location 1187 is 1060
 run/0: instruction buffer-full?/0
-mem/0: new alloc: 1215
 mem/0: array size is 30
+mem/0: new alloc: 1215
 run/0: instruction buffer-full?/1
 run/0: product 0 is 1060
 mem/0: storing 1060 in location 1217
@@ -451,8 +451,8 @@ mem/0: storing 99 in location 5
 run/0: instruction test-buffer-append-works/10
 mem/0: location 1002 is 1060
 run/0: instruction buffer-append/0
-mem/0: new alloc: 1245
 mem/0: array size is 30
+mem/0: new alloc: 1245
 run/0: instruction buffer-append/1
 run/0: product 0 is 1060
 mem/0: storing 1060 in location 1247
@@ -462,8 +462,8 @@ mem/0: storing 100 in location 1248
 run/0: instruction buffer-append/4
 mem/0: location 1247 is 1060
 run/0: instruction buffer-full?/0
-mem/0: new alloc: 1275
 mem/0: array size is 30
+mem/0: new alloc: 1275
 run/0: instruction buffer-full?/1
 run/0: product 0 is 1060
 mem/0: storing 1060 in location 1277
@@ -506,8 +506,8 @@ run/0: jump-unless fell through
 run/0: instruction buffer-append/6
 mem/0: location 1247 is 1060
 run/0: instruction grow-buffer/0
-mem/0: new alloc: 1305
 mem/0: array size is 30
+mem/0: new alloc: 1305
 run/0: instruction grow-buffer/1
 run/0: product 0 is 1060
 mem/0: storing 1060 in location 1307
@@ -535,11 +535,11 @@ mem/0: location 1308 is 1061
 mem/0: location 1061 is 1062
 mem/0: storing 1062 in location 1311
 run/0: instruction grow-buffer/6
+mem/0: location 1310 is 6
+mem/0: array size is 6
 mem/0: new alloc: 1335
 mem/0: location 1308 is 1061
 mem/0: storing 1335 in location 1061
-mem/0: location 1310 is 6
-mem/0: array size is 6
 run/0: instruction grow-buffer/7
 run/0: ingredient 0 is 0
 mem/0: storing 0 in location 1312
diff --git a/cpp/.traces/closure b/cpp/.traces/closure
index 0017b943..4f0588cf 100644
--- a/cpp/.traces/closure
+++ b/cpp/.traces/closure
@@ -62,12 +62,12 @@ after-brace/0: copy ...
 after-brace/0: reply ...
 schedule/0: main
 run/0: instruction main/0
-mem/0: new alloc: 1000
 mem/0: array size is 30
+mem/0: new alloc: 1000
 run/0: instruction main/1
 run/0: instruction init-counter/0
-mem/0: new alloc: 1030
 mem/0: array size is 30
+mem/0: new alloc: 1030
 run/0: instruction init-counter/1
 run/0: ingredient 0 is 23
 mem/0: storing 23 in location 1032
@@ -80,8 +80,8 @@ mem/0: storing 1030 in location 1002
 run/0: instruction main/2
 mem/0: location 1002 is 1030
 run/0: instruction increment-counter/0
-mem/0: new alloc: 1060
 mem/0: array size is 30
+mem/0: new alloc: 1060
 run/0: instruction increment-counter/1
 run/0: product 0 is 1030
 mem/0: storing 1030 in location 1061
@@ -101,8 +101,8 @@ mem/0: storing 4 in location 2
 run/0: instruction main/3
 mem/0: location 1002 is 1030
 run/0: instruction increment-counter/0
-mem/0: new alloc: 1090
 mem/0: array size is 30
+mem/0: new alloc: 1090
 run/0: instruction increment-counter/1
 run/0: product 0 is 1030
 mem/0: storing 1030 in location 1091
diff --git a/cpp/.traces/integer-to-decimal-digit-negative b/cpp/.traces/integer-to-decimal-digit-negative
index c085c7df..8291eade 100644
--- a/cpp/.traces/integer-to-decimal-digit-negative
+++ b/cpp/.traces/integer-to-decimal-digit-negative
@@ -10,8 +10,8 @@ after-brace/0: copy ...
 schedule/0: test-integer-to-decimal-digit-negative
 run/0: instruction test-integer-to-decimal-digit-negative/0
 run/0: instruction integer-to-decimal-string/0
-mem/0: new alloc: 1000
 mem/0: array size is 30
+mem/0: new alloc: 1000
 run/0: instruction integer-to-decimal-string/1
 run/0: product 0 is -1
 mem/0: storing -1 in location 1002
@@ -45,8 +45,8 @@ run/0: product 0 is 1
 mem/0: storing 1 in location 1002
 run/0: instruction integer-to-decimal-string/14
 run/0: instruction init-buffer/0
-mem/0: new alloc: 1030
 mem/0: array size is 30
+mem/0: new alloc: 1030
 run/0: instruction init-buffer/1
 mem/0: new alloc: 1060
 mem/0: storing 1060 in location 1032
@@ -72,11 +72,11 @@ run/0: instruction init-buffer/5
 run/0: product 0 is 30
 mem/0: storing 30 in location 1035
 run/0: instruction init-buffer/6
+mem/0: location 1035 is 30
+mem/0: array size is 30
 mem/0: new alloc: 1062
 mem/0: location 1034 is 1061
 mem/0: storing 1062 in location 1061
-mem/0: location 1035 is 30
-mem/0: array size is 30
 run/0: instruction init-buffer/7
 mem/0: location 1032 is 1060
 run/0: result 0 is 1060
@@ -113,8 +113,8 @@ run/0: instruction integer-to-decimal-string/21
 mem/0: location 1006 is 1060
 mem/0: location 1010 is 49
 run/0: instruction buffer-append/0
-mem/0: new alloc: 1092
 mem/0: array size is 30
+mem/0: new alloc: 1092
 run/0: instruction buffer-append/1
 run/0: product 0 is 1060
 mem/0: storing 1060 in location 1094
@@ -124,8 +124,8 @@ mem/0: storing 49 in location 1095
 run/0: instruction buffer-append/4
 mem/0: location 1094 is 1060
 run/0: instruction buffer-full?/0
-mem/0: new alloc: 1122
 mem/0: array size is 30
+mem/0: new alloc: 1122
 run/0: instruction buffer-full?/1
 run/0: product 0 is 1060
 mem/0: storing 1060 in location 1124
@@ -229,8 +229,8 @@ run/0: jump-unless fell through
 run/0: instruction integer-to-decimal-string/26
 mem/0: location 1006 is 1060
 run/0: instruction buffer-append/0
-mem/0: new alloc: 1152
 mem/0: array size is 30
+mem/0: new alloc: 1152
 run/0: instruction buffer-append/1
 run/0: product 0 is 1060
 mem/0: storing 1060 in location 1154
@@ -240,8 +240,8 @@ mem/0: storing 45 in location 1155
 run/0: instruction buffer-append/4
 mem/0: location 1154 is 1060
 run/0: instruction buffer-full?/0
-mem/0: new alloc: 1182
 mem/0: array size is 30
+mem/0: new alloc: 1182
 run/0: instruction buffer-full?/1
 run/0: product 0 is 1060
 mem/0: storing 1060 in location 1184
@@ -343,10 +343,10 @@ mem/0: location 1061 is 1062
 run/0: product 0 is 1062
 mem/0: storing 1062 in location 1012
 run/0: instruction integer-to-decimal-string/30
-mem/0: new alloc: 1212
-mem/0: storing 1212 in location 1003
 mem/0: location 1011 is 2
 mem/0: array size is 2
+mem/0: new alloc: 1212
+mem/0: storing 1212 in location 1003
 run/0: instruction integer-to-decimal-string/31
 run/0: ingredient 0 is len
 mem/0: location 1011 is 2
diff --git a/cpp/.traces/integer-to-decimal-digit-positive b/cpp/.traces/integer-to-decimal-digit-positive
index 1e3be0e1..ae35d140 100644
--- a/cpp/.traces/integer-to-decimal-digit-positive
+++ b/cpp/.traces/integer-to-decimal-digit-positive
@@ -10,8 +10,8 @@ after-brace/0: copy ...
 schedule/0: test-integer-to-decimal-digit-positive
 run/0: instruction test-integer-to-decimal-digit-positive/0
 run/0: instruction integer-to-decimal-string/0
-mem/0: new alloc: 1000
 mem/0: array size is 30
+mem/0: new alloc: 1000
 run/0: instruction integer-to-decimal-string/1
 run/0: product 0 is 234
 mem/0: storing 234 in location 1002
@@ -36,8 +36,8 @@ run/0: ingredient 1 is
 run/0: jumping to instruction 13
 run/0: instruction integer-to-decimal-string/14
 run/0: instruction init-buffer/0
-mem/0: new alloc: 1030
 mem/0: array size is 30
+mem/0: new alloc: 1030
 run/0: instruction init-buffer/1
 mem/0: new alloc: 1060
 mem/0: storing 1060 in location 1032
@@ -63,11 +63,11 @@ run/0: instruction init-buffer/5
 run/0: product 0 is 30
 mem/0: storing 30 in location 1035
 run/0: instruction init-buffer/6
+mem/0: location 1035 is 30
+mem/0: array size is 30
 mem/0: new alloc: 1062
 mem/0: location 1034 is 1061
 mem/0: storing 1062 in location 1061
-mem/0: location 1035 is 30
-mem/0: array size is 30
 run/0: instruction init-buffer/7
 mem/0: location 1032 is 1060
 run/0: result 0 is 1060
@@ -104,8 +104,8 @@ run/0: instruction integer-to-decimal-string/21
 mem/0: location 1006 is 1060
 mem/0: location 1010 is 52
 run/0: instruction buffer-append/0
-mem/0: new alloc: 1092
 mem/0: array size is 30
+mem/0: new alloc: 1092
 run/0: instruction buffer-append/1
 run/0: product 0 is 1060
 mem/0: storing 1060 in location 1094
@@ -115,8 +115,8 @@ mem/0: storing 52 in location 1095
 run/0: instruction buffer-append/4
 mem/0: location 1094 is 1060
 run/0: instruction buffer-full?/0
-mem/0: new alloc: 1122
 mem/0: array size is 30
+mem/0: new alloc: 1122
 run/0: instruction buffer-full?/1
 run/0: product 0 is 1060
 mem/0: storing 1060 in location 1124
@@ -231,8 +231,8 @@ run/0: instruction integer-to-decimal-string/21
 mem/0: location 1006 is 1060
 mem/0: location 1010 is 51
 run/0: instruction buffer-append/0
-mem/0: new alloc: 1152
 mem/0: array size is 30
+mem/0: new alloc: 1152
 run/0: instruction buffer-append/1
 run/0: product 0 is 1060
 mem/0: storing 1060 in location 1154
@@ -242,8 +242,8 @@ mem/0: storing 51 in location 1155
 run/0: instruction buffer-append/4
 mem/0: location 1154 is 1060
 run/0: instruction buffer-full?/0
-mem/0: new alloc: 1182
 mem/0: array size is 30
+mem/0: new alloc: 1182
 run/0: instruction buffer-full?/1
 run/0: product 0 is 1060
 mem/0: storing 1060 in location 1184
@@ -358,8 +358,8 @@ run/0: instruction integer-to-decimal-string/21
 mem/0: location 1006 is 1060
 mem/0: location 1010 is 50
 run/0: instruction buffer-append/0
-mem/0: new alloc: 1212
 mem/0: array size is 30
+mem/0: new alloc: 1212
 run/0: instruction buffer-append/1
 run/0: product 0 is 1060
 mem/0: storing 1060 in location 1214
@@ -369,8 +369,8 @@ mem/0: storing 50 in location 1215
 run/0: instruction buffer-append/4
 mem/0: location 1214 is 1060
 run/0: instruction buffer-full?/0
-mem/0: new alloc: 1242
 mem/0: array size is 30
+mem/0: new alloc: 1242
 run/0: instruction buffer-full?/1
 run/0: product 0 is 1060
 mem/0: storing 1060 in location 1244
@@ -491,10 +491,10 @@ mem/0: location 1061 is 1062
 run/0: product 0 is 1062
 mem/0: storing 1062 in location 1012
 run/0: instruction integer-to-decimal-string/30
-mem/0: new alloc: 1272
-mem/0: storing 1272 in location 1003
 mem/0: location 1011 is 3
 mem/0: array size is 3
+mem/0: new alloc: 1272
+mem/0: storing 1272 in location 1003
 run/0: instruction integer-to-decimal-string/31
 run/0: ingredient 0 is len
 mem/0: location 1011 is 3
diff --git a/cpp/.traces/integer-to-decimal-digit-zero b/cpp/.traces/integer-to-decimal-digit-zero
index c5d4df99..b7645a2d 100644
--- a/cpp/.traces/integer-to-decimal-digit-zero
+++ b/cpp/.traces/integer-to-decimal-digit-zero
@@ -10,8 +10,8 @@ after-brace/0: copy ...
 schedule/0: test-integer-to-decimal-digit-zero
 run/0: instruction test-integer-to-decimal-digit-zero/0
 run/0: instruction integer-to-decimal-string/0
-mem/0: new alloc: 1000
 mem/0: array size is 30
+mem/0: new alloc: 1000
 run/0: instruction integer-to-decimal-string/1
 run/0: product 0 is 0
 mem/0: storing 0 in location 1002
diff --git a/cpp/.traces/interpolate-at-end b/cpp/.traces/interpolate-at-end
index e9c08184..92eeccda 100644
--- a/cpp/.traces/interpolate-at-end
+++ b/cpp/.traces/interpolate-at-end
@@ -27,8 +27,8 @@ run/0: instruction test-interpolate-at-end/2
 mem/0: location 1 is 1000
 mem/0: location 2 is 1009
 run/0: instruction interpolate/0
-mem/0: new alloc: 1013
 mem/0: array size is 60
+mem/0: new alloc: 1013
 run/0: instruction interpolate/1
 run/0: product 0 is 1000
 mem/0: storing 1000 in location 1015
@@ -77,10 +77,10 @@ run/0: instruction interpolate/12
 run/0: instruction interpolate/13
 run/0: product 0 is 1000
 run/0: instruction interpolate/14
-mem/0: new alloc: 1073
-mem/0: storing 1073 in location 1021
 mem/0: location 1017 is 10
 mem/0: array size is 10
+mem/0: new alloc: 1073
+mem/0: storing 1073 in location 1021
 run/0: instruction interpolate/15
 run/0: ingredient 0 is 0
 mem/0: storing 0 in location 1022
diff --git a/cpp/.traces/interpolate-at-start b/cpp/.traces/interpolate-at-start
index 7c09ee1c..af045fdc 100644
--- a/cpp/.traces/interpolate-at-start
+++ b/cpp/.traces/interpolate-at-start
@@ -27,8 +27,8 @@ run/0: instruction test-interpolate-at-start/2
 mem/0: location 1 is 1000
 mem/0: location 2 is 1010
 run/0: instruction interpolate/0
-mem/0: new alloc: 1014
 mem/0: array size is 60
+mem/0: new alloc: 1014
 run/0: instruction interpolate/1
 run/0: product 0 is 1000
 mem/0: storing 1000 in location 1016
@@ -77,10 +77,10 @@ run/0: instruction interpolate/12
 run/0: instruction interpolate/13
 run/0: product 0 is 1000
 run/0: instruction interpolate/14
-mem/0: new alloc: 1074
-mem/0: storing 1074 in location 1022
 mem/0: location 1018 is 11
 mem/0: array size is 11
+mem/0: new alloc: 1074
+mem/0: storing 1074 in location 1022
 run/0: instruction interpolate/15
 run/0: ingredient 0 is 0
 mem/0: storing 0 in location 1023
diff --git a/cpp/.traces/interpolate-works b/cpp/.traces/interpolate-works
index 917885b6..97edab53 100644
--- a/cpp/.traces/interpolate-works
+++ b/cpp/.traces/interpolate-works
@@ -27,8 +27,8 @@ run/0: instruction test-interpolate-works/2
 mem/0: location 1 is 1000
 mem/0: location 2 is 1006
 run/0: instruction interpolate/0
-mem/0: new alloc: 1010
 mem/0: array size is 60
+mem/0: new alloc: 1010
 run/0: instruction interpolate/1
 run/0: product 0 is 1000
 mem/0: storing 1000 in location 1012
@@ -77,10 +77,10 @@ run/0: instruction interpolate/12
 run/0: instruction interpolate/13
 run/0: product 0 is 1000
 run/0: instruction interpolate/14
-mem/0: new alloc: 1070
-mem/0: storing 1070 in location 1018
 mem/0: location 1014 is 7
 mem/0: array size is 7
+mem/0: new alloc: 1070
+mem/0: storing 1070 in location 1018
 run/0: instruction interpolate/15
 run/0: ingredient 0 is 0
 mem/0: storing 0 in location 1019
diff --git a/cpp/.traces/new_array b/cpp/.traces/new_array
index 42cd5b71..92e3f62f 100644
--- a/cpp/.traces/new_array
+++ b/cpp/.traces/new_array
@@ -17,9 +17,9 @@ after-brace/0: new ...
 after-brace/0: subtract ...
 schedule/0: main
 run/0: instruction main/0
+mem/0: array size is 5
 mem/0: new alloc: 1000
 mem/0: storing 1000 in location 1
-mem/0: array size is 5
 run/0: instruction main/1
 mem/0: new alloc: 1005
 mem/0: storing 1005 in location 2
diff --git a/cpp/.traces/string-append-1 b/cpp/.traces/string-append-1
index f8da656b..def942ca 100644
--- a/cpp/.traces/string-append-1
+++ b/cpp/.traces/string-append-1
@@ -27,8 +27,8 @@ run/0: instruction test-string-append-1/2
 mem/0: location 1 is 1000
 mem/0: location 2 is 1007
 run/0: instruction string-append/0
-mem/0: new alloc: 1015
 mem/0: array size is 30
+mem/0: new alloc: 1015
 run/0: instruction string-append/1
 run/0: product 0 is 1000
 mem/0: storing 1000 in location 1017
@@ -49,10 +49,10 @@ mem/0: location 1020 is 7
 run/0: product 0 is 13
 mem/0: storing 13 in location 1021
 run/0: instruction string-append/6
-mem/0: new alloc: 1045
-mem/0: storing 1045 in location 1022
 mem/0: location 1021 is 13
 mem/0: array size is 13
+mem/0: new alloc: 1045
+mem/0: storing 1045 in location 1022
 run/0: instruction string-append/7
 run/0: ingredient 0 is 0
 mem/0: storing 0 in location 1023
diff --git a/cpp/.traces/string-equal-common-lengths-but-distinct b/cpp/.traces/string-equal-common-lengths-but-distinct
index a236c928..352324c4 100644
--- a/cpp/.traces/string-equal-common-lengths-but-distinct
+++ b/cpp/.traces/string-equal-common-lengths-but-distinct
@@ -24,8 +24,8 @@ after-brace/0: new ...
 after-brace/0: string-equal ...
 schedule/0: test-string-equal-common-lengths-but-distinct
 run/0: instruction test-string-equal-common-lengths-but-distinct/0
-mem/0: new alloc: 1000
 mem/0: array size is 30
+mem/0: new alloc: 1000
 run/0: instruction test-string-equal-common-lengths-but-distinct/1
 mem/0: storing 1030 in location 1002
 run/0: instruction test-string-equal-common-lengths-but-distinct/2
@@ -34,8 +34,8 @@ run/0: instruction test-string-equal-common-lengths-but-distinct/3
 mem/0: location 1002 is 1030
 mem/0: location 1003 is 1034
 run/0: instruction string-equal/0
-mem/0: new alloc: 1038
 mem/0: array size is 30
+mem/0: new alloc: 1038
 run/0: instruction string-equal/1
 run/0: product 0 is 1030
 mem/0: storing 1030 in location 1040
diff --git a/cpp/.traces/string-equal-distinct-lengths b/cpp/.traces/string-equal-distinct-lengths
index 38c09b9e..8e2b6834 100644
--- a/cpp/.traces/string-equal-distinct-lengths
+++ b/cpp/.traces/string-equal-distinct-lengths
@@ -24,8 +24,8 @@ after-brace/0: new ...
 after-brace/0: string-equal ...
 schedule/0: test-string-equal-distinct-lengths
 run/0: instruction test-string-equal-distinct-lengths/0
-mem/0: new alloc: 1000
 mem/0: array size is 30
+mem/0: new alloc: 1000
 run/0: instruction test-string-equal-distinct-lengths/1
 mem/0: storing 1030 in location 1002
 run/0: instruction test-string-equal-distinct-lengths/2
@@ -34,8 +34,8 @@ run/0: instruction test-string-equal-distinct-lengths/3
 mem/0: location 1002 is 1030
 mem/0: location 1003 is 1034
 run/0: instruction string-equal/0
-mem/0: new alloc: 1039
 mem/0: array size is 30
+mem/0: new alloc: 1039
 run/0: instruction string-equal/1
 run/0: product 0 is 1030
 mem/0: storing 1030 in location 1041
diff --git a/cpp/.traces/string-equal-identical b/cpp/.traces/string-equal-identical
index a392ec0c..6e07b00a 100644
--- a/cpp/.traces/string-equal-identical
+++ b/cpp/.traces/string-equal-identical
@@ -24,8 +24,8 @@ after-brace/0: new ...
 after-brace/0: string-equal ...
 schedule/0: test-string-equal-identical
 run/0: instruction test-string-equal-identical/0
-mem/0: new alloc: 1000
 mem/0: array size is 30
+mem/0: new alloc: 1000
 run/0: instruction test-string-equal-identical/1
 mem/0: storing 1030 in location 1002
 run/0: instruction test-string-equal-identical/2
@@ -34,8 +34,8 @@ run/0: instruction test-string-equal-identical/3
 mem/0: location 1002 is 1030
 mem/0: location 1003 is 1034
 run/0: instruction string-equal/0
-mem/0: new alloc: 1038
 mem/0: array size is 30
+mem/0: new alloc: 1038
 run/0: instruction string-equal/1
 run/0: product 0 is 1030
 mem/0: storing 1030 in location 1040
diff --git a/cpp/.traces/string-equal-reflexive b/cpp/.traces/string-equal-reflexive
index 86f4ac0e..a61a0032 100644
--- a/cpp/.traces/string-equal-reflexive
+++ b/cpp/.traces/string-equal-reflexive
@@ -18,16 +18,16 @@ after-brace/0: new ...
 after-brace/0: string-equal ...
 schedule/0: test-string-equal-reflexive
 run/0: instruction test-string-equal-reflexive/0
-mem/0: new alloc: 1000
 mem/0: array size is 30
+mem/0: new alloc: 1000
 run/0: instruction test-string-equal-reflexive/1
 mem/0: storing 1030 in location 1002
 run/0: instruction test-string-equal-reflexive/2
 mem/0: location 1002 is 1030
 mem/0: location 1002 is 1030
 run/0: instruction string-equal/0
-mem/0: new alloc: 1034
 mem/0: array size is 30
+mem/0: new alloc: 1034
 run/0: instruction string-equal/1
 run/0: product 0 is 1030
 mem/0: storing 1030 in location 1036
diff --git a/cpp/.traces/string-equal-with-empty b/cpp/.traces/string-equal-with-empty
index 1a0e4a44..ab5e63e4 100644
--- a/cpp/.traces/string-equal-with-empty
+++ b/cpp/.traces/string-equal-with-empty
@@ -24,8 +24,8 @@ after-brace/0: new ...
 after-brace/0: string-equal ...
 schedule/0: test-string-equal-with-empty
 run/0: instruction test-string-equal-with-empty/0
-mem/0: new alloc: 1000
 mem/0: array size is 30
+mem/0: new alloc: 1000
 run/0: instruction test-string-equal-with-empty/1
 mem/0: storing 1030 in location 1002
 run/0: instruction test-string-equal-with-empty/2
@@ -34,8 +34,8 @@ run/0: instruction test-string-equal-with-empty/3
 mem/0: location 1002 is 1030
 mem/0: location 1003 is 1031
 run/0: instruction string-equal/0
-mem/0: new alloc: 1036
 mem/0: array size is 30
+mem/0: new alloc: 1036
 run/0: instruction string-equal/1
 run/0: product 0 is 1030
 mem/0: storing 1030 in location 1038
diff --git a/cpp/042new.cc b/cpp/042new.cc
index d63fb1a4..9c88f11b 100644
--- a/cpp/042new.cc
+++ b/cpp/042new.cc
@@ -50,23 +50,37 @@ NEW,
 Recipe_number["new"] = NEW;
 :(before "End Primitive Recipe Implementations")
 case NEW: {
-  vector<int> result;
-  trace("mem") << "new alloc: " << Current_routine->alloc;
-  result.push_back(Current_routine->alloc);
-  write_memory(current_instruction().products[0], result);
-  vector<int> types;
-  types.push_back(current_instruction().ingredients[0].value);
-  if (current_instruction().ingredients.size() > 1) {
-    // array
-    vector<int> capacity = read_memory(current_instruction().ingredients[1]);
-    trace("mem") << "array size is " << capacity[0];
-    Memory[Current_routine->alloc] = capacity[0];
-    Current_routine->alloc += capacity[0]*size_of(types);
+  // compute the space we need
+  size_t size = 0;
+  size_t array_length = 0;
+  {
+    vector<int> type;
+    type.push_back(current_instruction().ingredients[0].value);
+    if (current_instruction().ingredients.size() > 1) {
+      // array
+      vector<int> capacity = read_memory(current_instruction().ingredients[1]);
+      array_length = capacity[0];
+      trace("mem") << "array size is " << array_length;
+      size = array_length*size_of(type);
+    }
+    else {
+      // scalar
+      size = size_of(type);
+    }
   }
-  else {
-    // scalar
-    Current_routine->alloc += size_of(types);
+  // compute the resulting location
+  const size_t result = Current_routine->alloc;
+  trace("mem") << "new alloc: " << result;
+  if (current_instruction().ingredients.size() > 1) {
+    // initialize array
+    Memory[result] = array_length;
   }
+  // write result to memory
+  vector<int> tmp;
+  tmp.push_back(Current_routine->alloc);
+  write_memory(current_instruction().products[0], tmp);
+  // bump
+  Current_routine->alloc += size;
   break;
 }