arkanalyzer 1.0.91 → 1.0.93
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/lib/Scene.d.ts +15 -0
- package/lib/Scene.d.ts.map +1 -1
- package/lib/Scene.js +39 -0
- package/lib/callgraph/algorithm/AbstractAnalysis.d.ts +6 -0
- package/lib/callgraph/algorithm/AbstractAnalysis.d.ts.map +1 -1
- package/lib/callgraph/algorithm/AbstractAnalysis.js +17 -8
- package/lib/callgraph/algorithm/ClassHierarchyAnalysis.d.ts +1 -0
- package/lib/callgraph/algorithm/ClassHierarchyAnalysis.d.ts.map +1 -1
- package/lib/callgraph/algorithm/ClassHierarchyAnalysis.js +9 -3
- package/lib/callgraph/algorithm/RapidTypeAnalysis.d.ts +147 -0
- package/lib/callgraph/algorithm/RapidTypeAnalysis.d.ts.map +1 -1
- package/lib/callgraph/algorithm/RapidTypeAnalysis.js +803 -76
- package/lib/callgraph/model/CallGraph.d.ts +1 -0
- package/lib/callgraph/model/CallGraph.d.ts.map +1 -1
- package/lib/callgraph/model/CallGraph.js +4 -0
- package/lib/callgraph/model/CallSite.d.ts +88 -1
- package/lib/callgraph/model/CallSite.d.ts.map +1 -1
- package/lib/callgraph/model/CallSite.js +58 -4
- package/lib/core/common/ArkIRTransformer.d.ts.map +1 -1
- package/lib/core/common/ArkIRTransformer.js +1 -1
- package/lib/core/common/IRInference.js +2 -2
- package/lib/core/common/SdkUtils.js +1 -1
- package/lib/core/common/TypeInference.d.ts.map +1 -1
- package/lib/core/common/TypeInference.js +3 -0
- package/lib/core/graph/builder/SwitchBuilder.d.ts.map +1 -1
- package/lib/core/graph/builder/SwitchBuilder.js +11 -1
- package/lib/core/graph/builder/ViewTreeBuilder.d.ts +13 -3
- package/lib/core/graph/builder/ViewTreeBuilder.d.ts.map +1 -1
- package/lib/core/graph/builder/ViewTreeBuilder.js +271 -86
- package/lib/core/model/ArkModule.d.ts +9 -12
- package/lib/core/model/ArkModule.d.ts.map +1 -1
- package/lib/core/model/ArkModule.js +7 -10
- package/lib/core/model/builder/ArkClassBuilder.js +10 -4
- package/lib/core/model/builder/ArkMethodBuilder.d.ts +2 -1
- package/lib/core/model/builder/ArkMethodBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/ArkMethodBuilder.js +5 -1
- package/lib/frontend/FrontendBuilder.d.ts +8 -10
- package/lib/frontend/FrontendBuilder.d.ts.map +1 -1
- package/lib/frontend/FrontendBuilder.js +9 -17
- package/lib/frontend/common/ModuleAnalysisConfig.d.ts +8 -1
- package/lib/frontend/common/ModuleAnalysisConfig.d.ts.map +1 -1
- package/lib/frontend/common/ModuleAnalysisConfig.js +10 -1
- package/lib/frontend/common/ModuleBuilder.d.ts +44 -33
- package/lib/frontend/common/ModuleBuilder.d.ts.map +1 -1
- package/lib/frontend/common/ModuleBuilder.js +195 -66
- package/lib/frontend/common/ModuleCache.d.ts +1 -0
- package/lib/frontend/common/ModuleCache.d.ts.map +1 -1
- package/lib/frontend/common/ModuleCache.js +1 -0
- package/lib/frontend/common/ModuleDepth.d.ts +19 -14
- package/lib/frontend/common/ModuleDepth.d.ts.map +1 -1
- package/lib/frontend/common/ModuleDepth.js +25 -15
- package/lib/frontend/cppFrontend/graph/builder/SwitchBuilder.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/graph/builder/SwitchBuilder.js +11 -1
- package/package.json +1 -1
|
@@ -189,6 +189,7 @@ function buildStruct2ArkClass(clsNode, cls, sourceFile, declaringMethod) {
|
|
|
189
189
|
initHeritage((0, builderUtils_1.buildHeritageClauses)(clsNode.heritageClauses), cls);
|
|
190
190
|
cls.setModifiers((0, builderUtils_1.buildModifiers)(clsNode));
|
|
191
191
|
cls.setDecorators((0, builderUtils_1.buildDecorators)(clsNode, sourceFile));
|
|
192
|
+
registerCustomComponentIfNeeded(cls);
|
|
192
193
|
cls.setCategory(ArkClass_1.ClassCategory.STRUCT);
|
|
193
194
|
init4InstanceInitMethod(cls);
|
|
194
195
|
init4StaticInitMethod(cls);
|
|
@@ -207,6 +208,7 @@ function buildClass2ArkClass(clsNode, cls, sourceFile, declaringMethod) {
|
|
|
207
208
|
initHeritage((0, builderUtils_1.buildHeritageClauses)(clsNode.heritageClauses), cls);
|
|
208
209
|
cls.setModifiers((0, builderUtils_1.buildModifiers)(clsNode));
|
|
209
210
|
cls.setDecorators((0, builderUtils_1.buildDecorators)(clsNode, sourceFile));
|
|
211
|
+
registerCustomComponentIfNeeded(cls);
|
|
210
212
|
cls.setCategory(ArkClass_1.ClassCategory.CLASS);
|
|
211
213
|
init4InstanceInitMethod(cls);
|
|
212
214
|
init4StaticInitMethod(cls);
|
|
@@ -225,6 +227,10 @@ function initHeritage(heritageClauses, cls) {
|
|
|
225
227
|
cls.addHeritageClassName(key);
|
|
226
228
|
}
|
|
227
229
|
}
|
|
230
|
+
/** Register @Component into Scene.customComponentMap while the class is being built. */
|
|
231
|
+
function registerCustomComponentIfNeeded(cls) {
|
|
232
|
+
cls.getDeclaringArkFile().getScene().registerCustomComponent(cls);
|
|
233
|
+
}
|
|
228
234
|
function buildInterface2ArkClass(clsNode, cls, sourceFile, declaringMethod) {
|
|
229
235
|
var _a;
|
|
230
236
|
const className = genClassName(clsNode.name ? (0, StringUtils_1.cloneText)(clsNode.name.text) : '', cls, declaringMethod);
|
|
@@ -285,7 +291,7 @@ function buildObjectLiteralExpression2ArkClass(clsNode, cls, sourceFile, declari
|
|
|
285
291
|
(0, ArkMethodBuilder_1.buildArkMethodFromArkClass)(property, cls, arkMethod, sourceFile);
|
|
286
292
|
}
|
|
287
293
|
});
|
|
288
|
-
(0, ArkMethodBuilder_1.buildInitMethod)(cls.getInstanceInitMethod(), instanceFieldInitializerStmts, instanceIRTransformer.getThisLocal());
|
|
294
|
+
(0, ArkMethodBuilder_1.buildInitMethod)(cls.getInstanceInitMethod(), instanceFieldInitializerStmts, instanceIRTransformer.getThisLocal(), instanceIRTransformer.getGlobals());
|
|
289
295
|
arkMethods.forEach(mtd => {
|
|
290
296
|
(0, ArkMethodBuilder_1.checkAndUpdateMethod)(mtd, cls);
|
|
291
297
|
cls.addMethod(mtd);
|
|
@@ -367,11 +373,11 @@ function buildArkClassMembers(clsNode, cls, sourceFile) {
|
|
|
367
373
|
}
|
|
368
374
|
});
|
|
369
375
|
if (ohos_typescript_1.default.isClassDeclaration(clsNode) || ohos_typescript_1.default.isClassExpression(clsNode) || ohos_typescript_1.default.isStructDeclaration(clsNode)) {
|
|
370
|
-
(0, ArkMethodBuilder_1.buildInitMethod)(cls.getInstanceInitMethod(), instanceInitStmts, instanceIRTransformer.getThisLocal());
|
|
371
|
-
(0, ArkMethodBuilder_1.buildInitMethod)(cls.getStaticInitMethod(), staticInitStmts, staticIRTransformer.getThisLocal());
|
|
376
|
+
(0, ArkMethodBuilder_1.buildInitMethod)(cls.getInstanceInitMethod(), instanceInitStmts, instanceIRTransformer.getThisLocal(), instanceIRTransformer.getGlobals());
|
|
377
|
+
(0, ArkMethodBuilder_1.buildInitMethod)(cls.getStaticInitMethod(), staticInitStmts, staticIRTransformer.getThisLocal(), staticIRTransformer.getGlobals());
|
|
372
378
|
}
|
|
373
379
|
if (ohos_typescript_1.default.isEnumDeclaration(clsNode)) {
|
|
374
|
-
(0, ArkMethodBuilder_1.buildInitMethod)(cls.getStaticInitMethod(), staticInitStmts, staticIRTransformer.getThisLocal());
|
|
380
|
+
(0, ArkMethodBuilder_1.buildInitMethod)(cls.getStaticInitMethod(), staticInitStmts, staticIRTransformer.getThisLocal(), staticIRTransformer.getGlobals());
|
|
375
381
|
}
|
|
376
382
|
}
|
|
377
383
|
function isClassMethod(member) {
|
|
@@ -2,6 +2,7 @@ import { Type } from '../../base/Type';
|
|
|
2
2
|
import { ArkClass } from '../ArkClass';
|
|
3
3
|
import { ArkMethod } from '../ArkMethod';
|
|
4
4
|
import ts from 'ohos-typescript';
|
|
5
|
+
import { GlobalRef } from '../../base/Ref';
|
|
5
6
|
import { Stmt } from '../../base/Stmt';
|
|
6
7
|
import { Local } from '../../base/Local';
|
|
7
8
|
import { Value } from '../../base/Value';
|
|
@@ -59,7 +60,7 @@ export declare class MethodParameter implements Value {
|
|
|
59
60
|
}
|
|
60
61
|
export declare function needDefaultConstructorInClass(arkClass: ArkClass): boolean;
|
|
61
62
|
export declare function buildDefaultConstructor(arkClass: ArkClass, visited?: Set<ArkClass>): boolean;
|
|
62
|
-
export declare function buildInitMethod(initMethod: ArkMethod, fieldInitializerStmts: Stmt[], thisLocal: Local): void;
|
|
63
|
+
export declare function buildInitMethod(initMethod: ArkMethod, fieldInitializerStmts: Stmt[], thisLocal: Local, globals?: Map<string, GlobalRef> | null): void;
|
|
63
64
|
export declare function addInitInConstructor(constructor: ArkMethod): void;
|
|
64
65
|
export declare function isMethodImplementation(node: MethodLikeNode): boolean;
|
|
65
66
|
export declare function checkAndUpdateMethod(method: ArkMethod, cls: ArkClass): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArkMethodBuilder.d.ts","sourceRoot":"","sources":["../../../../src/core/model/builder/ArkMethodBuilder.ts"],"names":[],"mappings":"AAeA,OAAO,EAAa,IAAI,EAAe,MAAM,iBAAiB,CAAC;AAG/D,OAAO,EAAE,QAAQ,EAAiB,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"ArkMethodBuilder.d.ts","sourceRoot":"","sources":["../../../../src/core/model/builder/ArkMethodBuilder.ts"],"names":[],"mappings":"AAeA,OAAO,EAAa,IAAI,EAAe,MAAM,iBAAiB,CAAC;AAG/D,OAAO,EAAE,QAAQ,EAAiB,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAYjC,OAAO,EAAgD,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAKzF,OAAO,EAAk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AAE,QAAQ,GAAG,OAAO,CASzE;AAmBD,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,GAAE,GAAG,CAAC,QAAQ,CAAa,GAAG,OAAO,CAwDvG;AAED,wBAAgB,eAAe,CAC3B,UAAU,EAAE,SAAS,EACrB,qBAAqB,EAAE,IAAI,EAAE,EAC7B,SAAS,EAAE,KAAK,EAChB,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAI,GACxC,IAAI,CA0BN;AAED,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,SAAS,GAAG,IAAI,CA+BjE;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAepE;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,QAAQ,GAAG,IAAI,CAW3E;AAED,wBAAgB,iCAAiC,CAAC,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,SAAS,GAAG,IAAI,CAmCnG;AAED,wBAAgB,wBAAwB,CAAC,WAAW,EAAE,SAAS,GAAG,IAAI,CA8CrE"}
|
|
@@ -367,7 +367,8 @@ function buildDefaultConstructor(arkClass, visited = new Set()) {
|
|
|
367
367
|
return true;
|
|
368
368
|
}
|
|
369
369
|
exports.buildDefaultConstructor = buildDefaultConstructor;
|
|
370
|
-
function buildInitMethod(initMethod, fieldInitializerStmts, thisLocal) {
|
|
370
|
+
function buildInitMethod(initMethod, fieldInitializerStmts, thisLocal, globals) {
|
|
371
|
+
var _a;
|
|
371
372
|
const classType = new Type_1.ClassType(initMethod.getDeclaringArkClass().getSignature());
|
|
372
373
|
const assignStmt = new Stmt_1.ArkAssignStmt(thisLocal, new Ref_1.ArkThisRef(classType));
|
|
373
374
|
const block = new BasicBlock_1.BasicBlock();
|
|
@@ -390,6 +391,9 @@ function buildInitMethod(initMethod, fieldInitializerStmts, thisLocal) {
|
|
|
390
391
|
cfg.buildDefUseStmt(locals);
|
|
391
392
|
cfg.setDeclaringMethod(initMethod);
|
|
392
393
|
initMethod.setBody(new ArkBody_1.ArkBody(locals, cfg));
|
|
394
|
+
if (globals && globals.size > 0) {
|
|
395
|
+
(_a = initMethod.getBody()) === null || _a === void 0 ? void 0 : _a.setUsedGlobals(globals);
|
|
396
|
+
}
|
|
393
397
|
}
|
|
394
398
|
exports.buildInitMethod = buildInitMethod;
|
|
395
399
|
function addInitInConstructor(constructor) {
|
|
@@ -43,9 +43,9 @@ export declare class FrontendBuilder {
|
|
|
43
43
|
* registering each with the module and scene.
|
|
44
44
|
*
|
|
45
45
|
* Each shell has language, filePath, projectDir, and fileSignature set, but no ImportInfo /
|
|
46
|
-
* ExportInfo / ArkClass / ArkMethod.
|
|
47
|
-
*
|
|
48
|
-
*
|
|
46
|
+
* ExportInfo / ArkClass / ArkMethod. Callers subsequently build content via
|
|
47
|
+
* {@link buildImports} then {@link upgradeArkFileToLevel} (SIGNATURES / BODIES), or
|
|
48
|
+
* {@link buildArkFileToLevel} for a one-shot path.
|
|
49
49
|
*
|
|
50
50
|
* @param scene - The owning {@link Scene}.
|
|
51
51
|
* @param module - The module whose directory is scanned.
|
|
@@ -55,8 +55,6 @@ export declare class FrontendBuilder {
|
|
|
55
55
|
/**
|
|
56
56
|
* Dispatch level-aware building to the appropriate frontend.
|
|
57
57
|
*
|
|
58
|
-
* - META: no content is built (only the ArkFile path/basic info created by the caller).
|
|
59
|
-
* - IMPORTS: lightweight import/export parsing only.
|
|
60
58
|
* - SIGNATURES: full namespace/class/method signatures are built (parameters, return types)
|
|
61
59
|
* without method bodies, reusing {@link buildProjectFileIntoArkFile}. The mounted
|
|
62
60
|
* BodyBuilders are released here so the ArkFile holds signatures only (no ArkBody/CFG).
|
|
@@ -65,12 +63,12 @@ export declare class FrontendBuilder {
|
|
|
65
63
|
*/
|
|
66
64
|
private static buildArkFileToLevel;
|
|
67
65
|
/**
|
|
68
|
-
*
|
|
66
|
+
* Lightweight import/export parsing only (used as a step inside {@link ModuleBuilder.buildModuleToLevel}).
|
|
69
67
|
*/
|
|
70
68
|
static buildImports(arkFile: ArkFile, language: Language): void;
|
|
71
69
|
/**
|
|
72
|
-
* Upgrade an existing ArkFile (whose ImportInfo/ExportInfo were already populated
|
|
73
|
-
*
|
|
70
|
+
* Upgrade an existing ArkFile (whose ImportInfo/ExportInfo were already populated) to
|
|
71
|
+
* SIGNATURES or BODIES by building class/method/namespace signatures on top.
|
|
74
72
|
*
|
|
75
73
|
* For ArkTS files, this calls {@link ArktsFrontend.buildProjectFileForSignatures} which builds
|
|
76
74
|
* signatures with `skipImportExport = true`, preserving existing import/export data and
|
|
@@ -79,7 +77,7 @@ export declare class FrontendBuilder {
|
|
|
79
77
|
*
|
|
80
78
|
* For C++ files, {@link CppFrontend.buildProjectFile} is safe to re-call: C++ ImportInfo uses
|
|
81
79
|
* stable clause keys (`#include "..."` / namespace names) that are overwritten by `Map.set`,
|
|
82
|
-
* and C++ ExportInfo is not produced during the
|
|
80
|
+
* and C++ ExportInfo is not produced during the import-only phase, so no duplication occurs.
|
|
83
81
|
*
|
|
84
82
|
* After signature building, BodyBuilders are released when the target level is SIGNATURES
|
|
85
83
|
* (no ArkBody/CFG retained). For BODIES, BodyBuilders are retained so that
|
|
@@ -88,7 +86,7 @@ export declare class FrontendBuilder {
|
|
|
88
86
|
* @param scene - The owning {@link Scene}.
|
|
89
87
|
* @param arkFile - The ArkFile to upgrade (must already have ImportInfo/ExportInfo).
|
|
90
88
|
* @param language - The language of the file.
|
|
91
|
-
* @param targetLevel - The target depth level (
|
|
89
|
+
* @param targetLevel - The target depth level (SIGNATURES or BODIES).
|
|
92
90
|
*/
|
|
93
91
|
static upgradeArkFileToLevel(scene: Scene, arkFile: ArkFile, language: Language, targetLevel: ModuleDepthLevel): void;
|
|
94
92
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FrontendBuilder.d.ts","sourceRoot":"","sources":["../../src/frontend/FrontendBuilder.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;;;;;;OAWG;WACW,uBAAuB,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,gBAAgB,GAAG,IAAI;IAYrG;;;;;;;;;;;;OAYG;WACW,sBAAsB,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,GAAG,OAAO,EAAE;IA+BhF;;;;;;;;OAQG;IACH,OAAO,CAAC,MAAM,CAAC,mBAAmB;IAWlC;;OAEG;WACW,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAQtE;;;;;;;;;;;;;;;;;;;;;OAqBG;WACW,qBAAqB,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,gBAAgB,GAAG,IAAI;IAW5H;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,qBAAqB;IASpC;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,sBAAsB;IAMrC;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;WACW,qBAAqB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI;IA8B5D;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,0BAA0B;CAc5C"}
|
|
@@ -131,6 +131,7 @@ class FrontendBuilder {
|
|
|
131
131
|
* @param level - The target depth level.
|
|
132
132
|
*/
|
|
133
133
|
static buildModuleFilesToLevel(scene, module, level) {
|
|
134
|
+
(0, ModuleDepth_1.assertDirectLoadLevel)(level);
|
|
134
135
|
const arkFiles = FrontendBuilder.createModuleFileShells(scene, module);
|
|
135
136
|
for (const arkFile of arkFiles) {
|
|
136
137
|
try {
|
|
@@ -146,9 +147,9 @@ class FrontendBuilder {
|
|
|
146
147
|
* registering each with the module and scene.
|
|
147
148
|
*
|
|
148
149
|
* Each shell has language, filePath, projectDir, and fileSignature set, but no ImportInfo /
|
|
149
|
-
* ExportInfo / ArkClass / ArkMethod.
|
|
150
|
-
*
|
|
151
|
-
*
|
|
150
|
+
* ExportInfo / ArkClass / ArkMethod. Callers subsequently build content via
|
|
151
|
+
* {@link buildImports} then {@link upgradeArkFileToLevel} (SIGNATURES / BODIES), or
|
|
152
|
+
* {@link buildArkFileToLevel} for a one-shot path.
|
|
152
153
|
*
|
|
153
154
|
* @param scene - The owning {@link Scene}.
|
|
154
155
|
* @param module - The module whose directory is scanned.
|
|
@@ -188,8 +189,6 @@ class FrontendBuilder {
|
|
|
188
189
|
/**
|
|
189
190
|
* Dispatch level-aware building to the appropriate frontend.
|
|
190
191
|
*
|
|
191
|
-
* - META: no content is built (only the ArkFile path/basic info created by the caller).
|
|
192
|
-
* - IMPORTS: lightweight import/export parsing only.
|
|
193
192
|
* - SIGNATURES: full namespace/class/method signatures are built (parameters, return types)
|
|
194
193
|
* without method bodies, reusing {@link buildProjectFileIntoArkFile}. The mounted
|
|
195
194
|
* BodyBuilders are released here so the ArkFile holds signatures only (no ArkBody/CFG).
|
|
@@ -197,13 +196,6 @@ class FrontendBuilder {
|
|
|
197
196
|
* so that {@link buildModuleMethodBody} can build method bodies in a subsequent phase.
|
|
198
197
|
*/
|
|
199
198
|
static buildArkFileToLevel(scene, filePath, arkFile, language, level) {
|
|
200
|
-
if (level <= ModuleDepth_1.ModuleDepthLevel.META) {
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
if (level === ModuleDepth_1.ModuleDepthLevel.IMPORTS) {
|
|
204
|
-
FrontendBuilder.buildImports(arkFile, language);
|
|
205
|
-
return;
|
|
206
|
-
}
|
|
207
199
|
// SIGNATURES and BODIES: reuse the full file builder to build signatures and mount
|
|
208
200
|
// BodyBuilders on each method implementation.
|
|
209
201
|
FrontendBuilder.buildProjectFileIntoArkFile(scene, filePath, arkFile);
|
|
@@ -214,7 +206,7 @@ class FrontendBuilder {
|
|
|
214
206
|
// BODIES: keep BodyBuilders mounted for phase 2 (body building in buildModuleMethodBody).
|
|
215
207
|
}
|
|
216
208
|
/**
|
|
217
|
-
*
|
|
209
|
+
* Lightweight import/export parsing only (used as a step inside {@link ModuleBuilder.buildModuleToLevel}).
|
|
218
210
|
*/
|
|
219
211
|
static buildImports(arkFile, language) {
|
|
220
212
|
if (language === ArkFile_1.Language.CXX) {
|
|
@@ -225,8 +217,8 @@ class FrontendBuilder {
|
|
|
225
217
|
}
|
|
226
218
|
}
|
|
227
219
|
/**
|
|
228
|
-
* Upgrade an existing ArkFile (whose ImportInfo/ExportInfo were already populated
|
|
229
|
-
*
|
|
220
|
+
* Upgrade an existing ArkFile (whose ImportInfo/ExportInfo were already populated) to
|
|
221
|
+
* SIGNATURES or BODIES by building class/method/namespace signatures on top.
|
|
230
222
|
*
|
|
231
223
|
* For ArkTS files, this calls {@link ArktsFrontend.buildProjectFileForSignatures} which builds
|
|
232
224
|
* signatures with `skipImportExport = true`, preserving existing import/export data and
|
|
@@ -235,7 +227,7 @@ class FrontendBuilder {
|
|
|
235
227
|
*
|
|
236
228
|
* For C++ files, {@link CppFrontend.buildProjectFile} is safe to re-call: C++ ImportInfo uses
|
|
237
229
|
* stable clause keys (`#include "..."` / namespace names) that are overwritten by `Map.set`,
|
|
238
|
-
* and C++ ExportInfo is not produced during the
|
|
230
|
+
* and C++ ExportInfo is not produced during the import-only phase, so no duplication occurs.
|
|
239
231
|
*
|
|
240
232
|
* After signature building, BodyBuilders are released when the target level is SIGNATURES
|
|
241
233
|
* (no ArkBody/CFG retained). For BODIES, BodyBuilders are retained so that
|
|
@@ -244,7 +236,7 @@ class FrontendBuilder {
|
|
|
244
236
|
* @param scene - The owning {@link Scene}.
|
|
245
237
|
* @param arkFile - The ArkFile to upgrade (must already have ImportInfo/ExportInfo).
|
|
246
238
|
* @param language - The language of the file.
|
|
247
|
-
* @param targetLevel - The target depth level (
|
|
239
|
+
* @param targetLevel - The target depth level (SIGNATURES or BODIES).
|
|
248
240
|
*/
|
|
249
241
|
static upgradeArkFileToLevel(scene, arkFile, language, targetLevel) {
|
|
250
242
|
if (language === ArkFile_1.Language.CXX) {
|
|
@@ -23,11 +23,16 @@ export type ModuleAnalysisCallback = (module: ArkModule, scene: Scene) => void;
|
|
|
23
23
|
* Bit indices are {@link ModuleID} (for ID include/exclude) or {@link ModuleType} enum values
|
|
24
24
|
* (for type filter).
|
|
25
25
|
*
|
|
26
|
-
* Load levels ({@link ModuleDepthLevel})
|
|
26
|
+
* ## Load levels ({@link ModuleDepthLevel})
|
|
27
|
+
*
|
|
27
28
|
* - {@link loadLevel} applies to target modules (default {@link ModuleDepthLevel.BODIES}).
|
|
28
29
|
* - {@link dependencyLoadLevel} applies to dependency modules — modules in the closure but
|
|
29
30
|
* not targets (default {@link ModuleDepthLevel.SIGNATURES}).
|
|
30
31
|
*
|
|
32
|
+
* Only {@link ModuleDepthLevel.SIGNATURES} and {@link ModuleDepthLevel.BODIES} are valid
|
|
33
|
+
* load targets. {@link ModuleDepthLevel.INDEX} is downgrade-only; setters throw if INDEX
|
|
34
|
+
* is passed.
|
|
35
|
+
*
|
|
31
36
|
* @category core/model
|
|
32
37
|
*/
|
|
33
38
|
export declare class ModuleAnalysisConfig {
|
|
@@ -76,6 +81,7 @@ export declare class ModuleAnalysisConfig {
|
|
|
76
81
|
getExcludedModuleIds(): SparseBitVector;
|
|
77
82
|
/**
|
|
78
83
|
* Set the {@link ModuleDepthLevel} for target modules.
|
|
84
|
+
* Only SIGNATURES / BODIES are valid; INDEX throws.
|
|
79
85
|
* Returns this config to allow chaining.
|
|
80
86
|
*/
|
|
81
87
|
setLoadLevel(level: ModuleDepthLevel): ModuleAnalysisConfig;
|
|
@@ -83,6 +89,7 @@ export declare class ModuleAnalysisConfig {
|
|
|
83
89
|
getLoadLevel(): ModuleDepthLevel;
|
|
84
90
|
/**
|
|
85
91
|
* Set the {@link ModuleDepthLevel} for dependency modules (in closure but not targets).
|
|
92
|
+
* Only SIGNATURES / BODIES are valid; INDEX throws.
|
|
86
93
|
* Returns this config to allow chaining.
|
|
87
94
|
*/
|
|
88
95
|
setDependencyLoadLevel(level: ModuleDepthLevel): ModuleAnalysisConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModuleAnalysisConfig.d.ts","sourceRoot":"","sources":["../../../src/frontend/common/ModuleAnalysisConfig.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,
|
|
1
|
+
{"version":3,"file":"ModuleAnalysisConfig.d.ts","sourceRoot":"","sources":["../../../src/frontend/common/ModuleAnalysisConfig.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAyB,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,qBAAa,oBAAoB;IAC7B,uFAAuF;IACvF,OAAO,CAAC,aAAa,CAA0C;IAC/D,4EAA4E;IAC5E,OAAO,CAAC,eAAe,CAA0C;IACjE,2FAA2F;IAC3F,OAAO,CAAC,iBAAiB,CAA0C;IACnE,qDAAqD;IACrD,OAAO,CAAC,SAAS,CAA6C;IAC9D,0FAA0F;IAC1F,OAAO,CAAC,mBAAmB,CAAiD;;IAM5E;;;OAGG;IACI,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,GAAG,oBAAoB;IAS/E,+EAA+E;IACxE,cAAc,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO;IAMhD;;;OAGG;IACI,kBAAkB,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,oBAAoB;IAMhE;;;OAGG;IACI,iBAAiB,CAAC,EAAE,EAAE,QAAQ,GAAG,oBAAoB;IAK5D,mGAAmG;IAC5F,kBAAkB,IAAI,eAAe;IAM5C;;;OAGG;IACI,oBAAoB,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,oBAAoB;IAMlE;;;;OAIG;IACI,eAAe,CAAC,EAAE,EAAE,QAAQ,GAAG,oBAAoB;IAK1D,mGAAmG;IAC5F,oBAAoB,IAAI,eAAe;IAM9C;;;;OAIG;IACI,YAAY,CAAC,KAAK,EAAE,gBAAgB,GAAG,oBAAoB;IAMlE,oGAAoG;IAC7F,YAAY,IAAI,gBAAgB;IAIvC;;;;OAIG;IACI,sBAAsB,CAAC,KAAK,EAAE,gBAAgB,GAAG,oBAAoB;IAM5E,4GAA4G;IACrG,sBAAsB,IAAI,gBAAgB;CAGpD"}
|
|
@@ -32,11 +32,16 @@ const ModuleDepth_1 = require("./ModuleDepth");
|
|
|
32
32
|
* Bit indices are {@link ModuleID} (for ID include/exclude) or {@link ModuleType} enum values
|
|
33
33
|
* (for type filter).
|
|
34
34
|
*
|
|
35
|
-
* Load levels ({@link ModuleDepthLevel})
|
|
35
|
+
* ## Load levels ({@link ModuleDepthLevel})
|
|
36
|
+
*
|
|
36
37
|
* - {@link loadLevel} applies to target modules (default {@link ModuleDepthLevel.BODIES}).
|
|
37
38
|
* - {@link dependencyLoadLevel} applies to dependency modules — modules in the closure but
|
|
38
39
|
* not targets (default {@link ModuleDepthLevel.SIGNATURES}).
|
|
39
40
|
*
|
|
41
|
+
* Only {@link ModuleDepthLevel.SIGNATURES} and {@link ModuleDepthLevel.BODIES} are valid
|
|
42
|
+
* load targets. {@link ModuleDepthLevel.INDEX} is downgrade-only; setters throw if INDEX
|
|
43
|
+
* is passed.
|
|
44
|
+
*
|
|
40
45
|
* @category core/model
|
|
41
46
|
*/
|
|
42
47
|
class ModuleAnalysisConfig {
|
|
@@ -118,9 +123,11 @@ class ModuleAnalysisConfig {
|
|
|
118
123
|
// --- Load levels ---
|
|
119
124
|
/**
|
|
120
125
|
* Set the {@link ModuleDepthLevel} for target modules.
|
|
126
|
+
* Only SIGNATURES / BODIES are valid; INDEX throws.
|
|
121
127
|
* Returns this config to allow chaining.
|
|
122
128
|
*/
|
|
123
129
|
setLoadLevel(level) {
|
|
130
|
+
(0, ModuleDepth_1.assertDirectLoadLevel)(level);
|
|
124
131
|
this.loadLevel = level;
|
|
125
132
|
return this;
|
|
126
133
|
}
|
|
@@ -130,9 +137,11 @@ class ModuleAnalysisConfig {
|
|
|
130
137
|
}
|
|
131
138
|
/**
|
|
132
139
|
* Set the {@link ModuleDepthLevel} for dependency modules (in closure but not targets).
|
|
140
|
+
* Only SIGNATURES / BODIES are valid; INDEX throws.
|
|
133
141
|
* Returns this config to allow chaining.
|
|
134
142
|
*/
|
|
135
143
|
setDependencyLoadLevel(level) {
|
|
144
|
+
(0, ModuleDepth_1.assertDirectLoadLevel)(level);
|
|
136
145
|
this.dependencyLoadLevel = level;
|
|
137
146
|
return this;
|
|
138
147
|
}
|
|
@@ -38,7 +38,7 @@ export declare class ModuleBuilder {
|
|
|
38
38
|
* Calibrated from scene_board_ext measurements (no-eviction, no GC runs):
|
|
39
39
|
* - BODIES: P75 of per-module heapUsed-per-file at BODIES level = ~1.7MB/file
|
|
40
40
|
* - SIGNATURES: P75 of per-module heapUsed-per-file at SIGNATURES level = ~700KB/file
|
|
41
|
-
* -
|
|
41
|
+
* - INDEX: hollow in-place IR (export-reachable shells); lighter than full SIGNATURES.
|
|
42
42
|
*
|
|
43
43
|
* No-GC calibration matches production conditions (no forced GC). Without GC,
|
|
44
44
|
* heapUsed increments include uncollected garbage from parsing and type inference,
|
|
@@ -340,17 +340,8 @@ export declare class ModuleBuilder {
|
|
|
340
340
|
*/
|
|
341
341
|
loadModule(moduleId: ModuleID, depthLevel?: ModuleDepthLevel): void;
|
|
342
342
|
/**
|
|
343
|
-
* Unload a module's data, releasing
|
|
344
|
-
*
|
|
345
|
-
* Clears the module's filesMap (releasing ArkFile/ArkClass/ArkMethod objects), resets the
|
|
346
|
-
* file dependency graph (so that the next {@link loadModule} rebuilds IMPORTS from scratch),
|
|
347
|
-
* and sets the load state to NOT_LOADED. After unloading, {@link loadModule} can rebuild
|
|
348
|
-
* the module from scratch.
|
|
349
|
-
*
|
|
350
|
-
* SDK modules are not unloaded (their data is built by {@link buildSdkModules} and shared
|
|
351
|
-
* globally).
|
|
352
|
-
*
|
|
353
|
-
* @param moduleId - ID of the module to unload.
|
|
343
|
+
* Unload a module's data, releasing IR and resetting to NOT_LOADED.
|
|
344
|
+
* SDK modules are not unloaded (built by {@link buildSdkModules}).
|
|
354
345
|
*/
|
|
355
346
|
unload(moduleId: ModuleID): void;
|
|
356
347
|
/**
|
|
@@ -386,6 +377,11 @@ export declare class ModuleBuilder {
|
|
|
386
377
|
private evictIfNeeded;
|
|
387
378
|
private runPhase1Eviction;
|
|
388
379
|
private runPhase2Downgrade;
|
|
380
|
+
/**
|
|
381
|
+
* Eviction phase 2b: if still over limit after BODIES→SIGNATURES, downgrade protected
|
|
382
|
+
* deps further to INDEX (hollow in-place IR; same lookup APIs as SIGNATURES).
|
|
383
|
+
*/
|
|
384
|
+
private runPhase2bDowngradeToIndex;
|
|
389
385
|
private runPhase3Eviction;
|
|
390
386
|
/**
|
|
391
387
|
* Estimate the memory cost of loading a module at the given depth level.
|
|
@@ -413,12 +409,37 @@ export declare class ModuleBuilder {
|
|
|
413
409
|
*/
|
|
414
410
|
private estimateDowngradeHeapUsedDecrease;
|
|
415
411
|
/**
|
|
416
|
-
* Downgrade a module
|
|
417
|
-
*
|
|
418
|
-
*
|
|
419
|
-
*
|
|
412
|
+
* Downgrade a module to the given target level. Used by eviction Phase 2 / 2b.
|
|
413
|
+
*
|
|
414
|
+
* - {@link ModuleDepthLevel.SIGNATURES}: clear method bodies / view trees / AST while keeping
|
|
415
|
+
* full ArkFile signature IR.
|
|
416
|
+
* - {@link ModuleDepthLevel.INDEX}: hollow in place (strip + prune non-exports). Use
|
|
417
|
+
* {@link unload} to drop IR entirely.
|
|
418
|
+
*
|
|
419
|
+
* No-op if already at or below the target.
|
|
420
420
|
*/
|
|
421
421
|
private downgradeModule;
|
|
422
|
+
/**
|
|
423
|
+
* Drop method bodies / view trees / AST / source text while keeping ArkFile shells.
|
|
424
|
+
* Shared by SIGNATURES and INDEX downgrade paths.
|
|
425
|
+
*/
|
|
426
|
+
private stripModuleBodiesAndAst;
|
|
427
|
+
/**
|
|
428
|
+
* INDEX retention: strip heavy payload in place, prune non-exported IR, keep export-reachable
|
|
429
|
+
* shells registered on the module / Scene so existing lookup APIs still resolve.
|
|
430
|
+
*/
|
|
431
|
+
private hollowModuleToIndex;
|
|
432
|
+
private collectExportReachableSets;
|
|
433
|
+
private addExportToKeepSets;
|
|
434
|
+
private pruneNonExportedIr;
|
|
435
|
+
private pruneNonKeptClasses;
|
|
436
|
+
private pruneNonKeptNamespaces;
|
|
437
|
+
private namespaceOwnsKeptClass;
|
|
438
|
+
/**
|
|
439
|
+
* Clear module IR from Scene maps and the module's filesMap so the next load rebuilds
|
|
440
|
+
* from disk. Used by {@link unload} and when upgrading out of hollow INDEX.
|
|
441
|
+
*/
|
|
442
|
+
private resetModuleIrForRebuild;
|
|
422
443
|
/**
|
|
423
444
|
* Get the number of source files in a module. If the module's filesMap is empty
|
|
424
445
|
* (not yet loaded), scans the module directory.
|
|
@@ -432,32 +453,22 @@ export declare class ModuleBuilder {
|
|
|
432
453
|
*/
|
|
433
454
|
private computeProtectedSets;
|
|
434
455
|
/**
|
|
435
|
-
* Build module
|
|
436
|
-
*
|
|
456
|
+
* Build module ArkFile IR up to SIGNATURES or BODIES.
|
|
457
|
+
* {@link ModuleDepthLevel.INDEX} is rejected ({@link assertDirectLoadLevel}).
|
|
437
458
|
*
|
|
438
|
-
* Two-phase build for level > IMPORTS:
|
|
439
459
|
* 1. Ensure ArkFile shells exist (create if filesMap is empty, reuse otherwise).
|
|
440
|
-
* 2. Build
|
|
441
|
-
*
|
|
442
|
-
* 3. Analyze intra-module file dependencies → compute topological order (moved here from
|
|
443
|
-
* {@link loadModule} so it is part of the build-to-level flow).
|
|
444
|
-
* 4. For level > IMPORTS: upgrade each file to the target level (SIGNATURES/BODIES) in
|
|
445
|
-
* topological order, so that depended-on files are parsed first.
|
|
446
|
-
*
|
|
447
|
-
* For level == META: only shells are created (no content).
|
|
448
|
-
* For level == IMPORTS: steps 1-3 (topoOrder available for later type inference).
|
|
449
|
-
* For level >= SIGNATURES: steps 1-4 (signatures built in topoOrder).
|
|
460
|
+
* 2. Build import/export info (if not already done) + analyze intra-module file dependencies.
|
|
461
|
+
* 3. Upgrade each file to the target level in topological order.
|
|
450
462
|
*
|
|
451
|
-
*
|
|
452
|
-
* built (e.g. when upgrading from IMPORTS to SIGNATURES), avoiding redundant re-parsing.
|
|
463
|
+
* Method bodies are built later by {@link loadModule} when the target is BODIES.
|
|
453
464
|
*
|
|
454
465
|
* @param module - The module to build.
|
|
455
|
-
* @param level -
|
|
466
|
+
* @param level - Must be SIGNATURES or BODIES.
|
|
456
467
|
*/
|
|
457
468
|
buildModuleToLevel(module: ArkModule, level: ModuleDepthLevel): void;
|
|
458
469
|
/**
|
|
459
470
|
* Analyze file-to-file dependencies within a module using the import/export `from` specifiers
|
|
460
|
-
* populated
|
|
471
|
+
* populated during the import/export parse step of {@link buildModuleToLevel}.
|
|
461
472
|
*
|
|
462
473
|
* Builds a {@link FileDepGraph}, resolves relative `from` specifiers to file paths within the
|
|
463
474
|
* same module, adds dependency edges, computes a topological order via SCC detection, and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModuleBuilder.d.ts","sourceRoot":"","sources":["../../../src/frontend/common/ModuleBuilder.ts"],"names":[],"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