From ed78d87f2d9d4d2a7c30c156fb7c6b3094f9be01 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Fri, 24 Apr 2015 23:36:25 -0700 Subject: 1192 --- cpp/.traces/new_concurrent | 10 +++++----- cpp/042new.cc | 27 +++++++++++++-------------- 2 files changed, 18 insertions(+), 19 deletions(-) (limited to 'cpp') diff --git a/cpp/.traces/new_concurrent b/cpp/.traces/new_concurrent index 2183538d..b3622668 100644 --- a/cpp/.traces/new_concurrent +++ b/cpp/.traces/new_concurrent @@ -2,14 +2,14 @@ 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: product: {name: "1", value: 0, type: 2-1, properties: ["1": "address":"integer", "raw": ]} 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: product: {name: "2", value: 0, type: 2-1, properties: ["2": "address":"integer", "raw": ]} 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"]} +parse/0: ingredient: {name: "1", value: 0, type: 2-1, properties: ["1": "address":"integer", "raw": ]} +parse/0: ingredient: {name: "2", value: 0, type: 2-1, properties: ["2": "address":"integer", "raw": ]} +parse/0: product: {name: "3", value: 0, type: 3, properties: ["3": "boolean", "raw": ]} new/0: integer -> 1 new/0: integer -> 1 after-brace/0: recipe f1 diff --git a/cpp/042new.cc b/cpp/042new.cc index 01536689..d63fb1a4 100644 --- a/cpp/042new.cc +++ b/cpp/042new.cc @@ -82,6 +82,19 @@ recipe main [ +run: instruction main/2 +mem: storing 5 in location 3 +//: Make sure that each routine gets a different alloc to start. +:(scenario new_concurrent) +recipe f1 [ + run f2:recipe + 1:address:integer/raw <- new integer:type +] +recipe f2 [ + 2:address:integer/raw <- new integer:type + # hack: assumes scheduler implementation + 3:boolean/raw <- equal 1:address:integer/raw, 2:address:integer/raw +] ++mem: storing 0 in location 3 + //:: Next, extend 'new' to handle a string literal argument. :(scenario new_string) @@ -107,17 +120,3 @@ 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 -- cgit 1.4.1-2-gfad0