about summary refs log tree commit diff stats
path: root/cpp/042new
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-04-24 22:14:07 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-04-24 22:14:07 -0700
commitf539f89fb9e95d6452d577e7ab27dd5f619d5a4c (patch)
tree3578efc33021c687e5cdc9811999949b939f3a10 /cpp/042new
parenteef937e692637b08714832183930ab45b497cc98 (diff)
downloadmu-f539f89fb9e95d6452d577e7ab27dd5f619d5a4c.tar.gz
1187
Diffstat (limited to 'cpp/042new')
-rw-r--r--cpp/042new27
1 files changed, 25 insertions, 2 deletions
diff --git a/cpp/042new b/cpp/042new
index f032f90a..a980d8cb 100644
--- a/cpp/042new
+++ b/cpp/042new
@@ -11,11 +11,13 @@ recipe main [
 +mem: storing 0 in location 3
 
 :(before "End Globals")
-const size_t Alloc_init = 1000;
+size_t Memory_allocated_until = 1000;
+:(before "End Setup")
+Memory_allocated_until = 1000;
 :(before "End routine Fields")
 size_t alloc;
 :(replace{} "routine::routine(recipe_number r)")
-  routine::routine(recipe_number r) :alloc(Alloc_init) {
+  routine::routine(recipe_number r) :alloc(Memory_allocated_until) {
     calls.push(call(r));
   }
 
@@ -101,3 +103,24 @@ if (current_instruction().ingredients[0].properties[0].second[0] == "literal-str
   // mu strings are not null-terminated in memory
   break;
 }
+
+//:: Make sure that each routine gets a different alloc to start.
+
+:(scenario new_concurrent)
+recipe f1 [
+  run f2:recipe
+  1:address:integer <- new integer:type
+]
+recipe f2 [
+  2:address:integer <- new integer:type
+  # hack: assumes scheduler implementation
+  3:boolean <- equal 1:address:integer, 2:address:integer
+]
++mem: storing 0 in location 3
+
+:(before "End Globals")
+size_t Initial_memory_per_routine = 100000;
+:(before "End Setup")
+Initial_memory_per_routine = 100000;
+:(after "routine::routine(recipe_number r)")
+  Memory_allocated_until += Initial_memory_per_routine;