diff options
Diffstat (limited to 'cpp')
36 files changed, 155 insertions, 58 deletions
diff --git a/cpp/.traces/brace_conversion b/cpp/.traces/brace_conversion index 580f334f..e1852440 100644 --- a/cpp/.traces/brace_conversion +++ b/cpp/.traces/brace_conversion @@ -1,5 +1,5 @@ parse/0: label: { -parse/0: instruction: 30 +parse/0: instruction: 31 parse/0: instruction: 1 parse/0: ingredient: {name: "0", value: 0, type: 0, properties: ["0": "literal"]} parse/0: product: {name: "1", value: 0, type: 1, properties: ["1": "integer"]} diff --git a/cpp/.traces/brace_conversion_and_run b/cpp/.traces/brace_conversion_and_run index 8250e7a4..78844009 100644 --- a/cpp/.traces/brace_conversion_and_run +++ b/cpp/.traces/brace_conversion_and_run @@ -9,7 +9,7 @@ parse/0: instruction: 13 parse/0: ingredient: {name: "1", value: 0, type: 1, properties: ["1": "integer"]} parse/0: ingredient: {name: "1", value: 0, type: 0, properties: ["1": "literal"]} parse/0: product: {name: "3", value: 0, type: 3, properties: ["3": "boolean"]} -parse/0: instruction: 31 +parse/0: instruction: 32 parse/0: ingredient: {name: "3", value: 0, type: 3, properties: ["3": "boolean"]} parse/0: instruction: 4 parse/0: ingredient: {name: "2", value: 0, type: 1, properties: ["2": "integer"]} @@ -19,7 +19,7 @@ parse/0: instruction: 3 parse/0: ingredient: {name: "1", value: 0, type: 1, properties: ["1": "integer"]} parse/0: ingredient: {name: "1", value: 0, type: 0, properties: ["1": "literal"]} parse/0: product: {name: "1", value: 0, type: 1, properties: ["1": "integer"]} -parse/0: instruction: 33 +parse/0: instruction: 34 parse/0: label: } parse/0: instruction: 1 parse/0: ingredient: {name: "2", value: 0, type: 1, properties: ["2": "integer"]} diff --git a/cpp/.traces/break_cascading b/cpp/.traces/break_cascading index c21cda61..be0dcb75 100644 --- a/cpp/.traces/break_cascading +++ b/cpp/.traces/break_cascading @@ -2,10 +2,10 @@ parse/0: instruction: 1 parse/0: ingredient: {name: "0", value: 0, type: 0, properties: ["0": "literal"]} parse/0: product: {name: "1", value: 0, type: 1, properties: ["1": "integer"]} parse/0: label: { -parse/0: instruction: 30 +parse/0: instruction: 31 parse/0: label: } parse/0: label: { -parse/0: instruction: 30 +parse/0: instruction: 31 parse/0: label: } brace/0: 1000: push (open, 1) brace/0: push (close, 3) diff --git a/cpp/.traces/break_cascading2 b/cpp/.traces/break_cascading2 index 8d0d42b9..a4bf4668 100644 --- a/cpp/.traces/break_cascading2 +++ b/cpp/.traces/break_cascading2 @@ -5,13 +5,13 @@ parse/0: instruction: 1 parse/0: ingredient: {name: "0", value: 0, type: 0, properties: ["0": "literal"]} parse/0: product: {name: "2", value: 0, type: 1, properties: ["2": "integer"]} parse/0: label: { -parse/0: instruction: 30 +parse/0: instruction: 31 parse/0: instruction: 1 parse/0: ingredient: {name: "0", value: 0, type: 0, properties: ["0": "literal"]} parse/0: product: {name: "3", value: 0, type: 1, properties: ["3": "integer"]} parse/0: label: } parse/0: label: { -parse/0: instruction: 30 +parse/0: instruction: 31 parse/0: label: } brace/0: 1000: push (open, 2) brace/0: push (close, 5) diff --git a/cpp/.traces/break_empty_block b/cpp/.traces/break_empty_block index ee11f3e6..5dc33d5f 100644 --- a/cpp/.traces/break_empty_block +++ b/cpp/.traces/break_empty_block @@ -2,7 +2,7 @@ parse/0: instruction: 1 parse/0: ingredient: {name: "0", value: 0, type: 0, properties: ["0": "literal"]} parse/0: product: {name: "1", value: 0, type: 1, properties: ["1": "integer"]} parse/0: label: { -parse/0: instruction: 30 +parse/0: instruction: 31 parse/0: label: } brace/0: 1000: push (open, 1) brace/0: push (close, 3) diff --git a/cpp/.traces/break_if b/cpp/.traces/break_if index 5e379313..ba84c1bb 100644 --- a/cpp/.traces/break_if +++ b/cpp/.traces/break_if @@ -5,14 +5,14 @@ parse/0: instruction: 1 parse/0: ingredient: {name: "0", value: 0, type: 0, properties: ["0": "literal"]} parse/0: product: {name: "2", value: 0, type: 1, properties: ["2": "integer"]} parse/0: label: { -parse/0: instruction: 31 +parse/0: instruction: 32 parse/0: ingredient: {name: "2", value: 0, type: 1, properties: ["2": "integer"]} parse/0: instruction: 1 parse/0: ingredient: {name: "0", value: 0, type: 0, properties: ["0": "literal"]} parse/0: product: {name: "3", value: 0, type: 1, properties: ["3": "integer"]} parse/0: label: } parse/0: label: { -parse/0: instruction: 30 +parse/0: instruction: 31 parse/0: label: } brace/0: 1000: push (open, 2) brace/0: push (close, 5) diff --git a/cpp/.traces/break_label b/cpp/.traces/break_label index b4e5d5a4..1f66321f 100644 --- a/cpp/.traces/break_label +++ b/cpp/.traces/break_label @@ -2,7 +2,7 @@ parse/0: instruction: 1 parse/0: ingredient: {name: "0", value: 0, type: 0, properties: ["0": "literal"]} parse/0: product: {name: "1", value: 0, type: 1, properties: ["1": "integer"]} parse/0: label: { -parse/0: instruction: 30 +parse/0: instruction: 31 parse/0: ingredient: {name: "+foo", value: 0, type: 0, properties: ["+foo": "offset"]} parse/0: label: } brace/0: 1000: push (open, 1) diff --git a/cpp/.traces/break_nested b/cpp/.traces/break_nested index 2d445d5d..2879c48a 100644 --- a/cpp/.traces/break_nested +++ b/cpp/.traces/break_nested @@ -5,7 +5,7 @@ parse/0: label: { parse/0: instruction: 1 parse/0: ingredient: {name: "0", value: 0, type: 0, properties: ["0": "literal"]} parse/0: product: {name: "2", value: 0, type: 1, properties: ["2": "integer"]} -parse/0: instruction: 30 +parse/0: instruction: 31 parse/0: label: { parse/0: instruction: 1 parse/0: ingredient: {name: "0", value: 0, type: 0, properties: ["0": "literal"]} diff --git a/cpp/.traces/break_nested_degenerate b/cpp/.traces/break_nested_degenerate index 633b6ea0..d451959f 100644 --- a/cpp/.traces/break_nested_degenerate +++ b/cpp/.traces/break_nested_degenerate @@ -5,7 +5,7 @@ parse/0: label: { parse/0: instruction: 1 parse/0: ingredient: {name: "0", value: 0, type: 0, properties: ["0": "literal"]} parse/0: product: {name: "2", value: 0, type: 1, properties: ["2": "integer"]} -parse/0: instruction: 30 +parse/0: instruction: 31 parse/0: label: { parse/0: label: } parse/0: instruction: 1 diff --git a/cpp/.traces/break_nested_degenerate2 b/cpp/.traces/break_nested_degenerate2 index e32a341f..47f21f34 100644 --- a/cpp/.traces/break_nested_degenerate2 +++ b/cpp/.traces/break_nested_degenerate2 @@ -5,7 +5,7 @@ parse/0: label: { parse/0: instruction: 1 parse/0: ingredient: {name: "0", value: 0, type: 0, properties: ["0": "literal"]} parse/0: product: {name: "2", value: 0, type: 1, properties: ["2": "integer"]} -parse/0: instruction: 30 +parse/0: instruction: 31 parse/0: label: { parse/0: label: } parse/0: label: } diff --git a/cpp/.traces/break_unless b/cpp/.traces/break_unless index 16d7f12b..8557c249 100644 --- a/cpp/.traces/break_unless +++ b/cpp/.traces/break_unless @@ -5,7 +5,7 @@ parse/0: instruction: 1 parse/0: ingredient: {name: "0", value: 0, type: 0, properties: ["0": "literal"]} parse/0: product: {name: "2", value: 0, type: 1, properties: ["2": "integer"]} parse/0: label: { -parse/0: instruction: 32 +parse/0: instruction: 33 parse/0: ingredient: {name: "2", value: 0, type: 1, properties: ["2": "integer"]} parse/0: instruction: 1 parse/0: ingredient: {name: "0", value: 0, type: 0, properties: ["0": "literal"]} diff --git a/cpp/.traces/buffer-append-works b/cpp/.traces/buffer-append-works index 8f078ca0..dbd2345d 100644 --- a/cpp/.traces/buffer-append-works +++ b/cpp/.traces/buffer-append-works @@ -1,4 +1,4 @@ -parse/0: instruction: 36 +parse/0: instruction: 37 parse/0: ingredient: {name: "location", value: 0, type: 0, properties: ["location": "type"]} parse/0: ingredient: {name: "30", value: 0, type: 0, properties: ["30": "literal"]} parse/0: product: {name: "default-space", value: 0, type: 2-5-1, properties: ["default-space": "address":"array":"location"]} diff --git a/cpp/.traces/closure b/cpp/.traces/closure index 62bbbd4e..ae880949 100644 --- a/cpp/.traces/closure +++ b/cpp/.traces/closure @@ -1,4 +1,4 @@ -parse/0: instruction: 36 +parse/0: instruction: 37 parse/0: ingredient: {name: "location", value: 0, type: 0, properties: ["location": "type"]} parse/0: ingredient: {name: "30", value: 0, type: 0, properties: ["30": "literal"]} parse/0: product: {name: "default-space", value: 0, type: 2-5-1, properties: ["default-space": "address":"array":"location"]} @@ -10,7 +10,7 @@ parse/0: product: {name: "2", value: 0, type: 1, properties: ["2": "integer", parse/0: instruction: 1002 parse/0: ingredient: {name: "1", value: 0, type: 2-5-1, properties: ["1": "address":"array":"location", "names": "init-counter"]} parse/0: product: {name: "3", value: 0, type: 1, properties: ["3": "integer", "raw": ]} -parse/0: instruction: 36 +parse/0: instruction: 37 parse/0: ingredient: {name: "location", value: 0, type: 0, properties: ["location": "type"]} parse/0: ingredient: {name: "30", value: 0, type: 0, properties: ["30": "literal"]} parse/0: product: {name: "default-space", value: 0, type: 2-5-1, properties: ["default-space": "address":"array":"location"]} @@ -22,7 +22,7 @@ parse/0: ingredient: {name: "3", value: 0, type: 0, properties: ["3": "literal parse/0: product: {name: "y", value: 0, type: 1, properties: ["y": "integer"]} parse/0: instruction: 28 parse/0: ingredient: {name: "default-space", value: 0, type: 2-5-1, properties: ["default-space": "address":"array":"location"]} -parse/0: instruction: 36 +parse/0: instruction: 37 parse/0: ingredient: {name: "space", value: 0, type: 0, properties: ["space": "literal"]} parse/0: ingredient: {name: "30", value: 0, type: 0, properties: ["30": "literal"]} parse/0: product: {name: "default-space", value: 0, type: 2-5-1, properties: ["default-space": "address":"array":"location"]} diff --git a/cpp/.traces/interpolate-at-end b/cpp/.traces/interpolate-at-end index a6dcb375..c0093a24 100644 --- a/cpp/.traces/interpolate-at-end +++ b/cpp/.traces/interpolate-at-end @@ -1,7 +1,7 @@ -parse/0: instruction: 36 +parse/0: instruction: 37 parse/0: ingredient: {name: "hello, _", value: 0, type: 0, properties: ["hello, _": "literal-string"]} parse/0: product: {name: "1", value: 0, type: 2-5-4, properties: ["1": "address":"array":"character", "raw": ]} -parse/0: instruction: 36 +parse/0: instruction: 37 parse/0: ingredient: {name: "abc", value: 0, type: 0, properties: ["abc": "literal-string"]} parse/0: product: {name: "2", value: 0, type: 2-5-4, properties: ["2": "address":"array":"character", "raw": ]} parse/0: instruction: 107 diff --git a/cpp/.traces/interpolate-at-start b/cpp/.traces/interpolate-at-start index ce99463f..69b84ff5 100644 --- a/cpp/.traces/interpolate-at-start +++ b/cpp/.traces/interpolate-at-start @@ -1,7 +1,7 @@ -parse/0: instruction: 36 +parse/0: instruction: 37 parse/0: ingredient: {name: "_, hello!", value: 0, type: 0, properties: ["_, hello!": "literal-string"]} parse/0: product: {name: "1", value: 0, type: 2-5-4, properties: ["1": "address":"array":"character", "raw": ]} -parse/0: instruction: 36 +parse/0: instruction: 37 parse/0: ingredient: {name: "abc", value: 0, type: 0, properties: ["abc": "literal-string"]} parse/0: product: {name: "2", value: 0, type: 2-5-4, properties: ["2": "address":"array":"character", "raw": ]} parse/0: instruction: 107 diff --git a/cpp/.traces/interpolate-works b/cpp/.traces/interpolate-works index a9f9b7fb..b033c1fd 100644 --- a/cpp/.traces/interpolate-works +++ b/cpp/.traces/interpolate-works @@ -1,7 +1,7 @@ -parse/0: instruction: 36 +parse/0: instruction: 37 parse/0: ingredient: {name: "abc _", value: 0, type: 0, properties: ["abc _": "literal-string"]} parse/0: product: {name: "1", value: 0, type: 2-5-4, properties: ["1": "address":"array":"character", "raw": ]} -parse/0: instruction: 36 +parse/0: instruction: 37 parse/0: ingredient: {name: "def", value: 0, type: 0, properties: ["def": "literal-string"]} parse/0: product: {name: "2", value: 0, type: 2-5-4, properties: ["2": "address":"array":"character", "raw": ]} parse/0: instruction: 107 diff --git a/cpp/.traces/loop b/cpp/.traces/loop index 4cfc2250..d68874c4 100644 --- a/cpp/.traces/loop +++ b/cpp/.traces/loop @@ -8,7 +8,7 @@ parse/0: label: { parse/0: instruction: 1 parse/0: ingredient: {name: "0", value: 0, type: 0, properties: ["0": "literal"]} parse/0: product: {name: "3", value: 0, type: 1, properties: ["3": "integer"]} -parse/0: instruction: 33 +parse/0: instruction: 34 parse/0: label: } brace/0: 1000: push (open, 2) brace/0: push (close, 5) diff --git a/cpp/.traces/loop_nested b/cpp/.traces/loop_nested index b707de42..37ccf23f 100644 --- a/cpp/.traces/loop_nested +++ b/cpp/.traces/loop_nested @@ -10,7 +10,7 @@ parse/0: instruction: 1 parse/0: ingredient: {name: "0", value: 0, type: 0, properties: ["0": "literal"]} parse/0: product: {name: "3", value: 0, type: 1, properties: ["3": "integer"]} parse/0: label: } -parse/0: instruction: 34 +parse/0: instruction: 35 parse/0: ingredient: {name: "4", value: 0, type: 3, properties: ["4": "boolean"]} parse/0: instruction: 1 parse/0: ingredient: {name: "0", value: 0, type: 0, properties: ["0": "literal"]} diff --git a/cpp/.traces/loop_unless b/cpp/.traces/loop_unless index fe50d87e..efd39cc2 100644 --- a/cpp/.traces/loop_unless +++ b/cpp/.traces/loop_unless @@ -5,7 +5,7 @@ parse/0: instruction: 1 parse/0: ingredient: {name: "0", value: 0, type: 0, properties: ["0": "literal"]} parse/0: product: {name: "2", value: 0, type: 1, properties: ["2": "integer"]} parse/0: label: { -parse/0: instruction: 35 +parse/0: instruction: 36 parse/0: ingredient: {name: "2", value: 0, type: 1, properties: ["2": "integer"]} parse/0: instruction: 1 parse/0: ingredient: {name: "0", value: 0, type: 0, properties: ["0": "literal"]} diff --git a/cpp/.traces/new b/cpp/.traces/new index ff60abae..6b9fb9a9 100644 --- a/cpp/.traces/new +++ b/cpp/.traces/new @@ -1,7 +1,7 @@ -parse/0: instruction: 36 +parse/0: instruction: 37 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", "raw": ]} -parse/0: instruction: 36 +parse/0: instruction: 37 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", "raw": ]} parse/0: instruction: 13 diff --git a/cpp/.traces/new_array b/cpp/.traces/new_array index 32a600fc..6f0fc8ac 100644 --- a/cpp/.traces/new_array +++ b/cpp/.traces/new_array @@ -1,8 +1,8 @@ -parse/0: instruction: 36 +parse/0: instruction: 37 parse/0: ingredient: {name: "integer", value: 0, type: 0, properties: ["integer": "type"]} parse/0: ingredient: {name: "5", value: 0, type: 0, properties: ["5": "literal"]} parse/0: product: {name: "1", value: 0, type: 2-5-1, properties: ["1": "address":"array":"integer", "raw": ]} -parse/0: instruction: 36 +parse/0: instruction: 37 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", "raw": ]} parse/0: instruction: 3 diff --git a/cpp/.traces/new_concurrent b/cpp/.traces/new_concurrent index 5e35b113..94200129 100644 --- a/cpp/.traces/new_concurrent +++ b/cpp/.traces/new_concurrent @@ -1,9 +1,9 @@ parse/0: instruction: 29 parse/0: ingredient: {name: "f2", value: 0, type: 0, properties: ["f2": "recipe"]} -parse/0: instruction: 36 +parse/0: instruction: 37 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", "raw": ]} -parse/0: instruction: 36 +parse/0: instruction: 37 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", "raw": ]} parse/0: instruction: 13 diff --git a/cpp/.traces/new_overflow b/cpp/.traces/new_overflow index 6a24ab18..877f1f46 100644 --- a/cpp/.traces/new_overflow +++ b/cpp/.traces/new_overflow @@ -1,7 +1,7 @@ -parse/0: instruction: 36 +parse/0: instruction: 37 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", "raw": ]} -parse/0: instruction: 36 +parse/0: instruction: 37 parse/0: ingredient: {name: "point", value: 0, type: 0, properties: ["point": "type"]} parse/0: product: {name: "2", value: 0, type: 2-6, properties: ["2": "address":"point", "raw": ]} new/0: integer -> 1 diff --git a/cpp/.traces/new_string b/cpp/.traces/new_string index 6b6cf903..e38d328b 100644 --- a/cpp/.traces/new_string +++ b/cpp/.traces/new_string @@ -1,4 +1,4 @@ -parse/0: instruction: 36 +parse/0: instruction: 37 parse/0: ingredient: {name: "abc def", value: 0, type: 0, properties: ["abc def": "literal-string"]} parse/0: product: {name: "1", value: 0, type: 2-5-4, properties: ["1": "address":"array":"character"]} parse/0: instruction: 21 diff --git a/cpp/.traces/stalled_routine b/cpp/.traces/stalled_routine new file mode 100644 index 00000000..cb2311c5 --- /dev/null +++ b/cpp/.traces/stalled_routine @@ -0,0 +1,40 @@ +parse/0: instruction: 1 +parse/0: ingredient: {name: "0", value: 0, type: 0, properties: ["0": "literal"]} +parse/0: product: {name: "1", value: 0, type: 1, properties: ["1": "integer"]} +parse/0: instruction: 29 +parse/0: ingredient: {name: "f2", value: 0, type: 0, properties: ["f2": "recipe"]} +parse/0: instruction: 30 +parse/0: ingredient: {name: "1", value: 0, type: 1, properties: ["1": "integer"]} +parse/0: instruction: 1 +parse/0: ingredient: {name: "1", value: 0, type: 1, properties: ["1": "integer"]} +parse/0: product: {name: "2", value: 0, type: 1, properties: ["2": "integer"]} +parse/0: instruction: 1 +parse/0: ingredient: {name: "34", value: 0, type: 0, properties: ["34": "literal"]} +parse/0: product: {name: "1", value: 0, type: 1, properties: ["1": "integer"]} +after-brace/0: recipe f1 +after-brace/0: copy ... +after-brace/0: run ... +after-brace/0: wait-for-location ... +after-brace/0: copy ... +after-brace/0: recipe f2 +after-brace/0: copy ... +new/0: routine allocated memory from 1000 to 101000 +schedule/0: f1 +run/0: instruction f1/0 +run/0: ingredient 0 is 0 +mem/0: storing 0 in location 1 +run/0: instruction f1/1 +run/0: ingredient 0 is f2 +new/0: routine allocated memory from 101000 to 201000 +run/0: instruction f1/2 +run/0: waiting for 1 to change from 0 +schedule/0: f2 +run/0: instruction f2/0 +run/0: ingredient 0 is 34 +mem/0: storing 34 in location 1 +schedule/0: waking up routine +schedule/0: f1 +run/0: instruction f1/3 +run/0: ingredient 0 is 1 +mem/0: location 1 is 34 +mem/0: storing 34 in location 2 diff --git a/cpp/.traces/string-append-1 b/cpp/.traces/string-append-1 index dbc84dcb..8dd9c849 100644 --- a/cpp/.traces/string-append-1 +++ b/cpp/.traces/string-append-1 @@ -1,7 +1,7 @@ -parse/0: instruction: 36 +parse/0: instruction: 37 parse/0: ingredient: {name: "hello,", value: 0, type: 0, properties: ["hello,": "literal-string"]} parse/0: product: {name: "1", value: 0, type: 2-5-4, properties: ["1": "address":"array":"character", "raw": ]} -parse/0: instruction: 36 +parse/0: instruction: 37 parse/0: ingredient: {name: " world!", value: 0, type: 0, properties: [" world!": "literal-string"]} parse/0: product: {name: "2", value: 0, type: 2-5-4, properties: ["2": "address":"array":"character", "raw": ]} parse/0: instruction: 106 diff --git a/cpp/.traces/string-equal-common-lengths-but-distinct b/cpp/.traces/string-equal-common-lengths-but-distinct index 45605a29..a21aaafe 100644 --- a/cpp/.traces/string-equal-common-lengths-but-distinct +++ b/cpp/.traces/string-equal-common-lengths-but-distinct @@ -1,11 +1,11 @@ -parse/0: instruction: 36 +parse/0: instruction: 37 parse/0: ingredient: {name: "location", value: 0, type: 0, properties: ["location": "type"]} parse/0: ingredient: {name: "30", value: 0, type: 0, properties: ["30": "literal"]} parse/0: product: {name: "default-space", value: 0, type: 2-5-1, properties: ["default-space": "address":"array":"location"]} -parse/0: instruction: 36 +parse/0: instruction: 37 parse/0: ingredient: {name: "abc", value: 0, type: 0, properties: ["abc": "literal-string"]} parse/0: product: {name: "x", value: 0, type: 2-5-4, properties: ["x": "address":"array":"character"]} -parse/0: instruction: 36 +parse/0: instruction: 37 parse/0: ingredient: {name: "abd", value: 0, type: 0, properties: ["abd": "literal-string"]} parse/0: product: {name: "y", value: 0, type: 2-5-4, properties: ["y": "address":"array":"character"]} parse/0: instruction: 100 diff --git a/cpp/.traces/string-equal-distinct-lengths b/cpp/.traces/string-equal-distinct-lengths index 249f6a32..e410fdc1 100644 --- a/cpp/.traces/string-equal-distinct-lengths +++ b/cpp/.traces/string-equal-distinct-lengths @@ -1,11 +1,11 @@ -parse/0: instruction: 36 +parse/0: instruction: 37 parse/0: ingredient: {name: "location", value: 0, type: 0, properties: ["location": "type"]} parse/0: ingredient: {name: "30", value: 0, type: 0, properties: ["30": "literal"]} parse/0: product: {name: "default-space", value: 0, type: 2-5-1, properties: ["default-space": "address":"array":"location"]} -parse/0: instruction: 36 +parse/0: instruction: 37 parse/0: ingredient: {name: "abc", value: 0, type: 0, properties: ["abc": "literal-string"]} parse/0: product: {name: "x", value: 0, type: 2-5-4, properties: ["x": "address":"array":"character"]} -parse/0: instruction: 36 +parse/0: instruction: 37 parse/0: ingredient: {name: "abcd", value: 0, type: 0, properties: ["abcd": "literal-string"]} parse/0: product: {name: "y", value: 0, type: 2-5-4, properties: ["y": "address":"array":"character"]} parse/0: instruction: 100 diff --git a/cpp/.traces/string-equal-identical b/cpp/.traces/string-equal-identical index bd621b78..cf783038 100644 --- a/cpp/.traces/string-equal-identical +++ b/cpp/.traces/string-equal-identical @@ -1,11 +1,11 @@ -parse/0: instruction: 36 +parse/0: instruction: 37 parse/0: ingredient: {name: "location", value: 0, type: 0, properties: ["location": "type"]} parse/0: ingredient: {name: "30", value: 0, type: 0, properties: ["30": "literal"]} parse/0: product: {name: "default-space", value: 0, type: 2-5-1, properties: ["default-space": "address":"array":"location"]} -parse/0: instruction: 36 +parse/0: instruction: 37 parse/0: ingredient: {name: "abc", value: 0, type: 0, properties: ["abc": "literal-string"]} parse/0: product: {name: "x", value: 0, type: 2-5-4, properties: ["x": "address":"array":"character"]} -parse/0: instruction: 36 +parse/0: instruction: 37 parse/0: ingredient: {name: "abc", value: 0, type: 0, properties: ["abc": "literal-string"]} parse/0: product: {name: "y", value: 0, type: 2-5-4, properties: ["y": "address":"array":"character"]} parse/0: instruction: 100 diff --git a/cpp/.traces/string-equal-reflexive b/cpp/.traces/string-equal-reflexive index b0379aee..6889bd9d 100644 --- a/cpp/.traces/string-equal-reflexive +++ b/cpp/.traces/string-equal-reflexive @@ -1,8 +1,8 @@ -parse/0: instruction: 36 +parse/0: instruction: 37 parse/0: ingredient: {name: "location", value: 0, type: 0, properties: ["location": "type"]} parse/0: ingredient: {name: "30", value: 0, type: 0, properties: ["30": "literal"]} parse/0: product: {name: "default-space", value: 0, type: 2-5-1, properties: ["default-space": "address":"array":"location"]} -parse/0: instruction: 36 +parse/0: instruction: 37 parse/0: ingredient: {name: "abc", value: 0, type: 0, properties: ["abc": "literal-string"]} parse/0: product: {name: "x", value: 0, type: 2-5-4, properties: ["x": "address":"array":"character"]} parse/0: instruction: 100 diff --git a/cpp/.traces/string-equal-with-empty b/cpp/.traces/string-equal-with-empty index f7c4fb88..c25963b3 100644 --- a/cpp/.traces/string-equal-with-empty +++ b/cpp/.traces/string-equal-with-empty @@ -1,11 +1,11 @@ -parse/0: instruction: 36 +parse/0: instruction: 37 parse/0: ingredient: {name: "location", value: 0, type: 0, properties: ["location": "type"]} parse/0: ingredient: {name: "30", value: 0, type: 0, properties: ["30": "literal"]} parse/0: product: {name: "default-space", value: 0, type: 2-5-1, properties: ["default-space": "address":"array":"location"]} -parse/0: instruction: 36 +parse/0: instruction: 37 parse/0: ingredient: {name: "", value: 0, type: 0, properties: ["": "literal-string"]} parse/0: product: {name: "x", value: 0, type: 2-5-4, properties: ["x": "address":"array":"character"]} -parse/0: instruction: 36 +parse/0: instruction: 37 parse/0: ingredient: {name: "abcd", value: 0, type: 0, properties: ["abcd": "literal-string"]} parse/0: product: {name: "y", value: 0, type: 2-5-4, properties: ["y": "address":"array":"character"]} parse/0: instruction: 100 diff --git a/cpp/.traces/string_literal b/cpp/.traces/string_literal index be063bc6..966b5166 100644 --- a/cpp/.traces/string_literal +++ b/cpp/.traces/string_literal @@ -1,3 +1,3 @@ -parse/0: instruction: 36 +parse/0: instruction: 37 parse/0: ingredient: {name: "abc def", value: 0, type: 0, properties: ["abc def": "literal-string"]} parse/0: product: {name: "1", value: 0, type: 2-5-4, properties: ["1": "address":"array":"character"]} diff --git a/cpp/.traces/string_literal_nested b/cpp/.traces/string_literal_nested index 3b22a0d6..963b8ad8 100644 --- a/cpp/.traces/string_literal_nested +++ b/cpp/.traces/string_literal_nested @@ -1,3 +1,3 @@ -parse/0: instruction: 36 +parse/0: instruction: 37 parse/0: ingredient: {name: "abc [def]", value: 0, type: 0, properties: ["abc [def]": "literal-string"]} parse/0: product: {name: "1", value: 0, type: 2-5-4, properties: ["1": "address":"array":"character"]} diff --git a/cpp/.traces/string_literal_with_colons b/cpp/.traces/string_literal_with_colons index 95200b73..a646ca0f 100644 --- a/cpp/.traces/string_literal_with_colons +++ b/cpp/.traces/string_literal_with_colons @@ -1,3 +1,3 @@ -parse/0: instruction: 36 +parse/0: instruction: 37 parse/0: ingredient: {name: "abc:def/ghi", value: 0, type: 0, properties: ["abc:def/ghi": "literal-string"]} parse/0: product: {name: "1", value: 0, type: 2-5-4, properties: ["1": "address":"array":"character"]} diff --git a/cpp/038scheduler.cc b/cpp/038scheduler.cc index f0f970dd..76b90933 100644 --- a/cpp/038scheduler.cc +++ b/cpp/038scheduler.cc @@ -18,7 +18,7 @@ recipe f2 [ void run_current_routine(size_t time_slice) :(replace "while (!Current_routine->completed())" following "void run_current_routine(size_t time_slice)") size_t ninstrs = 0; -while (!Current_routine->completed() && ninstrs < time_slice) +while (Current_routine->state == RUNNING && ninstrs < time_slice) :(after "Running One Instruction") ninstrs++; @@ -28,7 +28,7 @@ ninstrs++; enum routine_state { RUNNING, COMPLETED, - // End Routine States + // End routine States }; :(before "End routine Fields") enum routine_state state; diff --git a/cpp/039wait.cc b/cpp/039wait.cc new file mode 100644 index 00000000..eba3a437 --- /dev/null +++ b/cpp/039wait.cc @@ -0,0 +1,57 @@ +//: Routines can be put in a 'waiting' state, from which it will be ready to +//: run again when a specific memory location changes its value. This is mu's +//: basic technique for orchestrating the order in which different routines +//: operate. + +:(scenario "stalled_routine") +recipe f1 [ + 1:integer <- copy 0:literal + run f2:recipe + wait-for-location 1:integer + # now wait for f2 to run and modify location 1 before using its value + 2:integer <- copy 1:integer +] +recipe f2 [ + 1:integer <- copy 34:literal +] +# if we got the synchronization wrong we'd be storing 0 in location 2 ++mem: storing 34 in location 2 + +//: define the new state that all routines can be in + +:(before "End routine States") +WAITING, +:(before "End routine Fields") +// only if state == WAITING +size_t waiting_on_location; +int old_value_of_wating_location; +:(before "End routine Constructor") +waiting_on_location = old_value_of_wating_location = 0; + +//: primitive recipe to put routines in that state + +:(before "End Primitive Recipe Declarations") +WAIT_FOR_LOCATION, +:(before "End Primitive Recipe Numbers") +Recipe_number["wait-for-location"] = WAIT_FOR_LOCATION; +:(before "End Primitive Recipe Implementations") +case WAIT_FOR_LOCATION: { + reagent loc = canonize(current_instruction().ingredients[0]); + Current_routine->state = WAITING; + Current_routine->waiting_on_location = loc.value; + Current_routine->old_value_of_wating_location = Memory[loc.value]; + trace("run") << "waiting for " << loc.value << " to change from " << Memory[loc.value]; + break; +} + +//: scheduler tweak to get routines out of that state + +:(before "End Scheduler State Transitions") +for (size_t i = 0; i < Routines.size(); ++i) { + if (Routines[i]->state != WAITING) continue; + if (Memory[Routines[i]->waiting_on_location] != Routines[i]->old_value_of_wating_location) { + trace("schedule") << "waking up routine\n"; + Routines[i]->state = RUNNING; + Routines[i]->waiting_on_location = Routines[i]->old_value_of_wating_location = 0; + } +} |