From c6f157a6e3ee10fa9209b1fa4a305040ce876d00 Mon Sep 17 00:00:00 2001 From: raftedproc <71657594+raftedproc@users.noreply.github.com> Date: Thu, 28 Dec 2023 20:48:16 +0300 Subject: [PATCH] feat(air-parser): VM-347 After next validator fold check (#774) --- .../features/data_merging/data_merge.rs | 8 +- .../data_merging/scripts/inner_folds_v1.air | 4 +- .../features/streams/ap_with_fold.rs | 4 +- .../scripts/stream_fold_merging_v1.air | 8 +- .../test_module/features/streams/streams.rs | 74 +- benches/PERFORMANCE.json | 666 ++++++------ benches/PERFORMANCE.txt | 658 ++++++------ .../air-lib/air-parser/src/parser/air.lalrpop | 35 +- crates/air-lib/air-parser/src/parser/air.rs | 717 ++++++++++--- .../air-lib/air-parser/src/parser/errors.rs | 8 + .../air-parser/src/parser/tests/fold.rs | 958 ++++++++++++++++++ .../air-parser/src/parser/validator.rs | 295 ++++++ 12 files changed, 2577 insertions(+), 858 deletions(-) diff --git a/air/tests/test_module/features/data_merging/data_merge.rs b/air/tests/test_module/features/data_merging/data_merge.rs index d1c1db4b..cbce72fa 100644 --- a/air/tests/test_module/features/data_merging/data_merge.rs +++ b/air/tests/test_module/features/data_merging/data_merge.rs @@ -190,13 +190,13 @@ fn stream_merge() { let mut vm2 = create_avm(neighborhood_call_service, "B"); let script = r#" - (seq + (seq (call "A" ("add_provider" "") [] $void) - (seq + (seq (call "A" ("add_provider" "") [] $void) - (seq + (seq (call "A" ("get_providers" "") [] $providers) - (seq + (seq (call "A" ("get_providers" "") [] $providers) (seq (seq diff --git a/air/tests/test_module/features/data_merging/scripts/inner_folds_v1.air b/air/tests/test_module/features/data_merging/scripts/inner_folds_v1.air index ba2dd4ef..bae3b745 100644 --- a/air/tests/test_module/features/data_merging/scripts/inner_folds_v1.air +++ b/air/tests/test_module/features/data_merging/scripts/inner_folds_v1.air @@ -22,6 +22,6 @@ (seq (par (call "{1}" ("" "") [v1 v2]) - (next v2)) - (call "{1}" ("" "") [v1 v2]))) + (call "{1}" ("" "") [v1 v2])) + (next v2))) (next v1))))) diff --git a/air/tests/test_module/features/streams/ap_with_fold.rs b/air/tests/test_module/features/streams/ap_with_fold.rs index 487aa0d9..83739519 100644 --- a/air/tests/test_module/features/streams/ap_with_fold.rs +++ b/air/tests/test_module/features/streams/ap_with_fold.rs @@ -48,8 +48,8 @@ fn ap_with_fold() { (next pair))) (fold $inner ns (par - (next ns) - (null)))) + (null) + (next ns)))) (seq (call "{local_vm_peer_id}" ("op" "noop") []) (seq diff --git a/air/tests/test_module/features/streams/scripts/stream_fold_merging_v1.air b/air/tests/test_module/features/streams/scripts/stream_fold_merging_v1.air index 9d19d2c6..cb42d4ed 100644 --- a/air/tests/test_module/features/streams/scripts/stream_fold_merging_v1.air +++ b/air/tests/test_module/features/streams/scripts/stream_fold_merging_v1.air @@ -18,5 +18,9 @@ (par (seq (call "{4}" ("" "") [v]) - (next v)) - (call "{4}" ("" "") [v])))) + (call "{4}" ("" "") [v]) + ) + (next v) + ) + ) +) diff --git a/air/tests/test_module/features/streams/streams.rs b/air/tests/test_module/features/streams/streams.rs index c48ace9f..efca7619 100644 --- a/air/tests/test_module/features/streams/streams.rs +++ b/air/tests/test_module/features/streams/streams.rs @@ -251,17 +251,17 @@ fn stream_merging_v1() { stream!("1", 0, peer = setter_1_id), executed_state::request_sent_by(initiator_id), executed_state::fold(vec![ - executed_state::subtrace_lore(7, subtrace_desc(15, 2), subtrace_desc(23, 1)), - executed_state::subtrace_lore(9, subtrace_desc(17, 2), subtrace_desc(22, 1)), - executed_state::subtrace_lore(12, subtrace_desc(19, 2), subtrace_desc(21, 1)), + executed_state::subtrace_lore(7, subtrace_desc(15, 3), subtrace_desc(24, 0)), + executed_state::subtrace_lore(9, subtrace_desc(18, 3), subtrace_desc(24, 0)), + executed_state::subtrace_lore(12, subtrace_desc(21, 3), subtrace_desc(24, 0)), ]), - executed_state::par(7, 1), - unused!(unit_call_service_result, peer = executor_id, args = ["1"]), - executed_state::par(4, 1), - unused!(unit_call_service_result, peer = executor_id, args = ["1"]), - executed_state::par(1, 1), + executed_state::par(2, 6), unused!(unit_call_service_result, peer = executor_id, args = ["1"]), unused!(unit_call_service_result, peer = executor_id, args = ["1"]), + executed_state::par(2, 3), + unused!(unit_call_service_result, peer = executor_id, args = ["1"]), + unused!(unit_call_service_result, peer = executor_id, args = ["1"]), + executed_state::par(2, 0), unused!(unit_call_service_result, peer = executor_id, args = ["1"]), unused!(unit_call_service_result, peer = executor_id, args = ["1"]), ]); @@ -292,25 +292,25 @@ fn stream_merging_v1() { stream!("1", 0, peer = setter_1_id), stream!("2", 1, peer = setter_2_id), executed_state::fold(vec![ - executed_state::subtrace_lore(7, subtrace_desc(15, 2), subtrace_desc(23, 1)), - executed_state::subtrace_lore(9, subtrace_desc(17, 2), subtrace_desc(22, 1)), - executed_state::subtrace_lore(12, subtrace_desc(19, 2), subtrace_desc(21, 1)), - executed_state::subtrace_lore(8, subtrace_desc(24, 2), subtrace_desc(29, 1)), - executed_state::subtrace_lore(13, subtrace_desc(26, 2), subtrace_desc(28, 1)), + executed_state::subtrace_lore(7, subtrace_desc(15, 3), subtrace_desc(24, 0)), + executed_state::subtrace_lore(9, subtrace_desc(18, 3), subtrace_desc(24, 0)), + executed_state::subtrace_lore(12, subtrace_desc(21, 3), subtrace_desc(24, 0)), + executed_state::subtrace_lore(8, subtrace_desc(24, 3), subtrace_desc(30, 0)), + executed_state::subtrace_lore(13, subtrace_desc(27, 3), subtrace_desc(30, 0)), ]), - executed_state::par(7, 1), - unused!(unit_call_service_result, peer = executor_id, args = ["1"]), - executed_state::par(4, 1), - unused!(unit_call_service_result, peer = executor_id, args = ["1"]), - executed_state::par(1, 1), + executed_state::par(2, 6), unused!(unit_call_service_result, peer = executor_id, args = ["1"]), unused!(unit_call_service_result, peer = executor_id, args = ["1"]), + executed_state::par(2, 3), unused!(unit_call_service_result, peer = executor_id, args = ["1"]), unused!(unit_call_service_result, peer = executor_id, args = ["1"]), - executed_state::par(4, 1), + executed_state::par(2, 0), + unused!(unit_call_service_result, peer = executor_id, args = ["1"]), + unused!(unit_call_service_result, peer = executor_id, args = ["1"]), + executed_state::par(2, 3), unused!(unit_call_service_result, peer = executor_id, args = ["2"]), - executed_state::par(1, 1), unused!(unit_call_service_result, peer = executor_id, args = ["2"]), + executed_state::par(2, 0), unused!(unit_call_service_result, peer = executor_id, args = ["2"]), unused!(unit_call_service_result, peer = executor_id, args = ["2"]), ]); @@ -341,33 +341,33 @@ fn stream_merging_v1() { stream!("1", 0, peer = setter_1_id), stream!("2", 1, peer = setter_2_id), executed_state::fold(vec![ - executed_state::subtrace_lore(7, subtrace_desc(15, 2), subtrace_desc(23, 1)), - executed_state::subtrace_lore(9, subtrace_desc(17, 2), subtrace_desc(22, 1)), - executed_state::subtrace_lore(12, subtrace_desc(19, 2), subtrace_desc(21, 1)), - executed_state::subtrace_lore(8, subtrace_desc(24, 2), subtrace_desc(29, 1)), - executed_state::subtrace_lore(13, subtrace_desc(26, 2), subtrace_desc(28, 1)), - executed_state::subtrace_lore(10, subtrace_desc(30, 2), subtrace_desc(35, 1)), - executed_state::subtrace_lore(11, subtrace_desc(32, 2), subtrace_desc(34, 1)), + executed_state::subtrace_lore(7, subtrace_desc(15, 3), subtrace_desc(24, 0)), + executed_state::subtrace_lore(9, subtrace_desc(18, 3), subtrace_desc(24, 0)), + executed_state::subtrace_lore(12, subtrace_desc(21, 3), subtrace_desc(24, 0)), + executed_state::subtrace_lore(8, subtrace_desc(24, 3), subtrace_desc(30, 0)), + executed_state::subtrace_lore(13, subtrace_desc(27, 3), subtrace_desc(30, 0)), + executed_state::subtrace_lore(10, subtrace_desc(30, 3), subtrace_desc(36, 0)), + executed_state::subtrace_lore(11, subtrace_desc(33, 3), subtrace_desc(36, 0)), ]), - executed_state::par(7, 1), - unused!(unit_call_service_result, peer = executor_id, args = ["1"]), - executed_state::par(4, 1), - unused!(unit_call_service_result, peer = executor_id, args = ["1"]), - executed_state::par(1, 1), + executed_state::par(2, 6), unused!(unit_call_service_result, peer = executor_id, args = ["1"]), unused!(unit_call_service_result, peer = executor_id, args = ["1"]), + executed_state::par(2, 3), unused!(unit_call_service_result, peer = executor_id, args = ["1"]), unused!(unit_call_service_result, peer = executor_id, args = ["1"]), - executed_state::par(4, 1), - unused!(unit_call_service_result, peer = executor_id, args = ["2"]), - executed_state::par(1, 1), + executed_state::par(2, 0), + unused!(unit_call_service_result, peer = executor_id, args = ["1"]), + unused!(unit_call_service_result, peer = executor_id, args = ["1"]), + executed_state::par(2, 3), unused!(unit_call_service_result, peer = executor_id, args = ["2"]), unused!(unit_call_service_result, peer = executor_id, args = ["2"]), + executed_state::par(2, 0), unused!(unit_call_service_result, peer = executor_id, args = ["2"]), - executed_state::par(4, 1), + unused!(unit_call_service_result, peer = executor_id, args = ["2"]), + executed_state::par(2, 3), unused!(unit_call_service_result, peer = executor_id, args = ["3"]), - executed_state::par(1, 1), unused!(unit_call_service_result, peer = executor_id, args = ["3"]), + executed_state::par(2, 0), unused!(unit_call_service_result, peer = executor_id, args = ["3"]), unused!(unit_call_service_result, peer = executor_id, args = ["3"]), ]); diff --git a/benches/PERFORMANCE.json b/benches/PERFORMANCE.json index e077d54e..e702503f 100644 --- a/benches/PERFORMANCE.json +++ b/benches/PERFORMANCE.json @@ -1206,62 +1206,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "19.30ms", + "duration": "19.20ms", "nested": { "preparation_step::preparation::parse_data": { "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", - "duration": "6.94ms", + "duration": "7.01ms", "nested": { - "try_from_slice": "6.90ms" + "try_from_slice": "6.96ms" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "275.00µs", + "duration": "184.00µs", "nested": { "air::preparation_step::preparation::make_exec_ctx": { "common_prefix": "air::preparation_step::preparation", - "duration": "43.00µs", + "duration": "44.00µs", "nested": { - "CallResultsRepr.deserialize": "11.00µs" + "CallResultsRepr.deserialize": "10.00µs" } }, - "air_parser::parser::air_parser::parse": "18.00µs" + "air_parser::parser::air_parser::parse": "19.00µs" } }, - "runner::execute": "17.00µs", + "runner::execute": "9.00µs", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "5.50ms", + "duration": "5.81ms", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "5.48ms", + "duration": "5.78ms", "nested": { "populate_outcome_from_contexts": { "common_prefix": "air::farewell_step::outcome", - "duration": "5.44ms", + "duration": "5.74ms", "nested": { - "CallRequestsRepr.serialize": "14.00µs", - "InterpreterData::serialize": "4.13ms" + "CallRequestsRepr.serialize": "15.00µs", + "InterpreterData::serialize": "4.44ms" } } } } } }, - "signing_step::sign_produced_cids": "185.00µs", + "signing_step::sign_produced_cids": "98.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "6.24ms", + "duration": "5.99ms", "nested": { - "verify": "5.63ms" + "verify": "5.66ms" } } } } }, - "total_time": "19.30ms" + "total_time": "19.20ms" }, "call-requests500": { "comment": "multiple call requests", @@ -1272,62 +1272,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "52.20ms", + "duration": "53.00ms", "nested": { "preparation_step::preparation::parse_data": { "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", - "duration": "115.00µs", + "duration": "105.00µs", "nested": { - "try_from_slice": "78.00µs" + "try_from_slice": "66.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "315.00µs", + "duration": "235.00µs", "nested": { "air::preparation_step::preparation::make_exec_ctx": { "common_prefix": "air::preparation_step::preparation", - "duration": "62.00µs", + "duration": "60.00µs", "nested": { - "CallResultsRepr.deserialize": "35.00µs" + "CallResultsRepr.deserialize": "34.00µs" } }, - "air_parser::parser::air_parser::parse": "47.00µs" + "air_parser::parser::air_parser::parse": "48.00µs" } }, - "runner::execute": "25.40ms", + "runner::execute": "25.00ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "25.90ms", + "duration": "27.30ms", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "25.90ms", + "duration": "27.30ms", "nested": { "populate_outcome_from_contexts": { "common_prefix": "air::farewell_step::outcome", - "duration": "25.70ms", + "duration": "27.10ms", "nested": { - "CallRequestsRepr.serialize": "25.10ms", - "InterpreterData::serialize": "374.00µs" + "CallRequestsRepr.serialize": "26.50ms", + "InterpreterData::serialize": "377.00µs" } } } } } }, - "signing_step::sign_produced_cids": "196.00µs", + "signing_step::sign_produced_cids": "136.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "71.00µs", + "duration": "64.00µs", "nested": { - "verify": "11.00µs" + "verify": "10.00µs" } } } } }, - "total_time": "52.20ms" + "total_time": "53.00ms" }, "call-results500": { "comment": "multiple call results", @@ -1338,43 +1338,43 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "21.10ms", + "duration": "21.20ms", "nested": { "preparation_step::preparation::parse_data": { "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", - "duration": "657.00µs", + "duration": "587.00µs", "nested": { - "try_from_slice": "615.00µs" + "try_from_slice": "546.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "988.00µs", + "duration": "895.00µs", "nested": { "air::preparation_step::preparation::make_exec_ctx": { "common_prefix": "air::preparation_step::preparation", - "duration": "731.00µs", + "duration": "718.00µs", "nested": { - "CallResultsRepr.deserialize": "700.00µs" + "CallResultsRepr.deserialize": "686.00µs" } }, - "air_parser::parser::air_parser::parse": "48.00µs" + "air_parser::parser::air_parser::parse": "50.00µs" } }, - "runner::execute": "15.90ms", + "runner::execute": "16.50ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "2.69ms", + "duration": "2.63ms", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "2.66ms", + "duration": "2.60ms", "nested": { "populate_outcome_from_contexts": { "common_prefix": "air::farewell_step::outcome", - "duration": "2.22ms", + "duration": "2.15ms", "nested": { - "CallRequestsRepr.serialize": "14.00µs", + "CallRequestsRepr.serialize": "13.00µs", "InterpreterData::serialize": "1.54ms" } } @@ -1382,18 +1382,18 @@ } } }, - "signing_step::sign_produced_cids": "548.00µs", + "signing_step::sign_produced_cids": "456.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", "duration": "67.00µs", "nested": { - "verify": "9.00µs" + "verify": "10.00µs" } } } } }, - "total_time": "21.10ms" + "total_time": "21.20ms" }, "canon-map-key-by-lens": { "comment": "benchmarking a map insert operation", @@ -1408,52 +1408,52 @@ "nested": { "preparation_step::preparation::parse_data": { "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", - "duration": "4.02ms", + "duration": "4.07ms", "nested": { - "try_from_slice": "3.97ms" + "try_from_slice": "4.01ms" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "623.00µs", + "duration": "549.00µs", "nested": { "air::preparation_step::preparation::make_exec_ctx": { "common_prefix": "air::preparation_step::preparation", - "duration": "360.00µs", + "duration": "365.00µs", "nested": { "CallResultsRepr.deserialize": "10.00µs" } }, - "air_parser::parser::air_parser::parse": "53.00µs" + "air_parser::parser::air_parser::parse": "56.00µs" } }, - "runner::execute": "2.82ms", + "runner::execute": "2.84ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "3.24ms", + "duration": "3.49ms", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "3.22ms", + "duration": "3.46ms", "nested": { "populate_outcome_from_contexts": { "common_prefix": "air::farewell_step::outcome", - "duration": "2.81ms", + "duration": "3.00ms", "nested": { - "CallRequestsRepr.serialize": "13.00µs", - "InterpreterData::serialize": "2.37ms" + "CallRequestsRepr.serialize": "15.00µs", + "InterpreterData::serialize": "2.55ms" } } } } } }, - "signing_step::sign_produced_cids": "186.00µs", + "signing_step::sign_produced_cids": "102.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "5.00ms", + "duration": "4.84ms", "nested": { - "verify": "4.39ms" + "verify": "4.51ms" } } } @@ -1470,62 +1470,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "57.60ms", + "duration": "17.10ms", "nested": { "preparation_step::preparation::parse_data": { "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", - "duration": "8.23ms", + "duration": "4.03ms", "nested": { - "try_from_slice": "8.09ms" + "try_from_slice": "3.99ms" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "1.47ms", + "duration": "868.00µs", "nested": { "air::preparation_step::preparation::make_exec_ctx": { "common_prefix": "air::preparation_step::preparation", - "duration": "892.00µs", + "duration": "614.00µs", "nested": { - "CallResultsRepr.deserialize": "26.00µs" + "CallResultsRepr.deserialize": "18.00µs" } }, - "air_parser::parser::air_parser::parse": "106.00µs" + "air_parser::parser::air_parser::parse": "90.00µs" } }, - "runner::execute": "7.37ms", + "runner::execute": "3.21ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "20.60ms", + "duration": "3.22ms", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "20.50ms", + "duration": "3.19ms", "nested": { "populate_outcome_from_contexts": { "common_prefix": "air::farewell_step::outcome", - "duration": "19.50ms", + "duration": "2.79ms", "nested": { - "CallRequestsRepr.serialize": "44.00µs", - "InterpreterData::serialize": "18.30ms" + "CallRequestsRepr.serialize": "14.00µs", + "InterpreterData::serialize": "2.42ms" } } } } } }, - "signing_step::sign_produced_cids": "678.00µs", + "signing_step::sign_produced_cids": "108.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "18.80ms", + "duration": "5.46ms", "nested": { - "verify": "17.50ms" + "verify": "4.90ms" } } } } }, - "total_time": "57.60ms" + "total_time": "17.10ms" }, "canon-map-multiple-keys": { "comment": "benchmarking a map insert operation", @@ -1536,62 +1536,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "62.20ms", + "duration": "13.20ms", "nested": { "preparation_step::preparation::parse_data": { "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", - "duration": "770.00µs", + "duration": "326.00µs", "nested": { - "try_from_slice": "612.00µs" + "try_from_slice": "286.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "617.00µs", + "duration": "212.00µs", "nested": { "air::preparation_step::preparation::make_exec_ctx": { "common_prefix": "air::preparation_step::preparation", - "duration": "101.00µs", + "duration": "38.00µs", "nested": { - "CallResultsRepr.deserialize": "29.00µs" + "CallResultsRepr.deserialize": "10.00µs" } }, - "air_parser::parser::air_parser::parse": "88.00µs" + "air_parser::parser::air_parser::parse": "47.00µs" } }, - "runner::execute": "31.80ms", + "runner::execute": "9.08ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "13.20ms", + "duration": "3.05ms", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "9.57ms", + "duration": "3.03ms", "nested": { "populate_outcome_from_contexts": { "common_prefix": "air::farewell_step::outcome", - "duration": "8.79ms", + "duration": "2.69ms", "nested": { - "CallRequestsRepr.serialize": "80.00µs", - "InterpreterData::serialize": "4.23ms" + "CallRequestsRepr.serialize": "15.00µs", + "InterpreterData::serialize": "2.33ms" } } } } } }, - "signing_step::sign_produced_cids": "376.00µs", + "signing_step::sign_produced_cids": "108.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "1.21ms", + "duration": "337.00µs", "nested": { - "verify": "55.00µs" + "verify": "25.00µs" } } } } }, - "total_time": "62.20ms" + "total_time": "13.20ms" }, "canon-map-scalar-multiple-keys": { "comment": "benchmarking a map insert operation", @@ -1602,62 +1602,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "12.20ms", + "duration": "4.91ms", "nested": { "preparation_step::preparation::parse_data": { "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", - "duration": "728.00µs", + "duration": "325.00µs", "nested": { - "try_from_slice": "612.00µs" + "try_from_slice": "285.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "599.00µs", + "duration": "205.00µs", "nested": { "air::preparation_step::preparation::make_exec_ctx": { "common_prefix": "air::preparation_step::preparation", - "duration": "94.00µs", + "duration": "37.00µs", "nested": { - "CallResultsRepr.deserialize": "26.00µs" + "CallResultsRepr.deserialize": "10.00µs" } }, - "air_parser::parser::air_parser::parse": "92.00µs" + "air_parser::parser::air_parser::parse": "44.00µs" } }, - "runner::execute": "7.29ms", + "runner::execute": "3.32ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.55ms", + "duration": "495.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.49ms", + "duration": "473.00µs", "nested": { "populate_outcome_from_contexts": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.39ms", + "duration": "435.00µs", "nested": { - "CallRequestsRepr.serialize": "50.00µs", - "InterpreterData::serialize": "332.00µs" + "CallRequestsRepr.serialize": "13.00µs", + "InterpreterData::serialize": "171.00µs" } } } } } }, - "signing_step::sign_produced_cids": "386.00µs", + "signing_step::sign_produced_cids": "101.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "1.24ms", + "duration": "338.00µs", "nested": { - "verify": "64.00µs" + "verify": "25.00µs" } } } } }, - "total_time": "12.20ms" + "total_time": "4.91ms" }, "canon-map-scalar-single-key": { "comment": "benchmarking a map insert operation", @@ -1668,62 +1668,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "13.60ms", + "duration": "4.26ms", "nested": { "preparation_step::preparation::parse_data": { "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", - "duration": "3.23ms", + "duration": "378.00µs", "nested": { - "try_from_slice": "2.39ms" + "try_from_slice": "328.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "673.00µs", + "duration": "205.00µs", "nested": { "air::preparation_step::preparation::make_exec_ctx": { "common_prefix": "air::preparation_step::preparation", - "duration": "96.00µs", + "duration": "37.00µs", "nested": { - "CallResultsRepr.deserialize": "26.00µs" + "CallResultsRepr.deserialize": "10.00µs" } }, - "air_parser::parser::air_parser::parse": "81.00µs" + "air_parser::parser::air_parser::parse": "43.00µs" } }, - "runner::execute": "5.26ms", + "runner::execute": "2.49ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.25ms", + "duration": "493.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.18ms", + "duration": "471.00µs", "nested": { "populate_outcome_from_contexts": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.06ms", + "duration": "418.00µs", "nested": { - "CallRequestsRepr.serialize": "34.00µs", - "InterpreterData::serialize": "339.00µs" + "CallRequestsRepr.serialize": "12.00µs", + "InterpreterData::serialize": "179.00µs" } } } } } }, - "signing_step::sign_produced_cids": "362.00µs", + "signing_step::sign_produced_cids": "103.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "1.36ms", + "duration": "452.00µs", "nested": { - "verify": "133.00µs" + "verify": "82.00µs" } } } } }, - "total_time": "13.60ms" + "total_time": "4.26ms" }, "canon-map-single-key": { "comment": "benchmarking a map insert operation", @@ -1734,62 +1734,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "27.90ms", + "duration": "11.60ms", "nested": { "preparation_step::preparation::parse_data": { "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", - "duration": "773.00µs", + "duration": "395.00µs", "nested": { - "try_from_slice": "668.00µs" + "try_from_slice": "356.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "745.00µs", + "duration": "205.00µs", "nested": { "air::preparation_step::preparation::make_exec_ctx": { "common_prefix": "air::preparation_step::preparation", - "duration": "104.00µs", + "duration": "42.00µs", "nested": { - "CallResultsRepr.deserialize": "28.00µs" + "CallResultsRepr.deserialize": "10.00µs" } }, - "air_parser::parser::air_parser::parse": "83.00µs" + "air_parser::parser::air_parser::parse": "41.00µs" } }, - "runner::execute": "17.00ms", + "runner::execute": "7.10ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "7.10ms", + "duration": "3.24ms", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "7.00ms", + "duration": "3.22ms", "nested": { "populate_outcome_from_contexts": { "common_prefix": "air::farewell_step::outcome", - "duration": "6.33ms", + "duration": "2.92ms", "nested": { - "CallRequestsRepr.serialize": "60.00µs", - "InterpreterData::serialize": "5.24ms" + "CallRequestsRepr.serialize": "14.00µs", + "InterpreterData::serialize": "2.59ms" } } } } } }, - "signing_step::sign_produced_cids": "396.00µs", + "signing_step::sign_produced_cids": "114.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "1.40ms", + "duration": "383.00µs", "nested": { - "verify": "137.00µs" + "verify": "67.00µs" } } } } }, - "total_time": "27.90ms" + "total_time": "11.60ms" }, "dashboard": { "comment": "big dashboard test", @@ -1800,62 +1800,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "25.50ms", + "duration": "6.67ms", "nested": { "preparation_step::preparation::parse_data": { "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", - "duration": "8.05ms", + "duration": "1.05ms", "nested": { - "try_from_slice": "7.82ms" + "try_from_slice": "986.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "993.00µs", + "duration": "336.00µs", "nested": { "air::preparation_step::preparation::make_exec_ctx": { "common_prefix": "air::preparation_step::preparation", - "duration": "182.00µs", + "duration": "63.00µs", "nested": { - "CallResultsRepr.deserialize": "33.00µs" + "CallResultsRepr.deserialize": "10.00µs" } }, - "air_parser::parser::air_parser::parse": "297.00µs" + "air_parser::parser::air_parser::parse": "138.00µs" } }, - "runner::execute": "2.53ms", + "runner::execute": "1.41ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.85ms", + "duration": "805.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.78ms", + "duration": "784.00µs", "nested": { "populate_outcome_from_contexts": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.66ms", + "duration": "736.00µs", "nested": { - "CallRequestsRepr.serialize": "82.00µs", - "InterpreterData::serialize": "859.00µs" + "CallRequestsRepr.serialize": "28.00µs", + "InterpreterData::serialize": "496.00µs" } } } } } }, - "signing_step::sign_produced_cids": "443.00µs", + "signing_step::sign_produced_cids": "108.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "11.10ms", + "duration": "2.82ms", "nested": { - "verify": "484.00µs" + "verify": "213.00µs" } } } } }, - "total_time": "25.50ms" + "total_time": "6.67ms" }, "long-data": { "comment": "Long data trace", @@ -1866,62 +1866,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "16.20ms", + "duration": "6.39ms", "nested": { "preparation_step::preparation::parse_data": { "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", - "duration": "4.14ms", + "duration": "2.40ms", "nested": { - "try_from_slice": "4.00ms" + "try_from_slice": "2.36ms" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "667.00µs", + "duration": "203.00µs", "nested": { "air::preparation_step::preparation::make_exec_ctx": { "common_prefix": "air::preparation_step::preparation", - "duration": "168.00µs", + "duration": "65.00µs", "nested": { - "CallResultsRepr.deserialize": "29.00µs" + "CallResultsRepr.deserialize": "10.00µs" } }, - "air_parser::parser::air_parser::parse": "42.00µs" + "air_parser::parser::air_parser::parse": "17.00µs" } }, - "runner::execute": "27.00µs", + "runner::execute": "9.00µs", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "3.00ms", + "duration": "1.16ms", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "2.94ms", + "duration": "1.13ms", "nested": { "populate_outcome_from_contexts": { "common_prefix": "air::farewell_step::outcome", - "duration": "2.82ms", + "duration": "1.10ms", "nested": { - "CallRequestsRepr.serialize": "40.00µs", - "InterpreterData::serialize": "1.36ms" + "CallRequestsRepr.serialize": "14.00µs", + "InterpreterData::serialize": "589.00µs" } } } } } }, - "signing_step::sign_produced_cids": "373.00µs", + "signing_step::sign_produced_cids": "100.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "7.58ms", + "duration": "2.39ms", "nested": { - "verify": "4.10ms" + "verify": "943.00µs" } } } } }, - "total_time": "16.20ms" + "total_time": "6.39ms" }, "multiple-cids10": { "comment": "verifying multiple CIDs for single peer", @@ -1932,62 +1932,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "9.58ms", + "duration": "3.07ms", "nested": { "preparation_step::preparation::parse_data": { "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", - "duration": "950.00µs", + "duration": "420.00µs", "nested": { - "try_from_slice": "804.00µs" + "try_from_slice": "364.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "1.21ms", + "duration": "221.00µs", "nested": { "air::preparation_step::preparation::make_exec_ctx": { "common_prefix": "air::preparation_step::preparation", - "duration": "139.00µs", + "duration": "55.00µs", "nested": { - "CallResultsRepr.deserialize": "27.00µs" + "CallResultsRepr.deserialize": "11.00µs" } }, - "air_parser::parser::air_parser::parse": "395.00µs" + "air_parser::parser::air_parser::parse": "43.00µs" } }, - "runner::execute": "1.17ms", + "runner::execute": "574.00µs", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.26ms", + "duration": "622.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.19ms", + "duration": "600.00µs", "nested": { "populate_outcome_from_contexts": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.07ms", + "duration": "544.00µs", "nested": { - "CallRequestsRepr.serialize": "36.00µs", - "InterpreterData::serialize": "459.00µs" + "CallRequestsRepr.serialize": "15.00µs", + "InterpreterData::serialize": "329.00µs" } } } } } }, - "signing_step::sign_produced_cids": "406.00µs", + "signing_step::sign_produced_cids": "102.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "4.12ms", + "duration": "1.01ms", "nested": { - "verify": "512.00µs" + "verify": "253.00µs" } } } } }, - "total_time": "9.58ms" + "total_time": "3.07ms" }, "multiple-peers8": { "comment": "verifying many CIDs for many peers", @@ -1998,62 +1998,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "32.90ms", + "duration": "12.00ms", "nested": { "preparation_step::preparation::parse_data": { "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", - "duration": "3.59ms", + "duration": "1.60ms", "nested": { - "try_from_slice": "3.41ms" + "try_from_slice": "1.53ms" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "1.34ms", + "duration": "330.00µs", "nested": { "air::preparation_step::preparation::make_exec_ctx": { "common_prefix": "air::preparation_step::preparation", - "duration": "362.00µs", + "duration": "152.00µs", "nested": { - "CallResultsRepr.deserialize": "28.00µs" + "CallResultsRepr.deserialize": "10.00µs" } }, - "air_parser::parser::air_parser::parse": "445.00µs" + "air_parser::parser::air_parser::parse": "50.00µs" } }, - "runner::execute": "8.54ms", + "runner::execute": "3.96ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "3.83ms", + "duration": "1.57ms", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "3.77ms", + "duration": "1.55ms", "nested": { "populate_outcome_from_contexts": { "common_prefix": "air::farewell_step::outcome", - "duration": "3.54ms", + "duration": "1.43ms", "nested": { - "CallRequestsRepr.serialize": "41.00µs", - "InterpreterData::serialize": "2.67ms" + "CallRequestsRepr.serialize": "14.00µs", + "InterpreterData::serialize": "1.16ms" } } } } } }, - "signing_step::sign_produced_cids": "414.00µs", + "signing_step::sign_produced_cids": "104.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "14.70ms", + "duration": "4.30ms", "nested": { - "verify": "2.37ms" + "verify": "1.18ms" } } } } }, - "total_time": "32.90ms" + "total_time": "12.00ms" }, "multiple-sigs30": { "comment": "signing multiple CIDs", @@ -2064,62 +2064,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "64.60ms", + "duration": "26.20ms", "nested": { "preparation_step::preparation::parse_data": { "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", - "duration": "11.90ms", + "duration": "4.93ms", "nested": { - "try_from_slice": "11.69ms" + "try_from_slice": "4.88ms" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "1.54ms", + "duration": "438.00µs", "nested": { "air::preparation_step::preparation::make_exec_ctx": { "common_prefix": "air::preparation_step::preparation", - "duration": "815.00µs", + "duration": "261.00µs", "nested": { - "CallResultsRepr.deserialize": "31.00µs" + "CallResultsRepr.deserialize": "10.00µs" } }, - "air_parser::parser::air_parser::parse": "100.00µs" + "air_parser::parser::air_parser::parse": "49.00µs" } }, - "runner::execute": "26.90ms", + "runner::execute": "11.10ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "11.30ms", + "duration": "4.39ms", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "11.20ms", + "duration": "4.37ms", "nested": { "populate_outcome_from_contexts": { "common_prefix": "air::farewell_step::outcome", - "duration": "10.80ms", + "duration": "4.17ms", "nested": { - "CallRequestsRepr.serialize": "44.00µs", - "InterpreterData::serialize": "7.67ms" + "CallRequestsRepr.serialize": "14.00µs", + "InterpreterData::serialize": "3.04ms" } } } } } }, - "signing_step::sign_produced_cids": "1.63ms", + "signing_step::sign_produced_cids": "742.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "10.80ms", + "duration": "4.36ms", "nested": { - "verify": "4.52ms" + "verify": "2.03ms" } } } } }, - "total_time": "64.60ms" + "total_time": "26.20ms" }, "network-explore": { "comment": "5 peers of network are discovered", @@ -2130,62 +2130,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "10.30ms", + "duration": "3.35ms", "nested": { "preparation_step::preparation::parse_data": { "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", - "duration": "1.42ms", + "duration": "596.00µs", "nested": { - "try_from_slice": "1.25ms" + "try_from_slice": "509.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "702.00µs", + "duration": "249.00µs", "nested": { "air::preparation_step::preparation::make_exec_ctx": { "common_prefix": "air::preparation_step::preparation", - "duration": "114.00µs", + "duration": "46.00µs", "nested": { - "CallResultsRepr.deserialize": "28.00µs" + "CallResultsRepr.deserialize": "10.00µs" } }, - "air_parser::parser::air_parser::parse": "142.00µs" + "air_parser::parser::air_parser::parse": "74.00µs" } }, - "runner::execute": "336.00µs", + "runner::execute": "168.00µs", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.07ms", + "duration": "441.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.00ms", + "duration": "418.00µs", "nested": { "populate_outcome_from_contexts": { "common_prefix": "air::farewell_step::outcome", - "duration": "896.00µs", + "duration": "376.00µs", "nested": { - "CallRequestsRepr.serialize": "38.00µs", - "InterpreterData::serialize": "312.00µs" + "CallRequestsRepr.serialize": "14.00µs", + "InterpreterData::serialize": "199.00µs" } } } } } }, - "signing_step::sign_produced_cids": "385.00µs", + "signing_step::sign_produced_cids": "105.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "5.94ms", + "duration": "1.64ms", "nested": { - "verify": "128.00µs" + "verify": "99.00µs" } } } } }, - "total_time": "10.30ms" + "total_time": "3.35ms" }, "null": { "comment": "Empty data and null script", @@ -2196,56 +2196,56 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "12.90ms", + "duration": "712.00µs", "nested": { - "preparation_step::preparation::parse_data": "84.00µs", + "preparation_step::preparation::parse_data": "16.00µs", "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "599.00µs", + "duration": "183.00µs", "nested": { "air::preparation_step::preparation::make_exec_ctx": { "common_prefix": "air::preparation_step::preparation", - "duration": "95.00µs", + "duration": "35.00µs", "nested": { - "CallResultsRepr.deserialize": "28.00µs" + "CallResultsRepr.deserialize": "10.00µs" } }, - "air_parser::parser::air_parser::parse": "39.00µs" + "air_parser::parser::air_parser::parse": "17.00µs" } }, - "runner::execute": "30.00µs", + "runner::execute": "9.00µs", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "797.00µs", + "duration": "257.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "730.00µs", + "duration": "237.00µs", "nested": { "populate_outcome_from_contexts": { "common_prefix": "air::farewell_step::outcome", - "duration": "642.00µs", + "duration": "204.00µs", "nested": { - "CallRequestsRepr.serialize": "37.00µs", - "InterpreterData::serialize": "99.00µs" + "CallRequestsRepr.serialize": "13.00µs", + "InterpreterData::serialize": "51.00µs" } } } } } }, - "signing_step::sign_produced_cids": "433.00µs", + "signing_step::sign_produced_cids": "101.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "114.00µs", + "duration": "32.00µs", "nested": { - "verify": "41.00µs" + "verify": "10.00µs" } } } } }, - "total_time": "12.90ms" + "total_time": "712.00µs" }, "parser-10000-100": { "comment": "long air script with lot of variable assignments", @@ -2256,56 +2256,56 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "68.60ms", + "duration": "31.70ms", "nested": { - "preparation_step::preparation::parse_data": "48.00µs", + "preparation_step::preparation::parse_data": "16.00µs", "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "65.20ms", + "duration": "30.40ms", "nested": { "air::preparation_step::preparation::make_exec_ctx": { "common_prefix": "air::preparation_step::preparation", - "duration": "118.00µs", + "duration": "43.00µs", "nested": { - "CallResultsRepr.deserialize": "33.00µs" + "CallResultsRepr.deserialize": "12.00µs" } }, - "air_parser::parser::air_parser::parse": "64.60ms" + "air_parser::parser::air_parser::parse": "30.10ms" } }, - "runner::execute": "56.00µs", + "runner::execute": "27.00µs", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "843.00µs", + "duration": "284.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "776.00µs", + "duration": "262.00µs", "nested": { "populate_outcome_from_contexts": { "common_prefix": "air::farewell_step::outcome", - "duration": "687.00µs", + "duration": "220.00µs", "nested": { - "CallRequestsRepr.serialize": "38.00µs", - "InterpreterData::serialize": "108.00µs" + "CallRequestsRepr.serialize": "12.00µs", + "InterpreterData::serialize": "56.00µs" } } } } } }, - "signing_step::sign_produced_cids": "416.00µs", + "signing_step::sign_produced_cids": "101.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "96.00µs", + "duration": "33.00µs", "nested": { - "verify": "29.00µs" + "verify": "10.00µs" } } } } }, - "total_time": "68.60ms" + "total_time": "31.70ms" }, "parser-calls-10000-100": { "comment": "multiple calls parser benchmark", @@ -2316,56 +2316,56 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "55.80ms", + "duration": "26.50ms", "nested": { - "preparation_step::preparation::parse_data": "44.00µs", + "preparation_step::preparation::parse_data": "17.00µs", "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "51.90ms", + "duration": "24.80ms", "nested": { "air::preparation_step::preparation::make_exec_ctx": { "common_prefix": "air::preparation_step::preparation", - "duration": "100.00µs", + "duration": "44.00µs", "nested": { - "CallResultsRepr.deserialize": "28.00µs" + "CallResultsRepr.deserialize": "11.00µs" } }, - "air_parser::parser::air_parser::parse": "51.30ms" + "air_parser::parser::air_parser::parse": "24.60ms" } }, - "runner::execute": "51.00µs", + "runner::execute": "31.00µs", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "708.00µs", + "duration": "414.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "657.00µs", + "duration": "379.00µs", "nested": { "populate_outcome_from_contexts": { "common_prefix": "air::farewell_step::outcome", - "duration": "585.00µs", + "duration": "327.00µs", "nested": { - "CallRequestsRepr.serialize": "29.00µs", - "InterpreterData::serialize": "88.00µs" + "CallRequestsRepr.serialize": "21.00µs", + "InterpreterData::serialize": "71.00µs" } } } } } }, - "signing_step::sign_produced_cids": "366.00µs", + "signing_step::sign_produced_cids": "156.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "80.00µs", + "duration": "34.00µs", "nested": { - "verify": "24.00µs" + "verify": "10.00µs" } } } } }, - "total_time": "55.80ms" + "total_time": "26.50ms" }, "populate-map-multiple-keys": { "comment": "benchmarking a map insert operation", @@ -2376,62 +2376,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "10.50ms", + "duration": "4.10ms", "nested": { "preparation_step::preparation::parse_data": { "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", - "duration": "301.00µs", + "duration": "116.00µs", "nested": { - "try_from_slice": "198.00µs" + "try_from_slice": "72.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "713.00µs", + "duration": "212.00µs", "nested": { "air::preparation_step::preparation::make_exec_ctx": { "common_prefix": "air::preparation_step::preparation", - "duration": "104.00µs", + "duration": "40.00µs", "nested": { - "CallResultsRepr.deserialize": "29.00µs" + "CallResultsRepr.deserialize": "10.00µs" } }, - "air_parser::parser::air_parser::parse": "101.00µs" + "air_parser::parser::air_parser::parse": "50.00µs" } }, - "runner::execute": "6.05ms", + "runner::execute": "2.78ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.30ms", + "duration": "414.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.23ms", + "duration": "393.00µs", "nested": { "populate_outcome_from_contexts": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.13ms", + "duration": "356.00µs", "nested": { - "CallRequestsRepr.serialize": "41.00µs", - "InterpreterData::serialize": "465.00µs" + "CallRequestsRepr.serialize": "13.00µs", + "InterpreterData::serialize": "165.00µs" } } } } } }, - "signing_step::sign_produced_cids": "403.00µs", + "signing_step::sign_produced_cids": "101.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "1.27ms", + "duration": "336.00µs", "nested": { - "verify": "57.00µs" + "verify": "26.00µs" } } } } }, - "total_time": "10.50ms" + "total_time": "4.10ms" }, "populate-map-single-key": { "comment": "benchmarking a map insert operation", @@ -2442,65 +2442,65 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "8.85ms", + "duration": "3.40ms", "nested": { "preparation_step::preparation::parse_data": { "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", - "duration": "420.00µs", + "duration": "170.00µs", "nested": { - "try_from_slice": "317.00µs" + "try_from_slice": "131.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "668.00µs", + "duration": "216.00µs", "nested": { "air::preparation_step::preparation::make_exec_ctx": { "common_prefix": "air::preparation_step::preparation", - "duration": "115.00µs", + "duration": "39.00µs", "nested": { - "CallResultsRepr.deserialize": "28.00µs" + "CallResultsRepr.deserialize": "10.00µs" } }, - "air_parser::parser::air_parser::parse": "89.00µs" + "air_parser::parser::air_parser::parse": "50.00µs" } }, - "runner::execute": "4.29ms", + "runner::execute": "1.95ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.21ms", + "duration": "436.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.13ms", + "duration": "412.00µs", "nested": { "populate_outcome_from_contexts": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.01ms", + "duration": "360.00µs", "nested": { - "CallRequestsRepr.serialize": "34.00µs", - "InterpreterData::serialize": "390.00µs" + "CallRequestsRepr.serialize": "13.00µs", + "InterpreterData::serialize": "179.00µs" } } } } } }, - "signing_step::sign_produced_cids": "427.00µs", + "signing_step::sign_produced_cids": "105.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "1.42ms", + "duration": "401.00µs", "nested": { - "verify": "144.00µs" + "verify": "68.00µs" } } } } }, - "total_time": "8.85ms" + "total_time": "3.40ms" } }, - "datetime": "2023-12-25 12:09:49.153856+00:00", + "datetime": "2023-12-26 11:57:40.853306+00:00", "features": "", "platform": "Linux-6.5.9-arch2-1-x86_64-with-glibc2.35", "version": "0.55.0" diff --git a/benches/PERFORMANCE.txt b/benches/PERFORMANCE.txt index c79f3c56..8d264a6b 100644 --- a/benches/PERFORMANCE.txt +++ b/benches/PERFORMANCE.txt @@ -328,347 +328,347 @@ Machine 62dabcde478dc58760ebbe71ef6047299144a5f63990c6c3d826ebf30175adfc: new: 42.00µs Machine 88756ca30bfb93b0da6a64252adc98fc3e97e142c3b4970af3d2948fd66107b4: Platform: Linux-6.5.9-arch2-1-x86_64-with-glibc2.35 - Timestamp: 2023-12-25 12:09:49.153856+00:00 + Timestamp: 2023-12-26 11:57:40.853306+00:00 AquaVM version: 0.55.0 Benches: Features: - big-values-data (19.30ms; 59.000 MiB, 59.000 MiB): Loading a trace with huge values - air::runner::execute_air: 19.30ms - preparation_step::preparation::parse_data: 6.94ms - try_from_slice: 6.90ms - preparation_step::preparation::prepare: 275.00µs - air::preparation_step::preparation::make_exec_ctx: 43.00µs - CallResultsRepr.deserialize: 11.00µs - air_parser::parser::air_parser::parse: 18.00µs - runner::execute: 17.00µs - runner::farewell: 5.50ms - from_success_result: 5.48ms - populate_outcome_from_contexts: 5.44ms - CallRequestsRepr.serialize: 14.00µs - InterpreterData::serialize: 4.13ms - signing_step::sign_produced_cids: 185.00µs - verification_step::verify: 6.24ms - verify: 5.63ms - call-requests500 (52.20ms; 70.562 MiB, 70.562 MiB): multiple call requests - air::runner::execute_air: 52.20ms - preparation_step::preparation::parse_data: 115.00µs - try_from_slice: 78.00µs - preparation_step::preparation::prepare: 315.00µs - air::preparation_step::preparation::make_exec_ctx: 62.00µs - CallResultsRepr.deserialize: 35.00µs - air_parser::parser::air_parser::parse: 47.00µs - runner::execute: 25.40ms - runner::farewell: 25.90ms - from_success_result: 25.90ms - populate_outcome_from_contexts: 25.70ms - CallRequestsRepr.serialize: 25.10ms - InterpreterData::serialize: 374.00µs - signing_step::sign_produced_cids: 196.00µs - verification_step::verify: 71.00µs - verify: 11.00µs - call-results500 (21.10ms; 54.438 MiB, 54.438 MiB): multiple call results - air::runner::execute_air: 21.10ms - preparation_step::preparation::parse_data: 657.00µs - try_from_slice: 615.00µs - preparation_step::preparation::prepare: 988.00µs - air::preparation_step::preparation::make_exec_ctx: 731.00µs - CallResultsRepr.deserialize: 700.00µs + big-values-data (19.20ms; 59.000 MiB, 59.000 MiB): Loading a trace with huge values + air::runner::execute_air: 19.20ms + preparation_step::preparation::parse_data: 7.01ms + try_from_slice: 6.96ms + preparation_step::preparation::prepare: 184.00µs + air::preparation_step::preparation::make_exec_ctx: 44.00µs + CallResultsRepr.deserialize: 10.00µs + air_parser::parser::air_parser::parse: 19.00µs + runner::execute: 9.00µs + runner::farewell: 5.81ms + from_success_result: 5.78ms + populate_outcome_from_contexts: 5.74ms + CallRequestsRepr.serialize: 15.00µs + InterpreterData::serialize: 4.44ms + signing_step::sign_produced_cids: 98.00µs + verification_step::verify: 5.99ms + verify: 5.66ms + call-requests500 (53.00ms; 70.562 MiB, 70.562 MiB): multiple call requests + air::runner::execute_air: 53.00ms + preparation_step::preparation::parse_data: 105.00µs + try_from_slice: 66.00µs + preparation_step::preparation::prepare: 235.00µs + air::preparation_step::preparation::make_exec_ctx: 60.00µs + CallResultsRepr.deserialize: 34.00µs air_parser::parser::air_parser::parse: 48.00µs - runner::execute: 15.90ms - runner::farewell: 2.69ms - from_success_result: 2.66ms - populate_outcome_from_contexts: 2.22ms - CallRequestsRepr.serialize: 14.00µs + runner::execute: 25.00ms + runner::farewell: 27.30ms + from_success_result: 27.30ms + populate_outcome_from_contexts: 27.10ms + CallRequestsRepr.serialize: 26.50ms + InterpreterData::serialize: 377.00µs + signing_step::sign_produced_cids: 136.00µs + verification_step::verify: 64.00µs + verify: 10.00µs + call-results500 (21.20ms; 54.438 MiB, 54.438 MiB): multiple call results + air::runner::execute_air: 21.20ms + preparation_step::preparation::parse_data: 587.00µs + try_from_slice: 546.00µs + preparation_step::preparation::prepare: 895.00µs + air::preparation_step::preparation::make_exec_ctx: 718.00µs + CallResultsRepr.deserialize: 686.00µs + air_parser::parser::air_parser::parse: 50.00µs + runner::execute: 16.50ms + runner::farewell: 2.63ms + from_success_result: 2.60ms + populate_outcome_from_contexts: 2.15ms + CallRequestsRepr.serialize: 13.00µs InterpreterData::serialize: 1.54ms - signing_step::sign_produced_cids: 548.00µs + signing_step::sign_produced_cids: 456.00µs verification_step::verify: 67.00µs - verify: 9.00µs + verify: 10.00µs canon-map-key-by-lens (16.00ms; 56.625 MiB, 56.625 MiB): benchmarking a map insert operation air::runner::execute_air: 16.00ms - preparation_step::preparation::parse_data: 4.02ms - try_from_slice: 3.97ms - preparation_step::preparation::prepare: 623.00µs - air::preparation_step::preparation::make_exec_ctx: 360.00µs + preparation_step::preparation::parse_data: 4.07ms + try_from_slice: 4.01ms + preparation_step::preparation::prepare: 549.00µs + air::preparation_step::preparation::make_exec_ctx: 365.00µs CallResultsRepr.deserialize: 10.00µs - air_parser::parser::air_parser::parse: 53.00µs - runner::execute: 2.82ms + air_parser::parser::air_parser::parse: 56.00µs + runner::execute: 2.84ms + runner::farewell: 3.49ms + from_success_result: 3.46ms + populate_outcome_from_contexts: 3.00ms + CallRequestsRepr.serialize: 15.00µs + InterpreterData::serialize: 2.55ms + signing_step::sign_produced_cids: 102.00µs + verification_step::verify: 4.84ms + verify: 4.51ms + canon-map-key-element-by-lens (17.10ms; 56.625 MiB, 56.625 MiB): benchmarking a map insert operation + air::runner::execute_air: 17.10ms + preparation_step::preparation::parse_data: 4.03ms + try_from_slice: 3.99ms + preparation_step::preparation::prepare: 868.00µs + air::preparation_step::preparation::make_exec_ctx: 614.00µs + CallResultsRepr.deserialize: 18.00µs + air_parser::parser::air_parser::parse: 90.00µs + runner::execute: 3.21ms + runner::farewell: 3.22ms + from_success_result: 3.19ms + populate_outcome_from_contexts: 2.79ms + CallRequestsRepr.serialize: 14.00µs + InterpreterData::serialize: 2.42ms + signing_step::sign_produced_cids: 108.00µs + verification_step::verify: 5.46ms + verify: 4.90ms + canon-map-multiple-keys (13.20ms; 54.500 MiB, 54.500 MiB): benchmarking a map insert operation + air::runner::execute_air: 13.20ms + preparation_step::preparation::parse_data: 326.00µs + try_from_slice: 286.00µs + preparation_step::preparation::prepare: 212.00µs + air::preparation_step::preparation::make_exec_ctx: 38.00µs + CallResultsRepr.deserialize: 10.00µs + air_parser::parser::air_parser::parse: 47.00µs + runner::execute: 9.08ms + runner::farewell: 3.05ms + from_success_result: 3.03ms + populate_outcome_from_contexts: 2.69ms + CallRequestsRepr.serialize: 15.00µs + InterpreterData::serialize: 2.33ms + signing_step::sign_produced_cids: 108.00µs + verification_step::verify: 337.00µs + verify: 25.00µs + canon-map-scalar-multiple-keys (4.91ms; 53.125 MiB, 53.125 MiB): benchmarking a map insert operation + air::runner::execute_air: 4.91ms + preparation_step::preparation::parse_data: 325.00µs + try_from_slice: 285.00µs + preparation_step::preparation::prepare: 205.00µs + air::preparation_step::preparation::make_exec_ctx: 37.00µs + CallResultsRepr.deserialize: 10.00µs + air_parser::parser::air_parser::parse: 44.00µs + runner::execute: 3.32ms + runner::farewell: 495.00µs + from_success_result: 473.00µs + populate_outcome_from_contexts: 435.00µs + CallRequestsRepr.serialize: 13.00µs + InterpreterData::serialize: 171.00µs + signing_step::sign_produced_cids: 101.00µs + verification_step::verify: 338.00µs + verify: 25.00µs + canon-map-scalar-single-key (4.26ms; 53.000 MiB, 53.000 MiB): benchmarking a map insert operation + air::runner::execute_air: 4.26ms + preparation_step::preparation::parse_data: 378.00µs + try_from_slice: 328.00µs + preparation_step::preparation::prepare: 205.00µs + air::preparation_step::preparation::make_exec_ctx: 37.00µs + CallResultsRepr.deserialize: 10.00µs + air_parser::parser::air_parser::parse: 43.00µs + runner::execute: 2.49ms + runner::farewell: 493.00µs + from_success_result: 471.00µs + populate_outcome_from_contexts: 418.00µs + CallRequestsRepr.serialize: 12.00µs + InterpreterData::serialize: 179.00µs + signing_step::sign_produced_cids: 103.00µs + verification_step::verify: 452.00µs + verify: 82.00µs + canon-map-single-key (11.60ms; 55.312 MiB, 55.312 MiB): benchmarking a map insert operation + air::runner::execute_air: 11.60ms + preparation_step::preparation::parse_data: 395.00µs + try_from_slice: 356.00µs + preparation_step::preparation::prepare: 205.00µs + air::preparation_step::preparation::make_exec_ctx: 42.00µs + CallResultsRepr.deserialize: 10.00µs + air_parser::parser::air_parser::parse: 41.00µs + runner::execute: 7.10ms runner::farewell: 3.24ms from_success_result: 3.22ms - populate_outcome_from_contexts: 2.81ms - CallRequestsRepr.serialize: 13.00µs - InterpreterData::serialize: 2.37ms - signing_step::sign_produced_cids: 186.00µs - verification_step::verify: 5.00ms - verify: 4.39ms - canon-map-key-element-by-lens (57.60ms; 56.625 MiB, 56.625 MiB): benchmarking a map insert operation - air::runner::execute_air: 57.60ms - preparation_step::preparation::parse_data: 8.23ms - try_from_slice: 8.09ms - preparation_step::preparation::prepare: 1.47ms - air::preparation_step::preparation::make_exec_ctx: 892.00µs - CallResultsRepr.deserialize: 26.00µs - air_parser::parser::air_parser::parse: 106.00µs - runner::execute: 7.37ms - runner::farewell: 20.60ms - from_success_result: 20.50ms - populate_outcome_from_contexts: 19.50ms - CallRequestsRepr.serialize: 44.00µs - InterpreterData::serialize: 18.30ms - signing_step::sign_produced_cids: 678.00µs - verification_step::verify: 18.80ms - verify: 17.50ms - canon-map-multiple-keys (62.20ms; 54.500 MiB, 54.500 MiB): benchmarking a map insert operation - air::runner::execute_air: 62.20ms - preparation_step::preparation::parse_data: 770.00µs - try_from_slice: 612.00µs - preparation_step::preparation::prepare: 617.00µs - air::preparation_step::preparation::make_exec_ctx: 101.00µs - CallResultsRepr.deserialize: 29.00µs - air_parser::parser::air_parser::parse: 88.00µs - runner::execute: 31.80ms - runner::farewell: 13.20ms - from_success_result: 9.57ms - populate_outcome_from_contexts: 8.79ms - CallRequestsRepr.serialize: 80.00µs - InterpreterData::serialize: 4.23ms - signing_step::sign_produced_cids: 376.00µs - verification_step::verify: 1.21ms - verify: 55.00µs - canon-map-scalar-multiple-keys (12.20ms; 53.125 MiB, 53.125 MiB): benchmarking a map insert operation - air::runner::execute_air: 12.20ms - preparation_step::preparation::parse_data: 728.00µs - try_from_slice: 612.00µs - preparation_step::preparation::prepare: 599.00µs - air::preparation_step::preparation::make_exec_ctx: 94.00µs - CallResultsRepr.deserialize: 26.00µs - air_parser::parser::air_parser::parse: 92.00µs - runner::execute: 7.29ms - runner::farewell: 1.55ms - from_success_result: 1.49ms - populate_outcome_from_contexts: 1.39ms - CallRequestsRepr.serialize: 50.00µs - InterpreterData::serialize: 332.00µs - signing_step::sign_produced_cids: 386.00µs - verification_step::verify: 1.24ms - verify: 64.00µs - canon-map-scalar-single-key (13.60ms; 53.000 MiB, 53.000 MiB): benchmarking a map insert operation - air::runner::execute_air: 13.60ms - preparation_step::preparation::parse_data: 3.23ms - try_from_slice: 2.39ms - preparation_step::preparation::prepare: 673.00µs - air::preparation_step::preparation::make_exec_ctx: 96.00µs - CallResultsRepr.deserialize: 26.00µs - air_parser::parser::air_parser::parse: 81.00µs - runner::execute: 5.26ms - runner::farewell: 1.25ms - from_success_result: 1.18ms - populate_outcome_from_contexts: 1.06ms - CallRequestsRepr.serialize: 34.00µs - InterpreterData::serialize: 339.00µs - signing_step::sign_produced_cids: 362.00µs - verification_step::verify: 1.36ms - verify: 133.00µs - canon-map-single-key (27.90ms; 55.312 MiB, 55.312 MiB): benchmarking a map insert operation - air::runner::execute_air: 27.90ms - preparation_step::preparation::parse_data: 773.00µs - try_from_slice: 668.00µs - preparation_step::preparation::prepare: 745.00µs - air::preparation_step::preparation::make_exec_ctx: 104.00µs - CallResultsRepr.deserialize: 28.00µs - air_parser::parser::air_parser::parse: 83.00µs - runner::execute: 17.00ms - runner::farewell: 7.10ms - from_success_result: 7.00ms - populate_outcome_from_contexts: 6.33ms - CallRequestsRepr.serialize: 60.00µs - InterpreterData::serialize: 5.24ms - signing_step::sign_produced_cids: 396.00µs - verification_step::verify: 1.40ms - verify: 137.00µs - dashboard (25.50ms; 52.625 MiB, 52.625 MiB): big dashboard test - air::runner::execute_air: 25.50ms - preparation_step::preparation::parse_data: 8.05ms - try_from_slice: 7.82ms - preparation_step::preparation::prepare: 993.00µs - air::preparation_step::preparation::make_exec_ctx: 182.00µs - CallResultsRepr.deserialize: 33.00µs - air_parser::parser::air_parser::parse: 297.00µs - runner::execute: 2.53ms - runner::farewell: 1.85ms - from_success_result: 1.78ms - populate_outcome_from_contexts: 1.66ms - CallRequestsRepr.serialize: 82.00µs - InterpreterData::serialize: 859.00µs - signing_step::sign_produced_cids: 443.00µs - verification_step::verify: 11.10ms - verify: 484.00µs - long-data (16.20ms; 53.812 MiB, 53.812 MiB): Long data trace - air::runner::execute_air: 16.20ms - preparation_step::preparation::parse_data: 4.14ms - try_from_slice: 4.00ms - preparation_step::preparation::prepare: 667.00µs - air::preparation_step::preparation::make_exec_ctx: 168.00µs - CallResultsRepr.deserialize: 29.00µs - air_parser::parser::air_parser::parse: 42.00µs - runner::execute: 27.00µs - runner::farewell: 3.00ms - from_success_result: 2.94ms - populate_outcome_from_contexts: 2.82ms - CallRequestsRepr.serialize: 40.00µs - InterpreterData::serialize: 1.36ms - signing_step::sign_produced_cids: 373.00µs - verification_step::verify: 7.58ms - verify: 4.10ms - multiple-cids10 (9.58ms; 52.438 MiB, 52.438 MiB): verifying multiple CIDs for single peer - air::runner::execute_air: 9.58ms - preparation_step::preparation::parse_data: 950.00µs - try_from_slice: 804.00µs - preparation_step::preparation::prepare: 1.21ms - air::preparation_step::preparation::make_exec_ctx: 139.00µs - CallResultsRepr.deserialize: 27.00µs - air_parser::parser::air_parser::parse: 395.00µs - runner::execute: 1.17ms - runner::farewell: 1.26ms - from_success_result: 1.19ms - populate_outcome_from_contexts: 1.07ms - CallRequestsRepr.serialize: 36.00µs - InterpreterData::serialize: 459.00µs - signing_step::sign_produced_cids: 406.00µs - verification_step::verify: 4.12ms - verify: 512.00µs - multiple-peers8 (32.90ms; 53.375 MiB, 53.375 MiB): verifying many CIDs for many peers - air::runner::execute_air: 32.90ms - preparation_step::preparation::parse_data: 3.59ms - try_from_slice: 3.41ms - preparation_step::preparation::prepare: 1.34ms - air::preparation_step::preparation::make_exec_ctx: 362.00µs - CallResultsRepr.deserialize: 28.00µs - air_parser::parser::air_parser::parse: 445.00µs - runner::execute: 8.54ms - runner::farewell: 3.83ms - from_success_result: 3.77ms - populate_outcome_from_contexts: 3.54ms - CallRequestsRepr.serialize: 41.00µs - InterpreterData::serialize: 2.67ms - signing_step::sign_produced_cids: 414.00µs - verification_step::verify: 14.70ms - verify: 2.37ms - multiple-sigs30 (64.60ms; 56.188 MiB, 56.188 MiB): signing multiple CIDs - air::runner::execute_air: 64.60ms - preparation_step::preparation::parse_data: 11.90ms - try_from_slice: 11.69ms - preparation_step::preparation::prepare: 1.54ms - air::preparation_step::preparation::make_exec_ctx: 815.00µs - CallResultsRepr.deserialize: 31.00µs - air_parser::parser::air_parser::parse: 100.00µs - runner::execute: 26.90ms - runner::farewell: 11.30ms - from_success_result: 11.20ms - populate_outcome_from_contexts: 10.80ms - CallRequestsRepr.serialize: 44.00µs - InterpreterData::serialize: 7.67ms - signing_step::sign_produced_cids: 1.63ms - verification_step::verify: 10.80ms - verify: 4.52ms - network-explore (10.30ms; 52.375 MiB, 52.375 MiB): 5 peers of network are discovered - air::runner::execute_air: 10.30ms - preparation_step::preparation::parse_data: 1.42ms - try_from_slice: 1.25ms - preparation_step::preparation::prepare: 702.00µs - air::preparation_step::preparation::make_exec_ctx: 114.00µs - CallResultsRepr.deserialize: 28.00µs - air_parser::parser::air_parser::parse: 142.00µs - runner::execute: 336.00µs - runner::farewell: 1.07ms - from_success_result: 1.00ms - populate_outcome_from_contexts: 896.00µs - CallRequestsRepr.serialize: 38.00µs - InterpreterData::serialize: 312.00µs - signing_step::sign_produced_cids: 385.00µs - verification_step::verify: 5.94ms - verify: 128.00µs - null (12.90ms; 52.375 MiB, 52.375 MiB): Empty data and null script - air::runner::execute_air: 12.90ms - preparation_step::preparation::parse_data: 84.00µs - preparation_step::preparation::prepare: 599.00µs - air::preparation_step::preparation::make_exec_ctx: 95.00µs - CallResultsRepr.deserialize: 28.00µs - air_parser::parser::air_parser::parse: 39.00µs - runner::execute: 30.00µs - runner::farewell: 797.00µs - from_success_result: 730.00µs - populate_outcome_from_contexts: 642.00µs - CallRequestsRepr.serialize: 37.00µs - InterpreterData::serialize: 99.00µs - signing_step::sign_produced_cids: 433.00µs - verification_step::verify: 114.00µs - verify: 41.00µs - parser-10000-100 (68.60ms; 54.625 MiB, 54.625 MiB): long air script with lot of variable assignments - air::runner::execute_air: 68.60ms - preparation_step::preparation::parse_data: 48.00µs - preparation_step::preparation::prepare: 65.20ms - air::preparation_step::preparation::make_exec_ctx: 118.00µs - CallResultsRepr.deserialize: 33.00µs - air_parser::parser::air_parser::parse: 64.60ms - runner::execute: 56.00µs - runner::farewell: 843.00µs - from_success_result: 776.00µs - populate_outcome_from_contexts: 687.00µs - CallRequestsRepr.serialize: 38.00µs - InterpreterData::serialize: 108.00µs - signing_step::sign_produced_cids: 416.00µs - verification_step::verify: 96.00µs - verify: 29.00µs - parser-calls-10000-100 (55.80ms; 54.375 MiB, 54.375 MiB): multiple calls parser benchmark - air::runner::execute_air: 55.80ms - preparation_step::preparation::parse_data: 44.00µs - preparation_step::preparation::prepare: 51.90ms - air::preparation_step::preparation::make_exec_ctx: 100.00µs - CallResultsRepr.deserialize: 28.00µs - air_parser::parser::air_parser::parse: 51.30ms - runner::execute: 51.00µs - runner::farewell: 708.00µs - from_success_result: 657.00µs - populate_outcome_from_contexts: 585.00µs - CallRequestsRepr.serialize: 29.00µs - InterpreterData::serialize: 88.00µs - signing_step::sign_produced_cids: 366.00µs - verification_step::verify: 80.00µs - verify: 24.00µs - populate-map-multiple-keys (10.50ms; 53.000 MiB, 53.000 MiB): benchmarking a map insert operation - air::runner::execute_air: 10.50ms - preparation_step::preparation::parse_data: 301.00µs - try_from_slice: 198.00µs - preparation_step::preparation::prepare: 713.00µs - air::preparation_step::preparation::make_exec_ctx: 104.00µs - CallResultsRepr.deserialize: 29.00µs - air_parser::parser::air_parser::parse: 101.00µs - runner::execute: 6.05ms - runner::farewell: 1.30ms - from_success_result: 1.23ms - populate_outcome_from_contexts: 1.13ms - CallRequestsRepr.serialize: 41.00µs - InterpreterData::serialize: 465.00µs - signing_step::sign_produced_cids: 403.00µs - verification_step::verify: 1.27ms - verify: 57.00µs - populate-map-single-key (8.85ms; 52.938 MiB, 52.938 MiB): benchmarking a map insert operation - air::runner::execute_air: 8.85ms - preparation_step::preparation::parse_data: 420.00µs - try_from_slice: 317.00µs - preparation_step::preparation::prepare: 668.00µs - air::preparation_step::preparation::make_exec_ctx: 115.00µs - CallResultsRepr.deserialize: 28.00µs - air_parser::parser::air_parser::parse: 89.00µs - runner::execute: 4.29ms - runner::farewell: 1.21ms + populate_outcome_from_contexts: 2.92ms + CallRequestsRepr.serialize: 14.00µs + InterpreterData::serialize: 2.59ms + signing_step::sign_produced_cids: 114.00µs + verification_step::verify: 383.00µs + verify: 67.00µs + dashboard (6.67ms; 52.625 MiB, 52.625 MiB): big dashboard test + air::runner::execute_air: 6.67ms + preparation_step::preparation::parse_data: 1.05ms + try_from_slice: 986.00µs + preparation_step::preparation::prepare: 336.00µs + air::preparation_step::preparation::make_exec_ctx: 63.00µs + CallResultsRepr.deserialize: 10.00µs + air_parser::parser::air_parser::parse: 138.00µs + runner::execute: 1.41ms + runner::farewell: 805.00µs + from_success_result: 784.00µs + populate_outcome_from_contexts: 736.00µs + CallRequestsRepr.serialize: 28.00µs + InterpreterData::serialize: 496.00µs + signing_step::sign_produced_cids: 108.00µs + verification_step::verify: 2.82ms + verify: 213.00µs + long-data (6.39ms; 53.812 MiB, 53.812 MiB): Long data trace + air::runner::execute_air: 6.39ms + preparation_step::preparation::parse_data: 2.40ms + try_from_slice: 2.36ms + preparation_step::preparation::prepare: 203.00µs + air::preparation_step::preparation::make_exec_ctx: 65.00µs + CallResultsRepr.deserialize: 10.00µs + air_parser::parser::air_parser::parse: 17.00µs + runner::execute: 9.00µs + runner::farewell: 1.16ms from_success_result: 1.13ms - populate_outcome_from_contexts: 1.01ms - CallRequestsRepr.serialize: 34.00µs - InterpreterData::serialize: 390.00µs - signing_step::sign_produced_cids: 427.00µs - verification_step::verify: 1.42ms - verify: 144.00µs + populate_outcome_from_contexts: 1.10ms + CallRequestsRepr.serialize: 14.00µs + InterpreterData::serialize: 589.00µs + signing_step::sign_produced_cids: 100.00µs + verification_step::verify: 2.39ms + verify: 943.00µs + multiple-cids10 (3.07ms; 52.438 MiB, 52.438 MiB): verifying multiple CIDs for single peer + air::runner::execute_air: 3.07ms + preparation_step::preparation::parse_data: 420.00µs + try_from_slice: 364.00µs + preparation_step::preparation::prepare: 221.00µs + air::preparation_step::preparation::make_exec_ctx: 55.00µs + CallResultsRepr.deserialize: 11.00µs + air_parser::parser::air_parser::parse: 43.00µs + runner::execute: 574.00µs + runner::farewell: 622.00µs + from_success_result: 600.00µs + populate_outcome_from_contexts: 544.00µs + CallRequestsRepr.serialize: 15.00µs + InterpreterData::serialize: 329.00µs + signing_step::sign_produced_cids: 102.00µs + verification_step::verify: 1.01ms + verify: 253.00µs + multiple-peers8 (12.00ms; 53.375 MiB, 53.375 MiB): verifying many CIDs for many peers + air::runner::execute_air: 12.00ms + preparation_step::preparation::parse_data: 1.60ms + try_from_slice: 1.53ms + preparation_step::preparation::prepare: 330.00µs + air::preparation_step::preparation::make_exec_ctx: 152.00µs + CallResultsRepr.deserialize: 10.00µs + air_parser::parser::air_parser::parse: 50.00µs + runner::execute: 3.96ms + runner::farewell: 1.57ms + from_success_result: 1.55ms + populate_outcome_from_contexts: 1.43ms + CallRequestsRepr.serialize: 14.00µs + InterpreterData::serialize: 1.16ms + signing_step::sign_produced_cids: 104.00µs + verification_step::verify: 4.30ms + verify: 1.18ms + multiple-sigs30 (26.20ms; 56.188 MiB, 56.188 MiB): signing multiple CIDs + air::runner::execute_air: 26.20ms + preparation_step::preparation::parse_data: 4.93ms + try_from_slice: 4.88ms + preparation_step::preparation::prepare: 438.00µs + air::preparation_step::preparation::make_exec_ctx: 261.00µs + CallResultsRepr.deserialize: 10.00µs + air_parser::parser::air_parser::parse: 49.00µs + runner::execute: 11.10ms + runner::farewell: 4.39ms + from_success_result: 4.37ms + populate_outcome_from_contexts: 4.17ms + CallRequestsRepr.serialize: 14.00µs + InterpreterData::serialize: 3.04ms + signing_step::sign_produced_cids: 742.00µs + verification_step::verify: 4.36ms + verify: 2.03ms + network-explore (3.35ms; 52.375 MiB, 52.375 MiB): 5 peers of network are discovered + air::runner::execute_air: 3.35ms + preparation_step::preparation::parse_data: 596.00µs + try_from_slice: 509.00µs + preparation_step::preparation::prepare: 249.00µs + air::preparation_step::preparation::make_exec_ctx: 46.00µs + CallResultsRepr.deserialize: 10.00µs + air_parser::parser::air_parser::parse: 74.00µs + runner::execute: 168.00µs + runner::farewell: 441.00µs + from_success_result: 418.00µs + populate_outcome_from_contexts: 376.00µs + CallRequestsRepr.serialize: 14.00µs + InterpreterData::serialize: 199.00µs + signing_step::sign_produced_cids: 105.00µs + verification_step::verify: 1.64ms + verify: 99.00µs + null (712.00µs; 52.375 MiB, 52.375 MiB): Empty data and null script + air::runner::execute_air: 712.00µs + preparation_step::preparation::parse_data: 16.00µs + preparation_step::preparation::prepare: 183.00µs + air::preparation_step::preparation::make_exec_ctx: 35.00µs + CallResultsRepr.deserialize: 10.00µs + air_parser::parser::air_parser::parse: 17.00µs + runner::execute: 9.00µs + runner::farewell: 257.00µs + from_success_result: 237.00µs + populate_outcome_from_contexts: 204.00µs + CallRequestsRepr.serialize: 13.00µs + InterpreterData::serialize: 51.00µs + signing_step::sign_produced_cids: 101.00µs + verification_step::verify: 32.00µs + verify: 10.00µs + parser-10000-100 (31.70ms; 54.625 MiB, 54.625 MiB): long air script with lot of variable assignments + air::runner::execute_air: 31.70ms + preparation_step::preparation::parse_data: 16.00µs + preparation_step::preparation::prepare: 30.40ms + air::preparation_step::preparation::make_exec_ctx: 43.00µs + CallResultsRepr.deserialize: 12.00µs + air_parser::parser::air_parser::parse: 30.10ms + runner::execute: 27.00µs + runner::farewell: 284.00µs + from_success_result: 262.00µs + populate_outcome_from_contexts: 220.00µs + CallRequestsRepr.serialize: 12.00µs + InterpreterData::serialize: 56.00µs + signing_step::sign_produced_cids: 101.00µs + verification_step::verify: 33.00µs + verify: 10.00µs + parser-calls-10000-100 (26.50ms; 54.375 MiB, 54.375 MiB): multiple calls parser benchmark + air::runner::execute_air: 26.50ms + preparation_step::preparation::parse_data: 17.00µs + preparation_step::preparation::prepare: 24.80ms + air::preparation_step::preparation::make_exec_ctx: 44.00µs + CallResultsRepr.deserialize: 11.00µs + air_parser::parser::air_parser::parse: 24.60ms + runner::execute: 31.00µs + runner::farewell: 414.00µs + from_success_result: 379.00µs + populate_outcome_from_contexts: 327.00µs + CallRequestsRepr.serialize: 21.00µs + InterpreterData::serialize: 71.00µs + signing_step::sign_produced_cids: 156.00µs + verification_step::verify: 34.00µs + verify: 10.00µs + populate-map-multiple-keys (4.10ms; 53.000 MiB, 53.000 MiB): benchmarking a map insert operation + air::runner::execute_air: 4.10ms + preparation_step::preparation::parse_data: 116.00µs + try_from_slice: 72.00µs + preparation_step::preparation::prepare: 212.00µs + air::preparation_step::preparation::make_exec_ctx: 40.00µs + CallResultsRepr.deserialize: 10.00µs + air_parser::parser::air_parser::parse: 50.00µs + runner::execute: 2.78ms + runner::farewell: 414.00µs + from_success_result: 393.00µs + populate_outcome_from_contexts: 356.00µs + CallRequestsRepr.serialize: 13.00µs + InterpreterData::serialize: 165.00µs + signing_step::sign_produced_cids: 101.00µs + verification_step::verify: 336.00µs + verify: 26.00µs + populate-map-single-key (3.40ms; 52.938 MiB, 52.938 MiB): benchmarking a map insert operation + air::runner::execute_air: 3.40ms + preparation_step::preparation::parse_data: 170.00µs + try_from_slice: 131.00µs + preparation_step::preparation::prepare: 216.00µs + air::preparation_step::preparation::make_exec_ctx: 39.00µs + CallResultsRepr.deserialize: 10.00µs + air_parser::parser::air_parser::parse: 50.00µs + runner::execute: 1.95ms + runner::farewell: 436.00µs + from_success_result: 412.00µs + populate_outcome_from_contexts: 360.00µs + CallRequestsRepr.serialize: 13.00µs + InterpreterData::serialize: 179.00µs + signing_step::sign_produced_cids: 105.00µs + verification_step::verify: 401.00µs + verify: 68.00µs Machine c1f3ea5950db0a10b44da931c25774d64ab25084f47d504f72f311e694550ff1: Platform: macOS-12.0.1-x86_64-i386-64bit Timestamp: 2023-02-13 13:19:34.106863+00:00 diff --git a/crates/air-lib/air-parser/src/parser/air.lalrpop b/crates/air-lib/air-parser/src/parser/air.lalrpop index 52e0980f..e907305c 100644 --- a/crates/air-lib/air-parser/src/parser/air.lalrpop +++ b/crates/air-lib/air-parser/src/parser/air.lalrpop @@ -72,10 +72,30 @@ Instr: Instruction<'input> = { Instruction::ApMap(apply.into()) }, - "(" seq ")" => Instruction::Seq(Seq::new(l, r).into()), - "(" par ")" => Instruction::Par(Par::new(l, r).into()), - "(" never ")" => Instruction::Never(Never), - "(" null ")" => Instruction::Null(Null), + "(" seq ")" => { + let span = Span::new(left, right); + validator.met_merging_instr(span); + + Instruction::Seq(Seq::new(l, r).into()) + }, + "(" par ")" => { + let span = Span::new(left, right); + validator.met_merging_instr(span); + + Instruction::Par(Par::new(l, r).into()) + }, + "(" never ")" => { + let span = Span::new(left, right); + validator.met_simple_instr(span); + + Instruction::Never(Never) + }, + "(" null ")" => { + let span = Span::new(left, right); + validator.met_simple_instr(span); + + Instruction::Null(Null) + }, "(" new ")" => { let span = Span::new(left, right); @@ -132,7 +152,12 @@ Instr: Instruction<'input> = { Instruction::Next(next.into()) }, - "(" xor ")" => Instruction::Xor(Xor(l, r).into()), + "(" xor ")" => { + let span = Span::new(left, right); + validator.met_xoring_instr(span); + + Instruction::Xor(Xor(l, r).into()) + }, "(" match_ ")" => { let match_ = Match::new(l, r, i); diff --git a/crates/air-lib/air-parser/src/parser/air.rs b/crates/air-lib/air-parser/src/parser/air.rs index 81b76edc..9c1f85dc 100644 --- a/crates/air-lib/air-parser/src/parser/air.rs +++ b/crates/air-lib/air-parser/src/parser/air.rs @@ -1,5 +1,5 @@ // auto-generated: "lalrpop 0.20.0" -// sha3: 127100bc464d586a4839740daea718cfbd4c90154fcbc34ebfb7cc898a24b6d7 +// sha3: b4049ff6155302933d751e17dbfc78a894d367bd199f13197d81af0b8de556e2 use crate::ast::*; use crate::parser::ParserError; use crate::parser::VariableValidator; @@ -3516,11 +3516,11 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // FailBody = LastError => ActionFn(135); + // FailBody = LastError => ActionFn(140); let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0; let __end = __sym0.2; - let __nt = super::__action135::<>(input, errors, validator, __sym0); + let __nt = super::__action140::<>(input, errors, validator, __sym0); __symbols.push((__start, __Symbol::Variant20(__nt), __end)); (1, 14) } @@ -3537,11 +3537,11 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // FailBody = Error => ActionFn(136); + // FailBody = Error => ActionFn(141); let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0; let __end = __sym0.2; - let __nt = super::__action136::<>(input, errors, validator, __sym0); + let __nt = super::__action141::<>(input, errors, validator, __sym0); __symbols.push((__start, __Symbol::Variant20(__nt), __end)); (1, 14) } @@ -3707,7 +3707,7 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // Instr = "(", call, Triplet, Args, CallOutput, ")" => ActionFn(151); + // Instr = "(", call, Triplet, Args, CallOutput, ")" => ActionFn(161); assert!(__symbols.len() >= 6); let __sym5 = __pop_Variant0(__symbols); let __sym4 = __pop_Variant16(__symbols); @@ -3717,7 +3717,7 @@ mod __parse__AIR { let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0; let __end = __sym5.2; - let __nt = super::__action151::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5); + let __nt = super::__action161::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5); __symbols.push((__start, __Symbol::Variant12(__nt), __end)); (6, 17) } @@ -3734,7 +3734,7 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // Instr = "(", call, Triplet, Args, ")" => ActionFn(152); + // Instr = "(", call, Triplet, Args, ")" => ActionFn(162); assert!(__symbols.len() >= 5); let __sym4 = __pop_Variant0(__symbols); let __sym3 = __pop_Variant15(__symbols); @@ -3743,7 +3743,7 @@ mod __parse__AIR { let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0; let __end = __sym4.2; - let __nt = super::__action152::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4); + let __nt = super::__action162::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4); __symbols.push((__start, __Symbol::Variant12(__nt), __end)); (5, 17) } @@ -3760,7 +3760,7 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // Instr = "(", canon, ResolvableToPeerIdVariable, StreamArgument, CanonStreamArgument, ")" => ActionFn(138); + // Instr = "(", canon, ResolvableToPeerIdVariable, StreamArgument, CanonStreamArgument, ")" => ActionFn(143); assert!(__symbols.len() >= 6); let __sym5 = __pop_Variant0(__symbols); let __sym4 = __pop_Variant18(__symbols); @@ -3770,7 +3770,7 @@ mod __parse__AIR { let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0; let __end = __sym5.2; - let __nt = super::__action138::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5); + let __nt = super::__action143::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5); __symbols.push((__start, __Symbol::Variant12(__nt), __end)); (6, 17) } @@ -3787,7 +3787,7 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // Instr = "(", canon, ResolvableToPeerIdVariable, StreamMapArgument, CanonStreamMapArgument, ")" => ActionFn(139); + // Instr = "(", canon, ResolvableToPeerIdVariable, StreamMapArgument, CanonStreamMapArgument, ")" => ActionFn(144); assert!(__symbols.len() >= 6); let __sym5 = __pop_Variant0(__symbols); let __sym4 = __pop_Variant19(__symbols); @@ -3797,7 +3797,7 @@ mod __parse__AIR { let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0; let __end = __sym5.2; - let __nt = super::__action139::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5); + let __nt = super::__action144::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5); __symbols.push((__start, __Symbol::Variant12(__nt), __end)); (6, 17) } @@ -3814,7 +3814,7 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // Instr = "(", canon, ResolvableToPeerIdVariable, StreamMapArgument, Scalar, ")" => ActionFn(140); + // Instr = "(", canon, ResolvableToPeerIdVariable, StreamMapArgument, Scalar, ")" => ActionFn(145); assert!(__symbols.len() >= 6); let __sym5 = __pop_Variant0(__symbols); let __sym4 = __pop_Variant2(__symbols); @@ -3824,7 +3824,7 @@ mod __parse__AIR { let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0; let __end = __sym5.2; - let __nt = super::__action140::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5); + let __nt = super::__action145::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5); __symbols.push((__start, __Symbol::Variant12(__nt), __end)); (6, 17) } @@ -3841,7 +3841,7 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // Instr = "(", ap, ApArgument, ApResult, ")" => ActionFn(141); + // Instr = "(", ap, ApArgument, ApResult, ")" => ActionFn(146); assert!(__symbols.len() >= 5); let __sym4 = __pop_Variant0(__symbols); let __sym3 = __pop_Variant14(__symbols); @@ -3850,7 +3850,7 @@ mod __parse__AIR { let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0; let __end = __sym4.2; - let __nt = super::__action141::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4); + let __nt = super::__action146::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4); __symbols.push((__start, __Symbol::Variant12(__nt), __end)); (5, 17) } @@ -3867,7 +3867,7 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // Instr = "(", ap, "(", StreamMapKeyClause, ApArgument, ")", StreamMap, ")" => ActionFn(142); + // Instr = "(", ap, "(", StreamMapKeyClause, ApArgument, ")", StreamMap, ")" => ActionFn(147); assert!(__symbols.len() >= 8); let __sym7 = __pop_Variant0(__symbols); let __sym6 = __pop_Variant2(__symbols); @@ -3879,7 +3879,7 @@ mod __parse__AIR { let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0; let __end = __sym7.2; - let __nt = super::__action142::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5, __sym6, __sym7); + let __nt = super::__action147::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5, __sym6, __sym7); __symbols.push((__start, __Symbol::Variant12(__nt), __end)); (8, 17) } @@ -3896,7 +3896,7 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // Instr = "(", seq, Instr, Instr, ")" => ActionFn(8); + // Instr = "(", seq, Instr, Instr, ")" => ActionFn(148); assert!(__symbols.len() >= 5); let __sym4 = __pop_Variant0(__symbols); let __sym3 = __pop_Variant12(__symbols); @@ -3905,7 +3905,7 @@ mod __parse__AIR { let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0; let __end = __sym4.2; - let __nt = super::__action8::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4); + let __nt = super::__action148::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4); __symbols.push((__start, __Symbol::Variant12(__nt), __end)); (5, 17) } @@ -3922,7 +3922,7 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // Instr = "(", par, Instr, Instr, ")" => ActionFn(9); + // Instr = "(", par, Instr, Instr, ")" => ActionFn(149); assert!(__symbols.len() >= 5); let __sym4 = __pop_Variant0(__symbols); let __sym3 = __pop_Variant12(__symbols); @@ -3931,7 +3931,7 @@ mod __parse__AIR { let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0; let __end = __sym4.2; - let __nt = super::__action9::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4); + let __nt = super::__action149::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4); __symbols.push((__start, __Symbol::Variant12(__nt), __end)); (5, 17) } @@ -3948,14 +3948,14 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // Instr = "(", never, ")" => ActionFn(10); + // Instr = "(", never, ")" => ActionFn(150); assert!(__symbols.len() >= 3); let __sym2 = __pop_Variant0(__symbols); let __sym1 = __pop_Variant0(__symbols); let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0; let __end = __sym2.2; - let __nt = super::__action10::<>(input, errors, validator, __sym0, __sym1, __sym2); + let __nt = super::__action150::<>(input, errors, validator, __sym0, __sym1, __sym2); __symbols.push((__start, __Symbol::Variant12(__nt), __end)); (3, 17) } @@ -3972,14 +3972,14 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // Instr = "(", null, ")" => ActionFn(11); + // Instr = "(", null, ")" => ActionFn(151); assert!(__symbols.len() >= 3); let __sym2 = __pop_Variant0(__symbols); let __sym1 = __pop_Variant0(__symbols); let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0; let __end = __sym2.2; - let __nt = super::__action11::<>(input, errors, validator, __sym0, __sym1, __sym2); + let __nt = super::__action151::<>(input, errors, validator, __sym0, __sym1, __sym2); __symbols.push((__start, __Symbol::Variant12(__nt), __end)); (3, 17) } @@ -3996,7 +3996,7 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // Instr = "(", new, NewArgument, Instr, ")" => ActionFn(143); + // Instr = "(", new, NewArgument, Instr, ")" => ActionFn(152); assert!(__symbols.len() >= 5); let __sym4 = __pop_Variant0(__symbols); let __sym3 = __pop_Variant12(__symbols); @@ -4005,7 +4005,7 @@ mod __parse__AIR { let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0; let __end = __sym4.2; - let __nt = super::__action143::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4); + let __nt = super::__action152::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4); __symbols.push((__start, __Symbol::Variant12(__nt), __end)); (5, 17) } @@ -4022,7 +4022,7 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // Instr = "(", fail, FailBody, ")" => ActionFn(144); + // Instr = "(", fail, FailBody, ")" => ActionFn(153); assert!(__symbols.len() >= 4); let __sym3 = __pop_Variant0(__symbols); let __sym2 = __pop_Variant20(__symbols); @@ -4030,7 +4030,7 @@ mod __parse__AIR { let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0; let __end = __sym3.2; - let __nt = super::__action144::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3); + let __nt = super::__action153::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3); __symbols.push((__start, __Symbol::Variant12(__nt), __end)); (4, 17) } @@ -4047,7 +4047,7 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // Instr = "(", fold, FoldScalarIterable, Scalar, Instr, Instr, ")" => ActionFn(153); + // Instr = "(", fold, FoldScalarIterable, Scalar, Instr, Instr, ")" => ActionFn(163); assert!(__symbols.len() >= 7); let __sym6 = __pop_Variant0(__symbols); let __sym5 = __pop_Variant12(__symbols); @@ -4058,7 +4058,7 @@ mod __parse__AIR { let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0; let __end = __sym6.2; - let __nt = super::__action153::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5, __sym6); + let __nt = super::__action163::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5, __sym6); __symbols.push((__start, __Symbol::Variant12(__nt), __end)); (7, 17) } @@ -4075,7 +4075,7 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // Instr = "(", fold, FoldScalarIterable, Scalar, Instr, ")" => ActionFn(154); + // Instr = "(", fold, FoldScalarIterable, Scalar, Instr, ")" => ActionFn(164); assert!(__symbols.len() >= 6); let __sym5 = __pop_Variant0(__symbols); let __sym4 = __pop_Variant12(__symbols); @@ -4085,7 +4085,7 @@ mod __parse__AIR { let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0; let __end = __sym5.2; - let __nt = super::__action154::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5); + let __nt = super::__action164::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5); __symbols.push((__start, __Symbol::Variant12(__nt), __end)); (6, 17) } @@ -4102,7 +4102,7 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // Instr = "(", fold, Stream, Scalar, Instr, Instr, ")" => ActionFn(155); + // Instr = "(", fold, Stream, Scalar, Instr, Instr, ")" => ActionFn(165); assert!(__symbols.len() >= 7); let __sym6 = __pop_Variant0(__symbols); let __sym5 = __pop_Variant12(__symbols); @@ -4113,7 +4113,7 @@ mod __parse__AIR { let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0; let __end = __sym6.2; - let __nt = super::__action155::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5, __sym6); + let __nt = super::__action165::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5, __sym6); __symbols.push((__start, __Symbol::Variant12(__nt), __end)); (7, 17) } @@ -4130,7 +4130,7 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // Instr = "(", fold, Stream, Scalar, Instr, ")" => ActionFn(156); + // Instr = "(", fold, Stream, Scalar, Instr, ")" => ActionFn(166); assert!(__symbols.len() >= 6); let __sym5 = __pop_Variant0(__symbols); let __sym4 = __pop_Variant12(__symbols); @@ -4140,7 +4140,7 @@ mod __parse__AIR { let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0; let __end = __sym5.2; - let __nt = super::__action156::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5); + let __nt = super::__action166::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5); __symbols.push((__start, __Symbol::Variant12(__nt), __end)); (6, 17) } @@ -4157,7 +4157,7 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // Instr = "(", fold, StreamMap, Scalar, Instr, Instr, ")" => ActionFn(157); + // Instr = "(", fold, StreamMap, Scalar, Instr, Instr, ")" => ActionFn(167); assert!(__symbols.len() >= 7); let __sym6 = __pop_Variant0(__symbols); let __sym5 = __pop_Variant12(__symbols); @@ -4168,7 +4168,7 @@ mod __parse__AIR { let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0; let __end = __sym6.2; - let __nt = super::__action157::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5, __sym6); + let __nt = super::__action167::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5, __sym6); __symbols.push((__start, __Symbol::Variant12(__nt), __end)); (7, 17) } @@ -4185,7 +4185,7 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // Instr = "(", fold, StreamMap, Scalar, Instr, ")" => ActionFn(158); + // Instr = "(", fold, StreamMap, Scalar, Instr, ")" => ActionFn(168); assert!(__symbols.len() >= 6); let __sym5 = __pop_Variant0(__symbols); let __sym4 = __pop_Variant12(__symbols); @@ -4195,7 +4195,7 @@ mod __parse__AIR { let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0; let __end = __sym5.2; - let __nt = super::__action158::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5); + let __nt = super::__action168::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5); __symbols.push((__start, __Symbol::Variant12(__nt), __end)); (6, 17) } @@ -4212,7 +4212,7 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // Instr = "(", next, Scalar, ")" => ActionFn(148); + // Instr = "(", next, Scalar, ")" => ActionFn(157); assert!(__symbols.len() >= 4); let __sym3 = __pop_Variant0(__symbols); let __sym2 = __pop_Variant2(__symbols); @@ -4220,7 +4220,7 @@ mod __parse__AIR { let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0; let __end = __sym3.2; - let __nt = super::__action148::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3); + let __nt = super::__action157::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3); __symbols.push((__start, __Symbol::Variant12(__nt), __end)); (4, 17) } @@ -4237,7 +4237,7 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // Instr = "(", xor, Instr, Instr, ")" => ActionFn(18); + // Instr = "(", xor, Instr, Instr, ")" => ActionFn(158); assert!(__symbols.len() >= 5); let __sym4 = __pop_Variant0(__symbols); let __sym3 = __pop_Variant12(__symbols); @@ -4246,7 +4246,7 @@ mod __parse__AIR { let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0; let __end = __sym4.2; - let __nt = super::__action18::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4); + let __nt = super::__action158::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4); __symbols.push((__start, __Symbol::Variant12(__nt), __end)); (5, 17) } @@ -4263,7 +4263,7 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // Instr = "(", match_, Value, Value, Instr, ")" => ActionFn(149); + // Instr = "(", match_, Value, Value, Instr, ")" => ActionFn(159); assert!(__symbols.len() >= 6); let __sym5 = __pop_Variant0(__symbols); let __sym4 = __pop_Variant12(__symbols); @@ -4273,7 +4273,7 @@ mod __parse__AIR { let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0; let __end = __sym5.2; - let __nt = super::__action149::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5); + let __nt = super::__action159::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5); __symbols.push((__start, __Symbol::Variant12(__nt), __end)); (6, 17) } @@ -4290,7 +4290,7 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // Instr = "(", mismatch, Value, Value, Instr, ")" => ActionFn(150); + // Instr = "(", mismatch, Value, Value, Instr, ")" => ActionFn(160); assert!(__symbols.len() >= 6); let __sym5 = __pop_Variant0(__symbols); let __sym4 = __pop_Variant12(__symbols); @@ -4300,7 +4300,7 @@ mod __parse__AIR { let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0; let __end = __sym5.2; - let __nt = super::__action150::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5); + let __nt = super::__action160::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5); __symbols.push((__start, __Symbol::Variant12(__nt), __end)); (6, 17) } @@ -5548,14 +5548,21 @@ fn __action8< input: &'input str, errors: &'err mut Vec, ParserError>>, validator: &'v mut VariableValidator<'input>, + (_, left, _): (AirPos, AirPos, AirPos), (_, _, _): (AirPos, Token<'input>, AirPos), (_, _, _): (AirPos, Token<'input>, AirPos), (_, l, _): (AirPos, Instruction<'input>, AirPos), (_, r, _): (AirPos, Instruction<'input>, AirPos), (_, _, _): (AirPos, Token<'input>, AirPos), + (_, right, _): (AirPos, AirPos, AirPos), ) -> Instruction<'input> { - Instruction::Seq(Seq::new(l, r).into()) + { + let span = Span::new(left, right); + validator.met_merging_instr(span); + + Instruction::Seq(Seq::new(l, r).into()) + } } #[allow(unused_variables)] @@ -5568,14 +5575,21 @@ fn __action9< input: &'input str, errors: &'err mut Vec, ParserError>>, validator: &'v mut VariableValidator<'input>, + (_, left, _): (AirPos, AirPos, AirPos), (_, _, _): (AirPos, Token<'input>, AirPos), (_, _, _): (AirPos, Token<'input>, AirPos), (_, l, _): (AirPos, Instruction<'input>, AirPos), (_, r, _): (AirPos, Instruction<'input>, AirPos), (_, _, _): (AirPos, Token<'input>, AirPos), + (_, right, _): (AirPos, AirPos, AirPos), ) -> Instruction<'input> { - Instruction::Par(Par::new(l, r).into()) + { + let span = Span::new(left, right); + validator.met_merging_instr(span); + + Instruction::Par(Par::new(l, r).into()) + } } #[allow(unused_variables)] @@ -5588,12 +5602,19 @@ fn __action10< input: &'input str, errors: &'err mut Vec, ParserError>>, validator: &'v mut VariableValidator<'input>, - (_, __0, _): (AirPos, Token<'input>, AirPos), - (_, __1, _): (AirPos, Token<'input>, AirPos), - (_, __2, _): (AirPos, Token<'input>, AirPos), + (_, left, _): (AirPos, AirPos, AirPos), + (_, _, _): (AirPos, Token<'input>, AirPos), + (_, _, _): (AirPos, Token<'input>, AirPos), + (_, _, _): (AirPos, Token<'input>, AirPos), + (_, right, _): (AirPos, AirPos, AirPos), ) -> Instruction<'input> { - Instruction::Never(Never) + { + let span = Span::new(left, right); + validator.met_simple_instr(span); + + Instruction::Never(Never) + } } #[allow(unused_variables)] @@ -5606,12 +5627,19 @@ fn __action11< input: &'input str, errors: &'err mut Vec, ParserError>>, validator: &'v mut VariableValidator<'input>, - (_, __0, _): (AirPos, Token<'input>, AirPos), - (_, __1, _): (AirPos, Token<'input>, AirPos), - (_, __2, _): (AirPos, Token<'input>, AirPos), + (_, left, _): (AirPos, AirPos, AirPos), + (_, _, _): (AirPos, Token<'input>, AirPos), + (_, _, _): (AirPos, Token<'input>, AirPos), + (_, _, _): (AirPos, Token<'input>, AirPos), + (_, right, _): (AirPos, AirPos, AirPos), ) -> Instruction<'input> { - Instruction::Null(Null) + { + let span = Span::new(left, right); + validator.met_simple_instr(span); + + Instruction::Null(Null) + } } #[allow(unused_variables)] @@ -5803,14 +5831,21 @@ fn __action18< input: &'input str, errors: &'err mut Vec, ParserError>>, validator: &'v mut VariableValidator<'input>, + (_, left, _): (AirPos, AirPos, AirPos), (_, _, _): (AirPos, Token<'input>, AirPos), (_, _, _): (AirPos, Token<'input>, AirPos), (_, l, _): (AirPos, Instruction<'input>, AirPos), (_, r, _): (AirPos, Instruction<'input>, AirPos), (_, _, _): (AirPos, Token<'input>, AirPos), + (_, right, _): (AirPos, AirPos, AirPos), ) -> Instruction<'input> { - Instruction::Xor(Xor(l, r).into()) + { + let span = Span::new(left, right); + validator.met_xoring_instr(span); + + Instruction::Xor(Xor(l, r).into()) + } } #[allow(unused_variables)] @@ -7874,6 +7909,166 @@ fn __action127< 'err, 'input, 'v, +>( + input: &'input str, + errors: &'err mut Vec, ParserError>>, + validator: &'v mut VariableValidator<'input>, + __0: (AirPos, Token<'input>, AirPos), + __1: (AirPos, Token<'input>, AirPos), + __2: (AirPos, Instruction<'input>, AirPos), + __3: (AirPos, Instruction<'input>, AirPos), + __4: (AirPos, Token<'input>, AirPos), + __5: (AirPos, AirPos, AirPos), +) -> Instruction<'input> +{ + let __start0 = __0.0; + let __end0 = __0.0; + let __temp0 = __action112( + input, + errors, + validator, + &__start0, + &__end0, + ); + let __temp0 = (__start0, __temp0, __end0); + __action8( + input, + errors, + validator, + __temp0, + __0, + __1, + __2, + __3, + __4, + __5, + ) +} + +#[allow(unused_variables)] +#[allow(clippy::too_many_arguments)] +fn __action128< + 'err, + 'input, + 'v, +>( + input: &'input str, + errors: &'err mut Vec, ParserError>>, + validator: &'v mut VariableValidator<'input>, + __0: (AirPos, Token<'input>, AirPos), + __1: (AirPos, Token<'input>, AirPos), + __2: (AirPos, Instruction<'input>, AirPos), + __3: (AirPos, Instruction<'input>, AirPos), + __4: (AirPos, Token<'input>, AirPos), + __5: (AirPos, AirPos, AirPos), +) -> Instruction<'input> +{ + let __start0 = __0.0; + let __end0 = __0.0; + let __temp0 = __action112( + input, + errors, + validator, + &__start0, + &__end0, + ); + let __temp0 = (__start0, __temp0, __end0); + __action9( + input, + errors, + validator, + __temp0, + __0, + __1, + __2, + __3, + __4, + __5, + ) +} + +#[allow(unused_variables)] +#[allow(clippy::too_many_arguments)] +fn __action129< + 'err, + 'input, + 'v, +>( + input: &'input str, + errors: &'err mut Vec, ParserError>>, + validator: &'v mut VariableValidator<'input>, + __0: (AirPos, Token<'input>, AirPos), + __1: (AirPos, Token<'input>, AirPos), + __2: (AirPos, Token<'input>, AirPos), + __3: (AirPos, AirPos, AirPos), +) -> Instruction<'input> +{ + let __start0 = __0.0; + let __end0 = __0.0; + let __temp0 = __action112( + input, + errors, + validator, + &__start0, + &__end0, + ); + let __temp0 = (__start0, __temp0, __end0); + __action10( + input, + errors, + validator, + __temp0, + __0, + __1, + __2, + __3, + ) +} + +#[allow(unused_variables)] +#[allow(clippy::too_many_arguments)] +fn __action130< + 'err, + 'input, + 'v, +>( + input: &'input str, + errors: &'err mut Vec, ParserError>>, + validator: &'v mut VariableValidator<'input>, + __0: (AirPos, Token<'input>, AirPos), + __1: (AirPos, Token<'input>, AirPos), + __2: (AirPos, Token<'input>, AirPos), + __3: (AirPos, AirPos, AirPos), +) -> Instruction<'input> +{ + let __start0 = __0.0; + let __end0 = __0.0; + let __temp0 = __action112( + input, + errors, + validator, + &__start0, + &__end0, + ); + let __temp0 = (__start0, __temp0, __end0); + __action11( + input, + errors, + validator, + __temp0, + __0, + __1, + __2, + __3, + ) +} + +#[allow(unused_variables)] +#[allow(clippy::too_many_arguments)] +fn __action131< + 'err, + 'input, + 'v, >( input: &'input str, errors: &'err mut Vec, ParserError>>, @@ -7912,7 +8107,7 @@ fn __action127< #[allow(unused_variables)] #[allow(clippy::too_many_arguments)] -fn __action128< +fn __action132< 'err, 'input, 'v, @@ -7952,7 +8147,7 @@ fn __action128< #[allow(unused_variables)] #[allow(clippy::too_many_arguments)] -fn __action129< +fn __action133< 'err, 'input, 'v, @@ -7998,7 +8193,7 @@ fn __action129< #[allow(unused_variables)] #[allow(clippy::too_many_arguments)] -fn __action130< +fn __action134< 'err, 'input, 'v, @@ -8044,7 +8239,7 @@ fn __action130< #[allow(unused_variables)] #[allow(clippy::too_many_arguments)] -fn __action131< +fn __action135< 'err, 'input, 'v, @@ -8090,7 +8285,7 @@ fn __action131< #[allow(unused_variables)] #[allow(clippy::too_many_arguments)] -fn __action132< +fn __action136< 'err, 'input, 'v, @@ -8130,7 +8325,49 @@ fn __action132< #[allow(unused_variables)] #[allow(clippy::too_many_arguments)] -fn __action133< +fn __action137< + 'err, + 'input, + 'v, +>( + input: &'input str, + errors: &'err mut Vec, ParserError>>, + validator: &'v mut VariableValidator<'input>, + __0: (AirPos, Token<'input>, AirPos), + __1: (AirPos, Token<'input>, AirPos), + __2: (AirPos, Instruction<'input>, AirPos), + __3: (AirPos, Instruction<'input>, AirPos), + __4: (AirPos, Token<'input>, AirPos), + __5: (AirPos, AirPos, AirPos), +) -> Instruction<'input> +{ + let __start0 = __0.0; + let __end0 = __0.0; + let __temp0 = __action112( + input, + errors, + validator, + &__start0, + &__end0, + ); + let __temp0 = (__start0, __temp0, __end0); + __action18( + input, + errors, + validator, + __temp0, + __0, + __1, + __2, + __3, + __4, + __5, + ) +} + +#[allow(unused_variables)] +#[allow(clippy::too_many_arguments)] +fn __action138< 'err, 'input, 'v, @@ -8174,7 +8411,7 @@ fn __action133< #[allow(unused_variables)] #[allow(clippy::too_many_arguments)] -fn __action134< +fn __action139< 'err, 'input, 'v, @@ -8218,7 +8455,7 @@ fn __action134< #[allow(unused_variables)] #[allow(clippy::too_many_arguments)] -fn __action135< +fn __action140< 'err, 'input, 'v, @@ -8250,7 +8487,7 @@ fn __action135< #[allow(unused_variables)] #[allow(clippy::too_many_arguments)] -fn __action136< +fn __action141< 'err, 'input, 'v, @@ -8282,7 +8519,7 @@ fn __action136< #[allow(unused_variables)] #[allow(clippy::too_many_arguments)] -fn __action137< +fn __action142< 'err, 'input, 'v, @@ -8324,7 +8561,7 @@ fn __action137< #[allow(unused_variables)] #[allow(clippy::too_many_arguments)] -fn __action138< +fn __action143< 'err, 'input, 'v, @@ -8366,7 +8603,7 @@ fn __action138< #[allow(unused_variables)] #[allow(clippy::too_many_arguments)] -fn __action139< +fn __action144< 'err, 'input, 'v, @@ -8408,7 +8645,7 @@ fn __action139< #[allow(unused_variables)] #[allow(clippy::too_many_arguments)] -fn __action140< +fn __action145< 'err, 'input, 'v, @@ -8450,7 +8687,7 @@ fn __action140< #[allow(unused_variables)] #[allow(clippy::too_many_arguments)] -fn __action141< +fn __action146< 'err, 'input, 'v, @@ -8490,7 +8727,7 @@ fn __action141< #[allow(unused_variables)] #[allow(clippy::too_many_arguments)] -fn __action142< +fn __action147< 'err, 'input, 'v, @@ -8536,7 +8773,7 @@ fn __action142< #[allow(unused_variables)] #[allow(clippy::too_many_arguments)] -fn __action143< +fn __action148< 'err, 'input, 'v, @@ -8546,7 +8783,7 @@ fn __action143< validator: &'v mut VariableValidator<'input>, __0: (AirPos, Token<'input>, AirPos), __1: (AirPos, Token<'input>, AirPos), - __2: (AirPos, NewArgument<'input>, AirPos), + __2: (AirPos, Instruction<'input>, AirPos), __3: (AirPos, Instruction<'input>, AirPos), __4: (AirPos, Token<'input>, AirPos), ) -> Instruction<'input> @@ -8576,7 +8813,7 @@ fn __action143< #[allow(unused_variables)] #[allow(clippy::too_many_arguments)] -fn __action144< +fn __action149< 'err, 'input, 'v, @@ -8586,12 +8823,13 @@ fn __action144< validator: &'v mut VariableValidator<'input>, __0: (AirPos, Token<'input>, AirPos), __1: (AirPos, Token<'input>, AirPos), - __2: (AirPos, Fail<'input>, AirPos), - __3: (AirPos, Token<'input>, AirPos), + __2: (AirPos, Instruction<'input>, AirPos), + __3: (AirPos, Instruction<'input>, AirPos), + __4: (AirPos, Token<'input>, AirPos), ) -> Instruction<'input> { - let __start0 = __3.2; - let __end0 = __3.2; + let __start0 = __4.2; + let __end0 = __4.2; let __temp0 = __action109( input, errors, @@ -8608,13 +8846,14 @@ fn __action144< __1, __2, __3, + __4, __temp0, ) } #[allow(unused_variables)] #[allow(clippy::too_many_arguments)] -fn __action145< +fn __action150< 'err, 'input, 'v, @@ -8624,15 +8863,11 @@ fn __action145< validator: &'v mut VariableValidator<'input>, __0: (AirPos, Token<'input>, AirPos), __1: (AirPos, Token<'input>, AirPos), - __2: (AirPos, FoldScalarIterable<'input>, AirPos), - __3: (AirPos, (&'input str, AirPos), AirPos), - __4: (AirPos, Instruction<'input>, AirPos), - __5: (AirPos, core::option::Option>, AirPos), - __6: (AirPos, Token<'input>, AirPos), + __2: (AirPos, Token<'input>, AirPos), ) -> Instruction<'input> { - let __start0 = __6.2; - let __end0 = __6.2; + let __start0 = __2.2; + let __end0 = __2.2; let __temp0 = __action109( input, errors, @@ -8648,17 +8883,13 @@ fn __action145< __0, __1, __2, - __3, - __4, - __5, - __6, __temp0, ) } #[allow(unused_variables)] #[allow(clippy::too_many_arguments)] -fn __action146< +fn __action151< 'err, 'input, 'v, @@ -8668,15 +8899,11 @@ fn __action146< validator: &'v mut VariableValidator<'input>, __0: (AirPos, Token<'input>, AirPos), __1: (AirPos, Token<'input>, AirPos), - __2: (AirPos, (&'input str, AirPos), AirPos), - __3: (AirPos, (&'input str, AirPos), AirPos), - __4: (AirPos, Instruction<'input>, AirPos), - __5: (AirPos, core::option::Option>, AirPos), - __6: (AirPos, Token<'input>, AirPos), + __2: (AirPos, Token<'input>, AirPos), ) -> Instruction<'input> { - let __start0 = __6.2; - let __end0 = __6.2; + let __start0 = __2.2; + let __end0 = __2.2; let __temp0 = __action109( input, errors, @@ -8692,17 +8919,13 @@ fn __action146< __0, __1, __2, - __3, - __4, - __5, - __6, __temp0, ) } #[allow(unused_variables)] #[allow(clippy::too_many_arguments)] -fn __action147< +fn __action152< 'err, 'input, 'v, @@ -8712,15 +8935,13 @@ fn __action147< validator: &'v mut VariableValidator<'input>, __0: (AirPos, Token<'input>, AirPos), __1: (AirPos, Token<'input>, AirPos), - __2: (AirPos, (&'input str, AirPos), AirPos), - __3: (AirPos, (&'input str, AirPos), AirPos), - __4: (AirPos, Instruction<'input>, AirPos), - __5: (AirPos, core::option::Option>, AirPos), - __6: (AirPos, Token<'input>, AirPos), + __2: (AirPos, NewArgument<'input>, AirPos), + __3: (AirPos, Instruction<'input>, AirPos), + __4: (AirPos, Token<'input>, AirPos), ) -> Instruction<'input> { - let __start0 = __6.2; - let __end0 = __6.2; + let __start0 = __4.2; + let __end0 = __4.2; let __temp0 = __action109( input, errors, @@ -8738,15 +8959,13 @@ fn __action147< __2, __3, __4, - __5, - __6, __temp0, ) } #[allow(unused_variables)] #[allow(clippy::too_many_arguments)] -fn __action148< +fn __action153< 'err, 'input, 'v, @@ -8756,7 +8975,7 @@ fn __action148< validator: &'v mut VariableValidator<'input>, __0: (AirPos, Token<'input>, AirPos), __1: (AirPos, Token<'input>, AirPos), - __2: (AirPos, (&'input str, AirPos), AirPos), + __2: (AirPos, Fail<'input>, AirPos), __3: (AirPos, Token<'input>, AirPos), ) -> Instruction<'input> { @@ -8784,7 +9003,7 @@ fn __action148< #[allow(unused_variables)] #[allow(clippy::too_many_arguments)] -fn __action149< +fn __action154< 'err, 'input, 'v, @@ -8794,14 +9013,15 @@ fn __action149< validator: &'v mut VariableValidator<'input>, __0: (AirPos, Token<'input>, AirPos), __1: (AirPos, Token<'input>, AirPos), - __2: (AirPos, ImmutableValue<'input>, AirPos), - __3: (AirPos, ImmutableValue<'input>, AirPos), + __2: (AirPos, FoldScalarIterable<'input>, AirPos), + __3: (AirPos, (&'input str, AirPos), AirPos), __4: (AirPos, Instruction<'input>, AirPos), - __5: (AirPos, Token<'input>, AirPos), + __5: (AirPos, core::option::Option>, AirPos), + __6: (AirPos, Token<'input>, AirPos), ) -> Instruction<'input> { - let __start0 = __5.2; - let __end0 = __5.2; + let __start0 = __6.2; + let __end0 = __6.2; let __temp0 = __action109( input, errors, @@ -8820,13 +9040,180 @@ fn __action149< __3, __4, __5, + __6, __temp0, ) } #[allow(unused_variables)] #[allow(clippy::too_many_arguments)] -fn __action150< +fn __action155< + 'err, + 'input, + 'v, +>( + input: &'input str, + errors: &'err mut Vec, ParserError>>, + validator: &'v mut VariableValidator<'input>, + __0: (AirPos, Token<'input>, AirPos), + __1: (AirPos, Token<'input>, AirPos), + __2: (AirPos, (&'input str, AirPos), AirPos), + __3: (AirPos, (&'input str, AirPos), AirPos), + __4: (AirPos, Instruction<'input>, AirPos), + __5: (AirPos, core::option::Option>, AirPos), + __6: (AirPos, Token<'input>, AirPos), +) -> Instruction<'input> +{ + let __start0 = __6.2; + let __end0 = __6.2; + let __temp0 = __action109( + input, + errors, + validator, + &__start0, + &__end0, + ); + let __temp0 = (__start0, __temp0, __end0); + __action134( + input, + errors, + validator, + __0, + __1, + __2, + __3, + __4, + __5, + __6, + __temp0, + ) +} + +#[allow(unused_variables)] +#[allow(clippy::too_many_arguments)] +fn __action156< + 'err, + 'input, + 'v, +>( + input: &'input str, + errors: &'err mut Vec, ParserError>>, + validator: &'v mut VariableValidator<'input>, + __0: (AirPos, Token<'input>, AirPos), + __1: (AirPos, Token<'input>, AirPos), + __2: (AirPos, (&'input str, AirPos), AirPos), + __3: (AirPos, (&'input str, AirPos), AirPos), + __4: (AirPos, Instruction<'input>, AirPos), + __5: (AirPos, core::option::Option>, AirPos), + __6: (AirPos, Token<'input>, AirPos), +) -> Instruction<'input> +{ + let __start0 = __6.2; + let __end0 = __6.2; + let __temp0 = __action109( + input, + errors, + validator, + &__start0, + &__end0, + ); + let __temp0 = (__start0, __temp0, __end0); + __action135( + input, + errors, + validator, + __0, + __1, + __2, + __3, + __4, + __5, + __6, + __temp0, + ) +} + +#[allow(unused_variables)] +#[allow(clippy::too_many_arguments)] +fn __action157< + 'err, + 'input, + 'v, +>( + input: &'input str, + errors: &'err mut Vec, ParserError>>, + validator: &'v mut VariableValidator<'input>, + __0: (AirPos, Token<'input>, AirPos), + __1: (AirPos, Token<'input>, AirPos), + __2: (AirPos, (&'input str, AirPos), AirPos), + __3: (AirPos, Token<'input>, AirPos), +) -> Instruction<'input> +{ + let __start0 = __3.2; + let __end0 = __3.2; + let __temp0 = __action109( + input, + errors, + validator, + &__start0, + &__end0, + ); + let __temp0 = (__start0, __temp0, __end0); + __action136( + input, + errors, + validator, + __0, + __1, + __2, + __3, + __temp0, + ) +} + +#[allow(unused_variables)] +#[allow(clippy::too_many_arguments)] +fn __action158< + 'err, + 'input, + 'v, +>( + input: &'input str, + errors: &'err mut Vec, ParserError>>, + validator: &'v mut VariableValidator<'input>, + __0: (AirPos, Token<'input>, AirPos), + __1: (AirPos, Token<'input>, AirPos), + __2: (AirPos, Instruction<'input>, AirPos), + __3: (AirPos, Instruction<'input>, AirPos), + __4: (AirPos, Token<'input>, AirPos), +) -> Instruction<'input> +{ + let __start0 = __4.2; + let __end0 = __4.2; + let __temp0 = __action109( + input, + errors, + validator, + &__start0, + &__end0, + ); + let __temp0 = (__start0, __temp0, __end0); + __action137( + input, + errors, + validator, + __0, + __1, + __2, + __3, + __4, + __temp0, + ) +} + +#[allow(unused_variables)] +#[allow(clippy::too_many_arguments)] +fn __action159< 'err, 'input, 'v, @@ -8852,7 +9239,7 @@ fn __action150< &__end0, ); let __temp0 = (__start0, __temp0, __end0); - __action134( + __action138( input, errors, validator, @@ -8868,7 +9255,49 @@ fn __action150< #[allow(unused_variables)] #[allow(clippy::too_many_arguments)] -fn __action151< +fn __action160< + 'err, + 'input, + 'v, +>( + input: &'input str, + errors: &'err mut Vec, ParserError>>, + validator: &'v mut VariableValidator<'input>, + __0: (AirPos, Token<'input>, AirPos), + __1: (AirPos, Token<'input>, AirPos), + __2: (AirPos, ImmutableValue<'input>, AirPos), + __3: (AirPos, ImmutableValue<'input>, AirPos), + __4: (AirPos, Instruction<'input>, AirPos), + __5: (AirPos, Token<'input>, AirPos), +) -> Instruction<'input> +{ + let __start0 = __5.2; + let __end0 = __5.2; + let __temp0 = __action109( + input, + errors, + validator, + &__start0, + &__end0, + ); + let __temp0 = (__start0, __temp0, __end0); + __action139( + input, + errors, + validator, + __0, + __1, + __2, + __3, + __4, + __5, + __temp0, + ) +} + +#[allow(unused_variables)] +#[allow(clippy::too_many_arguments)] +fn __action161< 'err, 'input, 'v, @@ -8893,7 +9322,7 @@ fn __action151< __4, ); let __temp0 = (__start0, __temp0, __end0); - __action137( + __action142( input, errors, validator, @@ -8908,7 +9337,7 @@ fn __action151< #[allow(unused_variables)] #[allow(clippy::too_many_arguments)] -fn __action152< +fn __action162< 'err, 'input, 'v, @@ -8933,7 +9362,7 @@ fn __action152< &__end0, ); let __temp0 = (__start0, __temp0, __end0); - __action137( + __action142( input, errors, validator, @@ -8948,7 +9377,7 @@ fn __action152< #[allow(unused_variables)] #[allow(clippy::too_many_arguments)] -fn __action153< +fn __action163< 'err, 'input, 'v, @@ -8974,7 +9403,7 @@ fn __action153< __5, ); let __temp0 = (__start0, __temp0, __end0); - __action145( + __action154( input, errors, validator, @@ -8990,7 +9419,7 @@ fn __action153< #[allow(unused_variables)] #[allow(clippy::too_many_arguments)] -fn __action154< +fn __action164< 'err, 'input, 'v, @@ -9016,7 +9445,7 @@ fn __action154< &__end0, ); let __temp0 = (__start0, __temp0, __end0); - __action145( + __action154( input, errors, validator, @@ -9032,7 +9461,7 @@ fn __action154< #[allow(unused_variables)] #[allow(clippy::too_many_arguments)] -fn __action155< +fn __action165< 'err, 'input, 'v, @@ -9058,7 +9487,7 @@ fn __action155< __5, ); let __temp0 = (__start0, __temp0, __end0); - __action146( + __action155( input, errors, validator, @@ -9074,7 +9503,7 @@ fn __action155< #[allow(unused_variables)] #[allow(clippy::too_many_arguments)] -fn __action156< +fn __action166< 'err, 'input, 'v, @@ -9100,7 +9529,7 @@ fn __action156< &__end0, ); let __temp0 = (__start0, __temp0, __end0); - __action146( + __action155( input, errors, validator, @@ -9116,7 +9545,7 @@ fn __action156< #[allow(unused_variables)] #[allow(clippy::too_many_arguments)] -fn __action157< +fn __action167< 'err, 'input, 'v, @@ -9142,7 +9571,7 @@ fn __action157< __5, ); let __temp0 = (__start0, __temp0, __end0); - __action147( + __action156( input, errors, validator, @@ -9158,7 +9587,7 @@ fn __action157< #[allow(unused_variables)] #[allow(clippy::too_many_arguments)] -fn __action158< +fn __action168< 'err, 'input, 'v, @@ -9184,7 +9613,7 @@ fn __action158< &__end0, ); let __temp0 = (__start0, __temp0, __end0); - __action147( + __action156( input, errors, validator, diff --git a/crates/air-lib/air-parser/src/parser/errors.rs b/crates/air-lib/air-parser/src/parser/errors.rs index 30ab4f4b..48c1f92e 100644 --- a/crates/air-lib/air-parser/src/parser/errors.rs +++ b/crates/air-lib/air-parser/src/parser/errors.rs @@ -56,6 +56,9 @@ pub enum ParserError { #[error("error code 0 with fail is unsupported")] UnsupportedLiteralErrCodes { span: Span }, + + #[error("fold can not have instructions after next")] + FoldHasInstructionAfterNext(Span), } impl ParserError { @@ -71,6 +74,7 @@ impl ParserError { Self::MultipleNextInFold { span, .. } => *span, Self::UnsupportedMapKeyType { span, .. } => *span, Self::UnsupportedLiteralErrCodes { span } => *span, + Self::FoldHasInstructionAfterNext(span) => *span, } } @@ -124,6 +128,10 @@ impl ParserError { pub fn unsupported_literal_errcodes(span: Span) -> Self { Self::UnsupportedLiteralErrCodes { span } } + + pub fn fold_has_instruction_after_next(span: Span) -> Self { + Self::FoldHasInstructionAfterNext(span) + } } impl From for ParserError { diff --git a/crates/air-lib/air-parser/src/parser/tests/fold.rs b/crates/air-lib/air-parser/src/parser/tests/fold.rs index 1eac0785..8a3f6ad4 100644 --- a/crates/air-lib/air-parser/src/parser/tests/fold.rs +++ b/crates/air-lib/air-parser/src/parser/tests/fold.rs @@ -489,3 +489,961 @@ fn fold_on_canon_stream_map() { ); assert_eq!(instruction, expected); } + +#[test] +fn fold_on_scalar_with_subtree_and_next() { + let source_code = r#" + (seq + (call "" ("" "") [] iterable) + (fold iterable i + (seq + (seq + (call "" ("" "") ["hello" ""] $void) + (call "" ("" "") ["hello" ""] $voida) + ) + (next i) + ) + ) + ) + "#; + + let lexer = crate::AIRLexer::new(source_code); + + let parser = crate::AIRParser::new(); + let mut errors = Vec::new(); + let mut validator = crate::parser::VariableValidator::new(); + parser + .parse(source_code, &mut errors, &mut validator, lexer) + .expect("parser shouldn't fail"); + + let errors = validator.finalize(); + assert_eq!(errors.len(), 0); +} + +#[test] +fn fold_on_scalar_with_next_in_a_fold() { + let source_code = r#" + (seq + (seq + (call "" ("" "") [] iterable1) + (call "" ("" "") [] iterable2) + ) + (fold iterable1 i + (seq + (fold iterable2 it + (call "" ("" "") ["hello" ""] $void) + ) + (next i) + ) + ) + ) + "#; + + let lexer = crate::AIRLexer::new(source_code); + + let parser = crate::AIRParser::new(); + let mut errors = Vec::new(); + let mut validator = crate::parser::VariableValidator::new(); + parser + .parse(source_code, &mut errors, &mut validator, lexer) + .expect("parser shouldn't fail"); + + let errors = validator.finalize(); + assert_eq!(errors.len(), 0); +} + +#[test] +fn fold_on_scalar_with_next() { + let source_code = r#" + (seq + (call "" ("" "") [] iterable) + (fold iterable i + (seq + (next i) + (call "" ("" "") ["hello" ""] $void) + ) + ) + ) + "#; + + let lexer = crate::AIRLexer::new(source_code); + + let parser = crate::AIRParser::new(); + let mut errors = Vec::new(); + let mut validator = crate::parser::VariableValidator::new(); + parser + .parse(source_code, &mut errors, &mut validator, lexer) + .expect("parser shouldn't fail"); + + let errors = validator.finalize(); + assert_eq!(errors.len(), 0); +} + +#[test] +fn fold_on_scalar_with_next_in_a_fold1() { + let source_code = r#" + (seq + (seq + (call "" ("" "") [] iterable1) + (call "" ("" "") [] iterable2) + ) + (fold iterable1 i + (seq + (fold iterable2 it + (seq + (next i) + (call "" ("" "") ["hello" ""] $void) + ) + ) + (call "" ("" "") ["hello" ""] $voida) + ) + ) + ) + "#; + + let lexer = crate::AIRLexer::new(source_code); + + let parser = crate::AIRParser::new(); + let mut errors = Vec::new(); + let mut validator = crate::parser::VariableValidator::new(); + parser + .parse(source_code, &mut errors, &mut validator, lexer) + .expect("parser shouldn't fail"); + + let errors = validator.finalize(); + assert_eq!(errors.len(), 0); +} + +#[test] +fn fold_on_scalar_with_next_in_a_fold2() { + let source_code = r#" + (seq + (seq + (call "" ("" "") [] iterable1) + (call "" ("" "") [] iterable2) + ) + (fold iterable1 i + (seq + (fold iterable2 it + (seq + (call "" ("" "") ["hello" ""] $void) + (next i) + ) + ) + (call "" ("" "") ["hello" ""] $voida) + ) + ) + ) + "#; + + let lexer = crate::AIRLexer::new(source_code); + + let parser = crate::AIRParser::new(); + let mut errors = Vec::new(); + let mut validator = crate::parser::VariableValidator::new(); + parser + .parse(source_code, &mut errors, &mut validator, lexer) + .expect("parser shouldn't fail"); + + let errors = validator.finalize(); + assert_eq!(errors.len(), 0); +} + +#[test] +fn fold_on_scalar_with_next_in_a_branch1() { + let source_code = r#" + (seq + (call "" ("" "") [] iterable) + (fold iterable i + (seq + (seq + (call "" ("" "") ["hello" ""] $void) + (next i) + ) + (call "" ("" "") ["hello" ""] $voida) + ) + ) + ) + "#; + + let lexer = crate::AIRLexer::new(source_code); + + let parser = crate::AIRParser::new(); + let mut errors = Vec::new(); + let mut validator = crate::parser::VariableValidator::new(); + parser + .parse(source_code, &mut errors, &mut validator, lexer) + .expect("parser shouldn't fail"); + + let errors = validator.finalize(); + assert_eq!(errors.len(), 0); +} + +#[test] +fn fold_on_scalar_with_next_in_a_branch2() { + let source_code = r#" + (seq + (call "" ("" "") [] $iterable) + (fold $iterable i + (seq + (call "" ("" "") ["hello" ""] $voida) + (seq + (next i) + (call "" ("" "") ["hello" ""] $void) + ) + ) + ) + ) + "#; + + let lexer = crate::AIRLexer::new(source_code); + + let parser = crate::AIRParser::new(); + let mut errors = Vec::new(); + let mut validator = crate::parser::VariableValidator::new(); + parser + .parse(source_code, &mut errors, &mut validator, lexer) + .expect("parser shouldn't fail"); + + let errors = validator.finalize(); + dbg!(&errors); + assert_eq!(errors.len(), 1); + + let error = &errors[0].error; + let parser_error = match error { + ParseError::User { error } => error, + _ => panic!("unexpected error type"), + }; + + assert!(matches!( + parser_error, + ParserError::FoldHasInstructionAfterNext { .. } + )); +} + +#[test] +fn fold_on_stream_with_subtree_and_next() { + let source_code = r#" + (seq + (call "" ("" "") [] $iterable) + (fold $iterable i + (seq + (seq + (call "" ("" "") ["hello" ""] $void) + (call "" ("" "") ["hello" ""] $voida) + ) + (next i) + ) + ) + ) + "#; + + let lexer = crate::AIRLexer::new(source_code); + + let parser = crate::AIRParser::new(); + let mut errors = Vec::new(); + let mut validator = crate::parser::VariableValidator::new(); + parser + .parse(source_code, &mut errors, &mut validator, lexer) + .expect("parser shouldn't fail"); + + let errors = validator.finalize(); + assert_eq!(errors.len(), 0); +} + +#[test] +fn fold_on_stream_with_next_in_a_fold() { + let source_code = r#" + (seq + (seq + (call "" ("" "") [] $iterable1) + (call "" ("" "") [] $iterable2) + ) + (fold $iterable1 i + (seq + (fold $iterable2 it + (call "" ("" "") ["hello" ""] $void) + ) + (next i) + ) + ) + ) + "#; + + let lexer = crate::AIRLexer::new(source_code); + + let parser = crate::AIRParser::new(); + let mut errors = Vec::new(); + let mut validator = crate::parser::VariableValidator::new(); + parser + .parse(source_code, &mut errors, &mut validator, lexer) + .expect("parser shouldn't fail"); + + let errors = validator.finalize(); + assert_eq!(errors.len(), 0); +} + +#[test] +fn fold_on_stream_with_next_neg() { + let source_code = r#" + (seq + (call "" ("" "") [] $iterable) + (fold $iterable i + (seq + (next i) + (call "" ("" "") ["hello" ""] $void) + ) + ) + ) + "#; + + let lexer = crate::AIRLexer::new(source_code); + + let parser = crate::AIRParser::new(); + let mut errors = Vec::new(); + let mut validator = crate::parser::VariableValidator::new(); + parser + .parse(source_code, &mut errors, &mut validator, lexer) + .expect("parser shouldn't fail"); + + let errors = validator.finalize(); + dbg!(&errors); + assert_eq!(errors.len(), 1); + + let error = &errors[0].error; + let parser_error = match error { + ParseError::User { error } => error, + _ => panic!("unexpected error type"), + }; + + assert!(matches!( + parser_error, + ParserError::FoldHasInstructionAfterNext { .. } + )); +} + +#[test] +fn fold_on_stream_with_next_in_a_fold1() { + let source_code = r#" + (seq + (seq + (call "" ("" "") [] $iterable1) + (call "" ("" "") [] $iterable2) + ) + (fold $iterable1 i + (seq + (fold $iterable2 it + (seq + (next i) + (call "" ("" "") ["hello" ""] $void) + ) + ) + (call "" ("" "") ["hello" ""] $voida) + ) + ) + ) + "#; + + let lexer = crate::AIRLexer::new(source_code); + + let parser = crate::AIRParser::new(); + let mut errors = Vec::new(); + let mut validator = crate::parser::VariableValidator::new(); + parser + .parse(source_code, &mut errors, &mut validator, lexer) + .expect("parser shouldn't fail"); + + let errors = validator.finalize(); + dbg!(&errors); + assert_eq!(errors.len(), 1); + + let error = &errors[0].error; + let parser_error = match error { + ParseError::User { error } => error, + _ => panic!("unexpected error type"), + }; + + assert!(matches!( + parser_error, + ParserError::FoldHasInstructionAfterNext { .. } + )); +} + +#[test] +fn fold_on_stream_with_next_in_a_fold2() { + let source_code = r#" + (seq + (seq + (call "" ("" "") [] $iterable1) + (call "" ("" "") [] $iterable2) + ) + (fold $iterable1 i + (seq + (fold $iterable2 it + (seq + (call "" ("" "") ["hello" ""] $void) + (next i) + ) + ) + (call "" ("" "") ["hello" ""] $voida) + ) + ) + ) + "#; + + let lexer = crate::AIRLexer::new(source_code); + + let parser = crate::AIRParser::new(); + let mut errors = Vec::new(); + let mut validator = crate::parser::VariableValidator::new(); + parser + .parse(source_code, &mut errors, &mut validator, lexer) + .expect("parser shouldn't fail"); + + let errors = validator.finalize(); + dbg!(&errors); // WIP remove all + assert_eq!(errors.len(), 1); + + let error = &errors[0].error; + let parser_error = match error { + ParseError::User { error } => error, + _ => panic!("unexpected error type"), + }; + + assert!(matches!( + parser_error, + ParserError::FoldHasInstructionAfterNext { .. } + )); +} + +#[test] +fn fold_on_stream_with_next_in_a_branch1_neg() { + let source_code = r#" + (seq + (call "" ("" "") [] $iterable) + (fold $iterable i + (seq + (seq + (call "" ("" "") ["hello" ""] $void) + (next i) + ) + (call "" ("" "") ["hello" ""] $voida) + ) + ) + ) + "#; + + let lexer = crate::AIRLexer::new(source_code); + + let parser = crate::AIRParser::new(); + let mut errors = Vec::new(); + let mut validator = crate::parser::VariableValidator::new(); + parser + .parse(source_code, &mut errors, &mut validator, lexer) + .expect("parser shouldn't fail"); + + let errors = validator.finalize(); + dbg!(&errors); + assert_eq!(errors.len(), 1); + + let error = &errors[0].error; + let parser_error = match error { + ParseError::User { error } => error, + _ => panic!("unexpected error type"), + }; + + assert!(matches!( + parser_error, + ParserError::FoldHasInstructionAfterNext { .. } + )); +} + +#[test] +fn fold_on_stream_with_next_in_a_branch2_neg() { + let source_code = r#" + (seq + (call "" ("" "") [] $iterable) + (fold $iterable i + (seq + (call "" ("" "") ["hello" ""] $voida) + (seq + (next i) + (call "" ("" "") ["hello" ""] $void) + ) + ) + ) + ) + "#; + + let lexer = crate::AIRLexer::new(source_code); + + let parser = crate::AIRParser::new(); + let mut errors = Vec::new(); + let mut validator = crate::parser::VariableValidator::new(); + parser + .parse(source_code, &mut errors, &mut validator, lexer) + .expect("parser shouldn't fail"); + + let errors = validator.finalize(); + dbg!(&errors); + assert_eq!(errors.len(), 1); + + let error = &errors[0].error; + let parser_error = match error { + ParseError::User { error } => error, + _ => panic!("unexpected error type"), + }; + + assert!(matches!( + parser_error, + ParserError::FoldHasInstructionAfterNext { .. } + )); +} + +#[test] +fn fold_on_stream_with_xor() { + let source_code = r#" + (seq + (call "" ("" "") [] $iterable) + (fold $iterable i + (xor + (next i) + (call "" ("" "") ["hello" ""] $void) + ) + ) + ) + "#; + + let lexer = crate::AIRLexer::new(source_code); + + let parser = crate::AIRParser::new(); + let mut errors = Vec::new(); + let mut validator = crate::parser::VariableValidator::new(); + parser + .parse(source_code, &mut errors, &mut validator, lexer) + .expect("parser shouldn't fail"); + + let errors = validator.finalize(); + assert_eq!(errors.len(), 0); +} + +#[test] +fn fold_on_stream_with_xor_and_par() { + let source_code = r#" + (seq + (call "" ("" "") [] $iterable) + (fold $iterable i + (xor + (par + (ap 42 some) + (next i) + ) + (par + (call "" ("" "") ["hello" ""] $void) + (ap 42 some) + ) + ) + ) + ) + "#; + + let lexer = crate::AIRLexer::new(source_code); + + let parser = crate::AIRParser::new(); + let mut errors = Vec::new(); + let mut validator = crate::parser::VariableValidator::new(); + parser + .parse(source_code, &mut errors, &mut validator, lexer) + .expect("parser shouldn't fail"); + + let errors = validator.finalize(); + assert_eq!(errors.len(), 0); +} + +#[test] +fn fold_on_stream_multiple_folds_same_iter_names() { + let source_code = r#" + (seq + (call "" ("" "") [] $iterable) + (seq + (fold $iterable i + (seq + (ap 42 scalar) + (next i) + ) + ) + (fold $iterable i + (seq + (ap 42 scalar) + (next i) + ) + ) + ) + ) + "#; + + let lexer = crate::AIRLexer::new(source_code); + + let parser = crate::AIRParser::new(); + let mut errors = Vec::new(); + let mut validator = crate::parser::VariableValidator::new(); + parser + .parse(source_code, &mut errors, &mut validator, lexer) + .expect("parser shouldn't fail"); + + let errors = validator.finalize(); + assert_eq!(errors.len(), 0); +} + +#[test] +fn fold_on_stream_with_next_in_a_fold1_neg() { + let source_code = r#" + (seq + (seq + (call "" ("" "") [] $iterable1) + (call "" ("" "") [] $iterable2) + ) + (fold $iterable1 i + (seq + (fold $iterable2 it + (seq + (next i) + (call "" ("" "") ["hello" ""] $void) + ) + ) + (call "" ("" "") ["hello" ""] $voida) + ) + ) + ) + "#; + + let lexer = crate::AIRLexer::new(source_code); + + let parser = crate::AIRParser::new(); + let mut errors = Vec::new(); + let mut validator = crate::parser::VariableValidator::new(); + parser + .parse(source_code, &mut errors, &mut validator, lexer) + .expect("parser shouldn't fail"); + + let errors = validator.finalize(); + assert_eq!(errors.len(), 1); + + let error = &errors[0].error; + let parser_error = match error { + ParseError::User { error } => error, + _ => panic!("unexpected error type"), + }; + + assert!(matches!( + parser_error, + ParserError::FoldHasInstructionAfterNext { .. } + )); +} + +#[test] +fn fold_on_stream_with_next_in_a_fold2_neg() { + let source_code = r#" + (seq + (seq + (call "" ("" "") [] $iterable1) + (call "" ("" "") [] $iterable2) + ) + (fold $iterable1 i + (seq + (fold $iterable2 it + (seq + (call "" ("" "") ["hello" ""] $void) + (next i) + ) + ) + (call "" ("" "") ["hello" ""] $voida) + ) + ) + ) + "#; + + let lexer = crate::AIRLexer::new(source_code); + + let parser = crate::AIRParser::new(); + let mut errors = Vec::new(); + let mut validator = crate::parser::VariableValidator::new(); + parser + .parse(source_code, &mut errors, &mut validator, lexer) + .expect("parser shouldn't fail"); + + let errors = validator.finalize(); + assert_eq!(errors.len(), 1); + + let error = &errors[0].error; + let parser_error = match error { + ParseError::User { error } => error, + _ => panic!("unexpected error type"), + }; + + assert!(matches!( + parser_error, + ParserError::FoldHasInstructionAfterNext { .. } + )); +} + +#[test] +fn fold_on_stream_multiple_folds_same_iter_names_neg() { + let source_code = r#" + (seq + (call "" ("" "") [] $iterable) + (seq + (fold $iterable i + (seq + (next i) + (ap 42 scalar) + ) + ) + (fold $iterable i + (seq + (next i) + (ap 42 scalar) + ) + ) + ) + ) + "#; + + let lexer = crate::AIRLexer::new(source_code); + + let parser = crate::AIRParser::new(); + let mut errors = Vec::new(); + let mut validator = crate::parser::VariableValidator::new(); + parser + .parse(source_code, &mut errors, &mut validator, lexer) + .expect("parser shouldn't fail"); + + let errors = validator.finalize(); + assert_eq!(errors.len(), 2); + + errors.iter().map(|e| &e.error).for_each(|error| { + let parser_error = match error { + ParseError::User { error } => error, + _ => panic!("unexpected error type"), + }; + + assert!(matches!( + parser_error, + ParserError::FoldHasInstructionAfterNext { .. } + )); + }) +} + +#[test] +fn fold_on_stream_with_xor_and_par_neg() { + let source_code = r#" + (seq + (call "" ("" "") [] $iterable) + (fold $iterable i + (xor + (par + (next i) + (ap 42 some) + ) + (par + (call "" ("" "") ["hello" ""] $void) + (ap 42 some) + ) + ) + ) + ) + "#; + + let lexer = crate::AIRLexer::new(source_code); + + let parser = crate::AIRParser::new(); + let mut errors = Vec::new(); + let mut validator = crate::parser::VariableValidator::new(); + parser + .parse(source_code, &mut errors, &mut validator, lexer) + .expect("parser shouldn't fail"); + + let errors = validator.finalize(); + assert_eq!(errors.len(), 1); + + let error = &errors[0].error; + let parser_error = match error { + ParseError::User { error } => error, + _ => panic!("unexpected error type"), + }; + + assert!(matches!( + parser_error, + ParserError::FoldHasInstructionAfterNext { .. } + )); +} + +#[test] +fn fold_on_stream_with_xor_and_nested_fold_neg_1() { + let source_code = r#" + (seq + (call "" ("" "") [] $iterable) + (fold $iterable i + (xor + (seq + (fold $iterable it + (seq + (next it) + (ap 42 some) + ) + ) + (next i) + ) + (seq + (call "" ("" "") ["hello" ""] $void) + (ap 42 some) + ) + ) + ) + ) + "#; + + let lexer = crate::AIRLexer::new(source_code); + + let parser = crate::AIRParser::new(); + let mut errors = Vec::new(); + let mut validator = crate::parser::VariableValidator::new(); + parser + .parse(source_code, &mut errors, &mut validator, lexer) + .expect("parser shouldn't fail"); + + let errors = validator.finalize(); + assert_eq!(errors.len(), 1); + + let error = &errors[0].error; + let parser_error = match error { + ParseError::User { error } => error, + _ => panic!("unexpected error type"), + }; + + assert!(matches!( + parser_error, + ParserError::FoldHasInstructionAfterNext { .. } + )); +} + +#[test] +fn fold_on_stream_with_xor_and_nested_fold_2() { + let source_code = r#" + (seq + (call "" ("" "") [] $iterable) + (fold $iterable i + (seq + (ap 42 some) + (xor + (next i) + (fold $iterable it + (seq + (ap 42 some) + (next it) + ) + ) + ) + ) + ) + ) + "#; + + let lexer = crate::AIRLexer::new(source_code); + + let parser = crate::AIRParser::new(); + let mut errors = Vec::new(); + let mut validator = crate::parser::VariableValidator::new(); + parser + .parse(source_code, &mut errors, &mut validator, lexer) + .expect("parser shouldn't fail"); + + let errors = validator.finalize(); + assert_eq!(errors.len(), 0); +} + +#[test] +fn fold_on_stream_with_xor_and_nested_fold_neg_2() { + let source_code = r#" + (seq + (call "" ("" "") [] $iterable) + (fold $iterable i + (seq + (xor + (next i) + (fold $iterable it + (seq + (next it) + (ap 42 some) + ) + ) + + ) + (ap 42 some) + ) + ) + ) + "#; + + let lexer = crate::AIRLexer::new(source_code); + + let parser = crate::AIRParser::new(); + let mut errors = Vec::new(); + let mut validator = crate::parser::VariableValidator::new(); + parser + .parse(source_code, &mut errors, &mut validator, lexer) + .expect("parser shouldn't fail"); + + let errors = validator.finalize(); + assert_eq!(errors.len(), 2); + + errors.iter().map(|e| &e.error).for_each(|error| { + let parser_error = match error { + ParseError::User { error } => error, + _ => panic!("unexpected error type"), + }; + + assert!(matches!( + parser_error, + ParserError::FoldHasInstructionAfterNext { .. } + )); + }) +} + +#[test] +fn fold_on_stream_with_multiple_folds() { + let source_code = r#" + (new $inner + (seq + (par + (fold $inner ns + (seq + (ap ns $result) + (next ns) + ) + ) + (null) + ) + (par + (fold $inner ns + (next ns) + ) + (null) + ) + ) + ) + "#; + + let lexer = crate::AIRLexer::new(source_code); + + let parser = crate::AIRParser::new(); + let mut errors = Vec::new(); + let mut validator = crate::parser::VariableValidator::new(); + parser + .parse(source_code, &mut errors, &mut validator, lexer) + .expect("parser shouldn't fail"); + + let errors = validator.finalize(); + dbg!(errors.clone()); + assert_eq!(errors.len(), 0); +} diff --git a/crates/air-lib/air-parser/src/parser/validator.rs b/crates/air-lib/air-parser/src/parser/validator.rs index 32dd59af..7d5ac00e 100644 --- a/crates/air-lib/air-parser/src/parser/validator.rs +++ b/crates/air-lib/air-parser/src/parser/validator.rs @@ -30,6 +30,217 @@ use multimap::MultiMap; use std::collections::HashMap; use std::ops::Deref; +#[derive(Clone, Copy, Debug)] +pub enum CheckInstructionKind<'names> { + PivotalNext(&'names str), + Merging, + PopStack1, + PopStack2, + Replacing, + ReplacingWithCheck(&'names str), + Xoring, + PopStack1ReplacingWithCheck(&'names str), + Simple, +} + +/// This machine is used to check that there are no instructions after next +/// in a fold block over stream and map, e.g. +/// (fold $iterable iterator +/// (seq +/// (next iterator) +/// (call ...) <- instruction after next +/// ) +/// ) +/// Note that the fold over scalar doesn't have this restriction. +#[derive(Clone, Debug)] +struct AfterNextCheckMachine<'name> { + /// stack for the machine. + stack: Vec<(CheckInstructionKind<'name>, Span)>, + + /// lalrpop parses AIR so that `next` + /// is met before `fold``. At the moment when `next` is met + /// it is impossible to tell whether it belongs to a stream/map fold or not. + /// This field stores iterator name to span mapping to be used when `fold` is met. + potentially_malformed_spans: HashMap<&'name str, Span>, + + /// This vector contains all spans where an instruction after next was met. + malformed_spans: Vec, + + /// This flag disables the machine if invariants are broken, e.g. par/seq must see + /// at least 2 instruction kinds in the stack. + is_enabled: bool, +} + +impl<'name> Default for AfterNextCheckMachine<'name> { + fn default() -> Self { + Self { + stack: Default::default(), + potentially_malformed_spans: Default::default(), + malformed_spans: Default::default(), + is_enabled: true, + } + } +} + +impl<'name> AfterNextCheckMachine<'name> { + fn disable(&mut self) { + self.stack.clear(); + self.is_enabled = false; + } + + fn malformed_spans_iter(&self) -> std::slice::Iter { + self.malformed_spans.iter() + } + + fn met_instruction_kind(&mut self, instr_kind: CheckInstructionKind<'name>, span: Span) { + use CheckInstructionKind::*; + + if !self.is_enabled { + return; + } + match instr_kind { + CheckInstructionKind::Replacing => { + self.process_replacing(span); + } + CheckInstructionKind::Xoring => { + self.process_xoring(span); + } + CheckInstructionKind::Merging => { + self.process_merging(span); + } + CheckInstructionKind::ReplacingWithCheck(iterator_name) => { + self.replacing_with_check_common(iterator_name, span, &instr_kind); + } + PopStack1ReplacingWithCheck(iterator_name) => { + self.stack.pop(); + self.replacing_with_check_common(iterator_name, span, &instr_kind); + } + PivotalNext(_) | Simple => self.stack.push((instr_kind, span)), + PopStack1 => { + self.stack.pop(); + self.stack.push((instr_kind, span)) + } + PopStack2 => { + self.stack.pop(); + self.stack.pop(); + self.stack.push((instr_kind, span)) + } + } + } + + fn process_replacing(&mut self, span: Span) { + use CheckInstructionKind::*; + + let child = self.stack.pop(); + match child { + Some((pattern_kind @ PivotalNext(_), ..)) => { + self.stack.push((pattern_kind, span)); + } + Some(_) => { + self.stack.push((Replacing, span)); + } + None => self.disable(), + } + } + + fn process_xoring(&mut self, span: Span) { + use CheckInstructionKind::*; + + let right_branch = self.stack.pop(); + let left_branch = self.stack.pop(); + let left_right = left_branch.zip(right_branch); + + match left_right { + Some(((PivotalNext(_), ..), (PivotalNext(_), ..))) => { + // `xor` has `next` in both branches. It is impossible + // to tell which branch should poped up. + self.disable(); + } + Some(((pattern_kind @ PivotalNext(_), ..), ..)) + | Some((_, (pattern_kind @ PivotalNext(_), _))) => { + // potential failure but need to check when fold pops up. + self.stack.push((pattern_kind, span)); + } + Some(_) => { + self.stack.push((Xoring, span)); + } + _ => { + // disable machine if Xoring invariant, namely there must be 2 kinds on a stack, is broken. + self.disable(); + } + } + } + + fn process_merging(&mut self, span: Span) { + use CheckInstructionKind::*; + + let right_branch = self.stack.pop(); + let left_branch = self.stack.pop(); + let left_right = left_branch.zip(right_branch); + match left_right { + Some(( + (pattern_kind @ PivotalNext(left_iterable), ..), + (PivotalNext(right_iterable), ..), + )) if left_iterable == right_iterable => { + self.stack.push((pattern_kind, span)); + } + Some(((PivotalNext(iterator), _), ..)) => { + // potential failure but need to check when fold pops up. + self.stack.push((Merging, span)); + self.potentially_malformed_spans + .entry(iterator) + .or_insert(span); + } + Some((_, (pattern_kind @ PivotalNext(_), ..))) => { + self.stack.push((pattern_kind, span)); + } + Some(_) => { + self.stack.push((Merging, span)); + } + _ => { + // disable machine if Merging invariant, namely there must be 2 kinds on a stack, is broken. + self.disable(); + } + } + } + + fn after_next_check(&mut self, iterable: &'name str) { + let malformed_span = self.potentially_malformed_spans.get(iterable); + if let Some(span) = malformed_span { + self.malformed_spans.push(*span); + } + } + + fn replacing_with_check_common( + &mut self, + iterator_name: &'name str, + span: Span, + instr_kind: &CheckInstructionKind<'name>, + ) { + use CheckInstructionKind::*; + + let child = self.stack.pop(); + match child { + Some((PivotalNext(pivotal_next_iterator_name), ..)) + if pivotal_next_iterator_name == iterator_name => + { + self.after_next_check(iterator_name); + self.potentially_malformed_spans.remove(iterator_name); + self.stack.push((Simple, span)); + } + Some((pattern_kind @ PivotalNext(_), ..)) => { + self.after_next_check(iterator_name); + self.stack.push((pattern_kind, span)); + } + Some(_) => { + self.after_next_check(iterator_name); + self.stack.push((*instr_kind, span)); + } + None => self.is_enabled = false, + } + } +} + /// Intermediate implementation of variable validator. /// /// It is intended to track variables (i.e., those that were defined as @@ -65,6 +276,9 @@ pub struct VariableValidator<'i> { /// This vector contains all literal error codes used with fail. unsupported_literal_errcodes: Vec<(i64, Span)>, + + /// This machine is for after next instruction check. + after_next_machine: AfterNextCheckMachine<'i>, } impl<'i> VariableValidator<'i> { @@ -79,6 +293,8 @@ impl<'i> VariableValidator<'i> { self.met_args(call.args.deref(), span); + self.met_simple_instr(span); + match &call.output { CallOutputValue::Scalar(scalar) => self.met_variable_name_definition(scalar.name, span), CallOutputValue::Stream(stream) => self.met_variable_name_definition(stream.name, span), @@ -90,10 +306,12 @@ impl<'i> VariableValidator<'i> { // and it is useful for code generation pub(super) fn met_canon(&mut self, canon: &Canon<'i>, span: Span) { self.met_variable_name_definition(canon.canon_stream.name, span); + self.met_simple_instr(span); } pub(super) fn met_canon_map(&mut self, canon_map: &CanonMap<'i>, span: Span) { self.met_variable_name_definition(canon_map.canon_stream_map.name, span); + self.met_simple_instr(span); } pub(super) fn met_canon_map_scalar( @@ -102,16 +320,20 @@ impl<'i> VariableValidator<'i> { span: Span, ) { self.met_variable_name_definition(canon_stream_map_scalar.scalar.name, span); + + self.met_simple_instr(span); } pub(super) fn met_match(&mut self, match_: &Match<'i>, span: Span) { self.met_matchable(&match_.left_value, span); self.met_matchable(&match_.right_value, span); + self.met_replacing_instr(span); } pub(super) fn met_mismatch(&mut self, mismatch: &MisMatch<'i>, span: Span) { self.met_matchable(&mismatch.left_value, span); self.met_matchable(&mismatch.right_value, span); + self.met_replacing_instr(span); } pub(super) fn met_fold_scalar(&mut self, fold: &FoldScalar<'i>, span: Span) { @@ -128,16 +350,27 @@ impl<'i> VariableValidator<'i> { EmptyArray => {} }; self.met_iterator_definition(&fold.iterator, span); + self.met_popstack_instr(fold, span); } pub(super) fn meet_fold_stream(&mut self, fold: &FoldStream<'i>, span: Span) { self.met_variable_name(fold.iterable.name, span); self.met_iterator_definition(&fold.iterator, span); + + match fold.last_instruction { + Some(_) => self.met_popstack_replacing_with_check_instr(fold.iterator.name, span), + None => self.met_replacing_with_check_instr(fold.iterator.name, span), + } } pub(super) fn meet_fold_stream_map(&mut self, fold: &FoldStreamMap<'i>, span: Span) { self.met_variable_name(fold.iterable.name, span); self.met_iterator_definition(&fold.iterator, span); + + match fold.last_instruction { + Some(_) => self.met_popstack_replacing_with_check_instr(fold.iterator.name, span), + None => self.met_replacing_with_check_instr(fold.iterator.name, span), + } } pub(super) fn met_new(&mut self, new: &New<'i>, span: Span) { @@ -145,6 +378,7 @@ impl<'i> VariableValidator<'i> { .push((new.argument.name(), span)); // new defines a new variable self.met_variable_name_definition(new.argument.name(), span); + self.met_replacing_instr(span); } pub(super) fn met_next(&mut self, next: &Next<'i>, span: Span) { @@ -154,6 +388,7 @@ impl<'i> VariableValidator<'i> { // just put without a check for being already met self.unresolved_iterables.insert(iterable_name, span); self.multiple_next_candidates.insert(iterable_name, span); + self.met_pivotalnext_instr(iterable_name, span); } pub(super) fn met_ap(&mut self, ap: &Ap<'i>, span: Span) { @@ -181,12 +416,14 @@ impl<'i> VariableValidator<'i> { } } self.met_variable_name_definition(ap.result.name(), span); + self.met_simple_instr(span); } pub(super) fn met_ap_map(&mut self, ap_map: &ApMap<'i>, span: Span) { let key = &ap_map.key; self.met_map_key(key, span); self.met_variable_name_definition(ap_map.map.name, span); + self.met_simple_instr(span); } fn met_map_key(&mut self, key: &StreamMapKeyClause<'i>, span: Span) { @@ -207,6 +444,55 @@ impl<'i> VariableValidator<'i> { } _ => {} } + self.met_simple_instr(span); + } + + pub(super) fn met_merging_instr(&mut self, span: Span) { + self.after_next_machine + .met_instruction_kind(CheckInstructionKind::Merging, span); + } + + pub(super) fn met_pivotalnext_instr(&mut self, iterable_name: &'i str, span: Span) { + self.after_next_machine + .met_instruction_kind(CheckInstructionKind::PivotalNext(iterable_name), span); + } + + fn met_popstack_instr(&mut self, fold: &FoldScalar<'i>, span: Span) { + let instruction_kind = match fold.last_instruction { + Some(_) => CheckInstructionKind::PopStack2, + None => CheckInstructionKind::PopStack1, + }; + self.after_next_machine + .met_instruction_kind(instruction_kind, span); + } + + fn met_popstack_replacing_with_check_instr(&mut self, iterator_name: &'i str, span: Span) { + self.after_next_machine.met_instruction_kind( + CheckInstructionKind::PopStack1ReplacingWithCheck(iterator_name), + span, + ); + } + + pub(super) fn met_replacing_instr(&mut self, span: Span) { + self.after_next_machine + .met_instruction_kind(CheckInstructionKind::Replacing, span); + } + + pub(super) fn met_replacing_with_check_instr(&mut self, iterator_name: &'i str, span: Span) { + self.after_next_machine.met_instruction_kind( + CheckInstructionKind::ReplacingWithCheck(iterator_name), + span, + ); + } + + pub(super) fn met_xoring_instr(&mut self, span: Span) { + self.after_next_machine + .met_instruction_kind(CheckInstructionKind::Xoring, span); + } + + pub(super) fn met_simple_instr(&mut self, span: Span) { + self.after_next_machine + .met_instruction_kind(CheckInstructionKind::Simple, span); } pub(super) fn finalize(self) -> Vec, ParserError>> { @@ -218,6 +504,7 @@ impl<'i> VariableValidator<'i> { .check_iterator_for_multiple_definitions() .check_for_unsupported_map_keys() .check_for_unsupported_literal_errcodes() + .check_after_next_instr() .build() } @@ -517,6 +804,14 @@ impl<'i> ValidatorErrorBuilder<'i> { self } + fn check_after_next_instr(mut self) -> Self { + for span in self.validator.after_next_machine.malformed_spans_iter() { + let error = ParserError::fold_has_instruction_after_next(*span); + add_to_errors(&mut self.errors, *span, Token::Next, error); + } + self + } + fn build(self) -> Vec, ParserError>> { self.errors }