about summary refs log tree commit diff stats
path: root/cpp/026new
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/026new')
-rw-r--r--cpp/026new6
1 files changed, 6 insertions, 0 deletions
diff --git a/cpp/026new b/cpp/026new
index 1991be5b..e541d923 100644
--- a/cpp/026new
+++ b/cpp/026new
@@ -52,6 +52,8 @@ case NEW: {
   if (instructions[pc].ingredients.size() > 1) {
     // array
     vector<int> capacity = read_memory(instructions[pc].ingredients[1]);
+    trace("mem") << "array size is " << capacity[0];
+    Memory[Current_routine.alloc] = capacity[0];
     Current_routine.alloc += capacity[0]*size_of(types);
   }
   else {
@@ -67,4 +69,8 @@ recipe main [
   2:address:integer/raw <- new integer:type
   3:integer/raw <- subtract 2:address:integer/raw, 1:address:array:integer/raw
 ]
++run: instruction main/0
++mem: array size is 5
++run: instruction main/1
++run: instruction main/2
 +mem: storing 5 in location 3