about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--cpp/.traces/copy_array_indirect51
-rw-r--r--cpp/032array20
2 files changed, 71 insertions, 0 deletions
diff --git a/cpp/.traces/copy_array_indirect b/cpp/.traces/copy_array_indirect
new file mode 100644
index 00000000..79abdaf3
--- /dev/null
+++ b/cpp/.traces/copy_array_indirect
@@ -0,0 +1,51 @@
+parse/0: instruction: 1
+parse/0:   ingredient: {name: "3", value: 0, type: 0, properties: ["3": "literal"]}
+parse/0:   product: {name: "1", value: 0, type: 1, properties: ["1": "integer"]}
+parse/0: instruction: 1
+parse/0:   ingredient: {name: "14", value: 0, type: 0, properties: ["14": "literal"]}
+parse/0:   product: {name: "2", value: 0, type: 1, properties: ["2": "integer"]}
+parse/0: instruction: 1
+parse/0:   ingredient: {name: "15", value: 0, type: 0, properties: ["15": "literal"]}
+parse/0:   product: {name: "3", value: 0, type: 1, properties: ["3": "integer"]}
+parse/0: instruction: 1
+parse/0:   ingredient: {name: "16", value: 0, type: 0, properties: ["16": "literal"]}
+parse/0:   product: {name: "4", value: 0, type: 1, properties: ["4": "integer"]}
+parse/0: instruction: 1
+parse/0:   ingredient: {name: "1", value: 0, type: 0, properties: ["1": "literal"]}
+parse/0:   product: {name: "5", value: 0, type: 2-5-1, properties: ["5": "address":"array":"integer"]}
+parse/0: instruction: 1
+parse/0:   ingredient: {name: "5", value: 0, type: 2-5-1, properties: ["5": "address":"array":"integer", "deref": ]}
+parse/0:   product: {name: "6", value: 0, type: 5-1, properties: ["6": "array":"integer"]}
+after-brace/0: recipe main
+after-brace/0: copy ...
+after-brace/0: copy ...
+after-brace/0: copy ...
+after-brace/0: copy ...
+after-brace/0: copy ...
+after-brace/0: copy ...
+run/0: instruction main/0
+run/0: ingredient 0 is 3
+mem/0: storing 3 in location 1
+run/0: instruction main/1
+run/0: ingredient 0 is 14
+mem/0: storing 14 in location 2
+run/0: instruction main/2
+run/0: ingredient 0 is 15
+mem/0: storing 15 in location 3
+run/0: instruction main/3
+run/0: ingredient 0 is 16
+mem/0: storing 16 in location 4
+run/0: instruction main/4
+run/0: ingredient 0 is 1
+mem/0: storing 1 in location 5
+run/0: instruction main/5
+run/0: ingredient 0 is 5
+mem/0: location 5 is 1
+mem/0: location 1 is 3
+mem/0: location 2 is 14
+mem/0: location 3 is 15
+mem/0: location 4 is 16
+mem/0: storing 3 in location 6
+mem/0: storing 14 in location 7
+mem/0: storing 15 in location 8
+mem/0: storing 16 in location 9
diff --git a/cpp/032array b/cpp/032array
index a4f5ecba..84ee4d38 100644
--- a/cpp/032array
+++ b/cpp/032array
@@ -25,6 +25,26 @@ recipe main [
 +mem: storing 15 in location 7
 +mem: storing 16 in location 8
 
+:(scenario copy_array_indirect)
+recipe main [
+  1:integer <- copy 3:literal
+  2:integer <- copy 14:literal
+  3:integer <- copy 15:literal
+  4:integer <- copy 16:literal
+  5:address:array:integer <- copy 1:literal
+  6:array:integer <- copy 5:address:array:integer/deref
+]
++run: instruction main/5
++run: ingredient 0 is 5
++mem: location 1 is 3
++mem: location 2 is 14
++mem: location 3 is 15
++mem: location 4 is 16
++mem: storing 3 in location 6
++mem: storing 14 in location 7
++mem: storing 15 in location 8
++mem: storing 16 in location 9
+
 //: disable the size mismatch check since the destination array need not be initialized
 :(replace "if (size_of(x) != data.size())" following "void write_memory(reagent x, vector<int> data)")
 if (x.types[0] != Type_number["array"] && size_of(x) != data.size())