@eagleoutice/flowr 2.13.16 → 2.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -25
- package/abstract-interpretation/absint-visitor.js +1 -1
- package/abstract-interpretation/data-frame/mappers/access-mapper.js +4 -4
- package/abstract-interpretation/data-frame/mappers/arguments.js +7 -4
- package/abstract-interpretation/data-frame/mappers/function-mapper.js +18 -17
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +6 -6
- package/abstract-interpretation/data-frame/resolve-args.d.ts +9 -4
- package/abstract-interpretation/data-frame/resolve-args.js +10 -5
- package/benchmark/calibration.d.ts +16 -7
- package/benchmark/calibration.js +44 -17
- package/benchmark/slicer.d.ts +3 -2
- package/benchmark/slicer.js +9 -5
- package/benchmark/stats/size-of.js +1 -1
- package/benchmark/summarizer/first-phase/process.d.ts +2 -0
- package/benchmark/summarizer/first-phase/process.js +2 -0
- package/cli/benchmark-app.js +4 -1
- package/cli/benchmark-helper-app.d.ts +1 -0
- package/cli/benchmark-helper-app.js +2 -2
- package/cli/common/options.d.ts +5 -31
- package/cli/common/options.js +2 -8
- package/cli/common/scripts-info.d.ts +5 -38
- package/cli/common/scripts-info.js +0 -8
- package/cli/repl/core.js +1 -1
- package/cli/repl/execute.d.ts +2 -2
- package/cli/repl/execute.js +2 -2
- package/cli/repl/parser/slice-query-parser.js +1 -1
- package/cli/repl/print-version.js +2 -2
- package/config.d.ts +16 -0
- package/config.js +83 -5
- package/control-flow/extract-cfg.js +1 -1
- package/control-flow/semantic-cfg-guided-visitor.d.ts +1 -1
- package/control-flow/semantic-cfg-guided-visitor.js +1 -1
- package/control-flow/useless-loop.js +1 -1
- package/core/print/slice-diff-ansi.js +1 -1
- package/core/steps/pipeline/create-pipeline.js +1 -1
- package/dataflow/cluster.js +2 -2
- package/dataflow/environments/apply-kill.js +1 -1
- package/dataflow/environments/built-in-props.d.ts +13 -2
- package/dataflow/environments/built-in-props.js +23 -1
- package/dataflow/environments/built-in.d.ts +7 -1
- package/dataflow/environments/built-in.js +42 -3
- package/dataflow/environments/default-builtin-config.d.ts +518 -11
- package/dataflow/environments/default-builtin-config.js +218 -23
- package/dataflow/environments/environment.d.ts +10 -2
- package/dataflow/environments/environment.js +25 -7
- package/dataflow/environments/identifier.d.ts +8 -2
- package/dataflow/environments/identifier.js +6 -1
- package/dataflow/environments/query-fn-props.d.ts +6 -0
- package/dataflow/environments/query-fn-props.js +22 -2
- package/dataflow/environments/reference-to-maybe.js +5 -5
- package/dataflow/environments/resolve-by-name.d.ts +3 -0
- package/dataflow/environments/resolve-by-name.js +44 -7
- package/dataflow/environments/resolve-helper.d.ts +6 -0
- package/dataflow/environments/resolve-helper.js +6 -0
- package/dataflow/eval/resolve/alias-tracking.d.ts +5 -0
- package/dataflow/eval/resolve/alias-tracking.js +21 -14
- package/dataflow/eval/resolve/node-value.d.ts +6 -0
- package/dataflow/eval/resolve/node-value.js +15 -9
- package/dataflow/eval/resolve/resolve-argument.js +2 -2
- package/dataflow/eval/resolve/resolve-numbers.js +2 -2
- package/dataflow/eval/resolve/resolve-operators.js +5 -4
- package/dataflow/eval/resolve/resolve-strings.js +3 -3
- package/dataflow/eval/resolve/resolve-working-directory.d.ts +1 -1
- package/dataflow/eval/resolve/resolve-working-directory.js +3 -3
- package/dataflow/eval/resolve/resolve.d.ts +5 -5
- package/dataflow/eval/resolve/resolve.js +10 -11
- package/dataflow/eval/values/general.d.ts +4 -1
- package/dataflow/eval/values/general.js +1 -1
- package/dataflow/extractor.js +2 -1
- package/dataflow/fn/exceptions-of-function.d.ts +3 -1
- package/dataflow/fn/exceptions-of-function.js +87 -39
- package/dataflow/fn/higher-order-function.js +5 -4
- package/dataflow/fn/strict-function.d.ts +40 -0
- package/dataflow/fn/strict-function.js +337 -0
- package/dataflow/graph/call-graph.js +14 -14
- package/dataflow/graph/df-helper.d.ts +24 -1
- package/dataflow/graph/df-helper.js +29 -7
- package/dataflow/graph/diff-dataflow-graph.js +6 -6
- package/dataflow/graph/edge.d.ts +27 -0
- package/dataflow/graph/edge.js +33 -0
- package/dataflow/graph/graph-helper.d.ts +3 -4
- package/dataflow/graph/graph-helper.js +4 -5
- package/dataflow/graph/graph.d.ts +39 -3
- package/dataflow/graph/graph.js +75 -7
- package/dataflow/graph/vertex.d.ts +42 -6
- package/dataflow/graph/vertex.js +42 -6
- package/dataflow/info.d.ts +26 -0
- package/dataflow/info.js +28 -1
- package/dataflow/internal/linker.d.ts +1 -0
- package/dataflow/internal/linker.js +11 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +6 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +6 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +7 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +1 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +19 -18
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +6 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-list.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-local.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.js +5 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +1 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +29 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +3 -1
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +44 -20
- package/dataflow/internal/process/functions/call/common.d.ts +9 -1
- package/dataflow/internal/process/functions/call/common.js +17 -6
- package/dataflow/internal/process/functions/call/deferred.js +2 -1
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +3 -1
- package/dataflow/internal/process/functions/call/known-call-handling.js +6 -3
- package/dataflow/internal/process/functions/call/named-call-handling.js +44 -12
- package/dataflow/internal/process/functions/call/nse.d.ts +33 -5
- package/dataflow/internal/process/functions/call/nse.js +113 -6
- package/dataflow/internal/process/functions/call/quoted.d.ts +5 -0
- package/dataflow/internal/process/functions/call/quoted.js +21 -9
- package/dataflow/origin/dfg-get-origin.d.ts +1 -0
- package/dataflow/origin/dfg-get-origin.js +9 -6
- package/documentation/data/faq/faqs.js +88 -88
- package/documentation/data/faq/recommended-configs.js +1 -1
- package/documentation/data/faq/wiki-faq-store.js +1 -1
- package/documentation/doc-capabilities.js +1 -1
- package/documentation/doc-readme.js +1 -1
- package/documentation/doc-util/doc-auto-gen.js +6 -2
- package/documentation/doc-util/doc-functions.js +1 -1
- package/documentation/wiki-cfg.js +2 -2
- package/documentation/wiki-core.js +1 -1
- package/documentation/wiki-create-linting-rules.js +45 -45
- package/documentation/wiki-dataflow-graph.js +18 -18
- package/documentation/wiki-linter.js +1 -0
- package/documentation/wiki-linting-and-testing.js +93 -5
- package/documentation/wiki-mk/doc-maker.js +1 -1
- package/documentation/wiki-overview.js +12 -1
- package/documentation/wiki-query.js +53 -0
- package/documentation/wiki-signature-database.js +3 -0
- package/linter/linter-output.js +1 -1
- package/linter/linter-rules.d.ts +24 -0
- package/linter/linter-rules.js +3 -1
- package/linter/rules/file-path-validity.js +1 -1
- package/linter/rules/function-finder-util.js +1 -1
- package/linter/rules/naming-convention.js +1 -1
- package/linter/rules/network-functions.d.ts +1 -1
- package/linter/rules/no-leaked-credentials.js +2 -1
- package/linter/rules/stop-with-call-arg.js +4 -4
- package/linter/rules/unclosed-connection.d.ts +44 -0
- package/linter/rules/unclosed-connection.js +200 -0
- package/linter/rules/undefined-symbol-util.d.ts +1 -1
- package/linter/rules/undefined-symbol-util.js +5 -4
- package/linter/rules/undefined-symbol.js +3 -3
- package/linter/rules/unused-definition.js +2 -1
- package/package.json +38 -51
- package/project/context/flowr-analyzer-environment-context.d.ts +23 -0
- package/project/context/flowr-analyzer-environment-context.js +25 -0
- package/project/dependency-version-space.d.ts +3 -3
- package/project/dependency-version-space.js +3 -4
- package/project/flowr-analyzer.js +1 -1
- package/project/plugins/file-plugins/files/flowr-description-file.d.ts +1 -1
- package/project/plugins/file-plugins/files/flowr-description-file.js +1 -1
- package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +1 -1
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +1 -1
- package/project/plugins/file-plugins/files/flowr-news-file.d.ts +1 -1
- package/project/plugins/file-plugins/files/flowr-news-file.js +1 -1
- package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +1 -1
- package/project/plugins/file-plugins/files/flowr-rda-file.js +4 -4
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +2 -2
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +5 -5
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +36 -7
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +2 -2
- package/project/sigdb/build.js +16 -16
- package/project/sigdb/codec.d.ts +1 -1
- package/project/sigdb/codec.js +13 -13
- package/project/sigdb/decompress.d.ts +1 -1
- package/project/sigdb/decompress.js +33 -33
- package/project/sigdb/index-format.js +2 -2
- package/project/sigdb/manifest.d.ts +3 -1
- package/project/sigdb/manifest.js +68 -27
- package/project/sigdb/memory-source.d.ts +64 -0
- package/project/sigdb/memory-source.js +133 -0
- package/project/sigdb/reader.js +14 -14
- package/project/sigdb/schema.d.ts +2 -2
- package/project/sigdb/schema.js +2 -2
- package/queries/catalog/call-context-query/call-context-query-executor.js +1 -1
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +2 -2
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +2 -2
- package/queries/catalog/dependencies-query/dependencies-query-format.js +1 -1
- package/queries/catalog/dependencies-query/link-devices.js +3 -9
- package/queries/catalog/does-call-query/does-call-query-executor.js +2 -1
- package/queries/catalog/input-sources-query/simple-input-classifier.js +4 -4
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +2 -1
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +1 -0
- package/queries/catalog/inspect-strictness-query/inspect-strictness-query-executor.d.ts +6 -0
- package/queries/catalog/inspect-strictness-query/inspect-strictness-query-executor.js +25 -0
- package/queries/catalog/inspect-strictness-query/inspect-strictness-query-format.d.ts +31 -0
- package/queries/catalog/inspect-strictness-query/inspect-strictness-query-format.js +56 -0
- package/queries/catalog/location-map-query/location-map-query-format.js +1 -1
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +2 -2
- package/queries/catalog/signature-query/signature-query-executor.d.ts +2 -0
- package/queries/catalog/signature-query/signature-query-executor.js +3 -2
- package/queries/catalog/slice-query-options.d.ts +1 -1
- package/queries/catalog/slice-query-options.js +1 -1
- package/queries/query-function-filter.d.ts +8 -2
- package/queries/query-function-filter.js +11 -1
- package/queries/query.d.ts +11 -1
- package/queries/query.js +2 -0
- package/r-bridge/lang-4.x/ast/model/model.d.ts +4 -4
- package/r-bridge/lang-4.x/ast/model/model.js +4 -4
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-definition.js +1 -1
- package/r-bridge/retriever.d.ts +2 -1
- package/r-bridge/retriever.js +3 -2
- package/r-bridge/roxygen2/documentation-provider.d.ts +1 -0
- package/r-bridge/roxygen2/documentation-provider.js +1 -0
- package/r-bridge/roxygen2/roxygen-parse.d.ts +1 -1
- package/r-bridge/roxygen2/roxygen-parse.js +1 -1
- package/search/flowr-search-filters.d.ts +1 -1
- package/search/flowr-search-filters.js +2 -14
- package/search/search-executor/search-enrichers.js +4 -4
- package/search/search-executor/search-generators.js +1 -1
- package/slicing/criterion/parse.d.ts +2 -2
- package/slicing/criterion/parse.js +5 -5
- package/slicing/static/fingerprint.js +1 -1
- package/slicing/static/slice-call.d.ts +1 -1
- package/slicing/static/slice-call.js +2 -2
- package/slicing/static/static-slicer.js +4 -3
- package/util/assert.js +1 -1
- package/util/log.d.ts +4 -1
- package/util/log.js +15 -2
- package/util/logic.js +2 -2
- package/util/mermaid/cfg.js +1 -1
- package/util/mermaid/dfg.js +6 -6
- package/util/mermaid/mermaid.js +3 -1
- package/util/objects.d.ts +12 -0
- package/util/objects.js +48 -0
- package/util/quads.js +19 -6
- package/util/schema.js +2 -2
- package/util/simple-df/dfg-ascii.js +14 -3
- package/util/text/ansi.d.ts +2 -0
- package/util/text/ansi.js +8 -0
- package/util/text/name-rank.d.ts +29 -0
- package/util/text/name-rank.js +39 -0
- package/util/text/url-encoding.d.ts +15 -0
- package/util/text/url-encoding.js +59 -0
- package/util/version.js +1 -1
- package/cli/export-quads-app.d.ts +0 -7
- package/cli/export-quads-app.js +0 -44
package/benchmark/calibration.js
CHANGED
|
@@ -4,29 +4,32 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Publishing its runtime alongside the real measurements allows a viewer to normalize the other numbers by it,
|
|
6
6
|
* and hence to cancel out how fast or how loaded the machine was that produced them.
|
|
7
|
-
* The workload must therefore stay deterministic (no file system, no R session, no randomness)
|
|
8
|
-
*
|
|
7
|
+
* The workload must therefore stay deterministic (no file system, no R session, no randomness).
|
|
8
|
+
*
|
|
9
|
+
* Changing the work, the round count, or the way the repetitions are reduced puts every future run on a
|
|
10
|
+
* new scale, incomparable to the published history. Whoever changes it has to say so in the name of the
|
|
11
|
+
* measurement (`calibration v2`, ...).
|
|
9
12
|
* @module
|
|
10
13
|
*/
|
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.CalibrationSize = exports.CalibrationRounds = void 0;
|
|
15
|
+
exports.CalibrationSize = exports.CalibrationRounds = exports.CalibrationSamples = exports.CalibrationReps = void 0;
|
|
13
16
|
exports.runCalibration = runCalibration;
|
|
14
|
-
|
|
15
|
-
|
|
17
|
+
exports.calibrationChecksum = calibrationChecksum;
|
|
18
|
+
/** How often the {@link calibrationBatch} is timed within one {@link runCalibration} call. */
|
|
19
|
+
exports.CalibrationReps = 4;
|
|
20
|
+
/** How many files of a suite carry the calibration, which describes the machine and not the file. */
|
|
21
|
+
exports.CalibrationSamples = 8;
|
|
22
|
+
/** How many {@link calibrationRound}s make up one timed batch. */
|
|
23
|
+
exports.CalibrationRounds = 256;
|
|
16
24
|
/** How many elements a single {@link calibrationRound} works on. */
|
|
17
25
|
exports.CalibrationSize = 4096;
|
|
18
|
-
|
|
26
|
+
let sink = 0;
|
|
19
27
|
function nextRandom(state) {
|
|
20
28
|
state ^= state << 13;
|
|
21
29
|
state ^= state >>> 17;
|
|
22
30
|
state ^= state << 5;
|
|
23
31
|
return state | 0;
|
|
24
32
|
}
|
|
25
|
-
/**
|
|
26
|
-
* One round of the calibration workload, mixing integer arithmetic, array sorting, string handling, and map lookups
|
|
27
|
-
* to cover the operations that dominate the analysis itself.
|
|
28
|
-
* @returns a checksum, only returned so that the work cannot be optimized away
|
|
29
|
-
*/
|
|
30
33
|
function calibrationRound(round) {
|
|
31
34
|
let state = 0x1337 + round;
|
|
32
35
|
const numbers = new Array(exports.CalibrationSize);
|
|
@@ -35,29 +38,53 @@ function calibrationRound(round) {
|
|
|
35
38
|
numbers[i] = state % 100_000;
|
|
36
39
|
}
|
|
37
40
|
numbers.sort((a, b) => a - b);
|
|
41
|
+
const nodes = [];
|
|
38
42
|
const map = new Map();
|
|
43
|
+
const seen = new Set();
|
|
39
44
|
for (let i = 0; i < exports.CalibrationSize; i++) {
|
|
40
45
|
const key = `k${numbers[i] % 512}`;
|
|
46
|
+
nodes.push({ id: key, value: numbers[i], next: i + 1 });
|
|
41
47
|
map.set(key, (map.get(key) ?? 0) + i);
|
|
48
|
+
seen.add(key);
|
|
42
49
|
}
|
|
43
|
-
let checksum =
|
|
50
|
+
let checksum = seen.size;
|
|
44
51
|
for (const [key, value] of map) {
|
|
45
52
|
checksum = (checksum + key.length * value) | 0;
|
|
46
53
|
}
|
|
54
|
+
for (const node of nodes) {
|
|
55
|
+
checksum = (checksum + node.id.length + (node.value & 0xff) + node.next) | 0;
|
|
56
|
+
}
|
|
47
57
|
for (let i = 0; i < exports.CalibrationSize; i++) {
|
|
48
58
|
checksum = (checksum + Math.floor(Math.sqrt(numbers[i] + 1))) | 0;
|
|
49
59
|
}
|
|
50
60
|
return checksum;
|
|
51
61
|
}
|
|
52
|
-
|
|
53
|
-
* Runs the calibration workload {@link CalibrationRounds} times.
|
|
54
|
-
* @returns a checksum, only returned so that the work cannot be optimized away
|
|
55
|
-
*/
|
|
56
|
-
function runCalibration() {
|
|
62
|
+
function calibrationBatch() {
|
|
57
63
|
let checksum = 0;
|
|
58
64
|
for (let round = 0; round < exports.CalibrationRounds; round++) {
|
|
59
65
|
checksum = (checksum + calibrationRound(round)) | 0;
|
|
60
66
|
}
|
|
61
67
|
return checksum;
|
|
62
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Times {@link calibrationBatch} {@link CalibrationReps} times and reports the fastest of them.
|
|
71
|
+
* @returns the nanoseconds the fastest batch took
|
|
72
|
+
*/
|
|
73
|
+
function runCalibration() {
|
|
74
|
+
sink = calibrationRound(0);
|
|
75
|
+
let best = undefined;
|
|
76
|
+
for (let rep = 0; rep < exports.CalibrationReps; rep++) {
|
|
77
|
+
const start = process.hrtime.bigint();
|
|
78
|
+
sink = (sink + calibrationBatch()) | 0;
|
|
79
|
+
const took = process.hrtime.bigint() - start;
|
|
80
|
+
if (best === undefined || took < best) {
|
|
81
|
+
best = took;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return best ?? 0n;
|
|
85
|
+
}
|
|
86
|
+
/** the checksum of the rounds run so far, only exposed so that the workload has an observable effect */
|
|
87
|
+
function calibrationChecksum() {
|
|
88
|
+
return sink;
|
|
89
|
+
}
|
|
63
90
|
//# sourceMappingURL=calibration.js.map
|
package/benchmark/slicer.d.ts
CHANGED
|
@@ -97,13 +97,14 @@ export declare class BenchmarkSlicer {
|
|
|
97
97
|
inferDataFrameShapes(): SlicerStatsDfShape;
|
|
98
98
|
/**
|
|
99
99
|
* Measure the phases that are not part of the slicing itself: the dependencies query, the linter,
|
|
100
|
-
* and the synthetic {@link runCalibration | calibration} workload.
|
|
100
|
+
* and the synthetic {@link runCalibration | calibration} workload, the only one that reports its own time.
|
|
101
101
|
*
|
|
102
102
|
* These run *after* all other steps and are excluded from the {@link CommonSlicerMeasurements} (and hence from
|
|
103
103
|
* the `total`), so that they cannot distort any of the existing measurements.
|
|
104
104
|
* A failing phase is logged and skipped, it never aborts the benchmark.
|
|
105
|
+
* @param calibrate - whether to run the calibration, which describes the machine and hence only has to run for some files of a suite
|
|
105
106
|
*/
|
|
106
|
-
measureAdditionalPhases(): Promise<void>;
|
|
107
|
+
measureAdditionalPhases(calibrate?: boolean): Promise<void>;
|
|
107
108
|
/**
|
|
108
109
|
* The additional phases work on the analyzer api, so we have to set up an analyzer for the same request.
|
|
109
110
|
* All of its analyses happen before the measurement starts.
|
package/benchmark/slicer.js
CHANGED
|
@@ -129,10 +129,10 @@ class BenchmarkSlicer {
|
|
|
129
129
|
for (const [n, info] of vertices) {
|
|
130
130
|
const outgoingEdges = this.dataflow.graph.outgoingEdges(n);
|
|
131
131
|
numberOfEdges += outgoingEdges?.size ?? 0;
|
|
132
|
-
if (
|
|
132
|
+
if (vertex_1.FunctionCallVertex.is(info)) {
|
|
133
133
|
numberOfCalls++;
|
|
134
134
|
}
|
|
135
|
-
else if (
|
|
135
|
+
else if (vertex_1.FunctionDefinitionVertex.is(info)) {
|
|
136
136
|
numberOfDefinitions++;
|
|
137
137
|
}
|
|
138
138
|
}
|
|
@@ -344,13 +344,14 @@ class BenchmarkSlicer {
|
|
|
344
344
|
}
|
|
345
345
|
/**
|
|
346
346
|
* Measure the phases that are not part of the slicing itself: the dependencies query, the linter,
|
|
347
|
-
* and the synthetic {@link runCalibration | calibration} workload.
|
|
347
|
+
* and the synthetic {@link runCalibration | calibration} workload, the only one that reports its own time.
|
|
348
348
|
*
|
|
349
349
|
* These run *after* all other steps and are excluded from the {@link CommonSlicerMeasurements} (and hence from
|
|
350
350
|
* the `total`), so that they cannot distort any of the existing measurements.
|
|
351
351
|
* A failing phase is logged and skipped, it never aborts the benchmark.
|
|
352
|
+
* @param calibrate - whether to run the calibration, which describes the machine and hence only has to run for some files of a suite
|
|
352
353
|
*/
|
|
353
|
-
async measureAdditionalPhases() {
|
|
354
|
+
async measureAdditionalPhases(calibrate = true) {
|
|
354
355
|
this.totalStopwatch.pause();
|
|
355
356
|
try {
|
|
356
357
|
this.guardActive();
|
|
@@ -359,7 +360,10 @@ class BenchmarkSlicer {
|
|
|
359
360
|
await this.measureAdditional('dependencies query', () => analyzer.query([{ type: 'dependencies' }]));
|
|
360
361
|
await this.measureAdditional('linter run', () => analyzer.query([{ type: 'linter' }]));
|
|
361
362
|
}
|
|
362
|
-
|
|
363
|
+
if (calibrate) {
|
|
364
|
+
/* the calibration times itself, so that neither the warmup nor the reps it discards count */
|
|
365
|
+
this.additionalMeasurements.set('calibration', (0, calibration_1.runCalibration)());
|
|
366
|
+
}
|
|
363
367
|
}
|
|
364
368
|
catch (e) {
|
|
365
369
|
exports.benchmarkLogger.error(`failed to measure the additional phases: ${e instanceof Error ? e.message : String(e)}`);
|
|
@@ -6,6 +6,8 @@ import type { RShellEngineConfig } from '../../../config';
|
|
|
6
6
|
/**
|
|
7
7
|
* Summarizes the given stats by calculating the min, max, median, mean, and the standard deviation for each measurement.
|
|
8
8
|
* @see Slicer
|
|
9
|
+
* The re-parse below measures the raw parser on the sliced output, the analyzer's pipeline would measure something else.
|
|
10
|
+
* @lintIgnore use-instead
|
|
9
11
|
*/
|
|
10
12
|
export declare function summarizeSlicerStats(stats: SlicerStats, report?: (criteria: SlicingCriteria, stats: PerSliceStats) => void, engineConf?: RShellEngineConfig): Promise<Readonly<SummarizedSlicerStats>>;
|
|
11
13
|
/**
|
|
@@ -106,6 +106,8 @@ function calculateReductionForSlice(input, dataflow, perSlice, ignoreFluff) {
|
|
|
106
106
|
/**
|
|
107
107
|
* Summarizes the given stats by calculating the min, max, median, mean, and the standard deviation for each measurement.
|
|
108
108
|
* @see Slicer
|
|
109
|
+
* The re-parse below measures the raw parser on the sliced output, the analyzer's pipeline would measure something else.
|
|
110
|
+
* @lintIgnore use-instead
|
|
109
111
|
*/
|
|
110
112
|
async function summarizeSlicerStats(stats, report = () => {
|
|
111
113
|
}, engineConf) {
|
package/cli/benchmark-app.js
CHANGED
|
@@ -11,6 +11,7 @@ const assert_1 = require("../util/assert");
|
|
|
11
11
|
const files_1 = require("../util/files");
|
|
12
12
|
const log_1 = require("../util/log");
|
|
13
13
|
const parallel_1 = require("../util/parallel");
|
|
14
|
+
const calibration_1 = require("../benchmark/calibration");
|
|
14
15
|
const script_1 = require("./common/script");
|
|
15
16
|
const options = (0, script_1.processCommandLineArgs)('benchmark', [], {
|
|
16
17
|
subtitle: 'Slice given files with additional benchmark information',
|
|
@@ -64,6 +65,7 @@ async function benchmark() {
|
|
|
64
65
|
}
|
|
65
66
|
const limit = options.limit ?? files.length;
|
|
66
67
|
const verboseAdd = options.verbose ? ['--verbose'] : [];
|
|
68
|
+
const calibrationStep = Math.max(1, Math.ceil(files.length / calibration_1.CalibrationSamples));
|
|
67
69
|
const args = files.map((f, i) => [
|
|
68
70
|
'--input', f.request.content,
|
|
69
71
|
'--file-id', `${i}`,
|
|
@@ -77,7 +79,8 @@ async function benchmark() {
|
|
|
77
79
|
...(options.seed ? ['--seed', options.seed] : []),
|
|
78
80
|
...(options.cfg ? ['--cfg'] : []),
|
|
79
81
|
...(options.cg ? ['--cg'] : []),
|
|
80
|
-
...(options['no-extra-phases'] ? ['--no-extra-phases'] : [])
|
|
82
|
+
...(options['no-extra-phases'] ? ['--no-extra-phases'] : []),
|
|
83
|
+
...(i % calibrationStep === 0 ? ['--calibrate'] : [])
|
|
81
84
|
]);
|
|
82
85
|
const runs = options.runs ?? 1;
|
|
83
86
|
for (let i = 1; i <= runs; i++) {
|
|
@@ -82,9 +82,9 @@ async function benchmark() {
|
|
|
82
82
|
console.log(`${prefix} Skipping data frame shape inference: ${e instanceof Error ? e.message : String(e)}`);
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
console.log(`${prefix} Measuring the additional phases (dependencies query, linter, calibration)`);
|
|
85
|
+
console.log(`${prefix} Measuring the additional phases (dependencies query, linter${options.calibrate ? ', calibration' : ''})`);
|
|
86
86
|
if (!options['no-extra-phases']) {
|
|
87
|
-
await slicer.measureAdditionalPhases();
|
|
87
|
+
await slicer.measureAdditionalPhases(options.calibrate);
|
|
88
88
|
}
|
|
89
89
|
const { stats } = slicer.finish();
|
|
90
90
|
const output = {
|
package/cli/common/options.d.ts
CHANGED
|
@@ -201,40 +201,14 @@ export declare const benchmarkHelperOptions: [{
|
|
|
201
201
|
readonly description: "Skip the dependencies query, the linter run and the calibration, which cost suite runtime";
|
|
202
202
|
readonly defaultValue: false;
|
|
203
203
|
}, {
|
|
204
|
-
readonly name: "
|
|
205
|
-
readonly type: StringConstructor;
|
|
206
|
-
readonly description: "The random seed for sampling the slicing criteria if a maximum is set";
|
|
207
|
-
}];
|
|
208
|
-
export declare const exportQuadsOptions: [{
|
|
209
|
-
readonly name: "verbose";
|
|
210
|
-
readonly alias: "v";
|
|
204
|
+
readonly name: "calibrate";
|
|
211
205
|
readonly type: BooleanConstructor;
|
|
212
|
-
readonly description: "Run
|
|
213
|
-
|
|
214
|
-
readonly name: "help";
|
|
215
|
-
readonly alias: "h";
|
|
216
|
-
readonly type: BooleanConstructor;
|
|
217
|
-
readonly description: "Print this usage guide";
|
|
218
|
-
}, {
|
|
219
|
-
readonly name: "input";
|
|
220
|
-
readonly alias: "i";
|
|
221
|
-
readonly type: StringConstructor;
|
|
222
|
-
readonly description: "Pass a folder or file as src to read from";
|
|
223
|
-
readonly multiple: true;
|
|
224
|
-
readonly defaultOption: true;
|
|
225
|
-
readonly defaultValue: readonly [];
|
|
226
|
-
readonly typeLabel: "{underline files/folders}";
|
|
227
|
-
}, {
|
|
228
|
-
readonly name: "limit";
|
|
229
|
-
readonly alias: "l";
|
|
230
|
-
readonly type: NumberConstructor;
|
|
231
|
-
readonly description: "Limit the number of files to process";
|
|
206
|
+
readonly description: "Run the machine calibration workload, which describes the machine and not the file, so only a few files of a suite carry it";
|
|
207
|
+
readonly defaultValue: false;
|
|
232
208
|
}, {
|
|
233
|
-
readonly name: "
|
|
234
|
-
readonly alias: "o";
|
|
209
|
+
readonly name: "seed";
|
|
235
210
|
readonly type: StringConstructor;
|
|
236
|
-
readonly description: "
|
|
237
|
-
readonly typeLabel: "{underline file}";
|
|
211
|
+
readonly description: "The random seed for sampling the slicing criteria if a maximum is set";
|
|
238
212
|
}];
|
|
239
213
|
export declare const slicerOptions: [{
|
|
240
214
|
readonly name: "verbose";
|
package/cli/common/options.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.summarizerOptions = exports.slicerOptions = exports.
|
|
6
|
+
exports.summarizerOptions = exports.slicerOptions = exports.benchmarkHelperOptions = exports.benchmarkOptions = void 0;
|
|
7
7
|
const os_1 = __importDefault(require("os"));
|
|
8
8
|
const time_1 = require("../../util/text/time");
|
|
9
9
|
/**
|
|
@@ -46,15 +46,9 @@ exports.benchmarkHelperOptions = [
|
|
|
46
46
|
{ name: 'threshold', alias: 't', type: Number, description: 'How many re-visits of the same node are ok?', defaultValue: undefined, typeLabel: '{underline number}' },
|
|
47
47
|
{ name: 'sampling-strategy', type: String, description: 'Which strategy to use, when sampling is enabled', defaultValue: 'random', typeLabel: '{underline random/equidistant}' },
|
|
48
48
|
{ name: 'no-extra-phases', type: Boolean, description: 'Skip the dependencies query, the linter run and the calibration, which cost suite runtime', defaultValue: false },
|
|
49
|
+
{ name: 'calibrate', type: Boolean, description: 'Run the machine calibration workload, which describes the machine and not the file, so only a few files of a suite carry it', defaultValue: false },
|
|
49
50
|
{ name: 'seed', type: String, description: 'The random seed for sampling the slicing criteria if a maximum is set' },
|
|
50
51
|
];
|
|
51
|
-
exports.exportQuadsOptions = [
|
|
52
|
-
{ name: 'verbose', alias: 'v', type: Boolean, description: 'Run with verbose logging' },
|
|
53
|
-
{ name: 'help', alias: 'h', type: Boolean, description: 'Print this usage guide' },
|
|
54
|
-
{ name: 'input', alias: 'i', type: String, description: 'Pass a folder or file as src to read from', multiple: true, defaultOption: true, defaultValue: [], typeLabel: '{underline files/folders}' },
|
|
55
|
-
{ name: 'limit', alias: 'l', type: Number, description: 'Limit the number of files to process' },
|
|
56
|
-
{ name: 'output', alias: 'o', type: String, description: 'File to write all the generated quads to (defaults to {italic out.quads})', typeLabel: '{underline file}' },
|
|
57
|
-
];
|
|
58
52
|
exports.slicerOptions = [
|
|
59
53
|
{ name: 'verbose', alias: 'v', type: Boolean, description: 'Run with verbose logging' },
|
|
60
54
|
{ name: 'help', alias: 'h', type: Boolean, description: 'Print this usage guide' },
|
|
@@ -321,6 +321,11 @@ declare const _scripts: {
|
|
|
321
321
|
readonly type: BooleanConstructor;
|
|
322
322
|
readonly description: "Skip the dependencies query, the linter run and the calibration, which cost suite runtime";
|
|
323
323
|
readonly defaultValue: false;
|
|
324
|
+
}, {
|
|
325
|
+
readonly name: "calibrate";
|
|
326
|
+
readonly type: BooleanConstructor;
|
|
327
|
+
readonly description: "Run the machine calibration workload, which describes the machine and not the file, so only a few files of a suite carry it";
|
|
328
|
+
readonly defaultValue: false;
|
|
324
329
|
}, {
|
|
325
330
|
readonly name: "seed";
|
|
326
331
|
readonly type: StringConstructor;
|
|
@@ -387,44 +392,6 @@ declare const _scripts: {
|
|
|
387
392
|
usageExample: string;
|
|
388
393
|
type: string;
|
|
389
394
|
};
|
|
390
|
-
'export-quads': {
|
|
391
|
-
toolName: string;
|
|
392
|
-
target: string;
|
|
393
|
-
description: string;
|
|
394
|
-
usageExample: string;
|
|
395
|
-
options: [{
|
|
396
|
-
readonly name: "verbose";
|
|
397
|
-
readonly alias: "v";
|
|
398
|
-
readonly type: BooleanConstructor;
|
|
399
|
-
readonly description: "Run with verbose logging";
|
|
400
|
-
}, {
|
|
401
|
-
readonly name: "help";
|
|
402
|
-
readonly alias: "h";
|
|
403
|
-
readonly type: BooleanConstructor;
|
|
404
|
-
readonly description: "Print this usage guide";
|
|
405
|
-
}, {
|
|
406
|
-
readonly name: "input";
|
|
407
|
-
readonly alias: "i";
|
|
408
|
-
readonly type: StringConstructor;
|
|
409
|
-
readonly description: "Pass a folder or file as src to read from";
|
|
410
|
-
readonly multiple: true;
|
|
411
|
-
readonly defaultOption: true;
|
|
412
|
-
readonly defaultValue: readonly [];
|
|
413
|
-
readonly typeLabel: "{underline files/folders}";
|
|
414
|
-
}, {
|
|
415
|
-
readonly name: "limit";
|
|
416
|
-
readonly alias: "l";
|
|
417
|
-
readonly type: NumberConstructor;
|
|
418
|
-
readonly description: "Limit the number of files to process";
|
|
419
|
-
}, {
|
|
420
|
-
readonly name: "output";
|
|
421
|
-
readonly alias: "o";
|
|
422
|
-
readonly type: StringConstructor;
|
|
423
|
-
readonly description: "File to write all the generated quads to (defaults to {italic out.quads})";
|
|
424
|
-
readonly typeLabel: "{underline file}";
|
|
425
|
-
}];
|
|
426
|
-
type: string;
|
|
427
|
-
};
|
|
428
395
|
};
|
|
429
396
|
export declare const scripts: Record<keyof typeof _scripts, ScriptInformation>;
|
|
430
397
|
/**
|
|
@@ -40,14 +40,6 @@ const _scripts = {
|
|
|
40
40
|
options: options_1.summarizerOptions,
|
|
41
41
|
usageExample: 'summarizer "benchmark.json"',
|
|
42
42
|
type: 'master script',
|
|
43
|
-
},
|
|
44
|
-
'export-quads': {
|
|
45
|
-
toolName: 'export-quads',
|
|
46
|
-
target: 'export-quads-app',
|
|
47
|
-
description: 'Export quads of the normalized AST of a given R code file',
|
|
48
|
-
usageExample: 'export-quads "example.R" --output "example.quads"',
|
|
49
|
-
options: options_1.exportQuadsOptions,
|
|
50
|
-
type: 'master script',
|
|
51
43
|
}
|
|
52
44
|
};
|
|
53
45
|
exports.scripts = _scripts;
|
package/cli/repl/core.js
CHANGED
|
@@ -265,7 +265,7 @@ async function executeStatement(output, statement, analyzer, allowRSessionAccess
|
|
|
265
265
|
const args = processor.argsParser(remainingLine);
|
|
266
266
|
if (args.rCode) {
|
|
267
267
|
const rawPath = args.rCode.startsWith(retriever_1.fileProtocol)
|
|
268
|
-
? args.rCode.
|
|
268
|
+
? args.rCode.slice(retriever_1.fileProtocol.length)
|
|
269
269
|
: undefined;
|
|
270
270
|
const alreadyKnown = rawPath !== undefined
|
|
271
271
|
&& analyzer.context().files.getFileByPath(rawPath) !== undefined;
|
package/cli/repl/execute.d.ts
CHANGED
|
@@ -14,8 +14,8 @@ export declare function stdioCaptureProcessor(stdio: Stdio, onStdOutLine: (msg:
|
|
|
14
14
|
* It is probably best to use {@link __dirname} so you can specify the module relative to your
|
|
15
15
|
* current one.
|
|
16
16
|
* @param args - The arguments you want to start your process with.
|
|
17
|
-
* @param io - If you omit this argument, the in-, out
|
|
18
|
-
* will be automatically forwarded to the respective in-, out
|
|
17
|
+
* @param io - If you omit this argument, the in-, out-, and error-channels of the script execution
|
|
18
|
+
* will be automatically forwarded to the respective in-, out-, and error-channels of your process.
|
|
19
19
|
* However, by defining `io` you essentially gain full control on what should happen
|
|
20
20
|
* with these streams. For a simple capturing processor, for example if you want to collect
|
|
21
21
|
* the output of the script, see {@link stdioCaptureProcessor}.
|
package/cli/repl/execute.js
CHANGED
|
@@ -36,8 +36,8 @@ function stdioCaptureProcessor(stdio, onStdOutLine, onStdErrLine) {
|
|
|
36
36
|
* It is probably best to use {@link __dirname} so you can specify the module relative to your
|
|
37
37
|
* current one.
|
|
38
38
|
* @param args - The arguments you want to start your process with.
|
|
39
|
-
* @param io - If you omit this argument, the in-, out
|
|
40
|
-
* will be automatically forwarded to the respective in-, out
|
|
39
|
+
* @param io - If you omit this argument, the in-, out-, and error-channels of the script execution
|
|
40
|
+
* will be automatically forwarded to the respective in-, out-, and error-channels of your process.
|
|
41
41
|
* However, by defining `io` you essentially gain full control on what should happen
|
|
42
42
|
* with these streams. For a simple capturing processor, for example if you want to collect
|
|
43
43
|
* the output of the script, see {@link stdioCaptureProcessor}.
|
|
@@ -76,7 +76,7 @@ function warn(output, message) {
|
|
|
76
76
|
* {@link SliceFlag#conflicts|conflict} with each other, as they are applied silently otherwise.
|
|
77
77
|
*/
|
|
78
78
|
function warnAboutSliceFlags(output, argument, flags) {
|
|
79
|
-
const given = [...new Set(
|
|
79
|
+
const given = [...new Set(sliceFlagSuffix(argument))];
|
|
80
80
|
const known = new Map(flags.map(f => [f.flag, f]));
|
|
81
81
|
const unknown = given.filter(f => !known.has(f));
|
|
82
82
|
if (unknown.length > 0) {
|
|
@@ -5,7 +5,7 @@ exports.printVersionRepl = printVersionRepl;
|
|
|
5
5
|
const version_1 = require("../../util/version");
|
|
6
6
|
const manifest_1 = require("../../project/sigdb/manifest");
|
|
7
7
|
const ansi_1 = require("../../util/text/ansi");
|
|
8
|
-
const
|
|
8
|
+
const url_1 = require("url");
|
|
9
9
|
/**
|
|
10
10
|
* Returns a version string for the REPL including flowR, R, and the engine in use.
|
|
11
11
|
*/
|
|
@@ -40,7 +40,7 @@ function sigDbSummaryString() {
|
|
|
40
40
|
if (entries.length === 0) {
|
|
41
41
|
return it('no sigdb');
|
|
42
42
|
}
|
|
43
|
-
const link = (text, file) => it(ansi_1.formatter.hyperlink(text, (0,
|
|
43
|
+
const link = (text, file) => it(ansi_1.formatter.hyperlink(text, (0, url_1.pathToFileURL)(file).href, true));
|
|
44
44
|
// if every ref shares the same date, print it once
|
|
45
45
|
const shared = entries.every(e => e.date !== undefined && e.date === entries[0].date) ? entries[0].date : undefined;
|
|
46
46
|
const refs = entries.map(e => link(shared === undefined && e.date !== undefined ? `${e.label} ${e.date}` : e.label, e.file));
|
package/config.d.ts
CHANGED
|
@@ -491,6 +491,22 @@ export declare const FlowrConfig: {
|
|
|
491
491
|
readonly getForEngine: <T extends EngineConfig["type"]>(this: void, config: FlowrConfig, engine: T) => (EngineConfig & {
|
|
492
492
|
type: T;
|
|
493
493
|
}) | undefined;
|
|
494
|
+
/**
|
|
495
|
+
* Every key `config` changed against the {@link FlowrConfig.default|default}, as `a.b.c=<json>` lines.
|
|
496
|
+
* A whole configuration is a long document while an edit to it is usually one line, which is what makes
|
|
497
|
+
* this the form to hand around: a link, a command line, a bug report.
|
|
498
|
+
* @see {@link FlowrConfig.applyPaths} - to read them back
|
|
499
|
+
* @example
|
|
500
|
+
* ```ts
|
|
501
|
+
* FlowrConfig.changedPaths(config); // ['solver.sigdb.enabled=false']
|
|
502
|
+
* ```
|
|
503
|
+
*/
|
|
504
|
+
readonly changedPaths: (this: void, config: FlowrConfig) => string[];
|
|
505
|
+
/**
|
|
506
|
+
* The inverse of {@link FlowrConfig.changedPaths}: the default configuration with those keys set again.
|
|
507
|
+
* A line that names no known key, or whose value is not readable, is skipped rather than guessed at.
|
|
508
|
+
*/
|
|
509
|
+
readonly applyPaths: (this: void, paths: Iterable<string>, base?: FlowrConfig) => FlowrConfig;
|
|
494
510
|
/**
|
|
495
511
|
* Returns a new config object with the given value set at the given key, where the key is a dot-separated path to the value in the config object.
|
|
496
512
|
* @see {@link setInConfigInPlace} for a version that modifies the config object in place instead of returning a new one.
|
package/config.js
CHANGED
|
@@ -16,7 +16,6 @@ const log_1 = require("./util/log");
|
|
|
16
16
|
const files_1 = require("./util/files");
|
|
17
17
|
const joi_1 = __importDefault(require("joi"));
|
|
18
18
|
const project_kind_1 = require("./project/context/project-kind");
|
|
19
|
-
const object_path_1 = __importDefault(require("object-path"));
|
|
20
19
|
const gas_1 = require("./gas");
|
|
21
20
|
const input_types_1 = require("./queries/catalog/input-sources-query/input-types");
|
|
22
21
|
var VariableResolve;
|
|
@@ -188,6 +187,38 @@ function mergeConfigOntoDefaults(base, addon) {
|
|
|
188
187
|
};
|
|
189
188
|
return merge(base, addon);
|
|
190
189
|
}
|
|
190
|
+
/** The shortest start of `key` that none of its `siblings` share, which is how a path stays short and readable. */
|
|
191
|
+
function shortestPrefix(key, siblings = []) {
|
|
192
|
+
for (let length = 1; length < key.length; length++) {
|
|
193
|
+
const prefix = key.slice(0, length);
|
|
194
|
+
if (!siblings.some(other => other !== key && other.startsWith(prefix))) {
|
|
195
|
+
return prefix;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return key;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* The full path a possibly shortened one names, walking `within` a segment at a time: a segment that names a
|
|
202
|
+
* key outright is that key, otherwise it has to start exactly one of them.
|
|
203
|
+
*/
|
|
204
|
+
function expandPath(path, within) {
|
|
205
|
+
const full = [];
|
|
206
|
+
let at = within;
|
|
207
|
+
for (const segment of path.split('.')) {
|
|
208
|
+
if (at === null || typeof at !== 'object') {
|
|
209
|
+
return undefined;
|
|
210
|
+
}
|
|
211
|
+
const keys = Object.keys(at);
|
|
212
|
+
const key = keys.includes(segment) ? segment : keys.filter(other => other.startsWith(segment));
|
|
213
|
+
if (typeof key !== 'string' && key.length !== 1) {
|
|
214
|
+
return undefined;
|
|
215
|
+
}
|
|
216
|
+
const found = typeof key === 'string' ? key : key[0];
|
|
217
|
+
full.push(found);
|
|
218
|
+
at = at[found];
|
|
219
|
+
}
|
|
220
|
+
return full.length > 0 ? full.join('.') : undefined;
|
|
221
|
+
}
|
|
191
222
|
exports.FlowrConfig = {
|
|
192
223
|
name: 'FlowrConfig',
|
|
193
224
|
/**
|
|
@@ -535,6 +566,53 @@ exports.FlowrConfig = {
|
|
|
535
566
|
return defaultEngineConfigs[engine];
|
|
536
567
|
}
|
|
537
568
|
},
|
|
569
|
+
/**
|
|
570
|
+
* Every key `config` changed against the {@link FlowrConfig.default|default}, as `a.b.c=<json>` lines.
|
|
571
|
+
* A whole configuration is a long document while an edit to it is usually one line, which is what makes
|
|
572
|
+
* this the form to hand around: a link, a command line, a bug report.
|
|
573
|
+
* @see {@link FlowrConfig.applyPaths} - to read them back
|
|
574
|
+
* @example
|
|
575
|
+
* ```ts
|
|
576
|
+
* FlowrConfig.changedPaths(config); // ['solver.sigdb.enabled=false']
|
|
577
|
+
* ```
|
|
578
|
+
*/
|
|
579
|
+
changedPaths(config) {
|
|
580
|
+
const found = [];
|
|
581
|
+
const walk = (current, base, path, siblings) => {
|
|
582
|
+
if (current !== null && base !== null && typeof current === 'object' && typeof base === 'object'
|
|
583
|
+
&& !Array.isArray(current) && !Array.isArray(base)) {
|
|
584
|
+
const keys = [...new Set([...Object.keys(current), ...Object.keys(base)])];
|
|
585
|
+
for (const key of keys) {
|
|
586
|
+
walk(current[key], base[key], [...path, key], [...siblings, keys]);
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
else if (JSON.stringify(current) !== JSON.stringify(base)) {
|
|
590
|
+
const short = path.map((key, at) => shortestPrefix(key, siblings[at]));
|
|
591
|
+
found.push(`${short.join('.')}=${JSON.stringify(current)}`);
|
|
592
|
+
}
|
|
593
|
+
};
|
|
594
|
+
walk(config, exports.FlowrConfig.default(), [], []);
|
|
595
|
+
return found;
|
|
596
|
+
},
|
|
597
|
+
/**
|
|
598
|
+
* The inverse of {@link FlowrConfig.changedPaths}: the default configuration with those keys set again.
|
|
599
|
+
* A line that names no known key, or whose value is not readable, is skipped rather than guessed at.
|
|
600
|
+
*/
|
|
601
|
+
applyPaths(paths, base = exports.FlowrConfig.default()) {
|
|
602
|
+
const config = structuredClone(base);
|
|
603
|
+
for (const line of paths) {
|
|
604
|
+
const at = line.indexOf('=');
|
|
605
|
+
const key = at < 0 ? undefined : expandPath(line.slice(0, at), config);
|
|
606
|
+
if (key === undefined) {
|
|
607
|
+
continue;
|
|
608
|
+
}
|
|
609
|
+
try {
|
|
610
|
+
(0, objects_1.setOnPath)(config, key, JSON.parse(line.slice(at + 1)));
|
|
611
|
+
}
|
|
612
|
+
catch { /* a value nobody can read is one to leave alone */ }
|
|
613
|
+
}
|
|
614
|
+
return config;
|
|
615
|
+
},
|
|
538
616
|
/**
|
|
539
617
|
* Returns a new config object with the given value set at the given key, where the key is a dot-separated path to the value in the config object.
|
|
540
618
|
* @see {@link setInConfigInPlace} for a version that modifies the config object in place instead of returning a new one.
|
|
@@ -548,7 +626,7 @@ exports.FlowrConfig = {
|
|
|
548
626
|
*/
|
|
549
627
|
setInConfig(config, key, value) {
|
|
550
628
|
const clone = exports.FlowrConfig.clone(config);
|
|
551
|
-
|
|
629
|
+
(0, objects_1.setOnPath)(clone, key, value);
|
|
552
630
|
return clone;
|
|
553
631
|
},
|
|
554
632
|
/**
|
|
@@ -556,7 +634,7 @@ exports.FlowrConfig = {
|
|
|
556
634
|
* @see {@link setInConfig} for a version that returns a new config object instead of modifying the given one in place.
|
|
557
635
|
*/
|
|
558
636
|
setInConfigInPlace(config, key, value) {
|
|
559
|
-
|
|
637
|
+
(0, objects_1.setOnPath)(config, key, value);
|
|
560
638
|
},
|
|
561
639
|
};
|
|
562
640
|
/** Path to the user-global `flowr.json`, read as a fallback when no project config is found. */
|
|
@@ -577,9 +655,9 @@ function persistSigDbPathToGlobalConfig(dbPath) {
|
|
|
577
655
|
catch (e) {
|
|
578
656
|
log_1.log.warn(`Could not read global config ${file}, recreating it: ${e.message}`);
|
|
579
657
|
}
|
|
580
|
-
const current =
|
|
658
|
+
const current = (0, objects_1.getOnPath)(raw, 'solver.sigdb.additionalPaths');
|
|
581
659
|
const paths = Array.isArray(current) ? current : [];
|
|
582
|
-
|
|
660
|
+
(0, objects_1.setOnPath)(raw, 'solver.sigdb.additionalPaths', [...new Set([...paths, dbPath])]);
|
|
583
661
|
fs_1.default.mkdirSync(path_1.default.dirname(file), { recursive: true });
|
|
584
662
|
fs_1.default.writeFileSync(file, JSON.stringify(raw, null, '\t') + '\n');
|
|
585
663
|
return file;
|
|
@@ -469,7 +469,7 @@ const OriginToFoldTypeMap = {
|
|
|
469
469
|
function cfgFunctionCallWithDataflow(graph, folds) {
|
|
470
470
|
return (call, name, args, down) => {
|
|
471
471
|
const vtx = graph.getVertex(call.info.id);
|
|
472
|
-
if (
|
|
472
|
+
if (vertex_1.FunctionCallVertex.is(vtx) && vtx.onlyBuiltin && vtx.origin.length === 1) {
|
|
473
473
|
const origin = vtx.origin[0];
|
|
474
474
|
const mayMap = OriginToFoldTypeMap[origin];
|
|
475
475
|
// ifelse/fifelse/if_else share the IfThenElse origin but are eager calls, so only fold a real `if` node
|
|
@@ -123,7 +123,7 @@ export declare class SemanticCfgGuidedVisitor<OtherInfo = NoInfo, ControlFlow ex
|
|
|
123
123
|
*/
|
|
124
124
|
protected onProgram(_data: RExpressionList<OtherInfo>): void;
|
|
125
125
|
/**
|
|
126
|
-
* A helper function to request the {@link
|
|
126
|
+
* A helper function to request the {@link Dataflow.origin|origins} of the given node.
|
|
127
127
|
*/
|
|
128
128
|
protected getOrigins(id: NodeId): Origin[] | undefined;
|
|
129
129
|
/**
|
|
@@ -293,7 +293,7 @@ class SemanticCfgGuidedVisitor extends dfg_cfg_guided_visitor_1.DataflowAwareCfg
|
|
|
293
293
|
*/
|
|
294
294
|
onProgram(_data) { }
|
|
295
295
|
/**
|
|
296
|
-
* A helper function to request the {@link
|
|
296
|
+
* A helper function to request the {@link Dataflow.origin|origins} of the given node.
|
|
297
297
|
*/
|
|
298
298
|
getOrigins(id) {
|
|
299
299
|
return df_helper_1.Dataflow.origin(this.config.dfg, id);
|