about summary refs log tree commit diff stats
path: root/cpp/026new
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-04-02 10:30:27 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-04-02 10:30:27 -0700
commitfc9dc705462d0714ca9110dfd2f1fe058c915d9e (patch)
tree225bc560f05b4a2b061240c5e23e5c1c8333dba5 /cpp/026new
parentf652431d44a1fecf2ba778cf2d59f8ec650fcd68 (diff)
downloadmu-fc9dc705462d0714ca9110dfd2f1fe058c915d9e.tar.gz
1002
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