arkanalyzer 1.0.19 → 1.0.20

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.
Files changed (33) hide show
  1. package/lib/Scene.d.ts +11 -5
  2. package/lib/Scene.d.ts.map +1 -1
  3. package/lib/Scene.js +74 -29
  4. package/lib/callgraph/pointerAnalysis/PagBuilder.d.ts.map +1 -1
  5. package/lib/callgraph/pointerAnalysis/PagBuilder.js +3 -1
  6. package/lib/core/common/DummyMainCreater.d.ts +4 -0
  7. package/lib/core/common/DummyMainCreater.d.ts.map +1 -1
  8. package/lib/core/common/DummyMainCreater.js +63 -44
  9. package/lib/core/dataflow/GenericDataFlow.d.ts +143 -0
  10. package/lib/core/dataflow/GenericDataFlow.d.ts.map +1 -0
  11. package/lib/core/dataflow/GenericDataFlow.js +109 -0
  12. package/lib/core/dataflow/ReachingDef.d.ts +63 -0
  13. package/lib/core/dataflow/ReachingDef.d.ts.map +1 -0
  14. package/lib/core/dataflow/ReachingDef.js +168 -0
  15. package/lib/core/graph/BaseExplicitGraph.d.ts +3 -8
  16. package/lib/core/graph/BaseExplicitGraph.d.ts.map +1 -1
  17. package/lib/core/graph/BaseImplicitGraph.d.ts +78 -0
  18. package/lib/core/graph/BaseImplicitGraph.d.ts.map +1 -0
  19. package/lib/core/graph/BaseImplicitGraph.js +78 -0
  20. package/lib/core/graph/GraphTraits.d.ts +8 -0
  21. package/lib/core/graph/GraphTraits.d.ts.map +1 -0
  22. package/lib/core/graph/GraphTraits.js +16 -0
  23. package/lib/core/graph/Scc.d.ts +3 -2
  24. package/lib/core/graph/Scc.d.ts.map +1 -1
  25. package/lib/core/graph/Scc.js +1 -1
  26. package/lib/index.d.ts +1 -1
  27. package/lib/index.d.ts.map +1 -1
  28. package/lib/save/GraphPrinter.d.ts +4 -3
  29. package/lib/save/GraphPrinter.d.ts.map +1 -1
  30. package/lib/utils/SparseBitVector.d.ts +1 -1
  31. package/lib/utils/SparseBitVector.d.ts.map +1 -1
  32. package/lib/utils/SparseBitVector.js +11 -10
  33. package/package.json +2 -1
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.MFPDataFlowSolver = exports.Solution = void 0;
18
+ /**
19
+ * Represents the result of a data flow analysis.
20
+ * Contains the in and out sets for each node, as well as the corresponding data flow problem.
21
+ *
22
+ * @template Node - The type of nodes in the graph.
23
+ * @template V - The type of data flow values.
24
+ */
25
+ class Solution {
26
+ constructor(i, out, problem) {
27
+ this.in = i;
28
+ this.out = out;
29
+ this.problem = problem;
30
+ }
31
+ }
32
+ exports.Solution = Solution;
33
+ /**
34
+ * A solver for data flow analysis problems.
35
+ * Implements forward and backward data flow analysis using a worklist algorithm.
36
+ * The solver computes the Maximum Fixed Point (MFP) solution, which is a safe
37
+ * over-approximation of the ideal Meet-Over-All-Paths (MOP) solution.
38
+ */
39
+ class MFPDataFlowSolver {
40
+ /**
41
+ * Computes the MFP solution for a forward data flow analysis problem.
42
+ *
43
+ * @template Node - The type of nodes in the graph.
44
+ * @template V - The type of data flow values.
45
+ * @param problem - The data flow problem to solve.
46
+ * @returns The solution containing the in and out sets for all nodes.
47
+ */
48
+ calculateMopSolutionForwards(problem) {
49
+ let _out = problem.initOut;
50
+ let _in = problem.initIn;
51
+ let workList = problem.flowGraph.nodesInPostOrder;
52
+ let newEntries = new Set();
53
+ while (workList.length > 0) {
54
+ newEntries.clear();
55
+ workList.forEach((n) => {
56
+ let inSet;
57
+ const predecessors = problem.flowGraph.pred(n);
58
+ if (predecessors && predecessors.length > 0) {
59
+ const predecessorOuts = predecessors.map((pred) => _out.get(pred));
60
+ inSet = predecessorOuts.reduce((acc, cur) => problem.meet(acc, cur), problem.empty);
61
+ }
62
+ else {
63
+ inSet = problem.empty;
64
+ }
65
+ _in.set(n, inSet);
66
+ let old = _out.get(n);
67
+ let newSet = problem.transferFunction.apply(n, inSet);
68
+ if (!old || old.count() === 0 || !old.equals(newSet)) {
69
+ _out.set(n, newSet);
70
+ problem.flowGraph.succ(n).forEach((succ) => newEntries.add(succ));
71
+ }
72
+ });
73
+ workList = [...newEntries];
74
+ }
75
+ return new Solution(_in, _out, problem);
76
+ }
77
+ /**
78
+ * Computes the MFP solution for a backward data flow analysis problem.
79
+ *
80
+ * @template Node - The type of nodes in the graph.
81
+ * @template V - The type of data flow values.
82
+ * @param problem - The data flow problem to solve.
83
+ * @returns The solution containing the in and out sets for all nodes.
84
+ */
85
+ calculateMopSolutionBackwards(problem) {
86
+ let _out = problem.initOut;
87
+ let _in = problem.initIn;
88
+ let workList = problem.flowGraph.nodesInPostOrder;
89
+ let newEntries = new Set();
90
+ while (workList.length > 0) {
91
+ newEntries.clear();
92
+ workList.forEach((n) => {
93
+ let outSet = problem.flowGraph.succ(n).reduce((acc, curr) => {
94
+ return problem.meet(acc, _in.get(curr));
95
+ }, problem.empty);
96
+ _out.set(n, outSet);
97
+ let old = _in.get(n);
98
+ let newSet = problem.transferFunction.apply(n, outSet);
99
+ if (!old || !old.equals(newSet)) {
100
+ _in.set(n, newSet);
101
+ problem.flowGraph.pred(n).forEach((pred) => newEntries.add(pred));
102
+ }
103
+ });
104
+ workList = [...newEntries];
105
+ }
106
+ return new Solution(_in, _out, problem);
107
+ }
108
+ }
109
+ exports.MFPDataFlowSolver = MFPDataFlowSolver;
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Reaching Definitions Data Flow Analysis
3
+ *
4
+ * This module implements the Reaching Definitions data flow analysis algorithm.
5
+ * Reaching Definitions is a forward data flow analysis that determines, for each
6
+ * program point, the set of variable definitions (assignments) that may reach
7
+ * that point without being overwritten.
8
+ *
9
+ * Key Components:
10
+ * 1. **Transfer Function**:
11
+ * - Computes the out set for each node based on its in set.
12
+ * - Uses gen and kill sets to model the effects of assignments:
13
+ * - **gen**: The set of definitions generated by the current node.
14
+ * - **kill**: The set of definitions killed (overwritten) by the current node.
15
+ *
16
+ * 2. **Meet Operation**:
17
+ * - Combines data flow values from multiple paths (e.g., union for reaching definitions).
18
+ * - Ensures that the analysis is conservative (safe) by over-approximating the result.
19
+ *
20
+ * The analysis is forward, meaning it propagates information from predecessors to successors.
21
+ *
22
+ */
23
+ import { Stmt } from '../base/Stmt';
24
+ import { BaseImplicitGraph, NodeID } from '../graph/BaseImplicitGraph';
25
+ import { ArkMethod } from '../model/ArkMethod';
26
+ import { DataFlowProblem, TransferFunction, FlowGraph } from './GenericDataFlow';
27
+ import { SparseBitVector } from '../../utils/SparseBitVector';
28
+ type RDNode = Stmt;
29
+ type DFNodeCollection = SparseBitVector;
30
+ export declare class ReachingDefProblem implements DataFlowProblem<NodeID, DFNodeCollection> {
31
+ flowGraph: ReachingDefFlowGraph;
32
+ transferFunction: ReachingDefTransferFunction;
33
+ meet: (a: DFNodeCollection, b: DFNodeCollection) => DFNodeCollection;
34
+ initIn: Map<NodeID, DFNodeCollection>;
35
+ initOut: Map<NodeID, DFNodeCollection>;
36
+ forward: boolean;
37
+ empty: DFNodeCollection;
38
+ constructor(method: ArkMethod, forward?: boolean);
39
+ }
40
+ /**
41
+ * Represents the control flow graph (CFG) for reaching definitions analysis.
42
+ * This class implements the FlowGraph interface and provides methods to retrieve
43
+ * successors and predecessors of nodes, as well as topological orderings of nodes.
44
+ */
45
+ declare class ReachingDefFlowGraph extends BaseImplicitGraph<RDNode> implements FlowGraph<NodeID> {
46
+ nodesInPostOrder: NodeID[];
47
+ constructor(method: ArkMethod);
48
+ getGraphName(): string;
49
+ dumpNodes(): void;
50
+ private initSuccPred;
51
+ }
52
+ /**
53
+ * Represents the transfer function for reaching definitions analysis.
54
+ */
55
+ export declare class ReachingDefTransferFunction implements TransferFunction<NodeID, DFNodeCollection> {
56
+ gen: DFNodeCollection;
57
+ kill: Map<NodeID, DFNodeCollection>;
58
+ constructor(flowGraph: ReachingDefFlowGraph);
59
+ apply(n: NodeID, x: DFNodeCollection): DFNodeCollection;
60
+ private initGenKill;
61
+ }
62
+ export {};
63
+ //# sourceMappingURL=ReachingDef.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReachingDef.d.ts","sourceRoot":"","sources":["../../../src/core/dataflow/ReachingDef.ts"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAiB,IAAI,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG9D,KAAK,MAAM,GAAG,IAAI,CAAC;AACnB,KAAK,gBAAgB,GAAG,eAAe,CAAC;AAIxC,qBAAa,kBAAmB,YAAW,eAAe,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAChF,SAAS,EAAE,oBAAoB,CAAC;IAChC,gBAAgB,EAAE,2BAA2B,CAAC;IAC9C,IAAI,EAAE,CAAC,CAAC,EAAE,gBAAgB,EAAE,CAAC,EAAE,gBAAgB,KAAK,gBAAgB,CAAC;IACrE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IACtC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IACvC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,gBAAgB,CAAuB;gBAElC,MAAM,EAAE,SAAS,EAAE,OAAO,GAAE,OAAc;CAYzD;AAED;;;;GAIG;AACH,cAAM,oBAAqB,SAAQ,iBAAiB,CAAC,MAAM,CAAE,YAAW,SAAS,CAAC,MAAM,CAAC;IACrF,gBAAgB,EAAE,MAAM,EAAE,CAAC;gBAEf,MAAM,EAAE,SAAS;IAc7B,YAAY,IAAI,MAAM;IAItB,SAAS,IAAI,IAAI;IAIjB,OAAO,CAAC,YAAY;CAyCvB;AAED;;GAEG;AACH,qBAAa,2BAA4B,YAAW,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAC1F,GAAG,EAAE,gBAAgB,CAAC;IACtB,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;gBAExB,SAAS,EAAE,oBAAoB;IAM3C,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,gBAAgB,GAAG,gBAAgB;IAevD,OAAO,CAAC,WAAW;CAsBtB"}
@@ -0,0 +1,168 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.ReachingDefTransferFunction = exports.ReachingDefProblem = void 0;
18
+ /**
19
+ * Reaching Definitions Data Flow Analysis
20
+ *
21
+ * This module implements the Reaching Definitions data flow analysis algorithm.
22
+ * Reaching Definitions is a forward data flow analysis that determines, for each
23
+ * program point, the set of variable definitions (assignments) that may reach
24
+ * that point without being overwritten.
25
+ *
26
+ * Key Components:
27
+ * 1. **Transfer Function**:
28
+ * - Computes the out set for each node based on its in set.
29
+ * - Uses gen and kill sets to model the effects of assignments:
30
+ * - **gen**: The set of definitions generated by the current node.
31
+ * - **kill**: The set of definitions killed (overwritten) by the current node.
32
+ *
33
+ * 2. **Meet Operation**:
34
+ * - Combines data flow values from multiple paths (e.g., union for reaching definitions).
35
+ * - Ensures that the analysis is conservative (safe) by over-approximating the result.
36
+ *
37
+ * The analysis is forward, meaning it propagates information from predecessors to successors.
38
+ *
39
+ */
40
+ const Stmt_1 = require("../base/Stmt");
41
+ const BaseImplicitGraph_1 = require("../graph/BaseImplicitGraph");
42
+ const SparseBitVector_1 = require("../../utils/SparseBitVector");
43
+ let coCtor = SparseBitVector_1.SparseBitVector;
44
+ const BV_SIZE = 32;
45
+ class ReachingDefProblem {
46
+ constructor(method, forward = true) {
47
+ this.empty = new coCtor(BV_SIZE);
48
+ this.flowGraph = new ReachingDefFlowGraph(method);
49
+ this.transferFunction = new ReachingDefTransferFunction(this.flowGraph);
50
+ this.meet = (x, y) => {
51
+ let r = x.clone();
52
+ r.unionWith(y);
53
+ return r;
54
+ };
55
+ this.initIn = new Map(this.flowGraph.nodesInPostOrder.map((i) => [i, new coCtor(BV_SIZE)]));
56
+ this.initOut = new Map(this.flowGraph.nodesInPostOrder.map((i) => [i, new coCtor(BV_SIZE)]));
57
+ this.forward = forward;
58
+ }
59
+ }
60
+ exports.ReachingDefProblem = ReachingDefProblem;
61
+ /**
62
+ * Represents the control flow graph (CFG) for reaching definitions analysis.
63
+ * This class implements the FlowGraph interface and provides methods to retrieve
64
+ * successors and predecessors of nodes, as well as topological orderings of nodes.
65
+ */
66
+ class ReachingDefFlowGraph extends BaseImplicitGraph_1.BaseImplicitGraph {
67
+ constructor(method) {
68
+ super();
69
+ const cfg = method.getCfg();
70
+ if (!cfg) {
71
+ throw new Error('CFG not found');
72
+ }
73
+ const nodes = cfg.getStmts();
74
+ this.nodeToIdMap = new Map(nodes.map((x, i) => [x, i]));
75
+ this.nodesInPostOrder = nodes.map((_, i) => i);
76
+ this.initSuccPred(nodes, cfg);
77
+ }
78
+ getGraphName() {
79
+ return 'Reaching Definition Flow Graph';
80
+ }
81
+ dumpNodes() {
82
+ var _a;
83
+ (_a = this.nodeToIdMap) === null || _a === void 0 ? void 0 : _a.forEach((id, node) => console.log(id + ': ' + node.toString()));
84
+ }
85
+ initSuccPred(nodes, cfg) {
86
+ this.succMap = new Map();
87
+ this.predMap = new Map();
88
+ cfg.getBlocks().forEach((bb) => {
89
+ let stmts = bb.getStmts();
90
+ if (stmts.length === 0) {
91
+ return;
92
+ }
93
+ for (let i = 0; i < stmts.length - 1; i++) {
94
+ let c = this.nodeToIdMap.get(stmts[i]);
95
+ let n = this.nodeToIdMap.get(stmts[i + 1]);
96
+ this.succMap.set(c, [n]);
97
+ this.predMap.set(n, [c]);
98
+ }
99
+ let terminate = bb.getTail();
100
+ if (!terminate) {
101
+ throw new Error('cfg has no terminal');
102
+ }
103
+ bb.getSuccessors().forEach((succBB) => {
104
+ var _a, _b, _c, _d;
105
+ let head = succBB.getHead();
106
+ if (!head) {
107
+ return;
108
+ }
109
+ let t = (_a = this.nodeToIdMap) === null || _a === void 0 ? void 0 : _a.get(terminate);
110
+ let h = (_b = this.nodeToIdMap) === null || _b === void 0 ? void 0 : _b.get(head);
111
+ // Terminate's succ
112
+ let succ = (_c = this.succMap.get(t)) !== null && _c !== void 0 ? _c : [];
113
+ succ.push(h);
114
+ this.succMap.set(t, succ);
115
+ // Head's pred
116
+ let pred = (_d = this.predMap.get(h)) !== null && _d !== void 0 ? _d : [];
117
+ pred.push(t);
118
+ this.predMap.set(h, pred);
119
+ });
120
+ });
121
+ }
122
+ }
123
+ /**
124
+ * Represents the transfer function for reaching definitions analysis.
125
+ */
126
+ class ReachingDefTransferFunction {
127
+ constructor(flowGraph) {
128
+ this.gen = new coCtor(BV_SIZE);
129
+ this.kill = new Map();
130
+ this.initGenKill(flowGraph);
131
+ }
132
+ apply(n, x) {
133
+ const result = x.clone();
134
+ if (this.gen.test(n)) {
135
+ result.set(n);
136
+ }
137
+ const killSet = this.kill.get(n);
138
+ if (killSet) {
139
+ for (const item of killSet) {
140
+ result.reset(item);
141
+ }
142
+ }
143
+ return result;
144
+ }
145
+ initGenKill(g) {
146
+ let genValue2Nodes = new Map();
147
+ // Init Gen
148
+ g.getNodeToIdMap().forEach((id, node) => {
149
+ var _a;
150
+ if (node instanceof Stmt_1.ArkAssignStmt) {
151
+ let lop = node.getLeftOp();
152
+ let genNodes = (_a = genValue2Nodes.get(lop)) !== null && _a !== void 0 ? _a : new coCtor(BV_SIZE);
153
+ genNodes.set(id);
154
+ genValue2Nodes.set(lop, genNodes);
155
+ this.gen.set(id);
156
+ }
157
+ });
158
+ // Init Kill
159
+ genValue2Nodes.forEach((defNodes, v) => {
160
+ for (const i of defNodes) {
161
+ const killSet = defNodes.clone();
162
+ killSet.reset(i);
163
+ this.kill.set(i, killSet);
164
+ }
165
+ });
166
+ }
167
+ }
168
+ exports.ReachingDefTransferFunction = ReachingDefTransferFunction;
@@ -1,10 +1,5 @@
1
- export type NodeID = number;
2
- export type Kind = number;
3
- export interface GraphTraits {
4
- nodesItor(): IterableIterator<BaseNode>;
5
- getGraphName(): string;
6
- getNode(id: NodeID): BaseNode | undefined;
7
- }
1
+ import { Kind, NodeID, GraphTraits } from './GraphTraits';
2
+ export { Kind, NodeID };
8
3
  export declare abstract class BaseEdge {
9
4
  private src;
10
5
  private dst;
@@ -44,7 +39,7 @@ export declare abstract class BaseNode {
44
39
  getDotAttr(): string;
45
40
  abstract getDotLabel(): string;
46
41
  }
47
- export declare abstract class BaseExplicitGraph implements GraphTraits {
42
+ export declare abstract class BaseExplicitGraph implements GraphTraits<BaseNode> {
48
43
  protected edgeNum: number;
49
44
  protected nodeNum: number;
50
45
  protected idToNodeMap: Map<NodeID, BaseNode>;
@@ -1 +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IAAI;IAIlC,kBAAkB,CAAC,CAAC,EAAE,QAAQ,GAAG,OAAO;IAIxC,kBAAkB,CAAC,CAAC,EAAE,QAAQ,GAAG,OAAO;IAIxC,eAAe,IAAI,GAAG,CAAC,QAAQ,CAAC;IAIhC,gBAAgB,IAAI,GAAG,CAAC,QAAQ,CAAC;IAIjC,UAAU,IAAI,MAAM;aAIX,WAAW,IAAI,MAAM;CACxC;AAED,8BAAsB,iBAAkB,YAAW,WAAW,CAAC,QAAQ,CAAC;IACpE,SAAS,CAAC,OAAO,EAAE,MAAM,CAAK;IAC9B,SAAS,CAAC,OAAO,EAAE,MAAM,CAAK;IAC9B,SAAS,CAAC,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC7C,SAAS,CAAC,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;;IAO5B,UAAU,IAAI,MAAM;IAIpB,SAAS,IAAI,gBAAgB,CAAC,QAAQ,CAAC;IAIvC,OAAO,CAAC,CAAC,EAAE,QAAQ,GAAG,IAAI;IAK1B,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS;IAQzC,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAI5B,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAQ/B,OAAO,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO;IAU9C,cAAc,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO;IAUvC,YAAY,IAAI,gBAAgB,CAAC,QAAQ,CAAC;aAIjC,YAAY,IAAI,MAAM;CACzC"}
@@ -0,0 +1,78 @@
1
+ import { NodeID, GraphTraits } from './GraphTraits';
2
+ export { NodeID };
3
+ /**
4
+ * BaseImplicitGraph is an abstract class that represents an implicit graph.
5
+ * An implicit graph is a graph representation where node and edge information is implicitly stored using maps.
6
+ * This class implements the GraphTraits<Node> interface and provides basic graph operations.
7
+ */
8
+ export declare abstract class BaseImplicitGraph<Node> implements GraphTraits<Node> {
9
+ /**
10
+ * idToNodeMap is an optional map that maps node IDs (NodeID) to node objects (Node).
11
+ * If not initialized, calling related methods will throw an error.
12
+ */
13
+ protected idToNodeMap?: Map<NodeID, Node>;
14
+ /**
15
+ * nodeToIdMap is a map that maps node objects (Node) to node IDs (NodeID).
16
+ * This map must be initialized in the subclass.
17
+ */
18
+ protected nodeToIdMap: Map<Node, NodeID>;
19
+ /**
20
+ * succMap is a map that stores the successors of each node.
21
+ * The key is a node ID (NodeID), and the value is an array of successor node IDs.
22
+ */
23
+ succMap: Map<NodeID, NodeID[]>;
24
+ /**
25
+ * predMap is a map that stores the predecessors of each node.
26
+ * The key is a node ID (NodeID), and the value is an array of predecessor node IDs.
27
+ */
28
+ predMap: Map<NodeID, NodeID[]>;
29
+ constructor();
30
+ /**
31
+ * Gets the number of nodes in the graph.
32
+ * @returns The number of nodes in the graph.
33
+ */
34
+ getNodeNum(): number;
35
+ /**
36
+ * Returns an iterator for all nodes in the graph.
37
+ * @returns An iterator for traversing all nodes in the graph.
38
+ */
39
+ nodesItor(): IterableIterator<Node>;
40
+ /**
41
+ * Gets the node object corresponding to a given node ID.
42
+ * @param id The node ID.
43
+ * @returns The corresponding node object.
44
+ * @throws Throws an error if idToNodeMap is not initialized or if the node is not found.
45
+ */
46
+ getNode(id: NodeID): Node;
47
+ /**
48
+ * Checks whether the graph contains a specific node ID.
49
+ * @param id The node ID.
50
+ * @returns Returns true if the node ID exists in the graph; otherwise, returns false.
51
+ * @throws Throws an error if idToNodeMap is not initialized.
52
+ */
53
+ hasNode(id: NodeID): boolean;
54
+ /**
55
+ * Gets the list of successor node IDs for a given node.
56
+ * @param id The node ID.
57
+ * @returns An array of successor node IDs. Returns an empty array if no successors are found.
58
+ */
59
+ succ(id: NodeID): NodeID[];
60
+ /**
61
+ * Gets the list of predecessor node IDs for a given node.
62
+ * @param id The node ID.
63
+ * @returns An array of predecessor node IDs. Returns an empty array if no predecessors are found.
64
+ */
65
+ pred(id: NodeID): NodeID[];
66
+ /**
67
+ * Gets the nodeToIdMap, which maps node objects to node IDs.
68
+ * @returns The nodeToIdMap.
69
+ */
70
+ getNodeToIdMap(): Map<Node, NodeID>;
71
+ /**
72
+ * Abstract method to get the name of the graph.
73
+ * Subclasses must implement this method.
74
+ * @returns The name of the graph.
75
+ */
76
+ abstract getGraphName(): string;
77
+ }
78
+ //# sourceMappingURL=BaseImplicitGraph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseImplicitGraph.d.ts","sourceRoot":"","sources":["../../../src/core/graph/BaseImplicitGraph.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEpD,OAAO,EAAE,MAAM,EAAE,CAAC;AAElB;;;;GAIG;AACH,8BAAsB,iBAAiB,CAAC,IAAI,CAAE,YAAW,WAAW,CAAC,IAAI,CAAC;IACtE;;;OAGG;IACH,SAAS,CAAC,WAAW,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAE1C;;;OAGG;IACH,SAAS,CAAC,WAAW,EAAG,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAE1C;;;OAGG;IACH,OAAO,EAAG,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAEhC;;;OAGG;IACH,OAAO,EAAG,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;;IAIhC;;;OAGG;IACI,UAAU,IAAI,MAAM;IAI3B;;;OAGG;IACI,SAAS,IAAI,gBAAgB,CAAC,IAAI,CAAC;IAI1C;;;;;OAKG;IACI,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAYhC;;;;;OAKG;IACI,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAQnC;;;;OAIG;IACI,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE;IAIjC;;;;OAIG;IACI,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE;IAIjC;;;OAGG;IACI,cAAc,IAAI,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC;IAI1C;;;;OAIG;aACa,YAAY,IAAI,MAAM;CACzC"}
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseImplicitGraph = void 0;
4
+ /**
5
+ * BaseImplicitGraph is an abstract class that represents an implicit graph.
6
+ * An implicit graph is a graph representation where node and edge information is implicitly stored using maps.
7
+ * This class implements the GraphTraits<Node> interface and provides basic graph operations.
8
+ */
9
+ class BaseImplicitGraph {
10
+ constructor() { }
11
+ /**
12
+ * Gets the number of nodes in the graph.
13
+ * @returns The number of nodes in the graph.
14
+ */
15
+ getNodeNum() {
16
+ return this.nodeToIdMap.size;
17
+ }
18
+ /**
19
+ * Returns an iterator for all nodes in the graph.
20
+ * @returns An iterator for traversing all nodes in the graph.
21
+ */
22
+ nodesItor() {
23
+ return this.nodeToIdMap.keys();
24
+ }
25
+ /**
26
+ * Gets the node object corresponding to a given node ID.
27
+ * @param id The node ID.
28
+ * @returns The corresponding node object.
29
+ * @throws Throws an error if idToNodeMap is not initialized or if the node is not found.
30
+ */
31
+ getNode(id) {
32
+ if (!this.idToNodeMap) {
33
+ throw new Error(`initialize this.idToNodeMap first`);
34
+ }
35
+ if (!this.idToNodeMap.has(id)) {
36
+ throw new Error(`Can find Node # ${id}`);
37
+ }
38
+ return this.idToNodeMap.get(id);
39
+ }
40
+ /**
41
+ * Checks whether the graph contains a specific node ID.
42
+ * @param id The node ID.
43
+ * @returns Returns true if the node ID exists in the graph; otherwise, returns false.
44
+ * @throws Throws an error if idToNodeMap is not initialized.
45
+ */
46
+ hasNode(id) {
47
+ if (!this.idToNodeMap) {
48
+ throw new Error(`initialize this.idToNodeMap first`);
49
+ }
50
+ return this.idToNodeMap.has(id);
51
+ }
52
+ /**
53
+ * Gets the list of successor node IDs for a given node.
54
+ * @param id The node ID.
55
+ * @returns An array of successor node IDs. Returns an empty array if no successors are found.
56
+ */
57
+ succ(id) {
58
+ var _a;
59
+ return (_a = this.succMap.get(id)) !== null && _a !== void 0 ? _a : [];
60
+ }
61
+ /**
62
+ * Gets the list of predecessor node IDs for a given node.
63
+ * @param id The node ID.
64
+ * @returns An array of predecessor node IDs. Returns an empty array if no predecessors are found.
65
+ */
66
+ pred(id) {
67
+ var _a;
68
+ return (_a = this.predMap.get(id)) !== null && _a !== void 0 ? _a : [];
69
+ }
70
+ /**
71
+ * Gets the nodeToIdMap, which maps node objects to node IDs.
72
+ * @returns The nodeToIdMap.
73
+ */
74
+ getNodeToIdMap() {
75
+ return this.nodeToIdMap;
76
+ }
77
+ }
78
+ exports.BaseImplicitGraph = BaseImplicitGraph;
@@ -0,0 +1,8 @@
1
+ export type NodeID = number;
2
+ export type Kind = number;
3
+ export interface GraphTraits<Node> {
4
+ nodesItor(): IterableIterator<Node>;
5
+ getGraphName(): string;
6
+ getNode(id: NodeID): Node | undefined;
7
+ }
8
+ //# sourceMappingURL=GraphTraits.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphTraits.d.ts","sourceRoot":"","sources":["../../../src/core/graph/GraphTraits.ts"],"names":[],"mappings":"AAeA,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC;AAC5B,MAAM,MAAM,IAAI,GAAG,MAAM,CAAC;AAE1B,MAAM,WAAW,WAAW,CAAC,IAAI;IAC7B,SAAS,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACpC,YAAY,IAAI,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACzC"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2024 Huawei Device Co., Ltd.
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,5 @@
1
- import { NodeID, GraphTraits } from './BaseExplicitGraph';
1
+ import { BaseNode } from './BaseExplicitGraph';
2
+ import { NodeID, GraphTraits } from './GraphTraits';
2
3
  type NodeSet = Set<NodeID>;
3
4
  type NodeStack = NodeID[];
4
5
  type Node2RepSCCInfoMap = Map<NodeID, NodeSCCInfo>;
@@ -21,7 +22,7 @@ declare class NodeSCCInfo {
21
22
  * Wave Propagation and Deep Propagation for pointer Analysis
22
23
  * CGO 2009
23
24
  */
24
- export declare class SCCDetection<Graph extends GraphTraits> {
25
+ export declare class SCCDetection<Graph extends GraphTraits<BaseNode>> {
25
26
  private _G;
26
27
  private _I;
27
28
  private _D;
@@ -1 +1 @@
1
- {"version":3,"file":"Scc.d.ts","sourceRoot":"","sources":["../../../src/core/graph/Scc.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,MAAM,EAAY,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEpE,KAAK,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC;AAC3B,KAAK,SAAS,GAAG,MAAM,EAAE,CAAC;AAC1B,KAAK,kBAAkB,GAAG,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AAGnD;;GAEG;AACH,cAAM,WAAW;IACb,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,SAAS,CAAU;;IAO3B,IAAI,GAAG,IAAI,MAAM,CAEhB;IAED,IAAI,GAAG,CAAC,CAAC,EAAE,MAAM,EAEhB;IAED,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,IAA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AG,OAAO;IAMjC,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO;IAc/B,WAAW,IAAI,OAAO;CAGhC"}
@@ -106,7 +106,7 @@ class SCCDetection {
106
106
  this.setRep(v, v);
107
107
  this.setVisited(v);
108
108
  let node = this.getNode(v);
109
- node.getOutgoingEdges().forEach(e => {
109
+ node.getOutgoingEdges().forEach((e) => {
110
110
  let w = e.getDstID();
111
111
  if (!this.isVisited(w)) {
112
112
  this.visit(w);
package/lib/index.d.ts CHANGED
@@ -44,7 +44,7 @@ export { Cfg } from './core/graph/Cfg';
44
44
  export { ViewTree, ViewTreeNode } from './core/graph/ViewTree';
45
45
  export { DominanceFinder } from './core/graph/DominanceFinder';
46
46
  export { DominanceTree } from './core/graph/DominanceTree';
47
- export { NodeID, Kind, GraphTraits, BaseEdge, BaseNode, BaseExplicitGraph } from './core/graph/BaseExplicitGraph';
47
+ export { NodeID, Kind, BaseEdge, BaseNode, BaseExplicitGraph } from './core/graph/BaseExplicitGraph';
48
48
  export { SCCDetection } from './core/graph/Scc';
49
49
  export { ArkFile } from './core/model/ArkFile';
50
50
  export { ArkNamespace } from './core/model/ArkNamespace';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAG5E,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAGzE,cAAc,6BAA6B,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAG9E,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AACh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AAO,EAAE,EAAE,EAAE,CAAC"}
@@ -1,6 +1,7 @@
1
- import { BaseEdge, GraphTraits, NodeID } from "../core/graph/BaseExplicitGraph";
2
- import { Printer } from "./Printer";
3
- export declare class GraphPrinter<GraphType extends GraphTraits> extends Printer {
1
+ import { BaseEdge, BaseNode, NodeID } from '../core/graph/BaseExplicitGraph';
2
+ import { GraphTraits } from '../core/graph/GraphTraits';
3
+ import { Printer } from './Printer';
4
+ export declare class GraphPrinter<GraphType extends GraphTraits<BaseNode>> extends Printer {
4
5
  graph: GraphType;
5
6
  title: string;
6
7
  startID: NodeID | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"GraphPrinter.d.ts","sourceRoot":"","sources":["../../src/save/GraphPrinter.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,QAAQ,EAAY,WAAW,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAC1F,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA+CpC,qBAAa,YAAY,CAAC,SAAS,SAAS,WAAW,CAAE,SAAQ,OAAO;IACpE,KAAK,EAAE,SAAS,CAAC;IACjB,KAAK,EAAG,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,GAAG,SAAS,CAAa;gBAE5B,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,MAAM;IAQ7B,UAAU,CAAC,CAAC,EAAE,MAAM;IAIpB,IAAI,IAAI,MAAM;IAMd,UAAU,IAAI,IAAI;IAMlB,UAAU,IAAI,IAAI;IAmClB,SAAS,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI;IAQ/B,WAAW,IAAI,IAAI;IAanB,WAAW,IAAI,IAAI;CAG7B"}
1
+ {"version":3,"file":"GraphPrinter.d.ts","sourceRoot":"","sources":["../../src/save/GraphPrinter.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,WAAW,EA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