@markw65/monkeyc-optimizer 1.1.66 → 1.1.68
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/CHANGELOG.md +16 -1
- package/build/api.cjs +35 -35
- package/build/{chunk-UDJNFXSX.cjs → chunk-NGCEDNHJ.cjs} +477 -369
- package/build/{chunk-67LU4GPQ.cjs → chunk-OASVKTK5.cjs} +7 -4
- package/build/optimizer.cjs +21 -19
- package/build/sdk-util.cjs +15 -15
- package/build/src/build-config.d.ts +2 -0
- package/build/src/mc-rewrite.d.ts +1 -1
- package/build/src/optimizer.d.ts +7 -7
- package/build/src/pragma-checker.d.ts +2 -2
- package/build/src/type-flow/type-flow-util.d.ts +1 -1
- package/build/src/util.d.ts +1 -1
- package/build/src/worker-task.d.ts +1 -0
- package/build/util.cjs +26 -26
- package/build/worker-thread.cjs +4 -4
- package/package.json +3 -3
|
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_NGCEDNHJ_exports = {};
|
|
30
|
+
__export(chunk_NGCEDNHJ_exports, {
|
|
31
31
|
EnumTagsConst: () => EnumTagsConst,
|
|
32
32
|
LastTypeTag: () => LastTypeTag,
|
|
33
33
|
ObjectLikeTagsConst: () => ObjectLikeTagsConst,
|
|
@@ -64,6 +64,7 @@ __export(chunk_UDJNFXSX_exports, {
|
|
|
64
64
|
getConfig: () => getConfig,
|
|
65
65
|
getDeviceInfo: () => getDeviceInfo,
|
|
66
66
|
getFileASTs: () => getFileASTs,
|
|
67
|
+
getFnMapAnalysis: () => getFnMapAnalysis,
|
|
67
68
|
getFunctionDocumentation: () => getFunctionDocumentation,
|
|
68
69
|
getLanguages: () => getLanguages,
|
|
69
70
|
getProjectAnalysis: () => getProjectAnalysis,
|
|
@@ -134,8 +135,8 @@ __export(chunk_UDJNFXSX_exports, {
|
|
|
134
135
|
visitorNode: () => visitorNode,
|
|
135
136
|
xml_util_exports: () => xml_util_exports
|
|
136
137
|
});
|
|
137
|
-
module.exports = __toCommonJS(
|
|
138
|
-
var
|
|
138
|
+
module.exports = __toCommonJS(chunk_NGCEDNHJ_exports);
|
|
139
|
+
var import_chunk_OASVKTK5 = require("./chunk-OASVKTK5.cjs");
|
|
139
140
|
var import_chunk_MBTLUWXR = require("./chunk-MBTLUWXR.cjs");
|
|
140
141
|
var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
|
|
141
142
|
var import_node_assert = __toESM(require("node:assert"));
|
|
@@ -5642,6 +5643,18 @@ var init_build_config = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
5642
5643
|
default: "WARNING",
|
|
5643
5644
|
scope: "resource"
|
|
5644
5645
|
},
|
|
5646
|
+
strictTypeCheck: {
|
|
5647
|
+
type: "string",
|
|
5648
|
+
description: "Whether to do strict or relaxed type checking - Default deduces it from typeCheckLevel",
|
|
5649
|
+
enum: ["On", "Off", "Default"],
|
|
5650
|
+
enumDescriptions: [
|
|
5651
|
+
"Do Strict type checking",
|
|
5652
|
+
"Do Relaxed type checking",
|
|
5653
|
+
"Do Strict type checking iff typeCheckLevel is Strict"
|
|
5654
|
+
],
|
|
5655
|
+
default: "Default",
|
|
5656
|
+
scope: "resource"
|
|
5657
|
+
},
|
|
5645
5658
|
trustDeclaredTypes: {
|
|
5646
5659
|
order: 100,
|
|
5647
5660
|
type: "boolean",
|
|
@@ -7326,9 +7339,9 @@ function buildReducedGraph(state, func, refsForUpdate, notice) {
|
|
|
7326
7339
|
);
|
|
7327
7340
|
}
|
|
7328
7341
|
} else {
|
|
7329
|
-
(0,
|
|
7342
|
+
(0, import_chunk_OASVKTK5.forEach)(events, (e) => e.mayThrow = false);
|
|
7330
7343
|
}
|
|
7331
|
-
(0,
|
|
7344
|
+
(0, import_chunk_OASVKTK5.forEach)(events, (event) => {
|
|
7332
7345
|
if (event.mayThrow) {
|
|
7333
7346
|
for (let i = localState.stack.length; i--; ) {
|
|
7334
7347
|
const target = localState.stack[i].throw;
|
|
@@ -7473,7 +7486,7 @@ var init_control_flow = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
7473
7486
|
"src/control-flow.ts"() {
|
|
7474
7487
|
"use strict";
|
|
7475
7488
|
(0, import_chunk_MBTLUWXR.init_ast)();
|
|
7476
|
-
(0,
|
|
7489
|
+
(0, import_chunk_OASVKTK5.init_util)();
|
|
7477
7490
|
Terminals = {
|
|
7478
7491
|
BreakStatement: "break",
|
|
7479
7492
|
ContinueStatement: "continue",
|
|
@@ -7503,12 +7516,12 @@ var init_control_flow = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
7503
7516
|
if (!from.succs) {
|
|
7504
7517
|
from.succs = [to];
|
|
7505
7518
|
} else {
|
|
7506
|
-
(0,
|
|
7519
|
+
(0, import_chunk_OASVKTK5.pushUnique)(from.succs, to);
|
|
7507
7520
|
}
|
|
7508
7521
|
if (!to.preds) {
|
|
7509
7522
|
to.preds = [from];
|
|
7510
7523
|
} else {
|
|
7511
|
-
(0,
|
|
7524
|
+
(0, import_chunk_OASVKTK5.pushUnique)(to.preds, from);
|
|
7512
7525
|
}
|
|
7513
7526
|
}
|
|
7514
7527
|
newBlock(block) {
|
|
@@ -7862,8 +7875,8 @@ function mergeObjectValues(to, from) {
|
|
|
7862
7875
|
function mergeStateDecls(to, from) {
|
|
7863
7876
|
let changed = false;
|
|
7864
7877
|
let result = to;
|
|
7865
|
-
(0,
|
|
7866
|
-
if ((0,
|
|
7878
|
+
(0, import_chunk_OASVKTK5.forEach)(from, (v) => {
|
|
7879
|
+
if ((0, import_chunk_OASVKTK5.some)(to, (t) => t === v)) {
|
|
7867
7880
|
return;
|
|
7868
7881
|
}
|
|
7869
7882
|
if (Array.isArray(result)) {
|
|
@@ -8030,7 +8043,7 @@ var init_union_type = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
8030
8043
|
"use strict";
|
|
8031
8044
|
(0, import_chunk_MBTLUWXR.init_ast)();
|
|
8032
8045
|
init_data_flow();
|
|
8033
|
-
(0,
|
|
8046
|
+
(0, import_chunk_OASVKTK5.init_util)();
|
|
8034
8047
|
init_could_be();
|
|
8035
8048
|
init_intersection_type();
|
|
8036
8049
|
init_sub_type();
|
|
@@ -8045,7 +8058,7 @@ function expandTypedef(t) {
|
|
|
8045
8058
|
);
|
|
8046
8059
|
const tExpanded = cloneType(t);
|
|
8047
8060
|
clearValuesUnder(tExpanded, 262144, true);
|
|
8048
|
-
(0,
|
|
8061
|
+
(0, import_chunk_OASVKTK5.forEach)(decls, (decl) => unionInto(tExpanded, decl.resolvedType));
|
|
8049
8062
|
return tExpanded;
|
|
8050
8063
|
}
|
|
8051
8064
|
function intersectEnum(t, e) {
|
|
@@ -8239,9 +8252,9 @@ function intersectionValue(pair) {
|
|
|
8239
8252
|
case 4096:
|
|
8240
8253
|
case 8192: {
|
|
8241
8254
|
const common = [];
|
|
8242
|
-
(0,
|
|
8255
|
+
(0, import_chunk_OASVKTK5.forEach)(
|
|
8243
8256
|
pair.avalue,
|
|
8244
|
-
(sna) => (0,
|
|
8257
|
+
(sna) => (0, import_chunk_OASVKTK5.some)(pair.bvalue, (snb) => sna === snb) && common.push(sna)
|
|
8245
8258
|
);
|
|
8246
8259
|
if (!common.length)
|
|
8247
8260
|
return null;
|
|
@@ -8249,9 +8262,9 @@ function intersectionValue(pair) {
|
|
|
8249
8262
|
}
|
|
8250
8263
|
case 16384: {
|
|
8251
8264
|
const common = [];
|
|
8252
|
-
(0,
|
|
8265
|
+
(0, import_chunk_OASVKTK5.forEach)(pair.avalue, (sna) => {
|
|
8253
8266
|
const superA = getSuperClasses(sna);
|
|
8254
|
-
(0,
|
|
8267
|
+
(0, import_chunk_OASVKTK5.forEach)(pair.bvalue, (snb) => {
|
|
8255
8268
|
if (sna === snb || superA && superA.has(snb)) {
|
|
8256
8269
|
common.push(sna);
|
|
8257
8270
|
}
|
|
@@ -8497,7 +8510,7 @@ function restrictExactTypesByEquality(a, b) {
|
|
|
8497
8510
|
}
|
|
8498
8511
|
case 262144:
|
|
8499
8512
|
return restrictByEquality(
|
|
8500
|
-
(0,
|
|
8513
|
+
(0, import_chunk_OASVKTK5.reduce)(
|
|
8501
8514
|
a.value,
|
|
8502
8515
|
(cur, decl) => {
|
|
8503
8516
|
unionInto(cur, decl.resolvedType);
|
|
@@ -8564,7 +8577,7 @@ var init_intersection_type = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
8564
8577
|
"use strict";
|
|
8565
8578
|
init_api();
|
|
8566
8579
|
init_data_flow();
|
|
8567
|
-
(0,
|
|
8580
|
+
(0, import_chunk_OASVKTK5.init_util)();
|
|
8568
8581
|
init_could_be();
|
|
8569
8582
|
init_interp();
|
|
8570
8583
|
init_types();
|
|
@@ -8678,14 +8691,14 @@ function subtypeOfValue(pair) {
|
|
|
8678
8691
|
case 8192: {
|
|
8679
8692
|
const asd = pair.avalue;
|
|
8680
8693
|
const bsd = pair.bvalue;
|
|
8681
|
-
return (0,
|
|
8694
|
+
return (0, import_chunk_OASVKTK5.some)(asd, (sna) => (0, import_chunk_OASVKTK5.some)(bsd, (snb) => sna === snb));
|
|
8682
8695
|
}
|
|
8683
8696
|
case 16384: {
|
|
8684
8697
|
const asd = pair.avalue;
|
|
8685
8698
|
const bsd = pair.bvalue;
|
|
8686
|
-
return (0,
|
|
8699
|
+
return (0, import_chunk_OASVKTK5.every)(asd, (sna) => {
|
|
8687
8700
|
const superA = getSuperClasses(sna);
|
|
8688
|
-
return (0,
|
|
8701
|
+
return (0, import_chunk_OASVKTK5.some)(bsd, (snb) => {
|
|
8689
8702
|
if (sna === snb || superA && superA.has(snb)) {
|
|
8690
8703
|
return true;
|
|
8691
8704
|
}
|
|
@@ -8721,7 +8734,7 @@ var init_sub_type = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
8721
8734
|
"use strict";
|
|
8722
8735
|
init_api();
|
|
8723
8736
|
init_data_flow();
|
|
8724
|
-
(0,
|
|
8737
|
+
(0, import_chunk_OASVKTK5.init_util)();
|
|
8725
8738
|
init_could_be();
|
|
8726
8739
|
init_intersection_type();
|
|
8727
8740
|
init_types();
|
|
@@ -9142,13 +9155,13 @@ function isTypeStateKey(decl) {
|
|
|
9142
9155
|
return Array.isArray(decl) || decl.type !== "MemberDecl" && decl.type !== "Unknown";
|
|
9143
9156
|
}
|
|
9144
9157
|
function declIsLocal(decl) {
|
|
9145
|
-
return (0,
|
|
9158
|
+
return (0, import_chunk_OASVKTK5.some)(
|
|
9146
9159
|
decl,
|
|
9147
9160
|
(d) => d.type === "BinaryExpression" || d.type === "Identifier" || d.type === "VariableDeclarator" && isLocal(d)
|
|
9148
9161
|
);
|
|
9149
9162
|
}
|
|
9150
9163
|
function declIsNonLocal(decl) {
|
|
9151
|
-
return (0,
|
|
9164
|
+
return (0, import_chunk_OASVKTK5.some)(decl, (d) => d.type === "VariableDeclarator" && !isLocal(d));
|
|
9152
9165
|
}
|
|
9153
9166
|
function localDeclName(decl) {
|
|
9154
9167
|
if (Array.isArray(decl))
|
|
@@ -9161,12 +9174,12 @@ function localDeclName(decl) {
|
|
|
9161
9174
|
case "VariableDeclarator":
|
|
9162
9175
|
return variableDeclarationName(decl.node.id);
|
|
9163
9176
|
}
|
|
9164
|
-
throw new
|
|
9177
|
+
throw new import_chunk_OASVKTK5.AwaitedError(
|
|
9165
9178
|
declFullName(decl).then((declStr) => `Invalid local decl: ${declStr}`)
|
|
9166
9179
|
);
|
|
9167
9180
|
}
|
|
9168
9181
|
function tsKey(key) {
|
|
9169
|
-
return `${(0,
|
|
9182
|
+
return `${(0, import_chunk_OASVKTK5.map)(key, (k) => {
|
|
9170
9183
|
if (k.type === "Literal") {
|
|
9171
9184
|
return k.raw;
|
|
9172
9185
|
} else if (isStateNode(k)) {
|
|
@@ -9185,7 +9198,7 @@ function sourceLocation(loc) {
|
|
|
9185
9198
|
return loc ? `${loc.source || "??"}:${loc.start.line}:${loc.start.column}` : "??";
|
|
9186
9199
|
}
|
|
9187
9200
|
function printBlockHeader(block) {
|
|
9188
|
-
(0,
|
|
9201
|
+
(0, import_chunk_OASVKTK5.log)(
|
|
9189
9202
|
block.order,
|
|
9190
9203
|
`(${block.node?.loc?.source || "??"}:${block.node?.loc?.start.line || "??"})`,
|
|
9191
9204
|
`Preds: ${(block.preds || []).map((block2) => block2.order).join(", ")}`
|
|
@@ -9199,10 +9212,10 @@ function describeEvent(event) {
|
|
|
9199
9212
|
).then((desc) => `${event.type}: ${desc}`);
|
|
9200
9213
|
}
|
|
9201
9214
|
function printBlockEvents(block, extra) {
|
|
9202
|
-
(0,
|
|
9203
|
-
(0,
|
|
9215
|
+
(0, import_chunk_OASVKTK5.log)("Events:");
|
|
9216
|
+
(0, import_chunk_OASVKTK5.forEach)(
|
|
9204
9217
|
block.events,
|
|
9205
|
-
(event) => (0,
|
|
9218
|
+
(event) => (0, import_chunk_OASVKTK5.log)(
|
|
9206
9219
|
describeEvent(event).then(
|
|
9207
9220
|
(eventStr) => ` ${eventStr} ${extra ? extra(event) : ""}`
|
|
9208
9221
|
)
|
|
@@ -9210,7 +9223,7 @@ function printBlockEvents(block, extra) {
|
|
|
9210
9223
|
);
|
|
9211
9224
|
}
|
|
9212
9225
|
function printBlockTrailer(block) {
|
|
9213
|
-
(0,
|
|
9226
|
+
(0, import_chunk_OASVKTK5.log)(
|
|
9214
9227
|
`Succs: ${(block.succs || []).map((block2) => block2.order).join(", ")} ExSucc: ${block.exsucc ? block.exsucc.order : ""}`
|
|
9215
9228
|
);
|
|
9216
9229
|
}
|
|
@@ -9295,8 +9308,8 @@ function findObjectDeclsByProperty(state, object, next) {
|
|
|
9295
9308
|
const decls = getStateNodeDeclsFromType(state, object);
|
|
9296
9309
|
if (!decls)
|
|
9297
9310
|
return [null, null];
|
|
9298
|
-
const possibleDecls = (0, import_chunk_MBTLUWXR.hasProperty)(state.allDeclarations, next.
|
|
9299
|
-
return filterDecls(decls, possibleDecls, next.
|
|
9311
|
+
const possibleDecls = (0, import_chunk_MBTLUWXR.hasProperty)(state.allDeclarations, next.name) && state.allDeclarations[next.name];
|
|
9312
|
+
return filterDecls(decls, possibleDecls, next.name);
|
|
9300
9313
|
}
|
|
9301
9314
|
function refineObjectTypeByDecls(istate, object, trueDecls) {
|
|
9302
9315
|
const refinedType = typeFromTypeStateNodes(istate.state, trueDecls);
|
|
@@ -9326,7 +9339,7 @@ function resolveDottedMember(istate, object, next) {
|
|
|
9326
9339
|
const [objDecls, trueDecls] = findObjectDeclsByProperty(
|
|
9327
9340
|
istate.state,
|
|
9328
9341
|
object,
|
|
9329
|
-
next
|
|
9342
|
+
next.property
|
|
9330
9343
|
);
|
|
9331
9344
|
if (!objDecls)
|
|
9332
9345
|
return null;
|
|
@@ -9342,7 +9355,7 @@ var init_type_flow_util = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
9342
9355
|
"use strict";
|
|
9343
9356
|
init_api();
|
|
9344
9357
|
init_data_flow();
|
|
9345
|
-
(0,
|
|
9358
|
+
(0, import_chunk_OASVKTK5.init_util)();
|
|
9346
9359
|
init_intersection_type();
|
|
9347
9360
|
init_sub_type();
|
|
9348
9361
|
init_types();
|
|
@@ -9396,7 +9409,7 @@ function calleeObjectType(istate, callee) {
|
|
|
9396
9409
|
}
|
|
9397
9410
|
function checkCallArgs(istate, node, callees, args) {
|
|
9398
9411
|
const allDiags = [];
|
|
9399
|
-
const resultType = (0,
|
|
9412
|
+
const resultType = (0, import_chunk_OASVKTK5.reduce)(
|
|
9400
9413
|
callees,
|
|
9401
9414
|
(result, cur) => {
|
|
9402
9415
|
const curDiags = [];
|
|
@@ -9555,7 +9568,7 @@ function isOverride(cur, funcs) {
|
|
|
9555
9568
|
const cls = cur.stack?.[cur.stack.length - 1]?.sn;
|
|
9556
9569
|
if (cls?.type === "ClassDeclaration" && cls.superClasses) {
|
|
9557
9570
|
const supers = getSuperClasses(cls);
|
|
9558
|
-
if (supers && (0,
|
|
9571
|
+
if (supers && (0, import_chunk_OASVKTK5.some)(funcs, (func) => {
|
|
9559
9572
|
if (func === cur)
|
|
9560
9573
|
return false;
|
|
9561
9574
|
const fcls = func.stack?.[func.stack.length - 1].sn;
|
|
@@ -9841,7 +9854,11 @@ function getSystemCallTable(state) {
|
|
|
9841
9854
|
property: symbol,
|
|
9842
9855
|
computed: false
|
|
9843
9856
|
};
|
|
9844
|
-
const [, trueDecls] = findObjectDeclsByProperty(
|
|
9857
|
+
const [, trueDecls] = findObjectDeclsByProperty(
|
|
9858
|
+
state2,
|
|
9859
|
+
calleeObj,
|
|
9860
|
+
next.property
|
|
9861
|
+
);
|
|
9845
9862
|
if (!trueDecls)
|
|
9846
9863
|
return ret;
|
|
9847
9864
|
const callees = trueDecls.flatMap((decl) => decl.decls?.[symbol.name]).filter(
|
|
@@ -10049,7 +10066,7 @@ var init_interp_call = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
10049
10066
|
"use strict";
|
|
10050
10067
|
init_optimizer_types();
|
|
10051
10068
|
init_api();
|
|
10052
|
-
(0,
|
|
10069
|
+
(0, import_chunk_OASVKTK5.init_util)();
|
|
10053
10070
|
init_interp();
|
|
10054
10071
|
init_sub_type();
|
|
10055
10072
|
init_types();
|
|
@@ -10410,7 +10427,7 @@ function getLhsConstraint(istate, node) {
|
|
|
10410
10427
|
const [, trueDecls2] = findObjectDeclsByProperty(
|
|
10411
10428
|
istate.state,
|
|
10412
10429
|
object,
|
|
10413
|
-
node
|
|
10430
|
+
node.property
|
|
10414
10431
|
);
|
|
10415
10432
|
if (trueDecls2) {
|
|
10416
10433
|
lookupDefs = lookupNext(
|
|
@@ -11174,7 +11191,7 @@ function mustBeIdentical(a, b) {
|
|
|
11174
11191
|
return false;
|
|
11175
11192
|
}
|
|
11176
11193
|
function isByteArrayData(objectData) {
|
|
11177
|
-
return objectData.klass.value && (0,
|
|
11194
|
+
return objectData.klass.value && (0, import_chunk_OASVKTK5.every)(
|
|
11178
11195
|
objectData.klass.value,
|
|
11179
11196
|
(klass) => klass.fullName === "$.Toybox.Lang.ByteArray"
|
|
11180
11197
|
);
|
|
@@ -11186,7 +11203,7 @@ var init_interp = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
11186
11203
|
(0, import_chunk_MBTLUWXR.init_ast)();
|
|
11187
11204
|
init_data_flow();
|
|
11188
11205
|
init_optimizer_types();
|
|
11189
|
-
(0,
|
|
11206
|
+
(0, import_chunk_OASVKTK5.init_util)();
|
|
11190
11207
|
init_could_be();
|
|
11191
11208
|
init_interp_binary();
|
|
11192
11209
|
init_interp_call();
|
|
@@ -11417,7 +11434,7 @@ function typeFromTypeStateNode(state, sn, classVsObj) {
|
|
|
11417
11434
|
);
|
|
11418
11435
|
if (value2) {
|
|
11419
11436
|
const a = [];
|
|
11420
|
-
(0,
|
|
11437
|
+
(0, import_chunk_OASVKTK5.forEach)(value2, (v) => {
|
|
11421
11438
|
if (v !== sn)
|
|
11422
11439
|
a.push(v);
|
|
11423
11440
|
});
|
|
@@ -11909,7 +11926,7 @@ function mustBeFalse(arg) {
|
|
|
11909
11926
|
return arg.type === 1 || arg.type === 2 || (arg.type === 8 || arg.type === 16) && arg.value != null && Number(arg.value) === 0;
|
|
11910
11927
|
}
|
|
11911
11928
|
function display(type) {
|
|
11912
|
-
const names = (v, fn) => (0,
|
|
11929
|
+
const names = (v, fn) => (0, import_chunk_OASVKTK5.map)(v, fn).sort().filter((s, i, arr) => !i || s !== arr[i - 1]).join(" or ");
|
|
11913
11930
|
const parts = [];
|
|
11914
11931
|
const displayOne = (tv) => {
|
|
11915
11932
|
switch (tv.type) {
|
|
@@ -12110,7 +12127,7 @@ var init_types = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
12110
12127
|
init_data_flow();
|
|
12111
12128
|
init_api();
|
|
12112
12129
|
(0, import_chunk_MBTLUWXR.init_ast)();
|
|
12113
|
-
(0,
|
|
12130
|
+
(0, import_chunk_OASVKTK5.init_util)();
|
|
12114
12131
|
init_interp();
|
|
12115
12132
|
init_union_type();
|
|
12116
12133
|
init_intersection_type();
|
|
@@ -12170,7 +12187,7 @@ function couldBeHelper(a, b, shallow) {
|
|
|
12170
12187
|
262144
|
|
12171
12188
|
/* Typedef */
|
|
12172
12189
|
);
|
|
12173
|
-
return typedef && (0,
|
|
12190
|
+
return typedef && (0, import_chunk_OASVKTK5.some)(typedef, (td) => {
|
|
12174
12191
|
if (!td.resolvedType) {
|
|
12175
12192
|
throw new Error(`No resolved type for ${td.fullName} in 'couldBe'`);
|
|
12176
12193
|
}
|
|
@@ -12242,15 +12259,15 @@ function couldBeValue(pair, shallow) {
|
|
|
12242
12259
|
}
|
|
12243
12260
|
case 4096:
|
|
12244
12261
|
case 8192: {
|
|
12245
|
-
return (0,
|
|
12262
|
+
return (0, import_chunk_OASVKTK5.some)(
|
|
12246
12263
|
pair.avalue,
|
|
12247
|
-
(sna) => (0,
|
|
12264
|
+
(sna) => (0, import_chunk_OASVKTK5.some)(pair.bvalue, (snb) => sna === snb)
|
|
12248
12265
|
);
|
|
12249
12266
|
}
|
|
12250
12267
|
case 16384: {
|
|
12251
|
-
return (0,
|
|
12268
|
+
return (0, import_chunk_OASVKTK5.some)(pair.avalue, (sna) => {
|
|
12252
12269
|
const superA = getSuperClasses(sna);
|
|
12253
|
-
return (0,
|
|
12270
|
+
return (0, import_chunk_OASVKTK5.some)(pair.bvalue, (snb) => {
|
|
12254
12271
|
if (sna === snb || superA && superA.has(snb)) {
|
|
12255
12272
|
return true;
|
|
12256
12273
|
}
|
|
@@ -12283,7 +12300,7 @@ var init_could_be = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
12283
12300
|
"use strict";
|
|
12284
12301
|
init_api();
|
|
12285
12302
|
init_data_flow();
|
|
12286
|
-
(0,
|
|
12303
|
+
(0, import_chunk_OASVKTK5.init_util)();
|
|
12287
12304
|
init_types();
|
|
12288
12305
|
}
|
|
12289
12306
|
});
|
|
@@ -12390,7 +12407,7 @@ function findDeadStores(func, graph, nodeEquivs, findCopyPropCandidates, logThis
|
|
|
12390
12407
|
}
|
|
12391
12408
|
addAnt(curState.partiallyAnticipated, key, node);
|
|
12392
12409
|
if (logThisRun) {
|
|
12393
|
-
(0,
|
|
12410
|
+
(0, import_chunk_OASVKTK5.log)(
|
|
12394
12411
|
` antrefs: ${curState.partiallyAnticipated.get(key) !== false} ${curState.anticipated.get(key) !== false}`
|
|
12395
12412
|
);
|
|
12396
12413
|
}
|
|
@@ -12413,7 +12430,7 @@ function findDeadStores(func, graph, nodeEquivs, findCopyPropCandidates, logThis
|
|
|
12413
12430
|
const curState = cloneState(blockStates[top.order]);
|
|
12414
12431
|
if (logThisRun) {
|
|
12415
12432
|
printBlockHeader(top);
|
|
12416
|
-
curState.dead.forEach((decl) => (0,
|
|
12433
|
+
curState.dead.forEach((decl) => (0, import_chunk_OASVKTK5.log)(` - anticipated: ${tsKey(decl)}`));
|
|
12417
12434
|
}
|
|
12418
12435
|
if (top.events) {
|
|
12419
12436
|
for (let i = top.events.length; i--; ) {
|
|
@@ -12425,12 +12442,12 @@ function findDeadStores(func, graph, nodeEquivs, findCopyPropCandidates, logThis
|
|
|
12425
12442
|
case "ref":
|
|
12426
12443
|
if (isTypeStateKey(event.decl)) {
|
|
12427
12444
|
if (logThisRun) {
|
|
12428
|
-
(0,
|
|
12445
|
+
(0, import_chunk_OASVKTK5.log)(
|
|
12429
12446
|
describeEvent(event).then(
|
|
12430
12447
|
(eventStr) => `${eventStr} (${sourceLocation(event.node.loc)})`
|
|
12431
12448
|
)
|
|
12432
12449
|
);
|
|
12433
|
-
(0,
|
|
12450
|
+
(0, import_chunk_OASVKTK5.log)(` kill => ${tsKey(event.decl)}`);
|
|
12434
12451
|
}
|
|
12435
12452
|
copyPropRef(curState, event.decl, event.node);
|
|
12436
12453
|
curState.dead.delete(event.decl);
|
|
@@ -12439,7 +12456,7 @@ function findDeadStores(func, graph, nodeEquivs, findCopyPropCandidates, logThis
|
|
|
12439
12456
|
case "def":
|
|
12440
12457
|
if (isTypeStateKey(event.decl) && (event.node.type !== "VariableDeclarator" || event.node.init)) {
|
|
12441
12458
|
if (logThisRun) {
|
|
12442
|
-
(0,
|
|
12459
|
+
(0, import_chunk_OASVKTK5.log)(
|
|
12443
12460
|
describeEvent(event).then(
|
|
12444
12461
|
(eventStr) => `${eventStr} (${sourceLocation(event.node.loc)})`
|
|
12445
12462
|
)
|
|
@@ -12455,7 +12472,7 @@ function findDeadStores(func, graph, nodeEquivs, findCopyPropCandidates, logThis
|
|
|
12455
12472
|
const pant = curState.partiallyAnticipated.get(event.decl);
|
|
12456
12473
|
if (pant) {
|
|
12457
12474
|
if (logThisRun) {
|
|
12458
|
-
(0,
|
|
12475
|
+
(0, import_chunk_OASVKTK5.log)(
|
|
12459
12476
|
` is copy-prop-candidate ${curState.anticipated?.get(event.decl) === pant}`
|
|
12460
12477
|
);
|
|
12461
12478
|
}
|
|
@@ -12487,7 +12504,7 @@ function findDeadStores(func, graph, nodeEquivs, findCopyPropCandidates, logThis
|
|
|
12487
12504
|
if (assignNode) {
|
|
12488
12505
|
curState.dead.add(event.decl);
|
|
12489
12506
|
if (logThisRun) {
|
|
12490
|
-
(0,
|
|
12507
|
+
(0, import_chunk_OASVKTK5.log)(` anticipated => ${tsKey(event.decl)}`);
|
|
12491
12508
|
}
|
|
12492
12509
|
} else if (event.node.type === "UpdateExpression") {
|
|
12493
12510
|
copyPropRef(curState, event.decl, event.node.argument);
|
|
@@ -12498,7 +12515,7 @@ function findDeadStores(func, graph, nodeEquivs, findCopyPropCandidates, logThis
|
|
|
12498
12515
|
if (isTypeStateKey(event.decl)) {
|
|
12499
12516
|
curState.dead.add(event.decl);
|
|
12500
12517
|
if (logThisRun) {
|
|
12501
|
-
(0,
|
|
12518
|
+
(0, import_chunk_OASVKTK5.log)(` anticipated => ${tsKey(event.decl)}`);
|
|
12502
12519
|
}
|
|
12503
12520
|
}
|
|
12504
12521
|
break;
|
|
@@ -12561,9 +12578,9 @@ function eliminateDeadStores(state, func, graph, logThisRun) {
|
|
|
12561
12578
|
if (!deadStores.size)
|
|
12562
12579
|
return { changes: false, copyPropStores };
|
|
12563
12580
|
if (logThisRun) {
|
|
12564
|
-
(0,
|
|
12581
|
+
(0, import_chunk_OASVKTK5.log)("====== Dead Stores =====");
|
|
12565
12582
|
deadStores.forEach(
|
|
12566
|
-
(dead) => (dead.type === "AssignmentExpression" || dead.type === "UpdateExpression" || dead.type === "VariableDeclarator") && (0,
|
|
12583
|
+
(dead) => (dead.type === "AssignmentExpression" || dead.type === "UpdateExpression" || dead.type === "VariableDeclarator") && (0, import_chunk_OASVKTK5.log)(
|
|
12567
12584
|
formatAst(dead).then(
|
|
12568
12585
|
(deadStr) => `${deadStr} (${sourceLocation(dead.loc)})`
|
|
12569
12586
|
)
|
|
@@ -12618,7 +12635,7 @@ var init_dead_store = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
12618
12635
|
init_control_flow();
|
|
12619
12636
|
init_data_flow();
|
|
12620
12637
|
init_inliner();
|
|
12621
|
-
(0,
|
|
12638
|
+
(0, import_chunk_OASVKTK5.init_util)();
|
|
12622
12639
|
init_minimize_locals();
|
|
12623
12640
|
init_type_flow_util();
|
|
12624
12641
|
}
|
|
@@ -12983,13 +13000,13 @@ function typeStateEntry(value2, key) {
|
|
|
12983
13000
|
return `${tsKey(key)} = ${display(value2.curType)}`;
|
|
12984
13001
|
}
|
|
12985
13002
|
function printBlockState(block, state, indent = "") {
|
|
12986
|
-
(0,
|
|
13003
|
+
(0, import_chunk_OASVKTK5.log)(indent + "State:");
|
|
12987
13004
|
if (!state) {
|
|
12988
|
-
(0,
|
|
13005
|
+
(0, import_chunk_OASVKTK5.log)(indent + "Not visited!");
|
|
12989
13006
|
return;
|
|
12990
13007
|
}
|
|
12991
13008
|
state.map.forEach((value2, key) => {
|
|
12992
|
-
(0,
|
|
13009
|
+
(0, import_chunk_OASVKTK5.log)(
|
|
12993
13010
|
`${indent} - ${typeStateEntry(value2, key)}${value2.equivSet ? ` [(${Array.from(value2.equivSet).map(tsKey).join(", ")})]` : ""}`
|
|
12994
13011
|
);
|
|
12995
13012
|
});
|
|
@@ -13139,7 +13156,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
13139
13156
|
const [objDecls, trueDecls] = findObjectDeclsByProperty(
|
|
13140
13157
|
istate.state,
|
|
13141
13158
|
cur,
|
|
13142
|
-
me
|
|
13159
|
+
me.property
|
|
13143
13160
|
);
|
|
13144
13161
|
if (!objDecls) {
|
|
13145
13162
|
return null;
|
|
@@ -13196,7 +13213,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
13196
13213
|
type: 0
|
|
13197
13214
|
/* Never */
|
|
13198
13215
|
};
|
|
13199
|
-
(0,
|
|
13216
|
+
(0, import_chunk_OASVKTK5.forEach)(avalue, (v) => unionInto(n, v));
|
|
13200
13217
|
next = n;
|
|
13201
13218
|
}
|
|
13202
13219
|
} else {
|
|
@@ -13301,7 +13318,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
13301
13318
|
}
|
|
13302
13319
|
if (!isStatic && selfClassDecl) {
|
|
13303
13320
|
const baseObj = getObjectValue(baseElem.type);
|
|
13304
|
-
if (baseObj && baseObj.klass.type === 16384 && (0,
|
|
13321
|
+
if (baseObj && baseObj.klass.type === 16384 && (0, import_chunk_OASVKTK5.some)(
|
|
13305
13322
|
baseObj.klass.value,
|
|
13306
13323
|
(cls) => cls === selfClassDecl || getSuperClasses(cls)?.has(selfClassDecl) || getSuperClasses(selfClassDecl)?.has(cls) || false
|
|
13307
13324
|
)) {
|
|
@@ -13346,7 +13363,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
13346
13363
|
return [cur, updateAny];
|
|
13347
13364
|
}
|
|
13348
13365
|
function typeConstraint(decls, blockState) {
|
|
13349
|
-
return (0,
|
|
13366
|
+
return (0, import_chunk_OASVKTK5.reduce)(
|
|
13350
13367
|
decls,
|
|
13351
13368
|
(cur, decl) => {
|
|
13352
13369
|
if (decl.type === "Identifier" || decl.type === "BinaryExpression") {
|
|
@@ -13442,9 +13459,9 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
13442
13459
|
stack: [],
|
|
13443
13460
|
func
|
|
13444
13461
|
};
|
|
13445
|
-
const modifiableDecl = (decls, callees) => (0,
|
|
13462
|
+
const modifiableDecl = (decls, callees) => (0, import_chunk_OASVKTK5.some)(
|
|
13446
13463
|
decls,
|
|
13447
|
-
(decl) => decl.type === "VariableDeclarator" && decl.node.kind === "var" && !isLocal(decl) && (!callees || (0,
|
|
13464
|
+
(decl) => decl.type === "VariableDeclarator" && decl.node.kind === "var" && !isLocal(decl) && (!callees || (0, import_chunk_OASVKTK5.some)(callees, (callee) => functionMayModify(state, callee, decl)))
|
|
13448
13465
|
);
|
|
13449
13466
|
const mergeSuccState = (top, curState) => {
|
|
13450
13467
|
top.succs?.forEach((succ) => {
|
|
@@ -13453,7 +13470,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
13453
13470
|
}
|
|
13454
13471
|
if (mergeTypeState(blockStates, succ.order, curState, nodeCopyProp)) {
|
|
13455
13472
|
if (logThisRun) {
|
|
13456
|
-
(0,
|
|
13473
|
+
(0, import_chunk_OASVKTK5.log)(`re-merge: ${top.order} -> ${succ.order}`);
|
|
13457
13474
|
}
|
|
13458
13475
|
queue.enqueue(succ);
|
|
13459
13476
|
}
|
|
@@ -13463,7 +13480,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
13463
13480
|
const calleeObj = getStateType(curState, calleeObjDecl);
|
|
13464
13481
|
let calleeResult = null;
|
|
13465
13482
|
let effectFree = true;
|
|
13466
|
-
(0,
|
|
13483
|
+
(0, import_chunk_OASVKTK5.forEach)(callees, (callee) => {
|
|
13467
13484
|
const info = sysCallInfo(istate.state, callee);
|
|
13468
13485
|
if (!info) {
|
|
13469
13486
|
effectFree = false;
|
|
@@ -13740,7 +13757,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
13740
13757
|
});
|
|
13741
13758
|
} else {
|
|
13742
13759
|
if (logThisRun) {
|
|
13743
|
-
(0,
|
|
13760
|
+
(0, import_chunk_OASVKTK5.log)(` Flow (true): merge to ${trueSucc.order || -1}`);
|
|
13744
13761
|
printBlockState(top, sTrue || curState, " >true ");
|
|
13745
13762
|
}
|
|
13746
13763
|
if (mergeTypeState(
|
|
@@ -13750,7 +13767,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
13750
13767
|
nodeCopyProp
|
|
13751
13768
|
)) {
|
|
13752
13769
|
if (logThisRun) {
|
|
13753
|
-
(0,
|
|
13770
|
+
(0, import_chunk_OASVKTK5.log)(`re-merge: ${top.order} -> ${trueSucc.order}`);
|
|
13754
13771
|
}
|
|
13755
13772
|
queue.enqueue(trueSucc);
|
|
13756
13773
|
}
|
|
@@ -13762,7 +13779,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
13762
13779
|
});
|
|
13763
13780
|
} else {
|
|
13764
13781
|
if (logThisRun) {
|
|
13765
|
-
(0,
|
|
13782
|
+
(0, import_chunk_OASVKTK5.log)(` Flow (false): merge to: ${falseSucc.order || -1}`);
|
|
13766
13783
|
printBlockState(top, sFalse || curState, " >false ");
|
|
13767
13784
|
}
|
|
13768
13785
|
if (mergeTypeState(
|
|
@@ -13772,7 +13789,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
13772
13789
|
nodeCopyProp
|
|
13773
13790
|
)) {
|
|
13774
13791
|
if (logThisRun) {
|
|
13775
|
-
(0,
|
|
13792
|
+
(0, import_chunk_OASVKTK5.log)(`re-merge: ${top.order} -> ${falseSucc.order}`);
|
|
13776
13793
|
}
|
|
13777
13794
|
queue.enqueue(falseSucc);
|
|
13778
13795
|
}
|
|
@@ -13847,7 +13864,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
13847
13864
|
}
|
|
13848
13865
|
}
|
|
13849
13866
|
if (logThisRun) {
|
|
13850
|
-
(0,
|
|
13867
|
+
(0, import_chunk_OASVKTK5.log)(
|
|
13851
13868
|
describeEvent(event).then(
|
|
13852
13869
|
(eventStr) => ` ${eventStr} == ${display(curEntry.curType)}`
|
|
13853
13870
|
)
|
|
@@ -13857,7 +13874,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
13857
13874
|
}
|
|
13858
13875
|
case "mod": {
|
|
13859
13876
|
if (logThisRun) {
|
|
13860
|
-
(0,
|
|
13877
|
+
(0, import_chunk_OASVKTK5.log)(describeEvent(event).then((eventStr) => ` ${eventStr}`));
|
|
13861
13878
|
}
|
|
13862
13879
|
modInterference(curState, event, true, (callees, calleeObj) => {
|
|
13863
13880
|
clearRelatedCopyPropEvents(curState, null, nodeCopyProp);
|
|
@@ -13873,7 +13890,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
13873
13890
|
);
|
|
13874
13891
|
}
|
|
13875
13892
|
}
|
|
13876
|
-
if (nodeCopyProp.size && event.node.type === "CallExpression" && (0,
|
|
13893
|
+
if (nodeCopyProp.size && event.node.type === "CallExpression" && (0, import_chunk_OASVKTK5.some)(callees, (callee) => inlineRequested(state, callee))) {
|
|
13877
13894
|
event.node.arguments.forEach((arg) => {
|
|
13878
13895
|
const def = nodeCopyProp.get(arg);
|
|
13879
13896
|
if (def && nodeCopyProp.get(def) !== false) {
|
|
@@ -13885,7 +13902,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
13885
13902
|
let calleeEffects;
|
|
13886
13903
|
curState.map.forEach((tsv, decl) => {
|
|
13887
13904
|
let type = tsv.curType;
|
|
13888
|
-
if ((type.value == null || !(type.type & (32768 | 512 | 1024))) && !(0,
|
|
13905
|
+
if ((type.value == null || !(type.type & (32768 | 512 | 1024))) && !(0, import_chunk_OASVKTK5.some)(decl, (d) => d.type === "VariableDeclarator" && !isLocal(d))) {
|
|
13889
13906
|
return;
|
|
13890
13907
|
}
|
|
13891
13908
|
if (modifiableDecl(decl, callees)) {
|
|
@@ -13900,7 +13917,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
13900
13917
|
curState.map.set(decl, {
|
|
13901
13918
|
curType: typeConstraint(decl, curState)
|
|
13902
13919
|
});
|
|
13903
|
-
} else if (type.type & (32768 | 512 | 1024) && (calleeEffects == null ? calleeEffects = !callees || !(0,
|
|
13920
|
+
} else if (type.type & (32768 | 512 | 1024) && (calleeEffects == null ? calleeEffects = !callees || !(0, import_chunk_OASVKTK5.every)(callees, (callee) => callee.info === false) : calleeEffects)) {
|
|
13904
13921
|
if (type.value != null && type.type & 32768) {
|
|
13905
13922
|
const odata = getObjectValue(tsv.curType);
|
|
13906
13923
|
if (odata?.obj) {
|
|
@@ -13968,7 +13985,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
13968
13985
|
2
|
|
13969
13986
|
/* Reassign */
|
|
13970
13987
|
);
|
|
13971
|
-
(0,
|
|
13988
|
+
(0, import_chunk_OASVKTK5.some)(event.decl, (decl) => {
|
|
13972
13989
|
if (decl.type !== "VariableDeclarator" || decl.node.kind !== "var" || !isClassVariable(decl)) {
|
|
13973
13990
|
return false;
|
|
13974
13991
|
}
|
|
@@ -13976,7 +13993,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
13976
13993
|
if (affected) {
|
|
13977
13994
|
const objType = typeFromTypeStateNodes(
|
|
13978
13995
|
istate.state,
|
|
13979
|
-
(0,
|
|
13996
|
+
(0, import_chunk_OASVKTK5.map)(
|
|
13980
13997
|
event.decl,
|
|
13981
13998
|
(decl2) => decl2.type === "VariableDeclarator" && decl2.stack[decl2.stack.length - 1].sn
|
|
13982
13999
|
).filter(
|
|
@@ -13997,7 +14014,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
13997
14014
|
});
|
|
13998
14015
|
if (wasComputedDecl) {
|
|
13999
14016
|
curState.map.forEach((value2, decls) => {
|
|
14000
|
-
if ((0,
|
|
14017
|
+
if ((0, import_chunk_OASVKTK5.some)(
|
|
14001
14018
|
decls,
|
|
14002
14019
|
(decl) => decl.type === "VariableDeclarator" && decl.node.kind === "var" && !isLocal(decl)
|
|
14003
14020
|
)) {
|
|
@@ -14043,14 +14060,14 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
14043
14060
|
}
|
|
14044
14061
|
if (!copyPropCandidate.ant || // If the ref isn't anticipated, we can't propagate it
|
|
14045
14062
|
// in case it has side effects.
|
|
14046
|
-
(0,
|
|
14063
|
+
(0, import_chunk_OASVKTK5.some)(
|
|
14047
14064
|
event2.calleeDecl,
|
|
14048
14065
|
(callee) => callee.type === "FunctionDeclaration" && inlineRequested(state, callee)
|
|
14049
14066
|
)) {
|
|
14050
14067
|
return false;
|
|
14051
14068
|
}
|
|
14052
14069
|
}
|
|
14053
|
-
if (!event2.decl || isTypeStateKey(event2.decl) && (0,
|
|
14070
|
+
if (!event2.decl || isTypeStateKey(event2.decl) && (0, import_chunk_OASVKTK5.some)(
|
|
14054
14071
|
event2.decl,
|
|
14055
14072
|
(decl) => decl.type === "VariableDeclarator" && decl.node.kind === "var" || decl.type === "BinaryExpression" || decl.type === "Identifier"
|
|
14056
14073
|
)) {
|
|
@@ -14089,13 +14106,13 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
14089
14106
|
}
|
|
14090
14107
|
}
|
|
14091
14108
|
if (uninitClassDecls?.size) {
|
|
14092
|
-
(0,
|
|
14109
|
+
(0, import_chunk_OASVKTK5.forEach)(
|
|
14093
14110
|
event.decl,
|
|
14094
14111
|
(decl) => uninitClassDecls.has(decl) && curState.inited?.add(decl)
|
|
14095
14112
|
);
|
|
14096
14113
|
}
|
|
14097
14114
|
if (logThisRun) {
|
|
14098
|
-
(0,
|
|
14115
|
+
(0, import_chunk_OASVKTK5.log)(
|
|
14099
14116
|
describeEvent(event).then(
|
|
14100
14117
|
(eventStr) => ` ${eventStr} := ${display(type)}`
|
|
14101
14118
|
)
|
|
@@ -14113,7 +14130,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
14113
14130
|
);
|
|
14114
14131
|
}
|
|
14115
14132
|
if (logThisRun) {
|
|
14116
|
-
(0,
|
|
14133
|
+
(0, import_chunk_OASVKTK5.log)(
|
|
14117
14134
|
describeEvent(event).then(
|
|
14118
14135
|
(eventStr) => ` ${eventStr} : ${!Array.isArray(event.left) && event.left.type === "MemberDecl" ? `${display(
|
|
14119
14136
|
curState.map.get(event.left.base)?.curType || {
|
|
@@ -14171,8 +14188,8 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
14171
14188
|
}
|
|
14172
14189
|
if (!successorsHandled) {
|
|
14173
14190
|
if (logThisRun) {
|
|
14174
|
-
(0,
|
|
14175
|
-
` merge to: ${(0,
|
|
14191
|
+
(0, import_chunk_OASVKTK5.log)(
|
|
14192
|
+
` merge to: ${(0, import_chunk_OASVKTK5.map)(
|
|
14176
14193
|
top.succs,
|
|
14177
14194
|
(succ) => succ.order || -1
|
|
14178
14195
|
).join(", ")}`
|
|
@@ -14203,17 +14220,17 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
14203
14220
|
);
|
|
14204
14221
|
printBlockTrailer(block);
|
|
14205
14222
|
});
|
|
14206
|
-
(0,
|
|
14223
|
+
(0, import_chunk_OASVKTK5.log)("====== TypeMap =====");
|
|
14207
14224
|
typeMap.forEach((value2, key) => {
|
|
14208
|
-
(0,
|
|
14225
|
+
(0, import_chunk_OASVKTK5.log)(
|
|
14209
14226
|
formatAst(key).then(
|
|
14210
14227
|
(keyStr) => `${keyStr} = ${display(value2)} ${key.loc && key.loc.source ? ` (${sourceLocation(key.loc)})` : ""}`
|
|
14211
14228
|
)
|
|
14212
14229
|
);
|
|
14213
14230
|
});
|
|
14214
|
-
(0,
|
|
14231
|
+
(0, import_chunk_OASVKTK5.log)("====== EquivMap =====");
|
|
14215
14232
|
nodeEquivs.forEach((value2, key) => {
|
|
14216
|
-
(0,
|
|
14233
|
+
(0, import_chunk_OASVKTK5.log)(
|
|
14217
14234
|
formatAst(key).then(
|
|
14218
14235
|
(keyStr) => `${keyStr} = [${value2.equiv.map(
|
|
14219
14236
|
(equiv) => tsKey(equiv)
|
|
@@ -14221,7 +14238,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
14221
14238
|
)
|
|
14222
14239
|
);
|
|
14223
14240
|
});
|
|
14224
|
-
(0,
|
|
14241
|
+
(0, import_chunk_OASVKTK5.log)("====== Copy Prop =====");
|
|
14225
14242
|
nodeCopyProp.forEach((value2, key) => {
|
|
14226
14243
|
(0, import_node_assert3.default)(value2 !== false);
|
|
14227
14244
|
if (key.type === "VariableDeclarator" || key.type === "AssignmentExpression") {
|
|
@@ -14231,7 +14248,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
14231
14248
|
value2.type === "VariableDeclarator" && value2.init || value2.type === "AssignmentExpression"
|
|
14232
14249
|
);
|
|
14233
14250
|
const node = value2.type === "VariableDeclarator" ? value2.init : value2.right;
|
|
14234
|
-
(0,
|
|
14251
|
+
(0, import_chunk_OASVKTK5.log)(
|
|
14235
14252
|
formatAst(key).then(
|
|
14236
14253
|
(keyStr) => formatAstLongLines(node).then(
|
|
14237
14254
|
(nodeStr) => `${keyStr} = [${nodeStr}] ${key.loc && key.loc.source ? ` (${sourceLocation(key.loc)})` : ""}`
|
|
@@ -14241,10 +14258,10 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
14241
14258
|
});
|
|
14242
14259
|
}
|
|
14243
14260
|
if (logThisRun) {
|
|
14244
|
-
(0,
|
|
14261
|
+
(0, import_chunk_OASVKTK5.log)(formatAstLongLines(func.node));
|
|
14245
14262
|
if (copyPropStores) {
|
|
14246
14263
|
copyPropStores.forEach(({ ref, ant }, node) => {
|
|
14247
|
-
(0,
|
|
14264
|
+
(0, import_chunk_OASVKTK5.log)(
|
|
14248
14265
|
formatAstLongLines(node).then(
|
|
14249
14266
|
(nodeStr) => `copy-prop-store: ${nodeStr}${ant ? "!" : ""} => ${nodeCopyProp.get(node) !== ref ? "Failed" : "Success"}`
|
|
14250
14267
|
)
|
|
@@ -14258,9 +14275,9 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
14258
14275
|
}
|
|
14259
14276
|
if (logThisRun) {
|
|
14260
14277
|
if (selfAssignments.size) {
|
|
14261
|
-
(0,
|
|
14278
|
+
(0, import_chunk_OASVKTK5.log)("====== Self Assignments =====");
|
|
14262
14279
|
selfAssignments.forEach(
|
|
14263
|
-
(self) => (0,
|
|
14280
|
+
(self) => (0, import_chunk_OASVKTK5.log)(
|
|
14264
14281
|
formatAst(self).then(
|
|
14265
14282
|
(selfStr) => `${selfStr} (${sourceLocation(self.loc)})`
|
|
14266
14283
|
)
|
|
@@ -14325,7 +14342,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
14325
14342
|
if (copyNode) {
|
|
14326
14343
|
if (node.type === "AssignmentExpression") {
|
|
14327
14344
|
if (logThisRun) {
|
|
14328
|
-
(0,
|
|
14345
|
+
(0, import_chunk_OASVKTK5.log)(
|
|
14329
14346
|
formatAstLongLines(node).then(
|
|
14330
14347
|
(nodeStr) => `Killing copy-prop assignment ${nodeStr}`
|
|
14331
14348
|
)
|
|
@@ -14340,7 +14357,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
14340
14357
|
if (node.type === "VariableDeclarator") {
|
|
14341
14358
|
(0, import_node_assert3.default)(node.init);
|
|
14342
14359
|
if (logThisRun) {
|
|
14343
|
-
(0,
|
|
14360
|
+
(0, import_chunk_OASVKTK5.log)(
|
|
14344
14361
|
formatAstLongLines(node).then(
|
|
14345
14362
|
(nodeStr) => `Killing copy-prop variable initialization ${nodeStr}`
|
|
14346
14363
|
)
|
|
@@ -14361,7 +14378,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
14361
14378
|
right: copyNode.right
|
|
14362
14379
|
};
|
|
14363
14380
|
if (logThisRun) {
|
|
14364
|
-
(0,
|
|
14381
|
+
(0, import_chunk_OASVKTK5.log)(
|
|
14365
14382
|
formatAstLongLines(node).then(
|
|
14366
14383
|
(nodeStr) => formatAstLongLines(replacement2).then(
|
|
14367
14384
|
(repStr) => `copy-prop ${nodeStr} => ${repStr}`
|
|
@@ -14374,7 +14391,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
14374
14391
|
const init = copyNode.init;
|
|
14375
14392
|
(0, import_node_assert3.default)(init);
|
|
14376
14393
|
if (logThisRun) {
|
|
14377
|
-
(0,
|
|
14394
|
+
(0, import_chunk_OASVKTK5.log)(
|
|
14378
14395
|
formatAstLongLines(node).then(
|
|
14379
14396
|
(nodeStr) => formatAstLongLines(init).then(
|
|
14380
14397
|
(initStr) => `copy-prop ${nodeStr} => ${initStr}`
|
|
@@ -14388,7 +14405,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
14388
14405
|
}
|
|
14389
14406
|
if (selfAssignments.has(node)) {
|
|
14390
14407
|
if (logThisRun) {
|
|
14391
|
-
(0,
|
|
14408
|
+
(0, import_chunk_OASVKTK5.log)(
|
|
14392
14409
|
formatAst(node).then(
|
|
14393
14410
|
(nodeStr) => `Deleting self assignment: ${nodeStr} (${sourceLocation(
|
|
14394
14411
|
node.loc
|
|
@@ -14432,7 +14449,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
14432
14449
|
}, curInfo);
|
|
14433
14450
|
if (rep === curInfo)
|
|
14434
14451
|
return null;
|
|
14435
|
-
const name = (0,
|
|
14452
|
+
const name = (0, import_chunk_OASVKTK5.reduce)(
|
|
14436
14453
|
rep.decl,
|
|
14437
14454
|
(cur, decl) => decl.type === "VariableDeclarator" ? decl.name : cur,
|
|
14438
14455
|
null
|
|
@@ -14440,7 +14457,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
14440
14457
|
if (!name)
|
|
14441
14458
|
return null;
|
|
14442
14459
|
if (logThisRun) {
|
|
14443
|
-
(0,
|
|
14460
|
+
(0, import_chunk_OASVKTK5.log)(
|
|
14444
14461
|
formatAst(node).then(
|
|
14445
14462
|
(nodeStr) => `Replacing ${nodeStr} with ${name} at ${sourceLocation(
|
|
14446
14463
|
node.loc
|
|
@@ -14571,7 +14588,7 @@ var init_type_flow = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
14571
14588
|
init_type_flow_util();
|
|
14572
14589
|
init_types();
|
|
14573
14590
|
init_union_type();
|
|
14574
|
-
(0,
|
|
14591
|
+
(0, import_chunk_OASVKTK5.init_util)();
|
|
14575
14592
|
logging = true;
|
|
14576
14593
|
missingNullWorkaround = true;
|
|
14577
14594
|
}
|
|
@@ -14623,9 +14640,9 @@ function minimizeLocals(state, func) {
|
|
|
14623
14640
|
if (!didMerge)
|
|
14624
14641
|
return;
|
|
14625
14642
|
if (logThisRun) {
|
|
14626
|
-
(0,
|
|
14643
|
+
(0, import_chunk_OASVKTK5.log)(`>>> Merging locals in ${func.fullName}`);
|
|
14627
14644
|
merge.forEach(
|
|
14628
|
-
(merged) => merged.length > 1 && (0,
|
|
14645
|
+
(merged) => merged.length > 1 && (0, import_chunk_OASVKTK5.log)(` - merging ${merged.map((k) => tsKey(k)).join(" | ")}`)
|
|
14629
14646
|
);
|
|
14630
14647
|
}
|
|
14631
14648
|
const remap = /* @__PURE__ */ new Map();
|
|
@@ -14895,7 +14912,7 @@ var init_minimize_locals = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
14895
14912
|
(0, import_chunk_MBTLUWXR.init_ast)();
|
|
14896
14913
|
init_control_flow();
|
|
14897
14914
|
init_type_flow();
|
|
14898
|
-
(0,
|
|
14915
|
+
(0, import_chunk_OASVKTK5.init_util)();
|
|
14899
14916
|
init_variable_renamer();
|
|
14900
14917
|
init_type_flow_util();
|
|
14901
14918
|
}
|
|
@@ -14906,12 +14923,12 @@ function logAntState(s, decl) {
|
|
|
14906
14923
|
defs2++;
|
|
14907
14924
|
return defs2;
|
|
14908
14925
|
}, 0);
|
|
14909
|
-
(0,
|
|
14926
|
+
(0, import_chunk_OASVKTK5.log)(
|
|
14910
14927
|
declFullName(decl).then(
|
|
14911
14928
|
(declStr) => ` - ${declStr}: ${candidateCost(s)} bytes, ${s.ant.size - defs} refs, ${defs} defs, ${s.live ? "" : "!"}live, ${s.isIsolated ? "" : "!"}isolated`
|
|
14912
14929
|
)
|
|
14913
14930
|
);
|
|
14914
|
-
(0,
|
|
14931
|
+
(0, import_chunk_OASVKTK5.log)(
|
|
14915
14932
|
` - members: ${Array.from(s.members).map(([block, live]) => block.order + (live ? "t" : "f")).join(", ")}`
|
|
14916
14933
|
);
|
|
14917
14934
|
}
|
|
@@ -14928,7 +14945,7 @@ async function sizeBasedPRE(state, func) {
|
|
|
14928
14945
|
const candidates = computeAttributes(state, head);
|
|
14929
14946
|
if (candidates) {
|
|
14930
14947
|
if (logging2) {
|
|
14931
|
-
(0,
|
|
14948
|
+
(0, import_chunk_OASVKTK5.log)(`Found ${candidates.size} candidates in ${func.fullName}`);
|
|
14932
14949
|
logAntDecls(candidates);
|
|
14933
14950
|
}
|
|
14934
14951
|
const nodeMap = /* @__PURE__ */ new Map();
|
|
@@ -15021,7 +15038,7 @@ function buildPREGraph(state, func) {
|
|
|
15021
15038
|
const event = block.events[i];
|
|
15022
15039
|
switch (event.type) {
|
|
15023
15040
|
case "ref":
|
|
15024
|
-
if ((0,
|
|
15041
|
+
if ((0, import_chunk_OASVKTK5.some)(
|
|
15025
15042
|
event.decl,
|
|
15026
15043
|
(decl) => decl.type === "Literal" || decl.type === "VariableDeclarator" && decl.node.kind === "const"
|
|
15027
15044
|
)) {
|
|
@@ -15039,7 +15056,7 @@ function buildPREGraph(state, func) {
|
|
|
15039
15056
|
defs.add(event.decl);
|
|
15040
15057
|
break;
|
|
15041
15058
|
case "mod":
|
|
15042
|
-
if (event.callees && (0,
|
|
15059
|
+
if (event.callees && (0, import_chunk_OASVKTK5.every)(event.callees, (callee) => callee.info === false)) {
|
|
15043
15060
|
block.events.splice(i, 1);
|
|
15044
15061
|
break;
|
|
15045
15062
|
}
|
|
@@ -15198,21 +15215,21 @@ function computeAttributes(state, head) {
|
|
|
15198
15215
|
});
|
|
15199
15216
|
if (logging2) {
|
|
15200
15217
|
order.forEach((block) => {
|
|
15201
|
-
(0,
|
|
15218
|
+
(0, import_chunk_OASVKTK5.log)(
|
|
15202
15219
|
block.order,
|
|
15203
15220
|
`(${block.node ? block.node.loc?.start.line : "??"})`,
|
|
15204
15221
|
`Preds: ${(block.preds || []).map((block2) => block2.order).join(", ")}`
|
|
15205
15222
|
);
|
|
15206
15223
|
if (block.events) {
|
|
15207
15224
|
block.events.forEach(
|
|
15208
|
-
(event) => event.type !== "exn" && (0,
|
|
15225
|
+
(event) => event.type !== "exn" && (0, import_chunk_OASVKTK5.log)(
|
|
15209
15226
|
Promise.resolve(
|
|
15210
15227
|
event.decl ? declFullName(event.decl) : event.node ? formatAst(event.node) : "??"
|
|
15211
15228
|
).then((eventDetails) => ` ${event.type}: ${eventDetails}`)
|
|
15212
15229
|
)
|
|
15213
15230
|
);
|
|
15214
15231
|
}
|
|
15215
|
-
(0,
|
|
15232
|
+
(0, import_chunk_OASVKTK5.log)(
|
|
15216
15233
|
`Succs: ${(block.succs || []).map((block2) => block2.order).join(", ")} ExSucc: ${block.exsucc ? block.exsucc.order : ""}`
|
|
15217
15234
|
);
|
|
15218
15235
|
});
|
|
@@ -15280,7 +15297,7 @@ function computeAttributes(state, head) {
|
|
|
15280
15297
|
}
|
|
15281
15298
|
case "mod": {
|
|
15282
15299
|
curState.forEach((candidates, decls) => {
|
|
15283
|
-
if ((0,
|
|
15300
|
+
if ((0, import_chunk_OASVKTK5.some)(
|
|
15284
15301
|
decls,
|
|
15285
15302
|
(decl) => decl.type === "VariableDeclarator" && decl.node.kind === "var" && candidates.live && (!event.callees || event.callees.some(
|
|
15286
15303
|
(callee) => functionMayModify(state, callee, decl)
|
|
@@ -15322,7 +15339,7 @@ function computeAttributes(state, head) {
|
|
|
15322
15339
|
}
|
|
15323
15340
|
blockStates[top.order] = curState;
|
|
15324
15341
|
if (logging2) {
|
|
15325
|
-
(0,
|
|
15342
|
+
(0, import_chunk_OASVKTK5.log)(`Updated block ${top.order}`);
|
|
15326
15343
|
logAntDecls(curState);
|
|
15327
15344
|
}
|
|
15328
15345
|
if (top.preds) {
|
|
@@ -15424,7 +15441,7 @@ function applyReplacements(func, nodeMap, declMap) {
|
|
|
15424
15441
|
}
|
|
15425
15442
|
const name = declMap.get(event.decl);
|
|
15426
15443
|
if (!name) {
|
|
15427
|
-
throw new
|
|
15444
|
+
throw new import_chunk_OASVKTK5.AwaitedError(
|
|
15428
15445
|
formatAst(node).then(
|
|
15429
15446
|
(targetStr) => `No replacement found for "${targetStr}"`
|
|
15430
15447
|
)
|
|
@@ -15446,7 +15463,7 @@ function applyReplacements(func, nodeMap, declMap) {
|
|
|
15446
15463
|
const target = node.type === "AssignmentExpression" ? node.left : node.argument;
|
|
15447
15464
|
const name = declMap.get(event.decl);
|
|
15448
15465
|
if (!name) {
|
|
15449
|
-
throw new
|
|
15466
|
+
throw new import_chunk_OASVKTK5.AwaitedError(
|
|
15450
15467
|
formatAst(target).then(
|
|
15451
15468
|
(targetStr) => `No replacement found for "${targetStr}"`
|
|
15452
15469
|
)
|
|
@@ -15509,14 +15526,14 @@ function applyReplacements(func, nodeMap, declMap) {
|
|
|
15509
15526
|
const decl = event.decl;
|
|
15510
15527
|
const name = declMap.get(decl);
|
|
15511
15528
|
if (!name) {
|
|
15512
|
-
throw new
|
|
15529
|
+
throw new import_chunk_OASVKTK5.AwaitedError(
|
|
15513
15530
|
declFullName(decl).then(
|
|
15514
15531
|
(declStr) => `No replacement found for "${declStr}"`
|
|
15515
15532
|
)
|
|
15516
15533
|
);
|
|
15517
15534
|
}
|
|
15518
15535
|
if (!event.id) {
|
|
15519
|
-
throw new
|
|
15536
|
+
throw new import_chunk_OASVKTK5.AwaitedError(
|
|
15520
15537
|
declFullName(decl).then(
|
|
15521
15538
|
(declStr) => `Missing id for mod event for "${declStr}"`
|
|
15522
15539
|
)
|
|
@@ -15581,7 +15598,7 @@ var init_pre = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
15581
15598
|
init_data_flow();
|
|
15582
15599
|
init_function_info();
|
|
15583
15600
|
init_minimize_locals();
|
|
15584
|
-
(0,
|
|
15601
|
+
(0, import_chunk_OASVKTK5.init_util)();
|
|
15585
15602
|
logging2 = false;
|
|
15586
15603
|
LocalRefCost = 2;
|
|
15587
15604
|
}
|
|
@@ -15952,7 +15969,7 @@ function beforeEvaluate(istate, node) {
|
|
|
15952
15969
|
break;
|
|
15953
15970
|
}
|
|
15954
15971
|
const id = node.right.argument;
|
|
15955
|
-
if ((0,
|
|
15972
|
+
if ((0, import_chunk_OASVKTK5.every)(left.value.value, (m) => {
|
|
15956
15973
|
if ((0, import_chunk_MBTLUWXR.hasProperty)(m.decls, id.name))
|
|
15957
15974
|
return false;
|
|
15958
15975
|
return istate.state.lookup({
|
|
@@ -16398,7 +16415,7 @@ var init_optimize = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
16398
16415
|
(0, import_chunk_MBTLUWXR.init_ast)();
|
|
16399
16416
|
init_inliner();
|
|
16400
16417
|
init_type_flow();
|
|
16401
|
-
(0,
|
|
16418
|
+
(0, import_chunk_OASVKTK5.init_util)();
|
|
16402
16419
|
init_interp();
|
|
16403
16420
|
init_interp_binary();
|
|
16404
16421
|
init_types();
|
|
@@ -16609,6 +16626,7 @@ function collectClassInfo(state) {
|
|
|
16609
16626
|
const toybox = state.stack[0].sn.decls["Toybox"][0];
|
|
16610
16627
|
const lang = toybox.decls["Lang"][0];
|
|
16611
16628
|
const object = lang.decls["Object"];
|
|
16629
|
+
const invalidSymbols = state.config?.checkInvalidSymbols ?? "WARNING";
|
|
16612
16630
|
state.allClasses.forEach((elm) => {
|
|
16613
16631
|
if (elm.stack[elm.stack.length - 1].sn.type === "ClassDeclaration") {
|
|
16614
16632
|
elm.stack = elm.stack.slice(0, 1);
|
|
@@ -16623,7 +16641,18 @@ function collectClassInfo(state) {
|
|
|
16623
16641
|
(c) => isStateNode(c) && c.type === "ClassDeclaration"
|
|
16624
16642
|
);
|
|
16625
16643
|
elm.superClass = superClass && superClass.length ? superClass : true;
|
|
16626
|
-
if (
|
|
16644
|
+
if (elm.superClass === true) {
|
|
16645
|
+
if (invalidSymbols !== "OFF") {
|
|
16646
|
+
diagnostic(
|
|
16647
|
+
state,
|
|
16648
|
+
elm.node,
|
|
16649
|
+
formatAstLongLines(elm.node.superClass).then(
|
|
16650
|
+
(superClass2) => `Unable to find super class ${superClass2} for ${elm.fullName}`
|
|
16651
|
+
),
|
|
16652
|
+
invalidSymbols
|
|
16653
|
+
);
|
|
16654
|
+
}
|
|
16655
|
+
} else if (name) {
|
|
16627
16656
|
if (!elm.decls)
|
|
16628
16657
|
elm.decls = {};
|
|
16629
16658
|
elm.decls[name] = elm.superClass;
|
|
@@ -16632,24 +16661,44 @@ function collectClassInfo(state) {
|
|
|
16632
16661
|
elm.superClass = object;
|
|
16633
16662
|
}
|
|
16634
16663
|
});
|
|
16635
|
-
const markOverrides = (cls, scls) => {
|
|
16664
|
+
const markOverrides = (cls, scls, seen) => {
|
|
16636
16665
|
if (scls === true)
|
|
16637
16666
|
return;
|
|
16638
|
-
scls.
|
|
16639
|
-
|
|
16667
|
+
for (let i = scls.length; i--; ) {
|
|
16668
|
+
const c = scls[i];
|
|
16669
|
+
if (!c.decls)
|
|
16670
|
+
continue;
|
|
16671
|
+
if (seen.has(c)) {
|
|
16672
|
+
if (invalidSymbols !== "OFF") {
|
|
16673
|
+
diagnostic(
|
|
16674
|
+
state,
|
|
16675
|
+
cls.node,
|
|
16676
|
+
`Class ${cls.fullName}'s inheritance graph contains a cycle including ${c.fullName}`,
|
|
16677
|
+
invalidSymbols
|
|
16678
|
+
);
|
|
16679
|
+
}
|
|
16680
|
+
scls.splice(i, 1);
|
|
16681
|
+
continue;
|
|
16682
|
+
}
|
|
16683
|
+
Object.values(c.decls).forEach((funcs) => {
|
|
16640
16684
|
funcs.forEach((f) => {
|
|
16641
16685
|
if (f.type === "FunctionDeclaration" && (0, import_chunk_MBTLUWXR.hasProperty)(cls.decls, f.name)) {
|
|
16642
16686
|
f.node.hasOverride = true;
|
|
16643
16687
|
}
|
|
16644
16688
|
});
|
|
16645
16689
|
});
|
|
16646
|
-
if (c.superClass)
|
|
16647
|
-
|
|
16648
|
-
|
|
16690
|
+
if (c.superClass) {
|
|
16691
|
+
seen.add(c);
|
|
16692
|
+
markOverrides(cls, c.superClass, seen);
|
|
16693
|
+
seen.delete(c);
|
|
16694
|
+
}
|
|
16695
|
+
}
|
|
16649
16696
|
};
|
|
16650
16697
|
state.allClasses.forEach((elm) => {
|
|
16651
|
-
if (elm.superClass)
|
|
16652
|
-
|
|
16698
|
+
if (elm.superClass) {
|
|
16699
|
+
const seen = /* @__PURE__ */ new Set();
|
|
16700
|
+
markOverrides(elm, elm.superClass, seen);
|
|
16701
|
+
}
|
|
16653
16702
|
if (elm.hasInvoke && elm.decls) {
|
|
16654
16703
|
Object.values(elm.decls).forEach((funcs) => {
|
|
16655
16704
|
funcs.forEach((f) => {
|
|
@@ -16660,6 +16709,11 @@ function collectClassInfo(state) {
|
|
|
16660
16709
|
});
|
|
16661
16710
|
}
|
|
16662
16711
|
});
|
|
16712
|
+
state.allClasses.forEach((elm) => {
|
|
16713
|
+
if (elm.superClass && elm.superClass !== true && elm.superClass.length === 0) {
|
|
16714
|
+
elm.superClass = true;
|
|
16715
|
+
}
|
|
16716
|
+
});
|
|
16663
16717
|
}
|
|
16664
16718
|
function getFileSources(fnMap) {
|
|
16665
16719
|
return Promise.all(
|
|
@@ -16675,7 +16729,7 @@ function getFileSources(fnMap) {
|
|
|
16675
16729
|
function getFileASTs(fnMap) {
|
|
16676
16730
|
return getFileSources(fnMap).then(
|
|
16677
16731
|
() => Object.entries(fnMap).reduce((ok, [name, value2]) => {
|
|
16678
|
-
if (!value2.ast) {
|
|
16732
|
+
if (!value2.ast && !value2.parserError) {
|
|
16679
16733
|
const options = {
|
|
16680
16734
|
filepath: name
|
|
16681
16735
|
};
|
|
@@ -16689,7 +16743,6 @@ function getFileASTs(fnMap) {
|
|
|
16689
16743
|
options
|
|
16690
16744
|
);
|
|
16691
16745
|
} catch (e) {
|
|
16692
|
-
ok = false;
|
|
16693
16746
|
if (e instanceof Error) {
|
|
16694
16747
|
value2.parserError = e;
|
|
16695
16748
|
} else {
|
|
@@ -16697,11 +16750,11 @@ function getFileASTs(fnMap) {
|
|
|
16697
16750
|
}
|
|
16698
16751
|
}
|
|
16699
16752
|
}
|
|
16700
|
-
return ok;
|
|
16753
|
+
return value2.parserError ? false : ok;
|
|
16701
16754
|
}, true)
|
|
16702
16755
|
);
|
|
16703
16756
|
}
|
|
16704
|
-
async function analyze(fnMap, resourcesMap, manifestXML, config) {
|
|
16757
|
+
async function analyze(fnMap, resourcesMap, manifestXML, config, allowParseErrors) {
|
|
16705
16758
|
let hasTests = false;
|
|
16706
16759
|
let markApi = true;
|
|
16707
16760
|
const preState = {
|
|
@@ -16767,6 +16820,8 @@ async function analyze(fnMap, resourcesMap, manifestXML, config) {
|
|
|
16767
16820
|
Object.entries(fnMap).forEach(([name, value2]) => {
|
|
16768
16821
|
const { ast, parserError } = value2;
|
|
16769
16822
|
if (!ast) {
|
|
16823
|
+
if (allowParseErrors)
|
|
16824
|
+
return;
|
|
16770
16825
|
throw parserError || new Error(`Failed to parse ${name}`);
|
|
16771
16826
|
}
|
|
16772
16827
|
hasTests = false;
|
|
@@ -16785,7 +16840,7 @@ function reportMissingSymbols(state, config) {
|
|
|
16785
16840
|
const diagnosticType = config?.checkInvalidSymbols !== "OFF" ? config?.checkInvalidSymbols || "WARNING" : null;
|
|
16786
16841
|
const compiler2DiagnosticType = config?.checkCompilerLookupRules !== "OFF" ? config?.checkCompilerLookupRules || "WARNING" : null;
|
|
16787
16842
|
if (diagnosticType && !config?.compilerOptions?.includes("--Eno-invalid-symbol")) {
|
|
16788
|
-
const checkTypes = config?.
|
|
16843
|
+
const checkTypes = config?.checkTypes?.toLowerCase() !== "off";
|
|
16789
16844
|
const report = (ast) => {
|
|
16790
16845
|
visitReferences(state, ast, null, false, (node, results, error) => {
|
|
16791
16846
|
if (node.type === "BinaryExpression" && node.operator === "has") {
|
|
@@ -16935,17 +16990,12 @@ function markFunctionCalled(state, func) {
|
|
|
16935
16990
|
state.calledFunctions[func.id.name] = [func];
|
|
16936
16991
|
return;
|
|
16937
16992
|
}
|
|
16938
|
-
(0,
|
|
16993
|
+
(0, import_chunk_OASVKTK5.pushUnique)(state.calledFunctions[func.id.name], func);
|
|
16939
16994
|
}
|
|
16940
|
-
|
|
16941
|
-
|
|
16942
|
-
|
|
16943
|
-
|
|
16944
|
-
if (ex instanceof import_chunk_67LU4GPQ.AwaitedError) {
|
|
16945
|
-
await ex.resolve();
|
|
16946
|
-
}
|
|
16947
|
-
throw ex;
|
|
16948
|
-
}
|
|
16995
|
+
function optimizeMonkeyC(fnMap, resourcesMap, manifestXML, config) {
|
|
16996
|
+
return optimizeMonkeyCHelper(fnMap, resourcesMap, manifestXML, config).catch(
|
|
16997
|
+
(ex) => Promise.reject(ex instanceof import_chunk_OASVKTK5.AwaitedError ? ex.resolve() : ex)
|
|
16998
|
+
);
|
|
16949
16999
|
}
|
|
16950
17000
|
async function optimizeMonkeyCHelper(fnMap, resourcesMap, manifestXML, config) {
|
|
16951
17001
|
const state = await analyze(
|
|
@@ -17040,7 +17090,7 @@ async function optimizeMonkeyCHelper(fnMap, resourcesMap, manifestXML, config) {
|
|
|
17040
17090
|
};
|
|
17041
17091
|
const gistate = { state, stack: [] };
|
|
17042
17092
|
if (state.config?.checkTypes !== "OFF" && state.config?.trustDeclaredTypes && state.config.propagateTypes) {
|
|
17043
|
-
gistate.typeChecker = state.config.
|
|
17093
|
+
gistate.typeChecker = state.config.strictTypeCheck?.toLowerCase() === "on" ? subtypeOf : couldBeWeak;
|
|
17044
17094
|
gistate.checkTypes = state.config?.checkTypes || "WARNING";
|
|
17045
17095
|
}
|
|
17046
17096
|
let istate = gistate;
|
|
@@ -17469,15 +17519,12 @@ async function optimizeMonkeyCHelper(fnMap, resourcesMap, manifestXML, config) {
|
|
|
17469
17519
|
}
|
|
17470
17520
|
delete state.inlineDiagnostics;
|
|
17471
17521
|
}
|
|
17522
|
+
const diagnostics = state.diagnostics && await resolveDiagnosticsMap(state.diagnostics);
|
|
17472
17523
|
if (state.config?.checkBuildPragmas) {
|
|
17473
|
-
|
|
17474
|
-
|
|
17475
|
-
|
|
17476
|
-
|
|
17477
|
-
]).then(([diagnostics2]) => pragmaChecker(state, f.ast, diagnostics2));
|
|
17478
|
-
}, Promise.resolve());
|
|
17479
|
-
}
|
|
17480
|
-
const diagnostics = state.diagnostics ? await resolveDiagnosticsMap(state.diagnostics) : state.diagnostics;
|
|
17524
|
+
Object.entries(fnMap).forEach(([name, f]) => {
|
|
17525
|
+
pragmaChecker(state, f.ast, diagnostics?.[name]);
|
|
17526
|
+
});
|
|
17527
|
+
}
|
|
17481
17528
|
return {
|
|
17482
17529
|
diagnostics,
|
|
17483
17530
|
sdkVersion: state.sdkVersion
|
|
@@ -17699,6 +17746,7 @@ var init_mc_rewrite = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
17699
17746
|
"use strict";
|
|
17700
17747
|
init_api();
|
|
17701
17748
|
(0, import_chunk_MBTLUWXR.init_ast)();
|
|
17749
|
+
init_data_flow();
|
|
17702
17750
|
init_function_info();
|
|
17703
17751
|
init_inliner();
|
|
17704
17752
|
init_optimizer_types();
|
|
@@ -17712,9 +17760,8 @@ var init_mc_rewrite = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
17712
17760
|
init_sub_type();
|
|
17713
17761
|
init_types();
|
|
17714
17762
|
init_unused_exprs();
|
|
17715
|
-
(0,
|
|
17763
|
+
(0, import_chunk_OASVKTK5.init_util)();
|
|
17716
17764
|
init_variable_renamer();
|
|
17717
|
-
init_data_flow();
|
|
17718
17765
|
}
|
|
17719
17766
|
});
|
|
17720
17767
|
var negativeFixups;
|
|
@@ -18607,7 +18654,7 @@ async function getApiMapping(state, resourcesMap, manifestXML) {
|
|
|
18607
18654
|
throw `Negative constant ${fixup} was not a Literal`;
|
|
18608
18655
|
}
|
|
18609
18656
|
if (typeof init.value !== "number") {
|
|
18610
|
-
(0,
|
|
18657
|
+
(0, import_chunk_OASVKTK5.log)(`Negative fixup ${fixup} was not a number!`);
|
|
18611
18658
|
} else if (init.value > 0) {
|
|
18612
18659
|
init.value = -init.value;
|
|
18613
18660
|
init.raw = "-" + init.raw;
|
|
@@ -18697,11 +18744,11 @@ function sameStateNodeDecl(a, b) {
|
|
|
18697
18744
|
function sameLookupDefinition(a, b) {
|
|
18698
18745
|
return (
|
|
18699
18746
|
// sameStateNodeDecl(a.parent, b.parent) &&
|
|
18700
|
-
(0,
|
|
18747
|
+
(0, import_chunk_OASVKTK5.sameArrays)(a.results, b.results, (ar, br) => sameStateNodeDecl(ar, br))
|
|
18701
18748
|
);
|
|
18702
18749
|
}
|
|
18703
18750
|
function sameLookupResult(a, b) {
|
|
18704
|
-
return (0,
|
|
18751
|
+
return (0, import_chunk_OASVKTK5.sameArrays)(a, b, sameLookupDefinition);
|
|
18705
18752
|
}
|
|
18706
18753
|
function declKey(decl) {
|
|
18707
18754
|
return isStateNode(decl) ? decl.type === "ModuleDeclaration" ? decl.fullName : decl.node : decl;
|
|
@@ -18758,6 +18805,17 @@ function lookupNext(state, results, decls, property) {
|
|
|
18758
18805
|
);
|
|
18759
18806
|
return;
|
|
18760
18807
|
}
|
|
18808
|
+
if (module2.type === "VariableDeclarator" && module2.resolvedType) {
|
|
18809
|
+
const [, decls2] = findObjectDeclsByProperty(
|
|
18810
|
+
state,
|
|
18811
|
+
module2.resolvedType,
|
|
18812
|
+
property
|
|
18813
|
+
);
|
|
18814
|
+
if (decls2) {
|
|
18815
|
+
addToItems(decls2);
|
|
18816
|
+
return;
|
|
18817
|
+
}
|
|
18818
|
+
}
|
|
18761
18819
|
const res = checkOne(state, module2, decls, property);
|
|
18762
18820
|
if (res) {
|
|
18763
18821
|
items.push({ parent: module2, results: res });
|
|
@@ -18952,7 +19010,11 @@ function lookupWithType(state, node, typeMap, nonLocal = false, stack = null) {
|
|
|
18952
19010
|
const objectType = typeMap.get(node.object);
|
|
18953
19011
|
if (!objectType)
|
|
18954
19012
|
return results;
|
|
18955
|
-
const [, decls] = findObjectDeclsByProperty(
|
|
19013
|
+
const [, decls] = findObjectDeclsByProperty(
|
|
19014
|
+
state,
|
|
19015
|
+
objectType,
|
|
19016
|
+
node.property
|
|
19017
|
+
);
|
|
18956
19018
|
if (decls) {
|
|
18957
19019
|
const next = lookupNext(
|
|
18958
19020
|
state,
|
|
@@ -19239,7 +19301,7 @@ function stateFuncs() {
|
|
|
19239
19301
|
if (!(0, import_chunk_MBTLUWXR.hasProperty)(this.index, name)) {
|
|
19240
19302
|
this.index[name] = [];
|
|
19241
19303
|
}
|
|
19242
|
-
(0,
|
|
19304
|
+
(0, import_chunk_OASVKTK5.pushUnique)(this.index[name], parent);
|
|
19243
19305
|
}
|
|
19244
19306
|
});
|
|
19245
19307
|
break;
|
|
@@ -19294,7 +19356,7 @@ function stateFuncs() {
|
|
|
19294
19356
|
if (!(0, import_chunk_MBTLUWXR.hasProperty)(values, name)) {
|
|
19295
19357
|
values[name] = [];
|
|
19296
19358
|
}
|
|
19297
|
-
if ((0,
|
|
19359
|
+
if ((0, import_chunk_OASVKTK5.pushUnique)(values[name], m) && currentEnum) {
|
|
19298
19360
|
if (!this.enumMap)
|
|
19299
19361
|
this.enumMap = /* @__PURE__ */ new Map();
|
|
19300
19362
|
this.enumMap.set(m, currentEnum);
|
|
@@ -19302,7 +19364,7 @@ function stateFuncs() {
|
|
|
19302
19364
|
if (!(0, import_chunk_MBTLUWXR.hasProperty)(this.index, name)) {
|
|
19303
19365
|
this.index[name] = [];
|
|
19304
19366
|
}
|
|
19305
|
-
(0,
|
|
19367
|
+
(0, import_chunk_OASVKTK5.pushUnique)(this.index[name], parent);
|
|
19306
19368
|
});
|
|
19307
19369
|
break;
|
|
19308
19370
|
}
|
|
@@ -19803,7 +19865,7 @@ var init_api = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
19803
19865
|
init_sdk_util();
|
|
19804
19866
|
init_type_flow_util();
|
|
19805
19867
|
init_types();
|
|
19806
|
-
(0,
|
|
19868
|
+
(0, import_chunk_OASVKTK5.init_util)();
|
|
19807
19869
|
init_visitor();
|
|
19808
19870
|
}
|
|
19809
19871
|
});
|
|
@@ -19887,7 +19949,7 @@ function buildDataFlowGraph(state, func, wantsLiteral, trackInsertionPoints, wan
|
|
|
19887
19949
|
return decls;
|
|
19888
19950
|
}
|
|
19889
19951
|
if (canon.length !== decls.length || !canon.every((v, i) => v === decls[i])) {
|
|
19890
|
-
throw new
|
|
19952
|
+
throw new import_chunk_OASVKTK5.AwaitedError(
|
|
19891
19953
|
declFullName(canon).then(
|
|
19892
19954
|
(canonStr) => `Canonical representation of ${canonStr} did not match`
|
|
19893
19955
|
)
|
|
@@ -19921,7 +19983,7 @@ function buildDataFlowGraph(state, func, wantsLiteral, trackInsertionPoints, wan
|
|
|
19921
19983
|
}
|
|
19922
19984
|
const decl = lookupDefToDecl(results);
|
|
19923
19985
|
if (decl && path7.length) {
|
|
19924
|
-
if (wantsAllRefs && (0,
|
|
19986
|
+
if (wantsAllRefs && (0, import_chunk_OASVKTK5.every)(
|
|
19925
19987
|
decl,
|
|
19926
19988
|
(d) => d.type === "VariableDeclarator" || d.type === "BinaryExpression" || d.type === "Identifier"
|
|
19927
19989
|
)) {
|
|
@@ -19973,7 +20035,7 @@ function buildDataFlowGraph(state, func, wantsLiteral, trackInsertionPoints, wan
|
|
|
19973
20035
|
}
|
|
19974
20036
|
const v = liveDefs.get(def);
|
|
19975
20037
|
if (!v || !v.has(node)) {
|
|
19976
|
-
throw new
|
|
20038
|
+
throw new import_chunk_OASVKTK5.AwaitedError(
|
|
19977
20039
|
Promise.resolve(def ? declFullName(def) : "null").then(
|
|
19978
20040
|
(defStr) => `No stmt in liveDef for ${defStr}`
|
|
19979
20041
|
)
|
|
@@ -20031,7 +20093,7 @@ function buildDataFlowGraph(state, func, wantsLiteral, trackInsertionPoints, wan
|
|
|
20031
20093
|
const decls = findDecl(node);
|
|
20032
20094
|
if (!decls)
|
|
20033
20095
|
break;
|
|
20034
|
-
if (trackInsertionPoints && (0,
|
|
20096
|
+
if (trackInsertionPoints && (0, import_chunk_OASVKTK5.some)(decls, (decl) => {
|
|
20035
20097
|
if (decl.type === "VariableDeclarator") {
|
|
20036
20098
|
const defStmts = decl.node.kind === "var" && liveDefs.get(null) || liveDefs.get(decl);
|
|
20037
20099
|
if (defStmts) {
|
|
@@ -20282,8 +20344,8 @@ var init_data_flow = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
20282
20344
|
init_control_flow();
|
|
20283
20345
|
init_function_info();
|
|
20284
20346
|
init_type_flow_util();
|
|
20285
|
-
(0,
|
|
20286
|
-
DataflowQueue = class extends
|
|
20347
|
+
(0, import_chunk_OASVKTK5.init_util)();
|
|
20348
|
+
DataflowQueue = class extends import_chunk_OASVKTK5.GenericQueue {
|
|
20287
20349
|
constructor() {
|
|
20288
20350
|
super((b, a) => (a.order || 0) - (b.order || 0));
|
|
20289
20351
|
}
|
|
@@ -21078,7 +21140,7 @@ function computeJsrMap(func) {
|
|
|
21078
21140
|
}
|
|
21079
21141
|
function postOrderPropagate(func, preBlock, processBc, postBlock, merge) {
|
|
21080
21142
|
const order = /* @__PURE__ */ new Map();
|
|
21081
|
-
const queue = new
|
|
21143
|
+
const queue = new import_chunk_OASVKTK5.GenericQueue(
|
|
21082
21144
|
(b, a) => order.get(a) - order.get(b)
|
|
21083
21145
|
);
|
|
21084
21146
|
postOrderTraverse2(func, (block) => {
|
|
@@ -21137,7 +21199,7 @@ function rpoPropagate(func, preBlock, processBc, postBlock, merge) {
|
|
|
21137
21199
|
});
|
|
21138
21200
|
blocks.reverse().forEach((block, i) => order.set(block, i));
|
|
21139
21201
|
}
|
|
21140
|
-
const queue = new
|
|
21202
|
+
const queue = new import_chunk_OASVKTK5.GenericQueue(
|
|
21141
21203
|
(b, a) => order.get(a) - order.get(b)
|
|
21142
21204
|
);
|
|
21143
21205
|
queue.enqueue(func.blocks.get(func.offset));
|
|
@@ -21191,7 +21253,7 @@ function rpoPropagate(func, preBlock, processBc, postBlock, merge) {
|
|
|
21191
21253
|
var init_cflow = (0, import_chunk_ABYVSU2C.__esm)({
|
|
21192
21254
|
"src/readprg/cflow.ts"() {
|
|
21193
21255
|
"use strict";
|
|
21194
|
-
(0,
|
|
21256
|
+
(0, import_chunk_OASVKTK5.init_util)();
|
|
21195
21257
|
init_opcodes();
|
|
21196
21258
|
}
|
|
21197
21259
|
});
|
|
@@ -21654,12 +21716,12 @@ function interpFunc(func, context) {
|
|
|
21654
21716
|
const selfStores = /* @__PURE__ */ new Set();
|
|
21655
21717
|
const liveInState = /* @__PURE__ */ new Map();
|
|
21656
21718
|
const replacements = /* @__PURE__ */ new Map();
|
|
21657
|
-
const interpLogging = (0,
|
|
21719
|
+
const interpLogging = (0, import_chunk_OASVKTK5.wouldLog)("interp", 1);
|
|
21658
21720
|
if (interpLogging) {
|
|
21659
|
-
if ((0,
|
|
21660
|
-
(0,
|
|
21661
|
-
} else if ((0,
|
|
21662
|
-
(0,
|
|
21721
|
+
if ((0, import_chunk_OASVKTK5.wouldLog)("interp", 7)) {
|
|
21722
|
+
(0, import_chunk_OASVKTK5.setBanner)(functionBanner(func, context, "interp"));
|
|
21723
|
+
} else if ((0, import_chunk_OASVKTK5.wouldLog)("interp", 3)) {
|
|
21724
|
+
(0, import_chunk_OASVKTK5.setBanner)(
|
|
21663
21725
|
() => `+++++++++++++ interp-prepare ${func.name} ++++++++++++++`
|
|
21664
21726
|
);
|
|
21665
21727
|
}
|
|
@@ -21693,20 +21755,20 @@ function interpFunc(func, context) {
|
|
|
21693
21755
|
func,
|
|
21694
21756
|
(block) => {
|
|
21695
21757
|
if (interpLogging) {
|
|
21696
|
-
(0,
|
|
21758
|
+
(0, import_chunk_OASVKTK5.logger)(
|
|
21697
21759
|
"interp",
|
|
21698
21760
|
3,
|
|
21699
21761
|
`${offsetToString(block.offset)}: ${block.bytecodes[0]?.lineNum ? lineInfoToString(block.bytecodes[0]?.lineNum, context) : ""}
|
|
21700
21762
|
${interpStateToString(liveInState.get(block.offset))}`
|
|
21701
21763
|
);
|
|
21702
|
-
(0,
|
|
21764
|
+
(0, import_chunk_OASVKTK5.logger)("interp", 9, () => blockToString(block, context));
|
|
21703
21765
|
}
|
|
21704
21766
|
return cloneState2(liveInState.get(block.offset));
|
|
21705
21767
|
},
|
|
21706
21768
|
(block, bc, localState) => {
|
|
21707
21769
|
if (interpLogging) {
|
|
21708
|
-
if ((0,
|
|
21709
|
-
(0,
|
|
21770
|
+
if ((0, import_chunk_OASVKTK5.wouldLog)("interp", 8)) {
|
|
21771
|
+
(0, import_chunk_OASVKTK5.log)(
|
|
21710
21772
|
`${interpStateToString(localState)}
|
|
21711
21773
|
${bytecodeToString(
|
|
21712
21774
|
bc,
|
|
@@ -21871,14 +21933,14 @@ function interpFunc(func, context) {
|
|
|
21871
21933
|
if (!mergeInto(localState, succState))
|
|
21872
21934
|
return false;
|
|
21873
21935
|
if (interpLogging) {
|
|
21874
|
-
(0,
|
|
21936
|
+
(0, import_chunk_OASVKTK5.logger)("interp", 3, `Re-Merge to ${offsetToString(succBlock.offset)}`);
|
|
21875
21937
|
}
|
|
21876
21938
|
return true;
|
|
21877
21939
|
}
|
|
21878
21940
|
);
|
|
21879
21941
|
if (interpLogging) {
|
|
21880
|
-
if ((0,
|
|
21881
|
-
(0,
|
|
21942
|
+
if ((0, import_chunk_OASVKTK5.wouldLog)("interp", 5)) {
|
|
21943
|
+
(0, import_chunk_OASVKTK5.setBanner)(
|
|
21882
21944
|
functionBanner(func, context, "interp", (block, footer) => {
|
|
21883
21945
|
if (footer)
|
|
21884
21946
|
return "";
|
|
@@ -21886,44 +21948,44 @@ function interpFunc(func, context) {
|
|
|
21886
21948
|
})
|
|
21887
21949
|
);
|
|
21888
21950
|
} else {
|
|
21889
|
-
(0,
|
|
21951
|
+
(0, import_chunk_OASVKTK5.setBanner)(() => `=============== interp ${func.name} ==============`);
|
|
21890
21952
|
}
|
|
21891
21953
|
if (equivSets.size) {
|
|
21892
|
-
(0,
|
|
21954
|
+
(0, import_chunk_OASVKTK5.log)(`====== equivSets =====`);
|
|
21893
21955
|
equivSets.forEach(
|
|
21894
|
-
(value2, key) => (0,
|
|
21956
|
+
(value2, key) => (0, import_chunk_OASVKTK5.log)(
|
|
21895
21957
|
`L${key.arg} === ${Array.from(value2).sort().join(" ")} ${key.lineNum ? lineInfoToString(key.lineNum, context) : ""}`
|
|
21896
21958
|
)
|
|
21897
21959
|
);
|
|
21898
21960
|
}
|
|
21899
21961
|
if (selfStores.size) {
|
|
21900
|
-
(0,
|
|
21962
|
+
(0, import_chunk_OASVKTK5.log)(`====== selfStores =====`);
|
|
21901
21963
|
selfStores.forEach(
|
|
21902
|
-
(value2) => (0,
|
|
21964
|
+
(value2) => (0, import_chunk_OASVKTK5.log)(`${bytecodeToString(value2, symbolTable)}`)
|
|
21903
21965
|
);
|
|
21904
21966
|
}
|
|
21905
21967
|
if (replacements.size) {
|
|
21906
|
-
(0,
|
|
21968
|
+
(0, import_chunk_OASVKTK5.log)(`====== replacements =====`);
|
|
21907
21969
|
replacements.forEach(
|
|
21908
21970
|
(blockRep) => blockRep.forEach(
|
|
21909
|
-
(rep, bc) => (0,
|
|
21971
|
+
(rep, bc) => (0, import_chunk_OASVKTK5.log)(
|
|
21910
21972
|
`${bytecodeToString(bc, symbolTable)} => ${rep.invert ? "~" : ""}${bytecodeToString(rep, symbolTable)} ${bc.lineNum ? lineInfoToString(bc.lineNum, context) : ""}`
|
|
21911
21973
|
)
|
|
21912
21974
|
)
|
|
21913
21975
|
);
|
|
21914
21976
|
}
|
|
21915
21977
|
if (resolvedBranches.size) {
|
|
21916
|
-
(0,
|
|
21978
|
+
(0, import_chunk_OASVKTK5.log)(`====== resolved branches =====`);
|
|
21917
21979
|
resolvedBranches.forEach(
|
|
21918
|
-
(isTaken, block) => (0,
|
|
21980
|
+
(isTaken, block) => (0, import_chunk_OASVKTK5.log)(
|
|
21919
21981
|
`block ${offsetToString(block.offset)} is ${isTaken ? "always" : "never"} taken`
|
|
21920
21982
|
)
|
|
21921
21983
|
);
|
|
21922
21984
|
}
|
|
21923
21985
|
if (branchRedirects.size) {
|
|
21924
|
-
(0,
|
|
21986
|
+
(0, import_chunk_OASVKTK5.log)(`====== redirected branches =====`);
|
|
21925
21987
|
branchRedirects.forEach(
|
|
21926
|
-
({ to, from }, block) => (0,
|
|
21988
|
+
({ to, from }, block) => (0, import_chunk_OASVKTK5.log)(
|
|
21927
21989
|
`block ${offsetToString(
|
|
21928
21990
|
block.offset
|
|
21929
21991
|
)} redirects from ${offsetToString(from)} to ${offsetToString(to)}${safeBranchBlocks.get(from) ? ` popping ${safeBranchBlocks.get(from)}` : ""}`
|
|
@@ -21986,7 +22048,7 @@ function interpFunc(func, context) {
|
|
|
21986
22048
|
}
|
|
21987
22049
|
});
|
|
21988
22050
|
if (interpLogging)
|
|
21989
|
-
(0,
|
|
22051
|
+
(0, import_chunk_OASVKTK5.setBanner)(null);
|
|
21990
22052
|
return {
|
|
21991
22053
|
liveInState,
|
|
21992
22054
|
equivSets,
|
|
@@ -22036,7 +22098,7 @@ var init_interp2 = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
22036
22098
|
"src/readprg/interp.ts"() {
|
|
22037
22099
|
"use strict";
|
|
22038
22100
|
init_interp_binary();
|
|
22039
|
-
(0,
|
|
22101
|
+
(0, import_chunk_OASVKTK5.init_logger)();
|
|
22040
22102
|
init_interp();
|
|
22041
22103
|
init_types();
|
|
22042
22104
|
init_union_type();
|
|
@@ -22148,7 +22210,7 @@ function optimizeArrayInit(func, block, index, context, interpState) {
|
|
|
22148
22210
|
i = found;
|
|
22149
22211
|
}
|
|
22150
22212
|
if (initType && (block.bytecodes[index].op === 20 ? initType.type === 1 : initType.type === 8 && initType.value === 0)) {
|
|
22151
|
-
(0,
|
|
22213
|
+
(0, import_chunk_OASVKTK5.logger)(
|
|
22152
22214
|
"array-init",
|
|
22153
22215
|
1,
|
|
22154
22216
|
() => `${func.name}: Removing initialization of default initialized ${putvStarts.length} element array init at block ${offsetToString(
|
|
@@ -22185,7 +22247,7 @@ function optimizeArrayInit(func, block, index, context, interpState) {
|
|
|
22185
22247
|
convertAputv(offset - 1);
|
|
22186
22248
|
}
|
|
22187
22249
|
}
|
|
22188
|
-
(0,
|
|
22250
|
+
(0, import_chunk_OASVKTK5.logger)(
|
|
22189
22251
|
"array-init",
|
|
22190
22252
|
1,
|
|
22191
22253
|
() => `${func.name}: Optimizing unused ${putvStarts.length} element array init at block ${offsetToString(
|
|
@@ -22194,8 +22256,8 @@ function optimizeArrayInit(func, block, index, context, interpState) {
|
|
|
22194
22256
|
block.bytecodes[index].offset
|
|
22195
22257
|
)}`
|
|
22196
22258
|
);
|
|
22197
|
-
if ((0,
|
|
22198
|
-
(0,
|
|
22259
|
+
if ((0, import_chunk_OASVKTK5.wouldLog)("array-init", 5)) {
|
|
22260
|
+
(0, import_chunk_OASVKTK5.log)(blockToString(block, context));
|
|
22199
22261
|
}
|
|
22200
22262
|
return true;
|
|
22201
22263
|
}
|
|
@@ -22235,7 +22297,7 @@ function optimizeArrayInit(func, block, index, context, interpState) {
|
|
|
22235
22297
|
if (putvStarts.length < 3)
|
|
22236
22298
|
return false;
|
|
22237
22299
|
tryLocal(3);
|
|
22238
|
-
(0,
|
|
22300
|
+
(0, import_chunk_OASVKTK5.logger)(
|
|
22239
22301
|
"array-init",
|
|
22240
22302
|
1,
|
|
22241
22303
|
() => `${func.name}: Optimizing ${putvStarts.length} element array init with constant initializer ${bytecodeToString(
|
|
@@ -22261,7 +22323,7 @@ function optimizeArrayInit(func, block, index, context, interpState) {
|
|
|
22261
22323
|
block.bytecodes[index + 1].arg = putvStarts.length;
|
|
22262
22324
|
}
|
|
22263
22325
|
}
|
|
22264
|
-
(0,
|
|
22326
|
+
(0, import_chunk_OASVKTK5.logger)(
|
|
22265
22327
|
"array-init",
|
|
22266
22328
|
5,
|
|
22267
22329
|
() => `index: ${index}, i: ${i}
|
|
@@ -22314,7 +22376,7 @@ ${blockToString(block, context)}`
|
|
|
22314
22376
|
for (let i2 = putvStarts.length; i2-- > 1; ) {
|
|
22315
22377
|
block.bytecodes.splice(putvStarts[i2], 2);
|
|
22316
22378
|
}
|
|
22317
|
-
(0,
|
|
22379
|
+
(0, import_chunk_OASVKTK5.logger)(
|
|
22318
22380
|
"array-init",
|
|
22319
22381
|
1,
|
|
22320
22382
|
() => `${func.name}: Optimizing ${putvStarts.length} element array init at block ${offsetToString(
|
|
@@ -22373,15 +22435,15 @@ var init_array_init = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
22373
22435
|
"src/readprg/array-init.ts"() {
|
|
22374
22436
|
"use strict";
|
|
22375
22437
|
init_types();
|
|
22376
|
-
(0,
|
|
22438
|
+
(0, import_chunk_OASVKTK5.init_util)();
|
|
22377
22439
|
init_bytecode();
|
|
22378
22440
|
init_interp2();
|
|
22379
22441
|
init_opcodes();
|
|
22380
22442
|
}
|
|
22381
22443
|
});
|
|
22382
22444
|
function localDCE(func, context) {
|
|
22383
|
-
if ((0,
|
|
22384
|
-
(0,
|
|
22445
|
+
if ((0, import_chunk_OASVKTK5.wouldLog)("dce", 5)) {
|
|
22446
|
+
(0, import_chunk_OASVKTK5.setBanner)(
|
|
22385
22447
|
functionBanner(
|
|
22386
22448
|
func,
|
|
22387
22449
|
context,
|
|
@@ -22414,7 +22476,7 @@ function localDCE(func, context) {
|
|
|
22414
22476
|
};
|
|
22415
22477
|
func.blocks.forEach((block) => {
|
|
22416
22478
|
const reportPopv = (i, item, kill) => {
|
|
22417
|
-
(0,
|
|
22479
|
+
(0, import_chunk_OASVKTK5.logger)(
|
|
22418
22480
|
"dce",
|
|
22419
22481
|
2,
|
|
22420
22482
|
() => `${func.name}: Convert ${i}:${bytecodeToString(
|
|
@@ -22429,7 +22491,7 @@ function localDCE(func, context) {
|
|
|
22429
22491
|
);
|
|
22430
22492
|
};
|
|
22431
22493
|
const reportNop = (item) => {
|
|
22432
|
-
(0,
|
|
22494
|
+
(0, import_chunk_OASVKTK5.logger)(
|
|
22433
22495
|
"dce",
|
|
22434
22496
|
2,
|
|
22435
22497
|
() => `${func.name}: Kill ${item.deps.map(
|
|
@@ -22448,7 +22510,7 @@ function localDCE(func, context) {
|
|
|
22448
22510
|
case 19: {
|
|
22449
22511
|
const liveLocal = dceInfo.locals.has(bytecode.arg);
|
|
22450
22512
|
if (!liveLocal && (bytecode.arg || context.config.allowForbiddenOpts)) {
|
|
22451
|
-
(0,
|
|
22513
|
+
(0, import_chunk_OASVKTK5.logger)(
|
|
22452
22514
|
"dce",
|
|
22453
22515
|
2,
|
|
22454
22516
|
() => `${func.name}: Killing store to unused local ${bytecode.arg} at ${offsetToString(block.offset)}:${i}`
|
|
@@ -22608,10 +22670,10 @@ function localDCE(func, context) {
|
|
|
22608
22670
|
(bc) => bc.op !== 0
|
|
22609
22671
|
/* nop */
|
|
22610
22672
|
);
|
|
22611
|
-
(0,
|
|
22673
|
+
(0, import_chunk_OASVKTK5.logger)("dce", 3, functionBanner(func, context, "local-dce-end"));
|
|
22612
22674
|
}
|
|
22613
22675
|
});
|
|
22614
|
-
(0,
|
|
22676
|
+
(0, import_chunk_OASVKTK5.setBanner)(null);
|
|
22615
22677
|
return anyChanges;
|
|
22616
22678
|
}
|
|
22617
22679
|
function computeLiveLocals(func) {
|
|
@@ -22662,7 +22724,7 @@ var init_dce = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
22662
22724
|
"src/readprg/dce.ts"() {
|
|
22663
22725
|
"use strict";
|
|
22664
22726
|
init_data_flow();
|
|
22665
|
-
(0,
|
|
22727
|
+
(0, import_chunk_OASVKTK5.init_util)();
|
|
22666
22728
|
init_bytecode();
|
|
22667
22729
|
init_cflow();
|
|
22668
22730
|
init_opcodes();
|
|
@@ -22702,7 +22764,7 @@ function minimizeLocals2(func, equivSets, context) {
|
|
|
22702
22764
|
const splitRanges = computeSplitRanges(func, equivSets);
|
|
22703
22765
|
const locals = mergeSplitRanges(splitRanges);
|
|
22704
22766
|
const numLocals = Math.max(...Array.from(splitRanges.keys())) + 1;
|
|
22705
|
-
(0,
|
|
22767
|
+
(0, import_chunk_OASVKTK5.logger)("locals", 10, functionBanner(func, context, "Minimize Locals"));
|
|
22706
22768
|
let argc = func.argc ?? null;
|
|
22707
22769
|
const colors = /* @__PURE__ */ new Map();
|
|
22708
22770
|
const merge = [];
|
|
@@ -22769,15 +22831,15 @@ function minimizeLocals2(func, equivSets, context) {
|
|
|
22769
22831
|
}
|
|
22770
22832
|
}
|
|
22771
22833
|
}
|
|
22772
|
-
if ((0,
|
|
22773
|
-
if (!(0,
|
|
22774
|
-
(0,
|
|
22834
|
+
if ((0, import_chunk_OASVKTK5.wouldLog)("locals", 1)) {
|
|
22835
|
+
if (!(0, import_chunk_OASVKTK5.wouldLog)("locals", 10)) {
|
|
22836
|
+
(0, import_chunk_OASVKTK5.logger)("locals", 5, functionBanner(func, context, "Minimize Locals"));
|
|
22775
22837
|
}
|
|
22776
|
-
(0,
|
|
22838
|
+
(0, import_chunk_OASVKTK5.log)(
|
|
22777
22839
|
`>>> Merging locals in ${func.name} (in: ${numLocals} => out: ${merge.length})`
|
|
22778
22840
|
);
|
|
22779
22841
|
merge.slice().sort((a, b) => (colors.get(a[0]) ?? 0) - (colors.get(b[0]) ?? 0)).forEach(
|
|
22780
|
-
(merged) => (0,
|
|
22842
|
+
(merged) => (0, import_chunk_OASVKTK5.log)(
|
|
22781
22843
|
` ${colors.get(merged[0])} - ${merged.map((k) => bytecodeToString(k, context.symbolTable)).join(" | ")}`
|
|
22782
22844
|
)
|
|
22783
22845
|
);
|
|
@@ -23076,7 +23138,7 @@ function mergeSplitRanges(splitRanges) {
|
|
|
23076
23138
|
var init_locals = (0, import_chunk_ABYVSU2C.__esm)({
|
|
23077
23139
|
"src/readprg/locals.ts"() {
|
|
23078
23140
|
"use strict";
|
|
23079
|
-
(0,
|
|
23141
|
+
(0, import_chunk_OASVKTK5.init_logger)();
|
|
23080
23142
|
init_bytecode();
|
|
23081
23143
|
init_cflow();
|
|
23082
23144
|
init_opcodes();
|
|
@@ -23189,16 +23251,16 @@ function sizeBasedPRE2(func, context) {
|
|
|
23189
23251
|
delete bc.arg;
|
|
23190
23252
|
return bc;
|
|
23191
23253
|
};
|
|
23192
|
-
if ((0,
|
|
23193
|
-
if ((0,
|
|
23194
|
-
(0,
|
|
23254
|
+
if ((0, import_chunk_OASVKTK5.wouldLog)("pre", 1)) {
|
|
23255
|
+
if ((0, import_chunk_OASVKTK5.wouldLog)("pre", 5)) {
|
|
23256
|
+
(0, import_chunk_OASVKTK5.log)(functionBanner(func, context, "PRE")());
|
|
23195
23257
|
} else {
|
|
23196
|
-
(0,
|
|
23258
|
+
(0, import_chunk_OASVKTK5.log)(`================ PRE : ${func.name} ================
|
|
23197
23259
|
`);
|
|
23198
23260
|
}
|
|
23199
23261
|
insertionBlocks.forEach((o, key) => {
|
|
23200
23262
|
const bcs = canonicalMap.get(key);
|
|
23201
|
-
(0,
|
|
23263
|
+
(0, import_chunk_OASVKTK5.log)(
|
|
23202
23264
|
`Replacing ${bcs.size} instances of ${bytecodeToString(
|
|
23203
23265
|
bcs.values().next().value,
|
|
23204
23266
|
context.symbolTable
|
|
@@ -23281,13 +23343,13 @@ function sizeBasedPRE2(func, context) {
|
|
|
23281
23343
|
bytecode(1, insertionBlocks.size)
|
|
23282
23344
|
);
|
|
23283
23345
|
}
|
|
23284
|
-
(0,
|
|
23346
|
+
(0, import_chunk_OASVKTK5.logger)("pre", 5, functionBanner(func, context, "post-PRE"));
|
|
23285
23347
|
return true;
|
|
23286
23348
|
}
|
|
23287
23349
|
var init_pre2 = (0, import_chunk_ABYVSU2C.__esm)({
|
|
23288
23350
|
"src/readprg/pre.ts"() {
|
|
23289
23351
|
"use strict";
|
|
23290
|
-
(0,
|
|
23352
|
+
(0, import_chunk_OASVKTK5.init_logger)();
|
|
23291
23353
|
init_bytecode();
|
|
23292
23354
|
init_cflow();
|
|
23293
23355
|
init_opcodes();
|
|
@@ -23320,9 +23382,9 @@ function blockSharing(func, context) {
|
|
|
23320
23382
|
if (!any)
|
|
23321
23383
|
return false;
|
|
23322
23384
|
any = false;
|
|
23323
|
-
const logging3 = (0,
|
|
23324
|
-
if (logging3 && (0,
|
|
23325
|
-
(0,
|
|
23385
|
+
const logging3 = (0, import_chunk_OASVKTK5.wouldLog)("sharing", 1);
|
|
23386
|
+
if (logging3 && (0, import_chunk_OASVKTK5.wouldLog)("sharing", 10)) {
|
|
23387
|
+
(0, import_chunk_OASVKTK5.setBanner)(functionBanner(func, context, "sharing"));
|
|
23326
23388
|
}
|
|
23327
23389
|
candidates.forEach((blocks) => {
|
|
23328
23390
|
while (blocks.size > 1) {
|
|
@@ -23458,9 +23520,9 @@ function blockSharing(func, context) {
|
|
|
23458
23520
|
block2.offset
|
|
23459
23521
|
)})` : `block(${offsetToString(block2.offset)})`;
|
|
23460
23522
|
};
|
|
23461
|
-
(0,
|
|
23462
|
-
if ((0,
|
|
23463
|
-
(0,
|
|
23523
|
+
(0, import_chunk_OASVKTK5.log)(`Sharing ${showBlock(block)} with ${showBlock(target)}`);
|
|
23524
|
+
if ((0, import_chunk_OASVKTK5.wouldLog)("sharing", 5)) {
|
|
23525
|
+
(0, import_chunk_OASVKTK5.log)(blockToString(target, context));
|
|
23464
23526
|
}
|
|
23465
23527
|
}
|
|
23466
23528
|
if (target.bytecodes.length > length2) {
|
|
@@ -23487,13 +23549,13 @@ function blockSharing(func, context) {
|
|
|
23487
23549
|
});
|
|
23488
23550
|
}
|
|
23489
23551
|
});
|
|
23490
|
-
(0,
|
|
23552
|
+
(0, import_chunk_OASVKTK5.setBanner)(null);
|
|
23491
23553
|
return any;
|
|
23492
23554
|
}
|
|
23493
23555
|
var init_sharing = (0, import_chunk_ABYVSU2C.__esm)({
|
|
23494
23556
|
"src/readprg/sharing.ts"() {
|
|
23495
23557
|
"use strict";
|
|
23496
|
-
(0,
|
|
23558
|
+
(0, import_chunk_OASVKTK5.init_util)();
|
|
23497
23559
|
init_bytecode();
|
|
23498
23560
|
init_opcodes();
|
|
23499
23561
|
}
|
|
@@ -23557,7 +23619,7 @@ function doArrayInits(func, liveInState, context) {
|
|
|
23557
23619
|
}
|
|
23558
23620
|
function simpleOpts(func, context) {
|
|
23559
23621
|
const equalsSym = 8388787;
|
|
23560
|
-
const logging3 = (0,
|
|
23622
|
+
const logging3 = (0, import_chunk_OASVKTK5.wouldLog)("optimize", 5);
|
|
23561
23623
|
return Array.from(func.blocks.values()).reduce((changes, block) => {
|
|
23562
23624
|
for (let i = block.bytecodes.length; i--; ) {
|
|
23563
23625
|
const cur = block.bytecodes[i];
|
|
@@ -23565,7 +23627,7 @@ function simpleOpts(func, context) {
|
|
|
23565
23627
|
block.bytecodes.splice(i, 1);
|
|
23566
23628
|
changes = true;
|
|
23567
23629
|
if (logging3) {
|
|
23568
|
-
(0,
|
|
23630
|
+
(0, import_chunk_OASVKTK5.log)(`${func.name}: deleting ${bytecodeToString(cur, null)}`);
|
|
23569
23631
|
}
|
|
23570
23632
|
} else if (cur.op === 74 && context.config.removeArgc && context.config.allowForbiddenOpts) {
|
|
23571
23633
|
const arg = cur.arg.incsp;
|
|
@@ -23574,7 +23636,7 @@ function simpleOpts(func, context) {
|
|
|
23574
23636
|
incsp.arg = arg;
|
|
23575
23637
|
changes = true;
|
|
23576
23638
|
if (logging3) {
|
|
23577
|
-
(0,
|
|
23639
|
+
(0, import_chunk_OASVKTK5.log)(`${func.name}: argcincsp => incsp`);
|
|
23578
23640
|
}
|
|
23579
23641
|
} else if (i && cur.op === 39 && cur.arg === equalsSym) {
|
|
23580
23642
|
changes = equalSymbolToEq(block, i) || changes;
|
|
@@ -23585,7 +23647,7 @@ function simpleOpts(func, context) {
|
|
|
23585
23647
|
if (!shift && prev.op === 37) {
|
|
23586
23648
|
block.bytecodes.splice(i - 1, 2);
|
|
23587
23649
|
changes = true;
|
|
23588
|
-
logging3 && (0,
|
|
23650
|
+
logging3 && (0, import_chunk_OASVKTK5.log)(`${func.name}: deleting no-op shift (${shift})`);
|
|
23589
23651
|
continue;
|
|
23590
23652
|
}
|
|
23591
23653
|
if (shift === 1n && prev.op === 37) {
|
|
@@ -23595,7 +23657,7 @@ function simpleOpts(func, context) {
|
|
|
23595
23657
|
const add = cur;
|
|
23596
23658
|
add.op = 3;
|
|
23597
23659
|
delete add.arg;
|
|
23598
|
-
logging3 && (0,
|
|
23660
|
+
logging3 && (0, import_chunk_OASVKTK5.log)(`${func.name}: converting "ipush 1; shlv" to "dup 0; addv"`);
|
|
23599
23661
|
continue;
|
|
23600
23662
|
}
|
|
23601
23663
|
if (shift < (prev.op === 49 ? 64n : 31n)) {
|
|
@@ -23605,7 +23667,7 @@ function simpleOpts(func, context) {
|
|
|
23605
23667
|
} else {
|
|
23606
23668
|
prev.arg = BigInt.asIntN(64, mul);
|
|
23607
23669
|
}
|
|
23608
|
-
logging3 && (0,
|
|
23670
|
+
logging3 && (0, import_chunk_OASVKTK5.log)(
|
|
23609
23671
|
`${func.name}: converting shlv(${shift}) to mulv(${prev.arg})`
|
|
23610
23672
|
);
|
|
23611
23673
|
changes = true;
|
|
@@ -23619,14 +23681,14 @@ function simpleOpts(func, context) {
|
|
|
23619
23681
|
func.blocks.get(block.taken).preds.delete(block.offset);
|
|
23620
23682
|
delete block.taken;
|
|
23621
23683
|
changes = true;
|
|
23622
|
-
logging3 && (0,
|
|
23684
|
+
logging3 && (0, import_chunk_OASVKTK5.log)(`${func.name}: deleting empty finally handler`);
|
|
23623
23685
|
} else if (isCondBranch(cur.op)) {
|
|
23624
23686
|
const next = func.blocks.get(block.next);
|
|
23625
23687
|
const taken = func.blocks.get(block.taken);
|
|
23626
23688
|
if (next.preds.size > 1 && taken.preds.size === 1) {
|
|
23627
23689
|
const newOp = cur.op === 40 ? 41 : 40;
|
|
23628
23690
|
if (logging3) {
|
|
23629
|
-
(0,
|
|
23691
|
+
(0, import_chunk_OASVKTK5.log)(
|
|
23630
23692
|
`${func.name}: converting ${Opcodes[cur.op]} to ${Opcodes[newOp]}`
|
|
23631
23693
|
);
|
|
23632
23694
|
}
|
|
@@ -23639,7 +23701,7 @@ function simpleOpts(func, context) {
|
|
|
23639
23701
|
const isBool = i >= 2 && isBoolOp(block.bytecodes[i - 2].op);
|
|
23640
23702
|
if (next.next === block.taken && next.taken == null && taken.bytecodes.length === 1 && isCondBranch(taken.bytecodes[0].op) && next.bytecodes.length > 1 && next.bytecodes[next.bytecodes.length - 1].op === (cur.op === 41 ? 7 : 8) && (isBool || next.bytecodes.length > 2 && isBoolOp(next.bytecodes[next.bytecodes.length - 2].op)) && next.preds?.size === 1 && taken.preds?.size === 2) {
|
|
23641
23703
|
if (logging3) {
|
|
23642
|
-
(0,
|
|
23704
|
+
(0, import_chunk_OASVKTK5.log)(
|
|
23643
23705
|
`${func.name}: simplifying ${next.bytecodes[next.bytecodes.length - 1].op === 7 ? "'&&'" : "'||'"} at ${offsetToString(block.offset)}:${offsetToString(
|
|
23644
23706
|
next.offset
|
|
23645
23707
|
)}:${offsetToString(taken.offset)}:`
|
|
@@ -23656,7 +23718,7 @@ function simpleOpts(func, context) {
|
|
|
23656
23718
|
changes = true;
|
|
23657
23719
|
} else if (taken.next === block.next && taken.taken == null && next.bytecodes.length === 1 && isCondBranch(next.bytecodes[0].op) && taken.bytecodes.length > 1 && taken.bytecodes[taken.bytecodes.length - 1].op === (cur.op === 40 ? 7 : 8) && (isBool || taken.bytecodes.length > 2 && isBoolOp(taken.bytecodes[taken.bytecodes.length - 2].op)) && next.preds?.size === 2 && taken.preds?.size === 1) {
|
|
23658
23720
|
if (logging3) {
|
|
23659
|
-
(0,
|
|
23721
|
+
(0, import_chunk_OASVKTK5.log)(
|
|
23660
23722
|
`${func.name}: simplifying ${taken.bytecodes[taken.bytecodes.length - 1].op === 7 ? "'&&'" : "'||'"} at ${offsetToString(block.offset)}:${offsetToString(
|
|
23661
23723
|
taken.offset
|
|
23662
23724
|
)}:${offsetToString(next.offset)}:`
|
|
@@ -23704,7 +23766,7 @@ function equalSymbolToEq(block, equalsIndex) {
|
|
|
23704
23766
|
op: 26,
|
|
23705
23767
|
offset: invokem.offset
|
|
23706
23768
|
});
|
|
23707
|
-
(0,
|
|
23769
|
+
(0, import_chunk_OASVKTK5.logger)(
|
|
23708
23770
|
"optimize",
|
|
23709
23771
|
1,
|
|
23710
23772
|
`Replacing <thing>.equals(:symbol) with <thing> eq :symbol at ${offsetToString(
|
|
@@ -23764,7 +23826,7 @@ function removeUnreachableCatches(func, context) {
|
|
|
23764
23826
|
const next = func.blocks.get(block.next);
|
|
23765
23827
|
if (block.try === next.try) {
|
|
23766
23828
|
if (next.preds.size === 1) {
|
|
23767
|
-
(0,
|
|
23829
|
+
(0, import_chunk_OASVKTK5.logger)(
|
|
23768
23830
|
"cfg",
|
|
23769
23831
|
1,
|
|
23770
23832
|
() => `${func.name}: ${offsetToString(
|
|
@@ -23787,7 +23849,7 @@ function removeUnreachableCatches(func, context) {
|
|
|
23787
23849
|
delete next.preds;
|
|
23788
23850
|
removeBlock(func, next.offset);
|
|
23789
23851
|
} else if (next.next == null && next.bytecodes.length < 3 && next.bytecodes.reduce((size, bc) => size + opcodeSize(bc.op), 0) < 3 && countFallthroughPreds(func, next) > 1) {
|
|
23790
|
-
(0,
|
|
23852
|
+
(0, import_chunk_OASVKTK5.logger)(
|
|
23791
23853
|
"cfg",
|
|
23792
23854
|
1,
|
|
23793
23855
|
() => `${func.name}: ${offsetToString(
|
|
@@ -23812,7 +23874,7 @@ function removeUnreachableCatches(func, context) {
|
|
|
23812
23874
|
switch (last.op) {
|
|
23813
23875
|
case 41:
|
|
23814
23876
|
case 40:
|
|
23815
|
-
(0,
|
|
23877
|
+
(0, import_chunk_OASVKTK5.logger)(
|
|
23816
23878
|
"cfg",
|
|
23817
23879
|
1,
|
|
23818
23880
|
() => `${func.name}: killing no-op ${bytecodeToString(
|
|
@@ -23835,7 +23897,7 @@ function removeUnreachableCatches(func, context) {
|
|
|
23835
23897
|
for (let i = block.try.length; i--; ) {
|
|
23836
23898
|
const handler = block.try[i].handler;
|
|
23837
23899
|
if (!func.blocks.get(handler)?.preds?.size) {
|
|
23838
|
-
(0,
|
|
23900
|
+
(0, import_chunk_OASVKTK5.logger)(
|
|
23839
23901
|
"cfg",
|
|
23840
23902
|
1,
|
|
23841
23903
|
`${func.name}: killing unused try-catch at ${offsetToString(
|
|
@@ -23852,8 +23914,8 @@ function removeUnreachableCatches(func, context) {
|
|
|
23852
23914
|
});
|
|
23853
23915
|
}
|
|
23854
23916
|
function cleanCfg2(func, context) {
|
|
23855
|
-
if ((0,
|
|
23856
|
-
(0,
|
|
23917
|
+
if ((0, import_chunk_OASVKTK5.wouldLog)("cfg", 10)) {
|
|
23918
|
+
(0, import_chunk_OASVKTK5.setBanner)(functionBanner(func, context, "sharing"));
|
|
23857
23919
|
}
|
|
23858
23920
|
removeNoOpBlocks(func);
|
|
23859
23921
|
removeUnreachableCatches(func, context);
|
|
@@ -23868,12 +23930,12 @@ function cleanCfg2(func, context) {
|
|
|
23868
23930
|
(0, import_node_assert12.default)(!block.preds?.size);
|
|
23869
23931
|
func.blocks.delete(block.offset);
|
|
23870
23932
|
});
|
|
23871
|
-
(0,
|
|
23933
|
+
(0, import_chunk_OASVKTK5.setBanner)(null);
|
|
23872
23934
|
}
|
|
23873
23935
|
var init_optimize2 = (0, import_chunk_ABYVSU2C.__esm)({
|
|
23874
23936
|
"src/readprg/optimize.ts"() {
|
|
23875
23937
|
"use strict";
|
|
23876
|
-
(0,
|
|
23938
|
+
(0, import_chunk_OASVKTK5.init_util)();
|
|
23877
23939
|
init_array_init();
|
|
23878
23940
|
init_bytecode();
|
|
23879
23941
|
init_cflow();
|
|
@@ -24488,21 +24550,21 @@ function optimizeBytecode(context) {
|
|
|
24488
24550
|
functions.forEach(callback);
|
|
24489
24551
|
return;
|
|
24490
24552
|
}
|
|
24491
|
-
(0,
|
|
24553
|
+
(0, import_chunk_OASVKTK5.bumpLogging)(null, 10);
|
|
24492
24554
|
functions.forEach((func) => {
|
|
24493
24555
|
if (loggerFunc.test(func.name ?? "<null>")) {
|
|
24494
|
-
(0,
|
|
24556
|
+
(0, import_chunk_OASVKTK5.bumpLogging)(null, -10);
|
|
24495
24557
|
callback(func);
|
|
24496
|
-
(0,
|
|
24558
|
+
(0, import_chunk_OASVKTK5.bumpLogging)(null, 10);
|
|
24497
24559
|
return;
|
|
24498
24560
|
}
|
|
24499
24561
|
callback(func);
|
|
24500
24562
|
});
|
|
24501
|
-
(0,
|
|
24563
|
+
(0, import_chunk_OASVKTK5.bumpLogging)(null, -10);
|
|
24502
24564
|
};
|
|
24503
|
-
if ((0,
|
|
24565
|
+
if ((0, import_chunk_OASVKTK5.wouldLog)("list-input", 1)) {
|
|
24504
24566
|
forEachFunction(
|
|
24505
|
-
(func) => (0,
|
|
24567
|
+
(func) => (0, import_chunk_OASVKTK5.wouldLog)("list-input", 1) && printFunction(func, context)
|
|
24506
24568
|
);
|
|
24507
24569
|
}
|
|
24508
24570
|
forEachFunction((func) => optimizeFunc(func, context));
|
|
@@ -24520,7 +24582,7 @@ function optimizeBytecode(context) {
|
|
|
24520
24582
|
forEachFunction((func) => {
|
|
24521
24583
|
if (!func.name)
|
|
24522
24584
|
return;
|
|
24523
|
-
(0,
|
|
24585
|
+
(0, import_chunk_OASVKTK5.logger)(
|
|
24524
24586
|
"bytecode",
|
|
24525
24587
|
5,
|
|
24526
24588
|
`${func.name}: ${offset.toString(16)} ${offset - func.offset}`
|
|
@@ -24529,7 +24591,7 @@ function optimizeBytecode(context) {
|
|
|
24529
24591
|
});
|
|
24530
24592
|
const { offsetMap } = updateInfo;
|
|
24531
24593
|
offsetMap.set(code.byteLength, offset);
|
|
24532
|
-
(0,
|
|
24594
|
+
(0, import_chunk_OASVKTK5.logger)(
|
|
24533
24595
|
"bytecode",
|
|
24534
24596
|
1,
|
|
24535
24597
|
`${context.filepath}: code size: ${context.sections[
|
|
@@ -24541,9 +24603,9 @@ function optimizeBytecode(context) {
|
|
|
24541
24603
|
].length - offset}`
|
|
24542
24604
|
);
|
|
24543
24605
|
fixSectionSize(-1059145026, context.sections, offset);
|
|
24544
|
-
if ((0,
|
|
24606
|
+
if ((0, import_chunk_OASVKTK5.wouldLog)("list-output", 1)) {
|
|
24545
24607
|
forEachFunction(
|
|
24546
|
-
(func) => (0,
|
|
24608
|
+
(func) => (0, import_chunk_OASVKTK5.wouldLog)("list-output", 1) && printFunction(func, context)
|
|
24547
24609
|
);
|
|
24548
24610
|
}
|
|
24549
24611
|
fixupHeader(context, updateInfo);
|
|
@@ -24633,7 +24695,7 @@ ${functionToString(
|
|
|
24633
24695
|
---------------- ${func.name} ----------------`;
|
|
24634
24696
|
}
|
|
24635
24697
|
function printFunction(func, context) {
|
|
24636
|
-
(0,
|
|
24698
|
+
(0, import_chunk_OASVKTK5.log)(functionToString(func, context));
|
|
24637
24699
|
}
|
|
24638
24700
|
function functionToString(func, context, extra) {
|
|
24639
24701
|
const parts = [];
|
|
@@ -25064,7 +25126,7 @@ var init_bytecode = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
25064
25126
|
"use strict";
|
|
25065
25127
|
(0, import_chunk_MBTLUWXR.init_ast)();
|
|
25066
25128
|
init_sdk_util();
|
|
25067
|
-
(0,
|
|
25129
|
+
(0, import_chunk_OASVKTK5.init_util)();
|
|
25068
25130
|
init_data();
|
|
25069
25131
|
init_emit();
|
|
25070
25132
|
init_exceptions();
|
|
@@ -25350,10 +25412,10 @@ async function build_project(product, options, lineCallback) {
|
|
|
25350
25412
|
].flat();
|
|
25351
25413
|
if (!returnCommand) {
|
|
25352
25414
|
const handlers = [
|
|
25353
|
-
lineCallback || ((line) => (0,
|
|
25415
|
+
lineCallback || ((line) => (0, import_chunk_OASVKTK5.log)(line)),
|
|
25354
25416
|
(line) => console.error(line)
|
|
25355
25417
|
];
|
|
25356
|
-
await (0,
|
|
25418
|
+
await (0, import_chunk_OASVKTK5.spawnByLine)(exe, args, handlers, {
|
|
25357
25419
|
cwd: workspace
|
|
25358
25420
|
});
|
|
25359
25421
|
}
|
|
@@ -25363,7 +25425,7 @@ var init_build = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
25363
25425
|
"src/build.ts"() {
|
|
25364
25426
|
"use strict";
|
|
25365
25427
|
init_sdk_util();
|
|
25366
|
-
(0,
|
|
25428
|
+
(0, import_chunk_OASVKTK5.init_util)();
|
|
25367
25429
|
}
|
|
25368
25430
|
});
|
|
25369
25431
|
var require_ms = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
@@ -28310,7 +28372,7 @@ function resolve_filename(literal, default_source = null) {
|
|
|
28310
28372
|
return path2.resolve(root, literal.value);
|
|
28311
28373
|
}
|
|
28312
28374
|
async function resolve_literals(qualifier, default_source, deviceInfo, cache) {
|
|
28313
|
-
const resolve_file_list = (literals) => Promise.all(
|
|
28375
|
+
const resolve_file_list = (literals, checkExists = true) => Promise.all(
|
|
28314
28376
|
literals.map((v) => {
|
|
28315
28377
|
if (!isJNode(v)) {
|
|
28316
28378
|
return v;
|
|
@@ -28330,11 +28392,11 @@ async function resolve_literals(qualifier, default_source, deviceInfo, cache) {
|
|
|
28330
28392
|
);
|
|
28331
28393
|
if (!(0, import_chunk_MBTLUWXR.hasProperty)(cache.resolvedPaths, resolved)) {
|
|
28332
28394
|
if (/[*?[\]{}]/.test(resolved)) {
|
|
28333
|
-
cache.resolvedPaths[resolved] = (0,
|
|
28395
|
+
cache.resolvedPaths[resolved] = (0, import_chunk_OASVKTK5.globSome)(resolved, () => true);
|
|
28334
28396
|
} else {
|
|
28335
28397
|
cache.resolvedPaths[resolved] = fs5.stat(resolved).then(
|
|
28336
28398
|
() => true,
|
|
28337
|
-
() =>
|
|
28399
|
+
() => !checkExists
|
|
28338
28400
|
);
|
|
28339
28401
|
}
|
|
28340
28402
|
}
|
|
@@ -28345,12 +28407,13 @@ async function resolve_literals(qualifier, default_source, deviceInfo, cache) {
|
|
|
28345
28407
|
).then(
|
|
28346
28408
|
(results) => results.filter((name) => name != null)
|
|
28347
28409
|
);
|
|
28348
|
-
const resolve_one_file_list = async (base, name) => {
|
|
28410
|
+
const resolve_one_file_list = async (base, name, checkExists = true) => {
|
|
28349
28411
|
const bname = base[name];
|
|
28350
28412
|
if (!bname)
|
|
28351
28413
|
return;
|
|
28352
28414
|
const result = await resolve_file_list(
|
|
28353
|
-
bname
|
|
28415
|
+
bname,
|
|
28416
|
+
checkExists
|
|
28354
28417
|
);
|
|
28355
28418
|
if (!result || !result.length) {
|
|
28356
28419
|
delete base[name];
|
|
@@ -28362,7 +28425,7 @@ async function resolve_literals(qualifier, default_source, deviceInfo, cache) {
|
|
|
28362
28425
|
resolve_one_file_list(qualifier, "sourcePath"),
|
|
28363
28426
|
resolve_one_file_list(qualifier, "resourcePath"),
|
|
28364
28427
|
resolve_one_file_list(qualifier, "personality"),
|
|
28365
|
-
resolve_one_file_list(qualifier, "barrelPath")
|
|
28428
|
+
resolve_one_file_list(qualifier, "barrelPath", false)
|
|
28366
28429
|
];
|
|
28367
28430
|
const lang = qualifier["lang"];
|
|
28368
28431
|
if (lang) {
|
|
@@ -28408,12 +28471,12 @@ async function read_resource_files(targets, cache) {
|
|
|
28408
28471
|
if (!(0, import_chunk_MBTLUWXR.hasProperty)(resourceGroupPromises, key)) {
|
|
28409
28472
|
resourceGroupPromises[key] = Promise.all(
|
|
28410
28473
|
p.qualifier.resourcePath.map(
|
|
28411
|
-
(pattern) => (0,
|
|
28474
|
+
(pattern) => (0, import_chunk_OASVKTK5.globa)(pattern, { mark: true })
|
|
28412
28475
|
)
|
|
28413
28476
|
).then(
|
|
28414
28477
|
(patterns) => Promise.all(
|
|
28415
28478
|
patterns.flat().map(
|
|
28416
|
-
(path7) => path7.endsWith("/") ? (0,
|
|
28479
|
+
(path7) => path7.endsWith("/") ? (0, import_chunk_OASVKTK5.globa)(`${path7}**/*.xml`, { mark: true }) : path7
|
|
28417
28480
|
)
|
|
28418
28481
|
)
|
|
28419
28482
|
).then(
|
|
@@ -28473,7 +28536,7 @@ async function find_build_instructions_in_resource(file, rez, buildDependencies)
|
|
|
28473
28536
|
const sourceExcludes = excludes.map((e) => e.file?.value.value).filter((f) => f != null).map((f) => path2.resolve(dir, f).replace(/\\/g, "/"));
|
|
28474
28537
|
const filePatterns = excludes.map((e) => e.dir?.value.value).filter((f) => f != null).map((f) => path2.join(dir, f, "**", "*.mc").replace(/\\/g, "/"));
|
|
28475
28538
|
if (filePatterns.length) {
|
|
28476
|
-
const files = (await Promise.all(filePatterns.map((p) => (0,
|
|
28539
|
+
const files = (await Promise.all(filePatterns.map((p) => (0, import_chunk_OASVKTK5.globa)(p)))).flat();
|
|
28477
28540
|
sourceExcludes.push(...files);
|
|
28478
28541
|
}
|
|
28479
28542
|
const excludeAnnotations = excludes.map((e) => e.annotation?.value.value).filter((f) => f != null);
|
|
@@ -28647,23 +28710,32 @@ function identify_optimizer_groups(targets, options) {
|
|
|
28647
28710
|
target.group.optimizerConfig.products.push(target.product);
|
|
28648
28711
|
});
|
|
28649
28712
|
}
|
|
28650
|
-
function find_barrels(barrelPath) {
|
|
28651
|
-
|
|
28652
|
-
|
|
28653
|
-
|
|
28654
|
-
|
|
28655
|
-
|
|
28656
|
-
|
|
28657
|
-
|
|
28658
|
-
|
|
28713
|
+
function find_barrels(barrelPath, buildDependencies) {
|
|
28714
|
+
return (Array.isArray(barrelPath) ? (
|
|
28715
|
+
// This is a sublist. The barrel has more than one jungle file.
|
|
28716
|
+
Promise.all(barrelPath.map((path7) => (0, import_chunk_OASVKTK5.globa)(path7, { mark: true }))).then(
|
|
28717
|
+
(paths) => [
|
|
28718
|
+
paths.flat().filter((path7) => path7.endsWith(".jungle")).join(";")
|
|
28719
|
+
]
|
|
28720
|
+
)
|
|
28721
|
+
) : (0, import_chunk_OASVKTK5.globa)(barrelPath, { mark: true }).then(
|
|
28659
28722
|
(paths) => Promise.all(
|
|
28660
28723
|
paths.map(
|
|
28661
|
-
(path7) => path7.endsWith("/") ? (0,
|
|
28724
|
+
(path7) => path7.endsWith("/") ? (0, import_chunk_OASVKTK5.globa)(`${path7}**/*.barrel`) : path7
|
|
28662
28725
|
)
|
|
28663
28726
|
)
|
|
28664
28727
|
).then(
|
|
28665
|
-
(barrelPaths) => barrelPaths.flat().filter(
|
|
28666
|
-
|
|
28728
|
+
(barrelPaths) => barrelPaths.flat().filter(
|
|
28729
|
+
(path7) => path7.endsWith(".jungle") || path7.endsWith(".barrel")
|
|
28730
|
+
)
|
|
28731
|
+
)).then((paths) => {
|
|
28732
|
+
(0, import_chunk_OASVKTK5.forEach)(
|
|
28733
|
+
barrelPath,
|
|
28734
|
+
(path7) => /[*?[\]{}]/.test(path7) || (buildDependencies[path7] = true)
|
|
28735
|
+
);
|
|
28736
|
+
paths.forEach((path7) => buildDependencies[path7] = true);
|
|
28737
|
+
return paths;
|
|
28738
|
+
});
|
|
28667
28739
|
}
|
|
28668
28740
|
function resolve_barrel(barrel, barrelDir, products, options, cache, buildDependencies) {
|
|
28669
28741
|
if ((0, import_chunk_MBTLUWXR.hasProperty)(cache.barrels, barrel)) {
|
|
@@ -28709,7 +28781,7 @@ function resolve_barrel(barrel, barrelDir, products, options, cache, buildDepend
|
|
|
28709
28781
|
throw e;
|
|
28710
28782
|
});
|
|
28711
28783
|
}
|
|
28712
|
-
function resolve_barrels(product, qualifier, barrels, products, options, cache, buildDependencies) {
|
|
28784
|
+
function resolve_barrels(jungle, product, qualifier, barrels, products, options, cache, buildDependencies) {
|
|
28713
28785
|
if (qualifier.annotations) {
|
|
28714
28786
|
Object.keys(qualifier.annotations).forEach((key) => {
|
|
28715
28787
|
if (!barrels.includes(key)) {
|
|
@@ -28747,7 +28819,7 @@ function resolve_barrels(product, qualifier, barrels, products, options, cache,
|
|
|
28747
28819
|
barrels.map((b) => [b, null])
|
|
28748
28820
|
);
|
|
28749
28821
|
return (qualifier.barrelPath || []).reduce(
|
|
28750
|
-
(promise, barrelPath) => promise.then(() => find_barrels(barrelPath)).then((barrelPaths) => {
|
|
28822
|
+
(promise, barrelPath) => promise.then(() => find_barrels(barrelPath, buildDependencies)).then((barrelPaths) => {
|
|
28751
28823
|
return Promise.all(
|
|
28752
28824
|
barrelPaths.map(
|
|
28753
28825
|
(barrel) => resolve_barrel(
|
|
@@ -28784,9 +28856,11 @@ function resolve_barrels(product, qualifier, barrels, products, options, cache,
|
|
|
28784
28856
|
).then(() => {
|
|
28785
28857
|
const unresolved = Object.entries(barrelMap).filter((v) => v[1] === null);
|
|
28786
28858
|
if (unresolved.length) {
|
|
28787
|
-
|
|
28859
|
+
const e = new Error(
|
|
28788
28860
|
`Failed to resolve some barrels: ${unresolved.map(([name]) => name).join(",")}`
|
|
28789
28861
|
);
|
|
28862
|
+
e.source = jungle;
|
|
28863
|
+
throw e;
|
|
28790
28864
|
}
|
|
28791
28865
|
const finalMap = barrelMap;
|
|
28792
28866
|
if (!cache.barrelMap)
|
|
@@ -28851,6 +28925,7 @@ async function get_jungle_and_barrels(jungleFiles, defaultProducts, options, cac
|
|
|
28851
28925
|
).then((qualifier) => {
|
|
28852
28926
|
targets.push({ product, qualifier, shape });
|
|
28853
28927
|
return resolve_barrels(
|
|
28928
|
+
jungles[0],
|
|
28854
28929
|
product,
|
|
28855
28930
|
qualifier,
|
|
28856
28931
|
barrels,
|
|
@@ -28931,7 +29006,7 @@ var init_jungles = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
28931
29006
|
init_api();
|
|
28932
29007
|
init_manifest();
|
|
28933
29008
|
init_sdk_util();
|
|
28934
|
-
(0,
|
|
29009
|
+
(0, import_chunk_OASVKTK5.init_util)();
|
|
28935
29010
|
depth = 0;
|
|
28936
29011
|
}
|
|
28937
29012
|
});
|
|
@@ -28959,7 +29034,7 @@ async function launchSimulator(force = true) {
|
|
|
28959
29034
|
await new Promise((r) => setTimeout(r, 200));
|
|
28960
29035
|
}
|
|
28961
29036
|
} catch (e) {
|
|
28962
|
-
(0,
|
|
29037
|
+
(0, import_chunk_OASVKTK5.log)(e);
|
|
28963
29038
|
}
|
|
28964
29039
|
}
|
|
28965
29040
|
function checkIfSimulatorRunning() {
|
|
@@ -28990,10 +29065,10 @@ function simulateProgram(prg, device, test = false, logger2) {
|
|
|
28990
29065
|
}
|
|
28991
29066
|
}
|
|
28992
29067
|
return getSdkPath().then(
|
|
28993
|
-
(sdk) => (0,
|
|
29068
|
+
(sdk) => (0, import_chunk_OASVKTK5.spawnByLine)(
|
|
28994
29069
|
path3.resolve(sdk, "bin", isWin ? "monkeydo.bat" : "monkeydo"),
|
|
28995
29070
|
args,
|
|
28996
|
-
logger2 || ((line) => (0,
|
|
29071
|
+
logger2 || ((line) => (0, import_chunk_OASVKTK5.log)(line))
|
|
28997
29072
|
).then(() => {
|
|
28998
29073
|
return;
|
|
28999
29074
|
})
|
|
@@ -29003,7 +29078,7 @@ var init_launch = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
29003
29078
|
"src/launch.ts"() {
|
|
29004
29079
|
"use strict";
|
|
29005
29080
|
init_sdk_util();
|
|
29006
|
-
(0,
|
|
29081
|
+
(0, import_chunk_OASVKTK5.init_util)();
|
|
29007
29082
|
}
|
|
29008
29083
|
});
|
|
29009
29084
|
function relative_path_no_dotdot(relative2) {
|
|
@@ -29024,7 +29099,7 @@ async function getCodeWorkspaceSettings(folder) {
|
|
|
29024
29099
|
let curDir = folder;
|
|
29025
29100
|
try {
|
|
29026
29101
|
while (curDir) {
|
|
29027
|
-
const code_workspaces = await (0,
|
|
29102
|
+
const code_workspaces = await (0, import_chunk_OASVKTK5.globa)(
|
|
29028
29103
|
path4.resolve(curDir, "*.code-workspace"),
|
|
29029
29104
|
{ onlyFiles: true }
|
|
29030
29105
|
);
|
|
@@ -29075,7 +29150,12 @@ function getConfig(options) {
|
|
|
29075
29150
|
}
|
|
29076
29151
|
return settings;
|
|
29077
29152
|
});
|
|
29078
|
-
}, Promise.resolve(null)).then(() =>
|
|
29153
|
+
}, Promise.resolve(options.ignore_settings_files ? {} : null)).then((settings) => {
|
|
29154
|
+
if (settings && (!config.strictTypeCheck || config.strictTypeCheck === "Default") && (settings["monkeyC.typeCheckLevel"]?.toString().toLowerCase() === "strict" || settings["prettierMonkeyC.typeCheckLevel"]?.toString().toLowerCase() === "strict")) {
|
|
29155
|
+
config.strictTypeCheck = "On";
|
|
29156
|
+
}
|
|
29157
|
+
return config;
|
|
29158
|
+
});
|
|
29079
29159
|
}
|
|
29080
29160
|
async function buildOptimizedProject(product, options) {
|
|
29081
29161
|
const config = await getConfig(options);
|
|
@@ -29147,7 +29227,7 @@ async function createLocalBarrels(targets, options) {
|
|
|
29147
29227
|
optBarrelDir
|
|
29148
29228
|
};
|
|
29149
29229
|
return promise2.then(
|
|
29150
|
-
() => (0,
|
|
29230
|
+
() => (0, import_chunk_OASVKTK5.copyRecursiveAsNeeded)(
|
|
29151
29231
|
rawBarrelDir,
|
|
29152
29232
|
optBarrelDir,
|
|
29153
29233
|
(src) => !src.endsWith(".mc")
|
|
@@ -29265,17 +29345,14 @@ async function generateOptimizedProject(options) {
|
|
|
29265
29345
|
let hasPersonality = false;
|
|
29266
29346
|
const promises = Object.keys(buildConfigs).sort().map((key) => {
|
|
29267
29347
|
const buildConfig = buildConfigs[key];
|
|
29268
|
-
const outputPath = path4.join(config.outputPath, key);
|
|
29269
29348
|
return buildConfig ? runTaskInPool({
|
|
29270
29349
|
type: "generateOneConfig",
|
|
29271
29350
|
data: {
|
|
29272
29351
|
buildConfig,
|
|
29273
29352
|
manifestXML: xml,
|
|
29274
29353
|
dependencyFiles,
|
|
29275
|
-
config
|
|
29276
|
-
|
|
29277
|
-
outputPath
|
|
29278
|
-
}
|
|
29354
|
+
config,
|
|
29355
|
+
key
|
|
29279
29356
|
}
|
|
29280
29357
|
}).catch((e) => {
|
|
29281
29358
|
if (!e.stack) {
|
|
@@ -29294,7 +29371,7 @@ async function generateOptimizedProject(options) {
|
|
|
29294
29371
|
if (t.sdkVersion != null && t.sdkVersion >= 4002001) {
|
|
29295
29372
|
hasPersonality = true;
|
|
29296
29373
|
}
|
|
29297
|
-
}) : fs6.rm(path4.resolve(workspace, outputPath), {
|
|
29374
|
+
}) : fs6.rm(path4.resolve(workspace, config.outputPath, key), {
|
|
29298
29375
|
recursive: true,
|
|
29299
29376
|
force: true
|
|
29300
29377
|
});
|
|
@@ -29447,30 +29524,48 @@ async function generateOptimizedProject(options) {
|
|
|
29447
29524
|
diagnostics
|
|
29448
29525
|
};
|
|
29449
29526
|
}
|
|
29450
|
-
async function filesFromPaths(workspace,
|
|
29451
|
-
|
|
29452
|
-
|
|
29527
|
+
async function filesFromPaths(workspace, buildDir, inPaths, extension) {
|
|
29528
|
+
const filter = buildDir.startsWith(workspace);
|
|
29529
|
+
const paths = (await Promise.all(
|
|
29530
|
+
inPaths?.map(
|
|
29531
|
+
(pattern) => (0, import_chunk_OASVKTK5.globa)(pattern, { cwd: workspace, mark: true }).then(
|
|
29532
|
+
(paths2) => paths2.map((p) => ({
|
|
29533
|
+
path: p,
|
|
29534
|
+
filter: filter && /^\*\*[\\/]\*.mc$/i.test(path4.relative(workspace, pattern))
|
|
29535
|
+
}))
|
|
29536
|
+
)
|
|
29537
|
+
) || []
|
|
29453
29538
|
)).flat();
|
|
29454
29539
|
const files = await Promise.all(
|
|
29455
29540
|
paths.map(
|
|
29456
|
-
(
|
|
29541
|
+
(result) => result.path.endsWith("/") ? (0, import_chunk_OASVKTK5.globa)(`${result.path}**/*${extension}`, {
|
|
29542
|
+
cwd: workspace,
|
|
29543
|
+
mark: true
|
|
29544
|
+
}).then(
|
|
29545
|
+
(paths2) => paths2.map((path7) => ({
|
|
29546
|
+
path: path7,
|
|
29547
|
+
filter: result.filter
|
|
29548
|
+
}))
|
|
29549
|
+
) : result
|
|
29457
29550
|
)
|
|
29458
29551
|
);
|
|
29459
29552
|
return {
|
|
29460
29553
|
files: files.flat().filter(
|
|
29461
|
-
(file) => file.endsWith(extension) && !
|
|
29462
|
-
),
|
|
29463
|
-
paths
|
|
29554
|
+
(file) => file.path.endsWith(extension) && (!file.filter || !file.path.startsWith(buildDir))
|
|
29555
|
+
).map(({ path: path7 }) => path7),
|
|
29556
|
+
paths: paths.map(({ path: path7 }) => path7)
|
|
29464
29557
|
};
|
|
29465
29558
|
}
|
|
29466
|
-
async function fileInfoFromConfig(workspace, output, buildConfig, extraExcludes, barrel) {
|
|
29559
|
+
async function fileInfoFromConfig(workspace, buildDir, output, buildConfig, extraExcludes, barrel) {
|
|
29467
29560
|
const { files, paths } = await filesFromPaths(
|
|
29468
29561
|
workspace,
|
|
29562
|
+
buildDir,
|
|
29469
29563
|
buildConfig.sourcePath,
|
|
29470
29564
|
".mc"
|
|
29471
29565
|
);
|
|
29472
29566
|
const { files: personalityFiles } = await filesFromPaths(
|
|
29473
29567
|
workspace,
|
|
29568
|
+
buildDir,
|
|
29474
29569
|
buildConfig.personality,
|
|
29475
29570
|
".mss"
|
|
29476
29571
|
);
|
|
@@ -29508,9 +29603,10 @@ function excludesFromAnnotations(barrel, annotations, resolvedBarrel) {
|
|
|
29508
29603
|
}
|
|
29509
29604
|
return excludes;
|
|
29510
29605
|
}
|
|
29511
|
-
async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, config) {
|
|
29606
|
+
async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, config, key) {
|
|
29512
29607
|
const { workspace } = config;
|
|
29513
|
-
const
|
|
29608
|
+
const outputRoot = path4.resolve(workspace, config.outputPath);
|
|
29609
|
+
const output = path4.join(outputRoot, key);
|
|
29514
29610
|
const buildModeExcludes = {
|
|
29515
29611
|
// note: exclude debug in release builds, and release in debug builds
|
|
29516
29612
|
[config.releaseBuild ? "debug" : "release"]: true
|
|
@@ -29524,6 +29620,7 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
|
|
|
29524
29620
|
}
|
|
29525
29621
|
const { fnMap } = await fileInfoFromConfig(
|
|
29526
29622
|
workspace,
|
|
29623
|
+
outputRoot,
|
|
29527
29624
|
path4.join(output, "source"),
|
|
29528
29625
|
buildConfig,
|
|
29529
29626
|
buildModeExcludes,
|
|
@@ -29541,6 +29638,7 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
|
|
|
29541
29638
|
);
|
|
29542
29639
|
return fileInfoFromConfig(
|
|
29543
29640
|
path4.dirname(resolvedBarrel.jungles[0]),
|
|
29641
|
+
outputRoot,
|
|
29544
29642
|
path4.join(output, "barrels", barrel),
|
|
29545
29643
|
resolvedBarrel.qualifier,
|
|
29546
29644
|
{
|
|
@@ -29556,14 +29654,14 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
|
|
|
29556
29654
|
}).flat()
|
|
29557
29655
|
);
|
|
29558
29656
|
barrelFnMaps.forEach(
|
|
29559
|
-
(barrelFnMap) => Object.entries(barrelFnMap).forEach(([
|
|
29560
|
-
if (!(0, import_chunk_MBTLUWXR.hasProperty)(fnMap,
|
|
29561
|
-
fnMap[
|
|
29657
|
+
(barrelFnMap) => Object.entries(barrelFnMap).forEach(([key2, value2]) => {
|
|
29658
|
+
if (!(0, import_chunk_MBTLUWXR.hasProperty)(fnMap, key2)) {
|
|
29659
|
+
fnMap[key2] = value2;
|
|
29562
29660
|
}
|
|
29563
29661
|
})
|
|
29564
29662
|
);
|
|
29565
29663
|
}
|
|
29566
|
-
const actualOptimizedFiles = (await (0,
|
|
29664
|
+
const actualOptimizedFiles = (await (0, import_chunk_OASVKTK5.globa)(path4.join(output, "**", "*.mc"), { mark: true })).filter((file) => !file.endsWith("/")).sort();
|
|
29567
29665
|
const {
|
|
29568
29666
|
hasTests,
|
|
29569
29667
|
diagnostics: prevDiagnostics,
|
|
@@ -29579,13 +29677,13 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
|
|
|
29579
29677
|
const sdk = await getSdkPath();
|
|
29580
29678
|
const match = sdk.match(/-(\d+\.\d+\.\d+)/);
|
|
29581
29679
|
if ((match && parseSdkVersion(match[1])) === prevSdkVersion) {
|
|
29582
|
-
const source_time = await (0,
|
|
29680
|
+
const source_time = await (0, import_chunk_OASVKTK5.last_modified)(
|
|
29583
29681
|
Object.keys(fnMap).concat(dependencyFiles)
|
|
29584
29682
|
);
|
|
29585
|
-
const opt_time = await (0,
|
|
29683
|
+
const opt_time = await (0, import_chunk_OASVKTK5.first_modified)(
|
|
29586
29684
|
Object.values(fnMap).map((v) => v.output)
|
|
29587
29685
|
);
|
|
29588
|
-
if (source_time < opt_time &&
|
|
29686
|
+
if (source_time < opt_time && 1720645332171 < opt_time) {
|
|
29589
29687
|
return {
|
|
29590
29688
|
hasTests,
|
|
29591
29689
|
diagnostics: prevDiagnostics,
|
|
@@ -29594,13 +29692,12 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
|
|
|
29594
29692
|
}
|
|
29595
29693
|
}
|
|
29596
29694
|
}
|
|
29597
|
-
const [
|
|
29598
|
-
fs6.rm(output, { recursive: true, force: true }),
|
|
29599
|
-
fs6.mkdir(output, { recursive: true }),
|
|
29695
|
+
const [prettierConfig] = await Promise.all([
|
|
29600
29696
|
Prettier2.resolveConfig(config.workspace, {
|
|
29601
29697
|
useCache: false,
|
|
29602
29698
|
editorconfig: true
|
|
29603
|
-
})
|
|
29699
|
+
}),
|
|
29700
|
+
fs6.rm(output, { recursive: true, force: true }).then(() => fs6.mkdir(output, { recursive: true }))
|
|
29604
29701
|
]);
|
|
29605
29702
|
return optimizeMonkeyC(fnMap, resourcesMap, manifestXML, config).then(
|
|
29606
29703
|
({ diagnostics, sdkVersion }) => {
|
|
@@ -29624,7 +29721,7 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
|
|
|
29624
29721
|
hasTests: hasTests2,
|
|
29625
29722
|
diagnostics,
|
|
29626
29723
|
sdkVersion,
|
|
29627
|
-
optimizerVersion: "1.1.
|
|
29724
|
+
optimizerVersion: "1.1.68",
|
|
29628
29725
|
...Object.fromEntries(
|
|
29629
29726
|
configOptionsToCheck.map((option) => [option, config[option]])
|
|
29630
29727
|
)
|
|
@@ -29634,15 +29731,12 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
|
|
|
29634
29731
|
}
|
|
29635
29732
|
);
|
|
29636
29733
|
}
|
|
29637
|
-
|
|
29638
|
-
|
|
29639
|
-
|
|
29640
|
-
|
|
29641
|
-
|
|
29642
|
-
|
|
29643
|
-
}
|
|
29644
|
-
throw ex;
|
|
29645
|
-
}
|
|
29734
|
+
function getProjectAnalysis(targets, analysis, manifestXML, options) {
|
|
29735
|
+
return getConfig(options).then(
|
|
29736
|
+
(options2) => getProjectAnalysisHelper(targets, analysis, manifestXML, options2)
|
|
29737
|
+
).catch(
|
|
29738
|
+
(ex) => Promise.reject(ex instanceof import_chunk_OASVKTK5.AwaitedError ? ex.resolve() : ex)
|
|
29739
|
+
);
|
|
29646
29740
|
}
|
|
29647
29741
|
async function getProjectAnalysisHelper(targets, analysis, manifestXML, options) {
|
|
29648
29742
|
const qualifiers = /* @__PURE__ */ new Map();
|
|
@@ -29672,11 +29766,13 @@ async function getProjectAnalysisHelper(targets, analysis, manifestXML, options)
|
|
|
29672
29766
|
}
|
|
29673
29767
|
return product;
|
|
29674
29768
|
});
|
|
29769
|
+
const { workspace, outputPath } = options;
|
|
29675
29770
|
const { fnMap, paths } = await Promise.all(
|
|
29676
29771
|
Array.from(qualifiers).map(
|
|
29677
29772
|
([name, qualifier]) => fileInfoFromConfig(
|
|
29678
29773
|
qualifier.root,
|
|
29679
|
-
|
|
29774
|
+
path4.resolve(workspace, outputPath ?? "bin/optimized"),
|
|
29775
|
+
workspace,
|
|
29680
29776
|
{
|
|
29681
29777
|
sourcePath: Array.from(qualifier.sourcePath),
|
|
29682
29778
|
personality: Array.from(qualifier.personality),
|
|
@@ -29708,9 +29804,7 @@ async function getProjectAnalysisHelper(targets, analysis, manifestXML, options)
|
|
|
29708
29804
|
}
|
|
29709
29805
|
});
|
|
29710
29806
|
}
|
|
29711
|
-
|
|
29712
|
-
return { fnMap, paths };
|
|
29713
|
-
}
|
|
29807
|
+
await getFileASTs(fnMap);
|
|
29714
29808
|
const resourcesMap = {};
|
|
29715
29809
|
const addResources = (name, resources) => {
|
|
29716
29810
|
if (!resources)
|
|
@@ -29729,14 +29823,22 @@ async function getProjectAnalysisHelper(targets, analysis, manifestXML, options)
|
|
|
29729
29823
|
);
|
|
29730
29824
|
}
|
|
29731
29825
|
});
|
|
29732
|
-
|
|
29733
|
-
|
|
29826
|
+
return {
|
|
29827
|
+
...await getFnMapAnalysis(fnMap, resourcesMap, manifestXML, options),
|
|
29828
|
+
paths
|
|
29829
|
+
};
|
|
29830
|
+
}
|
|
29831
|
+
async function getFnMapAnalysis(fnMap, resourcesMap, manifestXML, options) {
|
|
29832
|
+
const state = await analyze(fnMap, resourcesMap, manifestXML, options, true);
|
|
29833
|
+
if (Object.values(fnMap).every(({ ast }) => ast != null)) {
|
|
29834
|
+
reportMissingSymbols(state, options);
|
|
29835
|
+
}
|
|
29734
29836
|
let typeMap = null;
|
|
29735
|
-
if (state.config?.propagateTypes && state.config.trustDeclaredTypes && state.config.checkTypes !== "OFF"
|
|
29837
|
+
if (state.config?.propagateTypes && state.config.trustDeclaredTypes && state.config.checkTypes !== "OFF") {
|
|
29736
29838
|
const gistate = {
|
|
29737
29839
|
state,
|
|
29738
29840
|
stack: [],
|
|
29739
|
-
typeChecker: state.config.
|
|
29841
|
+
typeChecker: state.config.strictTypeCheck?.toLowerCase() === "on" ? subtypeOf : couldBeWeak,
|
|
29740
29842
|
checkTypes: state.config?.checkTypes || "WARNING"
|
|
29741
29843
|
};
|
|
29742
29844
|
state.pre = (node) => {
|
|
@@ -29765,14 +29867,17 @@ async function getProjectAnalysisHelper(targets, analysis, manifestXML, options)
|
|
|
29765
29867
|
return null;
|
|
29766
29868
|
};
|
|
29767
29869
|
Object.values(state.fnMap).forEach((f) => {
|
|
29768
|
-
collectNamespaces(f.ast, state);
|
|
29870
|
+
f.ast && collectNamespaces(f.ast, state);
|
|
29769
29871
|
});
|
|
29770
29872
|
delete state.pre;
|
|
29771
29873
|
}
|
|
29772
|
-
|
|
29773
|
-
|
|
29874
|
+
const diagnostics = state.diagnostics && await resolveDiagnosticsMap(state.diagnostics);
|
|
29875
|
+
if (state.config?.checkBuildPragmas) {
|
|
29876
|
+
Object.entries(fnMap).forEach(([name, f]) => {
|
|
29877
|
+
pragmaChecker(state, f.ast, diagnostics?.[name]);
|
|
29878
|
+
});
|
|
29774
29879
|
}
|
|
29775
|
-
return { fnMap,
|
|
29880
|
+
return { fnMap, state, typeMap };
|
|
29776
29881
|
}
|
|
29777
29882
|
var defaultConfig, configOptionsToCheck;
|
|
29778
29883
|
var init_optimizer = (0, import_chunk_ABYVSU2C.__esm)({
|
|
@@ -29784,12 +29889,13 @@ var init_optimizer = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
29784
29889
|
init_launch();
|
|
29785
29890
|
init_manifest();
|
|
29786
29891
|
init_mc_rewrite();
|
|
29892
|
+
init_pragma_checker();
|
|
29787
29893
|
init_sdk_util();
|
|
29788
29894
|
init_type_flow();
|
|
29789
29895
|
init_could_be();
|
|
29790
29896
|
init_interp();
|
|
29791
29897
|
init_sub_type();
|
|
29792
|
-
(0,
|
|
29898
|
+
(0, import_chunk_OASVKTK5.init_util)();
|
|
29793
29899
|
init_worker_pool();
|
|
29794
29900
|
init_optimizer_types();
|
|
29795
29901
|
init_types();
|
|
@@ -29849,7 +29955,7 @@ async function performTask(task) {
|
|
|
29849
29955
|
throw new Error(`Invalid task type ${type}`);
|
|
29850
29956
|
}
|
|
29851
29957
|
return Promise.resolve(handler(task.data)).then(
|
|
29852
|
-
(result) =>
|
|
29958
|
+
(result) => import_chunk_OASVKTK5.logPromise.then(() => result)
|
|
29853
29959
|
);
|
|
29854
29960
|
}
|
|
29855
29961
|
var workerTaskHandlers;
|
|
@@ -29859,7 +29965,7 @@ var init_worker_task = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
29859
29965
|
init_optimizer();
|
|
29860
29966
|
init_readprg();
|
|
29861
29967
|
init_sdk_util();
|
|
29862
|
-
(0,
|
|
29968
|
+
(0, import_chunk_OASVKTK5.init_logger)();
|
|
29863
29969
|
workerTaskHandlers = {
|
|
29864
29970
|
buildOptimizedProject(data) {
|
|
29865
29971
|
return buildOptimizedProject(data.product, data.options);
|
|
@@ -29876,7 +29982,8 @@ var init_worker_task = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
29876
29982
|
data.buildConfig,
|
|
29877
29983
|
data.manifestXML,
|
|
29878
29984
|
data.dependencyFiles,
|
|
29879
|
-
data.config
|
|
29985
|
+
data.config,
|
|
29986
|
+
data.key
|
|
29880
29987
|
);
|
|
29881
29988
|
},
|
|
29882
29989
|
optimizePrgAndDebug(data) {
|
|
@@ -30076,7 +30183,7 @@ async function optimizeProgram(filepath, devKey, output, config) {
|
|
|
30076
30183
|
}
|
|
30077
30184
|
function optimizeProgramBuffer(filepath, view, debugXml, apiDebugXml, key, config) {
|
|
30078
30185
|
const { sections } = readPrgWithOffsets(view);
|
|
30079
|
-
(0,
|
|
30186
|
+
(0, import_chunk_OASVKTK5.logger)("readprg", 5, sections);
|
|
30080
30187
|
const symbolTable = new SymbolTable();
|
|
30081
30188
|
if ((0, import_chunk_MBTLUWXR.hasProperty)(sections, 1461170197 .toString())) {
|
|
30082
30189
|
symbolTable.parse(sections[
|
|
@@ -30376,7 +30483,7 @@ var init_readprg = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
30376
30483
|
init_signer();
|
|
30377
30484
|
init_symbols();
|
|
30378
30485
|
init_sdk_util();
|
|
30379
|
-
(0,
|
|
30486
|
+
(0, import_chunk_OASVKTK5.init_util)();
|
|
30380
30487
|
init_worker_pool();
|
|
30381
30488
|
}
|
|
30382
30489
|
});
|
|
@@ -30388,7 +30495,7 @@ function getSdkPath() {
|
|
|
30388
30495
|
});
|
|
30389
30496
|
}
|
|
30390
30497
|
async function getDeviceInfo() {
|
|
30391
|
-
const files = await (0,
|
|
30498
|
+
const files = await (0, import_chunk_OASVKTK5.globa)(`${connectiq}/Devices/*/compiler.json`);
|
|
30392
30499
|
if (!files.length) {
|
|
30393
30500
|
throw new Error(
|
|
30394
30501
|
`No devices found at '${connectiq}/Devices'. Check your sdk is correctly installed`
|
|
@@ -30456,7 +30563,7 @@ async function getFunctionDocumentation() {
|
|
|
30456
30563
|
var isWin, appSupport, connectiq;
|
|
30457
30564
|
var init_sdk_util = (0, import_chunk_ABYVSU2C.__esm)({
|
|
30458
30565
|
"src/sdk-util.ts"() {
|
|
30459
|
-
(0,
|
|
30566
|
+
(0, import_chunk_OASVKTK5.init_util)();
|
|
30460
30567
|
init_xml_util();
|
|
30461
30568
|
init_readprg();
|
|
30462
30569
|
init_bytecode();
|
|
@@ -30504,6 +30611,7 @@ var init_sdk_util = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
30504
30611
|
getConfig,
|
|
30505
30612
|
getDeviceInfo,
|
|
30506
30613
|
getFileASTs,
|
|
30614
|
+
getFnMapAnalysis,
|
|
30507
30615
|
getFunctionDocumentation,
|
|
30508
30616
|
getLanguages,
|
|
30509
30617
|
getProjectAnalysis,
|