@eagleoutice/flowr 1.3.13 → 1.4.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/abstract-interpretation/domain.d.ts +27 -0
- package/abstract-interpretation/domain.js +146 -0
- package/abstract-interpretation/handler/binop/binop.d.ts +16 -0
- package/abstract-interpretation/handler/binop/binop.js +40 -0
- package/abstract-interpretation/handler/binop/operators.d.ts +2 -0
- package/abstract-interpretation/handler/binop/operators.js +42 -0
- package/abstract-interpretation/handler/handler.d.ts +6 -0
- package/abstract-interpretation/handler/handler.js +3 -0
- package/abstract-interpretation/processor.d.ts +10 -0
- package/abstract-interpretation/processor.js +78 -0
- package/benchmark/slicer.d.ts +6 -5
- package/benchmark/slicer.js +2 -0
- package/benchmark/stats/print.d.ts +1 -1
- package/benchmark/stats/stats.d.ts +4 -4
- package/benchmark/stats/stats.js +1 -1
- package/cli/common/features.d.ts +1 -1
- package/cli/common/options.d.ts +1 -1
- package/cli/common/script.d.ts +1 -1
- package/cli/common/scripts-info.d.ts +2 -2
- package/cli/repl/commands/cfg.d.ts +1 -1
- package/cli/repl/commands/cfg.js +1 -1
- package/cli/repl/commands/commands.d.ts +1 -1
- package/cli/repl/commands/dataflow.d.ts +1 -1
- package/cli/repl/commands/execute.d.ts +2 -2
- package/cli/repl/commands/main.d.ts +2 -2
- package/cli/repl/commands/normalize.d.ts +1 -1
- package/cli/repl/commands/parse.d.ts +1 -1
- package/cli/repl/commands/quit.d.ts +1 -1
- package/cli/repl/commands/version.d.ts +1 -1
- package/cli/repl/core.d.ts +3 -5
- package/cli/repl/core.js +33 -6
- package/cli/repl/execute.d.ts +1 -1
- package/cli/repl/server/connection.d.ts +2 -2
- package/cli/repl/server/connection.js +3 -2
- package/cli/repl/server/messages/analysis.d.ts +3 -3
- package/cli/repl/server/messages/error.d.ts +1 -1
- package/cli/repl/server/messages/hello.d.ts +2 -2
- package/cli/repl/server/messages/messages.d.ts +6 -6
- package/cli/repl/server/messages/messages.js +26 -6
- package/cli/repl/server/messages/repl.d.ts +1 -1
- package/cli/repl/server/messages/repl.js +28 -8
- package/cli/repl/server/messages/slice.d.ts +3 -3
- package/cli/repl/server/messages/slice.js +28 -8
- package/cli/repl/server/net.d.ts +16 -0
- package/cli/repl/server/net.js +40 -1
- package/cli/repl/server/send.d.ts +2 -2
- package/cli/repl/server/server.d.ts +2 -2
- package/cli/repl/server/validate.d.ts +3 -3
- package/cli/statistics-helper-app.js +2 -2
- package/core/input.d.ts +6 -6
- package/core/output.d.ts +3 -2
- package/core/print/dataflow-printer.d.ts +3 -3
- package/core/print/normalize-printer.d.ts +2 -2
- package/core/print/parse-printer.d.ts +2 -2
- package/core/print/print.d.ts +1 -1
- package/core/print/slice-diff-ansi.d.ts +1 -1
- package/core/slicer.d.ts +5 -4
- package/core/slicer.js +6 -2
- package/core/steps.d.ts +22 -4
- package/core/steps.js +10 -2
- package/dataflow/environments/append.d.ts +1 -1
- package/dataflow/environments/environment.d.ts +4 -4
- package/dataflow/environments/overwrite.d.ts +1 -1
- package/dataflow/environments/register.d.ts +2 -2
- package/dataflow/environments/resolve-by-name.d.ts +2 -2
- package/dataflow/environments/scoping.d.ts +1 -1
- package/dataflow/extractor.d.ts +4 -4
- package/dataflow/graph/diff.d.ts +3 -3
- package/dataflow/graph/graph.d.ts +8 -7
- package/dataflow/graph/quads.d.ts +2 -2
- package/dataflow/graph/vertex.d.ts +5 -5
- package/dataflow/internal/info.d.ts +2 -2
- package/dataflow/internal/linker.d.ts +3 -3
- package/dataflow/internal/process/access.d.ts +3 -3
- package/dataflow/internal/process/expression-list.d.ts +3 -3
- package/dataflow/internal/process/expression-list.js +0 -4
- package/dataflow/internal/process/functions/argument.d.ts +4 -4
- package/dataflow/internal/process/functions/exit-points.d.ts +1 -1
- package/dataflow/internal/process/functions/function-call.d.ts +3 -3
- package/dataflow/internal/process/functions/function-definition.d.ts +3 -3
- package/dataflow/internal/process/functions/parameter.d.ts +3 -3
- package/dataflow/internal/process/if-then-else.d.ts +3 -3
- package/dataflow/internal/process/loops/for-loop.d.ts +3 -3
- package/dataflow/internal/process/loops/repeat-loop.d.ts +3 -3
- package/dataflow/internal/process/loops/while-loop.d.ts +3 -3
- package/dataflow/internal/process/operators/assignment.d.ts +3 -3
- package/dataflow/internal/process/operators/non-assignment-binary-op.d.ts +3 -3
- package/dataflow/internal/process/operators/pipe.d.ts +3 -3
- package/dataflow/internal/process/operators/unary-op.d.ts +3 -3
- package/dataflow/internal/process/symbol.d.ts +3 -3
- package/dataflow/internal/process/uninteresting-leaf.d.ts +2 -2
- package/dataflow/processor.d.ts +3 -3
- package/flowr.d.ts +3 -2
- package/flowr.js +5 -3
- package/package.json +11 -2
- package/r-bridge/lang-4.x/ast/model/collect.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/model.d.ts +6 -6
- package/r-bridge/lang-4.x/ast/model/nodes/info/index.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +4 -4
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +4 -4
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +4 -4
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/operators.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/processing/fold.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/processing/role.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/processing/stateful-fold.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/processing/visitor.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/xml/config.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/data.d.ts +5 -5
- package/r-bridge/lang-4.x/ast/parser/xml/hooks.d.ts +5 -5
- package/r-bridge/lang-4.x/ast/parser/xml/input-format.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/xml/internal/access.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/control/if-then-else.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/control/if-then.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/expression/expression.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/argument.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/call.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/definition.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/parameter.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/break.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/for.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/next.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/repeat.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/while.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/meta.d.ts +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/binary.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/special.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/unary.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/other/comment.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/other/line-directive.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/elements.d.ts +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/root.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/single-element.d.ts +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/number.d.ts +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/string.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/symbol.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/xml-to-json.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/parser.d.ts +4 -4
- package/r-bridge/retriever.d.ts +2 -2
- package/r-bridge/shell-executor.d.ts +25 -0
- package/r-bridge/shell-executor.js +119 -0
- package/r-bridge/shell.d.ts +8 -5
- package/r-bridge/shell.js +6 -3
- package/reconstruct/reconstruct.d.ts +1 -1
- package/slicing/criterion/collect-all.d.ts +3 -3
- package/slicing/criterion/filters/all-variables.d.ts +1 -1
- package/slicing/criterion/parse.d.ts +1 -1
- package/slicing/static/static-slicer.d.ts +3 -3
- package/statistics/features/common-syntax-probability.d.ts +3 -2
- package/statistics/features/common-syntax-probability.js +0 -3
- package/statistics/features/feature.d.ts +6 -6
- package/statistics/features/post-processing.d.ts +2 -2
- package/statistics/features/supported/assignments/assignments.d.ts +2 -2
- package/statistics/features/supported/assignments/post-process.d.ts +2 -2
- package/statistics/features/supported/comments/comments.d.ts +2 -2
- package/statistics/features/supported/comments/post-process.d.ts +2 -2
- package/statistics/features/supported/control-flow/control-flow.d.ts +2 -2
- package/statistics/features/supported/control-flow/post-process.d.ts +2 -2
- package/statistics/features/supported/data-access/data-access.d.ts +3 -3
- package/statistics/features/supported/data-access/post-process.d.ts +2 -2
- package/statistics/features/supported/defined-functions/defined-functions.d.ts +4 -4
- package/statistics/features/supported/defined-functions/post-process.d.ts +2 -2
- package/statistics/features/supported/expression-list/expression-list.d.ts +2 -2
- package/statistics/features/supported/expression-list/post-process.d.ts +2 -2
- package/statistics/features/supported/loops/loops.d.ts +2 -2
- package/statistics/features/supported/loops/post-process.d.ts +2 -2
- package/statistics/features/supported/used-functions/post-process.d.ts +2 -2
- package/statistics/features/supported/used-functions/used-functions.d.ts +3 -3
- package/statistics/features/supported/used-packages/post-process.d.ts +2 -2
- package/statistics/features/supported/used-packages/used-packages.d.ts +2 -2
- package/statistics/features/supported/values/post-process.d.ts +2 -2
- package/statistics/features/supported/values/values.d.ts +2 -2
- package/statistics/features/supported/variables/post-process.d.ts +3 -3
- package/statistics/features/supported/variables/variables.d.ts +2 -2
- package/statistics/meta-statistics.d.ts +1 -1
- package/statistics/output/print-stats.d.ts +2 -2
- package/statistics/output/statistics-file.d.ts +1 -1
- package/statistics/statistics.d.ts +4 -4
- package/util/{cfg.d.ts → cfg/cfg.d.ts} +18 -6
- package/util/{cfg.js → cfg/cfg.js} +42 -37
- package/util/cfg/visitor.d.ts +14 -0
- package/util/cfg/visitor.js +64 -0
- package/util/diff.d.ts +1 -1
- package/util/files.d.ts +1 -1
- package/util/mermaid/ast.d.ts +1 -1
- package/util/mermaid/cfg.d.ts +2 -2
- package/util/mermaid/dfg.d.ts +3 -3
- package/util/objects.d.ts +1 -1
- package/util/quads.d.ts +2 -2
- package/util/summarizer/benchmark/data.d.ts +1 -1
- package/util/summarizer/benchmark/first-phase/process.d.ts +3 -3
- package/util/summarizer/benchmark/second-phase/graph.d.ts +1 -1
- package/util/summarizer/benchmark/second-phase/process.d.ts +1 -1
- package/util/summarizer/benchmark/summarizer.d.ts +3 -2
- package/util/summarizer/benchmark/summarizer.js +0 -4
- package/util/summarizer/statistics/post-process/clusterer.d.ts +2 -2
- package/util/summarizer/statistics/post-process/file-based-count.d.ts +1 -1
- package/util/summarizer/statistics/post-process/histogram.d.ts +2 -2
- package/util/summarizer/statistics/post-process/post-process-output.d.ts +2 -2
- package/util/summarizer/statistics/second-phase/process.d.ts +2 -2
- package/util/summarizer/statistics/summarizer.d.ts +3 -2
- package/util/summarizer/summarizer.d.ts +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.cfg2quads = exports.equalCfg = exports.extractCFG = exports.emptyControlFlowInformation = exports.ControlFlowGraph = void 0;
|
|
4
|
-
const r_bridge_1 = require("
|
|
5
|
-
const set_1 = require("
|
|
6
|
-
const quads_1 = require("
|
|
7
|
-
const log_1 = require("
|
|
8
|
-
const json_1 = require("
|
|
4
|
+
const r_bridge_1 = require("../../r-bridge");
|
|
5
|
+
const set_1 = require("../set");
|
|
6
|
+
const quads_1 = require("../quads");
|
|
7
|
+
const log_1 = require("../log");
|
|
8
|
+
const json_1 = require("../json");
|
|
9
9
|
/**
|
|
10
10
|
* This class represents the control flow graph of an R program.
|
|
11
11
|
* The control flow may be hierarchical when confronted with function definitions (see {@link CfgVertex} and {@link CFG#rootVertexIds|rootVertexIds()}).
|
|
@@ -65,10 +65,10 @@ function emptyControlFlowInformation() {
|
|
|
65
65
|
}
|
|
66
66
|
exports.emptyControlFlowInformation = emptyControlFlowInformation;
|
|
67
67
|
const cfgFolds = {
|
|
68
|
-
foldNumber: cfgLeaf,
|
|
69
|
-
foldString: cfgLeaf,
|
|
70
|
-
foldLogical: cfgLeaf,
|
|
71
|
-
foldSymbol: cfgLeaf,
|
|
68
|
+
foldNumber: cfgLeaf("expression" /* CfgVertexType.Expression */),
|
|
69
|
+
foldString: cfgLeaf("expression" /* CfgVertexType.Expression */),
|
|
70
|
+
foldLogical: cfgLeaf("expression" /* CfgVertexType.Expression */),
|
|
71
|
+
foldSymbol: cfgLeaf("expression" /* CfgVertexType.Expression */),
|
|
72
72
|
foldAccess: cfgAccess,
|
|
73
73
|
binaryOp: {
|
|
74
74
|
foldLogicalOp: cfgBinaryOp,
|
|
@@ -107,24 +107,29 @@ function extractCFG(ast) {
|
|
|
107
107
|
return (0, r_bridge_1.foldAst)(ast.ast, cfgFolds);
|
|
108
108
|
}
|
|
109
109
|
exports.extractCFG = extractCFG;
|
|
110
|
-
function cfgLeaf(
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
110
|
+
function cfgLeaf(type) {
|
|
111
|
+
return (leaf) => {
|
|
112
|
+
const graph = new ControlFlowGraph();
|
|
113
|
+
graph.addVertex({ id: leaf.info.id, name: leaf.type, type });
|
|
114
|
+
return { graph, breaks: [], nexts: [], returns: [], exitPoints: [leaf.info.id], entryPoints: [leaf.info.id] };
|
|
115
|
+
};
|
|
114
116
|
}
|
|
115
117
|
function cfgBreak(leaf) {
|
|
116
|
-
return { ...cfgLeaf(leaf), breaks: [leaf.info.id] };
|
|
118
|
+
return { ...cfgLeaf("statement" /* CfgVertexType.Statement */)(leaf), breaks: [leaf.info.id] };
|
|
117
119
|
}
|
|
118
120
|
function cfgNext(leaf) {
|
|
119
|
-
return { ...cfgLeaf(leaf), nexts: [leaf.info.id] };
|
|
121
|
+
return { ...cfgLeaf("statement" /* CfgVertexType.Statement */)(leaf), nexts: [leaf.info.id] };
|
|
120
122
|
}
|
|
121
123
|
function cfgIgnore(_leaf) {
|
|
122
124
|
return { graph: new ControlFlowGraph(), breaks: [], nexts: [], returns: [], exitPoints: [], entryPoints: [] };
|
|
123
125
|
}
|
|
126
|
+
function identifyMayStatementType(node) {
|
|
127
|
+
return node.info.role === "expr-list-child" /* RoleInParent.ExpressionListChild */ ? "statement" /* CfgVertexType.Statement */ : "expression" /* CfgVertexType.Expression */;
|
|
128
|
+
}
|
|
124
129
|
function cfgIfThenElse(ifNode, condition, then, otherwise) {
|
|
125
130
|
const graph = new ControlFlowGraph();
|
|
126
|
-
graph.addVertex({ id: ifNode.info.id, name: ifNode.type });
|
|
127
|
-
graph.addVertex({ id: ifNode.info.id + '-exit', name: 'if-exit' });
|
|
131
|
+
graph.addVertex({ id: ifNode.info.id, name: ifNode.type, type: identifyMayStatementType(ifNode) });
|
|
132
|
+
graph.addVertex({ id: ifNode.info.id + '-exit', name: 'if-exit', type: "end-marker" /* CfgVertexType.EndMarker */ });
|
|
128
133
|
graph.merge(condition.graph);
|
|
129
134
|
graph.merge(then.graph);
|
|
130
135
|
if (otherwise) {
|
|
@@ -160,8 +165,8 @@ function cfgIfThenElse(ifNode, condition, then, otherwise) {
|
|
|
160
165
|
}
|
|
161
166
|
function cfgRepeat(repeat, body) {
|
|
162
167
|
const graph = body.graph;
|
|
163
|
-
graph.addVertex({ id: repeat.info.id, name: repeat.type });
|
|
164
|
-
graph.addVertex({ id: repeat.info.id + '-exit', name: 'repeat-exit' });
|
|
168
|
+
graph.addVertex({ id: repeat.info.id, name: repeat.type, type: identifyMayStatementType(repeat) });
|
|
169
|
+
graph.addVertex({ id: repeat.info.id + '-exit', name: 'repeat-exit', type: "end-marker" /* CfgVertexType.EndMarker */ });
|
|
165
170
|
for (const entryPoint of body.entryPoints) {
|
|
166
171
|
graph.addEdge(repeat.info.id, entryPoint, { label: 'FD' });
|
|
167
172
|
}
|
|
@@ -176,8 +181,8 @@ function cfgRepeat(repeat, body) {
|
|
|
176
181
|
}
|
|
177
182
|
function cfgWhile(whileLoop, condition, body) {
|
|
178
183
|
const graph = condition.graph;
|
|
179
|
-
graph.addVertex({ id: whileLoop.info.id, name: whileLoop.type });
|
|
180
|
-
graph.addVertex({ id: whileLoop.info.id + '-exit', name: 'while-exit' });
|
|
184
|
+
graph.addVertex({ id: whileLoop.info.id, name: whileLoop.type, type: identifyMayStatementType(whileLoop) });
|
|
185
|
+
graph.addVertex({ id: whileLoop.info.id + '-exit', name: 'while-exit', type: "end-marker" /* CfgVertexType.EndMarker */ });
|
|
181
186
|
graph.merge(body.graph);
|
|
182
187
|
for (const entry of condition.entryPoints) {
|
|
183
188
|
graph.addEdge(entry, whileLoop.info.id, { label: 'FD' });
|
|
@@ -204,8 +209,8 @@ function cfgWhile(whileLoop, condition, body) {
|
|
|
204
209
|
}
|
|
205
210
|
function cfgFor(forLoop, variable, vector, body) {
|
|
206
211
|
const graph = variable.graph;
|
|
207
|
-
graph.addVertex({ id: forLoop.info.id, name: forLoop.type });
|
|
208
|
-
graph.addVertex({ id: forLoop.info.id + '-exit', name: 'for-exit' });
|
|
212
|
+
graph.addVertex({ id: forLoop.info.id, name: forLoop.type, type: identifyMayStatementType(forLoop) });
|
|
213
|
+
graph.addVertex({ id: forLoop.info.id + '-exit', name: 'for-exit', type: "end-marker" /* CfgVertexType.EndMarker */ });
|
|
209
214
|
graph.merge(vector.graph);
|
|
210
215
|
graph.merge(body.graph);
|
|
211
216
|
for (const entry of vector.entryPoints) {
|
|
@@ -236,9 +241,9 @@ function cfgFor(forLoop, variable, vector, body) {
|
|
|
236
241
|
function cfgFunctionDefinition(fn, params, body) {
|
|
237
242
|
const graph = new ControlFlowGraph();
|
|
238
243
|
const children = [fn.info.id + '-params', fn.info.id + '-exit'];
|
|
239
|
-
graph.addVertex({ id: fn.info.id + '-params', name: 'function-parameters' }, false);
|
|
240
|
-
graph.addVertex({ id: fn.info.id + '-exit', name: 'function-exit' }, false);
|
|
241
|
-
graph.addVertex({ id: fn.info.id, name: fn.type, children });
|
|
244
|
+
graph.addVertex({ id: fn.info.id + '-params', name: 'function-parameters', type: "mid-marker" /* CfgVertexType.MidMarker */ }, false);
|
|
245
|
+
graph.addVertex({ id: fn.info.id + '-exit', name: 'function-exit', type: "end-marker" /* CfgVertexType.EndMarker */ }, false);
|
|
246
|
+
graph.addVertex({ id: fn.info.id, name: fn.type, children, type: identifyMayStatementType(fn) });
|
|
242
247
|
graph.merge(body.graph, true);
|
|
243
248
|
children.push(...body.graph.rootVertexIds());
|
|
244
249
|
for (const param of params) {
|
|
@@ -263,15 +268,15 @@ function cfgFunctionDefinition(fn, params, body) {
|
|
|
263
268
|
function cfgFunctionCall(call, name, args) {
|
|
264
269
|
const graph = name.graph;
|
|
265
270
|
const info = { graph, breaks: [...name.breaks], nexts: [...name.nexts], returns: [...name.returns], exitPoints: [call.info.id + '-exit'], entryPoints: [call.info.id] };
|
|
266
|
-
graph.addVertex({ id: call.info.id, name: call.type });
|
|
271
|
+
graph.addVertex({ id: call.info.id, name: call.type, type: identifyMayStatementType(call) });
|
|
267
272
|
for (const entryPoint of name.entryPoints) {
|
|
268
273
|
graph.addEdge(entryPoint, call.info.id, { label: 'FD' });
|
|
269
274
|
}
|
|
270
|
-
graph.addVertex({ id: call.info.id + '-name', name: 'call-name' });
|
|
275
|
+
graph.addVertex({ id: call.info.id + '-name', name: 'call-name', type: "mid-marker" /* CfgVertexType.MidMarker */ });
|
|
271
276
|
for (const exitPoint of name.exitPoints) {
|
|
272
277
|
graph.addEdge(call.info.id + '-name', exitPoint, { label: 'FD' });
|
|
273
278
|
}
|
|
274
|
-
graph.addVertex({ id: call.info.id + '-exit', name: 'call-exit' });
|
|
279
|
+
graph.addVertex({ id: call.info.id + '-exit', name: 'call-exit', type: "end-marker" /* CfgVertexType.EndMarker */ });
|
|
275
280
|
let lastArgExits = [call.info.id + '-name'];
|
|
276
281
|
for (const arg of args) {
|
|
277
282
|
if (arg === undefined) {
|
|
@@ -297,7 +302,7 @@ function cfgFunctionCall(call, name, args) {
|
|
|
297
302
|
function cfgArgumentOrParameter(node, name, value) {
|
|
298
303
|
const graph = new ControlFlowGraph();
|
|
299
304
|
const info = { graph, breaks: [], nexts: [], returns: [], exitPoints: [node.info.id + '-exit'], entryPoints: [node.info.id] };
|
|
300
|
-
graph.addVertex({ id: node.info.id, name: node.type });
|
|
305
|
+
graph.addVertex({ id: node.info.id, name: node.type, type: "expression" /* CfgVertexType.Expression */ });
|
|
301
306
|
let currentExitPoint = [node.info.id];
|
|
302
307
|
if (name) {
|
|
303
308
|
graph.merge(name.graph);
|
|
@@ -309,7 +314,7 @@ function cfgArgumentOrParameter(node, name, value) {
|
|
|
309
314
|
}
|
|
310
315
|
currentExitPoint = name.exitPoints;
|
|
311
316
|
}
|
|
312
|
-
graph.addVertex({ id: node.info.id + '-before-value', name: 'before-value' });
|
|
317
|
+
graph.addVertex({ id: node.info.id + '-before-value', name: 'before-value', type: "mid-marker" /* CfgVertexType.MidMarker */ });
|
|
313
318
|
for (const exitPoints of currentExitPoint) {
|
|
314
319
|
graph.addEdge(node.info.id + '-before-value', exitPoints, { label: 'FD' });
|
|
315
320
|
}
|
|
@@ -326,7 +331,7 @@ function cfgArgumentOrParameter(node, name, value) {
|
|
|
326
331
|
}
|
|
327
332
|
currentExitPoint = value.exitPoints;
|
|
328
333
|
}
|
|
329
|
-
graph.addVertex({ id: node.info.id + '-exit', name: 'exit' });
|
|
334
|
+
graph.addVertex({ id: node.info.id + '-exit', name: 'exit', type: "end-marker" /* CfgVertexType.EndMarker */ });
|
|
330
335
|
for (const exit of currentExitPoint) {
|
|
331
336
|
graph.addEdge(node.info.id + '-exit', exit, { label: 'FD' });
|
|
332
337
|
}
|
|
@@ -335,8 +340,8 @@ function cfgArgumentOrParameter(node, name, value) {
|
|
|
335
340
|
function cfgBinaryOp(binOp, lhs, rhs) {
|
|
336
341
|
const graph = new ControlFlowGraph().merge(lhs.graph).merge(rhs.graph);
|
|
337
342
|
const result = { graph, breaks: [...lhs.breaks, ...rhs.breaks], nexts: [...lhs.nexts, ...rhs.nexts], returns: [...lhs.returns, ...rhs.returns], entryPoints: [binOp.info.id], exitPoints: [binOp.info.id + '-exit'] };
|
|
338
|
-
graph.addVertex({ id: binOp.info.id, name: binOp.type });
|
|
339
|
-
graph.addVertex({ id: binOp.info.id + '-exit', name: 'binOp-exit' });
|
|
343
|
+
graph.addVertex({ id: binOp.info.id, name: binOp.type, type: binOp.flavor === 'assignment' ? "statement" /* CfgVertexType.Statement */ : "expression" /* CfgVertexType.Expression */ });
|
|
344
|
+
graph.addVertex({ id: binOp.info.id + '-exit', name: 'binOp-exit', type: "end-marker" /* CfgVertexType.EndMarker */ });
|
|
340
345
|
for (const exitPoint of lhs.exitPoints) {
|
|
341
346
|
for (const entryPoint of rhs.entryPoints) {
|
|
342
347
|
result.graph.addEdge(entryPoint, exitPoint, { label: 'FD' });
|
|
@@ -353,8 +358,8 @@ function cfgBinaryOp(binOp, lhs, rhs) {
|
|
|
353
358
|
function cfgAccess(access, name, accessors) {
|
|
354
359
|
const result = name;
|
|
355
360
|
const graph = result.graph;
|
|
356
|
-
graph.addVertex({ id: access.info.id, name: access.type });
|
|
357
|
-
graph.addVertex({ id: access.info.id + '-exit', name: 'access-exit' });
|
|
361
|
+
graph.addVertex({ id: access.info.id, name: access.type, type: "expression" /* CfgVertexType.Expression */ });
|
|
362
|
+
graph.addVertex({ id: access.info.id + '-exit', name: 'access-exit', type: "end-marker" /* CfgVertexType.EndMarker */ });
|
|
358
363
|
for (const entry of name.entryPoints) {
|
|
359
364
|
graph.addEdge(entry, access.info.id, { label: 'FD' });
|
|
360
365
|
}
|
|
@@ -383,7 +388,7 @@ function cfgAccess(access, name, accessors) {
|
|
|
383
388
|
function cfgUnaryOp(unary, operand) {
|
|
384
389
|
const graph = operand.graph;
|
|
385
390
|
const result = { ...operand, graph, exitPoints: [unary.info.id] };
|
|
386
|
-
graph.addVertex({ id: unary.info.id, name: unary.type });
|
|
391
|
+
graph.addVertex({ id: unary.info.id, name: unary.type, type: "end-marker" /* CfgVertexType.EndMarker */ });
|
|
387
392
|
return result;
|
|
388
393
|
}
|
|
389
394
|
function cfgExprList(_node, expressions) {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { NodeId } from '../../r-bridge';
|
|
2
|
+
import type { CfgEdge, CfgVertex, ControlFlowInformation } from './cfg';
|
|
3
|
+
export interface NodeVisitingContext {
|
|
4
|
+
parent: {
|
|
5
|
+
vertex: NodeId;
|
|
6
|
+
edge: CfgEdge;
|
|
7
|
+
} | 'root';
|
|
8
|
+
cfg: ControlFlowInformation;
|
|
9
|
+
visited: Set<NodeId>;
|
|
10
|
+
/** contains the current vertex as well */
|
|
11
|
+
siblings: NodeId[];
|
|
12
|
+
}
|
|
13
|
+
export type OnEnterVisitNode = (node: CfgVertex, context: NodeVisitingContext) => void;
|
|
14
|
+
export declare function visitCfg(cfg: ControlFlowInformation, onVisit: OnEnterVisitNode): void;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.visitCfg = void 0;
|
|
4
|
+
const assert_1 = require("../assert");
|
|
5
|
+
class ControlFlowGraphExecutionTraceVisitor {
|
|
6
|
+
onEnter;
|
|
7
|
+
constructor(onEnter) {
|
|
8
|
+
this.onEnter = onEnter;
|
|
9
|
+
}
|
|
10
|
+
visitSingle(node, context) {
|
|
11
|
+
if (context.visited.has(node.id)) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
// only visit a node if we have visited all of its successors
|
|
15
|
+
const successorEdges = context.cfg.graph.edges().get(node.id);
|
|
16
|
+
if (successorEdges) {
|
|
17
|
+
for (const [target,] of successorEdges) {
|
|
18
|
+
if (!context.visited.has(target)) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
context.visited.add(node.id);
|
|
24
|
+
this.onEnter(node, context);
|
|
25
|
+
// find all ingoing edges
|
|
26
|
+
const predecessors = this.retrieveAllPredecessors(context, node);
|
|
27
|
+
const siblings = predecessors.map(p => p.source);
|
|
28
|
+
for (const predecessor of predecessors) {
|
|
29
|
+
const { source, edge } = predecessor;
|
|
30
|
+
const sourceVertex = context.cfg.graph.vertices().get(source);
|
|
31
|
+
(0, assert_1.guard)(sourceVertex !== undefined, () => `Source vertex with id ${source} not found`);
|
|
32
|
+
this.visitSingle(sourceVertex, {
|
|
33
|
+
parent: { vertex: node.id, edge },
|
|
34
|
+
cfg: context.cfg,
|
|
35
|
+
visited: context.visited,
|
|
36
|
+
siblings
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
retrieveAllPredecessors(context, node) {
|
|
41
|
+
const predecessors = [];
|
|
42
|
+
for (const entry of context.cfg.graph.edges().entries()) {
|
|
43
|
+
const [source, targets] = entry;
|
|
44
|
+
const target = targets.get(node.id);
|
|
45
|
+
if (target) {
|
|
46
|
+
predecessors.push({ source, edge: target });
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return predecessors;
|
|
50
|
+
}
|
|
51
|
+
visit(cfg) {
|
|
52
|
+
const visited = new Set;
|
|
53
|
+
for (const id of cfg.entryPoints) {
|
|
54
|
+
const node = cfg.graph.vertices().get(id);
|
|
55
|
+
(0, assert_1.guard)(node !== undefined, `Node with id ${id} not present`);
|
|
56
|
+
this.visitSingle(node, { parent: 'root', cfg, siblings: [...cfg.entryPoints], visited });
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function visitCfg(cfg, onVisit) {
|
|
61
|
+
return new ControlFlowGraphExecutionTraceVisitor(onVisit).visit(cfg);
|
|
62
|
+
}
|
|
63
|
+
exports.visitCfg = visitCfg;
|
|
64
|
+
//# sourceMappingURL=visitor.js.map
|
package/util/diff.d.ts
CHANGED
package/util/files.d.ts
CHANGED
package/util/mermaid/ast.d.ts
CHANGED
package/util/mermaid/cfg.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NormalizedAst } from '../../r-bridge';
|
|
2
|
-
import { ControlFlowInformation } from '../cfg';
|
|
1
|
+
import type { NormalizedAst } from '../../r-bridge';
|
|
2
|
+
import type { ControlFlowInformation } from '../cfg/cfg';
|
|
3
3
|
export declare function cfgToMermaid(cfg: ControlFlowInformation, normalizedAst: NormalizedAst, prefix?: string): string;
|
|
4
4
|
/**
|
|
5
5
|
* Use mermaid to visualize the normalized AST.
|
package/util/mermaid/dfg.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { NodeId } from '../../r-bridge';
|
|
2
|
-
import { SourceRange } from '../range';
|
|
3
|
-
import { DataflowGraph, DataflowMap } from '../../dataflow';
|
|
1
|
+
import type { NodeId } from '../../r-bridge';
|
|
2
|
+
import type { SourceRange } from '../range';
|
|
3
|
+
import type { DataflowGraph, DataflowMap } from '../../dataflow';
|
|
4
4
|
export declare function formatRange(range: SourceRange | undefined): string;
|
|
5
5
|
export declare function graphToMermaid(graph: DataflowGraph, dataflowIdMap: DataflowMap | undefined, prefix?: string | null, idPrefix?: string, includeEnvironments?: boolean, mark?: Set<NodeId>, rootGraph?: DataflowGraph): string;
|
|
6
6
|
/**
|
package/util/objects.d.ts
CHANGED
package/util/quads.d.ts
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @module
|
|
9
9
|
*/
|
|
10
|
-
import { MergeableRecord } from './objects';
|
|
11
|
-
import { NodeId } from '../r-bridge';
|
|
10
|
+
import type { MergeableRecord } from './objects';
|
|
11
|
+
import type { NodeId } from '../r-bridge';
|
|
12
12
|
type RecordForQuad = Record<string, unknown>;
|
|
13
13
|
type DataForQuad = Record<string, unknown> | ArrayLike<unknown>;
|
|
14
14
|
type ContextForQuad = string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CommonSlicerMeasurements, PerSliceMeasurements, SlicerStats, SlicerStatsDataflow, SlicerStatsInput } from '../../../benchmark';
|
|
1
|
+
import type { CommonSlicerMeasurements, PerSliceMeasurements, SlicerStats, SlicerStatsDataflow, SlicerStatsInput } from '../../../benchmark';
|
|
2
2
|
export interface SummarizedMeasurement<T = number> {
|
|
3
3
|
min: T;
|
|
4
4
|
max: T;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SummarizedMeasurement, SummarizedSlicerStats } from '../data';
|
|
2
|
-
import { PerSliceStats, SlicerStats } from '../../../../benchmark';
|
|
3
|
-
import { SlicingCriteria } from '../../../../slicing';
|
|
1
|
+
import type { SummarizedMeasurement, SummarizedSlicerStats } from '../data';
|
|
2
|
+
import type { PerSliceStats, SlicerStats } from '../../../../benchmark';
|
|
3
|
+
import type { SlicingCriteria } from '../../../../slicing';
|
|
4
4
|
/**
|
|
5
5
|
* Summarizes the given stats by calculating the min, max, median, mean, and the standard deviation for each measurement.
|
|
6
6
|
* @see Slicer
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { UltimateSlicerStats } from '../data';
|
|
1
|
+
import type { UltimateSlicerStats } from '../data';
|
|
2
2
|
export declare function writeGraphOutput(ultimate: UltimateSlicerStats, outputGraphPath: string): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { SummarizedSlicerStats, UltimateSlicerStats } from '../data';
|
|
2
|
+
import type { SummarizedSlicerStats, UltimateSlicerStats } from '../data';
|
|
3
3
|
export declare function summarizeAllSummarizedStats(stats: SummarizedSlicerStats[]): UltimateSlicerStats;
|
|
4
4
|
export declare function processNextSummary(line: Buffer, allSummarized: SummarizedSlicerStats[]): void;
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
* This module is tasked with processing the results of the benchmarking (see {@link SlicerStats}).
|
|
3
3
|
* @module
|
|
4
4
|
*/
|
|
5
|
-
import { CommonSummarizerConfiguration
|
|
6
|
-
import {
|
|
5
|
+
import type { CommonSummarizerConfiguration } from '../summarizer';
|
|
6
|
+
import { Summarizer } from '../summarizer';
|
|
7
|
+
import type { UltimateSlicerStats } from './data';
|
|
7
8
|
export interface BenchmarkSummarizerConfiguration extends CommonSummarizerConfiguration {
|
|
8
9
|
/**
|
|
9
10
|
* If given, produce graph data output (e.g. for the benchmark visualization) to the given path
|
|
@@ -4,10 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.BenchmarkSummarizer = void 0;
|
|
7
|
-
/**
|
|
8
|
-
* This module is tasked with processing the results of the benchmarking (see {@link SlicerStats}).
|
|
9
|
-
* @module
|
|
10
|
-
*/
|
|
11
7
|
const summarizer_1 = require("../summarizer");
|
|
12
8
|
const fs_1 = __importDefault(require("fs"));
|
|
13
9
|
const input_1 = require("./first-phase/input");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DefaultMap } from '../../../defaultmap';
|
|
2
|
-
import { NodeId } from '../../../../r-bridge';
|
|
3
|
-
import { MergeableRecord } from '../../../objects';
|
|
2
|
+
import type { NodeId } from '../../../../r-bridge';
|
|
3
|
+
import type { MergeableRecord } from '../../../objects';
|
|
4
4
|
export type ContextsWithCount = DefaultMap<NodeId, number>;
|
|
5
5
|
export type ClusterContextIdMap = DefaultMap<string | undefined, NodeId>;
|
|
6
6
|
export type ClusterValueInfoMap = DefaultMap<string, ContextsWithCount>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ClusterReport } from './clusterer';
|
|
2
|
-
import { Table } from '../../../files';
|
|
1
|
+
import type { ClusterReport } from './clusterer';
|
|
2
|
+
import type { Table } from '../../../files';
|
|
3
3
|
/**
|
|
4
4
|
* A conventional histogram (e.g., created by {@link histogramFromNumbers}).
|
|
5
5
|
* Can be converted to a {@link Table} by {@link histograms2table}.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FeatureSelection } from '../../../../statistics';
|
|
2
|
-
import { ClusterReport } from './clusterer';
|
|
1
|
+
import type { FeatureSelection } from '../../../../statistics';
|
|
2
|
+
import type { ClusterReport } from './clusterer';
|
|
3
3
|
/**
|
|
4
4
|
* Post process the collections in a given folder, reducing them in a memory preserving way.
|
|
5
5
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CommonSummarizerConfiguration } from '../../summarizer';
|
|
2
|
-
import { StatisticsSummarizerConfiguration } from '../summarizer';
|
|
1
|
+
import type { CommonSummarizerConfiguration } from '../../summarizer';
|
|
2
|
+
import type { StatisticsSummarizerConfiguration } from '../summarizer';
|
|
3
3
|
/**
|
|
4
4
|
* Post process the collections in a given folder, retrieving the final summaries.
|
|
5
5
|
*
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { CommonSummarizerConfiguration
|
|
2
|
-
import {
|
|
1
|
+
import type { CommonSummarizerConfiguration } from '../summarizer';
|
|
2
|
+
import { Summarizer } from '../summarizer';
|
|
3
|
+
import type { FeatureSelection } from '../../../statistics';
|
|
3
4
|
export interface StatisticsSummarizerConfiguration extends CommonSummarizerConfiguration {
|
|
4
5
|
/**
|
|
5
6
|
* The input path to read all zips from
|