about summary refs log tree commit diff stats
path: root/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp')
-rw-r--r--cpp/.traces/new_concurrent37
-rw-r--r--cpp/042new27
2 files changed, 62 insertions, 2 deletions
diff --git a/cpp/.traces/new_concurrent b/cpp/.traces/new_concurrent
new file mode 100644
index 00000000..2183538d
--- /dev/null
+++ b/cpp/.traces/new_concurrent
@@ -0,0 +1,37 @@
+parse/0: instruction: 29
+parse/0:   ingredient: {name: "f2", value: 0, type: 0, properties: ["f2": "recipe"]}
+parse/0: instruction: 36
+parse/0:   ingredient: {name: "integer", value: 0, type: 0, properties: ["integer": "type"]}
+parse/0:   product: {name: "1", value: 0, type: 2-1, properties: ["1": "address":"integer"]}
+parse/0: instruction: 36
+parse/0:   ingredient: {name: "integer", value: 0, type: 0, properties: ["integer": "type"]}
+parse/0:   product: {name: "2", value: 0, type: 2-1, properties: ["2": "address":"integer"]}
+parse/0: instruction: 13
+parse/0:   ingredient: {name: "1", value: 0, type: 2-1, properties: ["1": "address":"integer"]}
+parse/0:   ingredient: {name: "2", value: 0, type: 2-1, properties: ["2": "address":"integer"]}
+parse/0:   product: {name: "3", value: 0, type: 3, properties: ["3": "boolean"]}
+new/0: integer -> 1
+new/0: integer -> 1
+after-brace/0: recipe f1
+after-brace/0: run ...
+after-brace/0: new ...
+after-brace/0: recipe f2
+after-brace/0: new ...
+after-brace/0: equal ...
+schedule/0: f1
+run/0: instruction f1/0
+run/0: ingredient 0 is f2
+run/0: instruction f1/1
+mem/0: new alloc: 1000
+mem/0: storing 1000 in location 1
+schedule/0: f2
+run/0: instruction f2/0
+mem/0: new alloc: 101000
+mem/0: storing 101000 in location 2
+run/0: instruction f2/1
+run/0: ingredient 0 is 1
+mem/0: location 1 is 1000
+run/0: ingredient 1 is 2
+mem/0: location 2 is 101000
+run/0: product 0 is 0
+mem/0: storing 0 in location 3
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;