@markw65/monkeyc-optimizer 1.1.24 → 1.1.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/build/api.cjs +33 -33
- package/build/{chunk-3HVXWNU4.cjs → chunk-SNWJ2FZL.cjs} +17 -6
- package/build/optimizer.cjs +17 -17
- package/build/sdk-util.cjs +14 -14
- package/build/worker-thread.cjs +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -843,3 +843,8 @@ No functional change, just fixes a typo that broke the typescript exports.
|
|
|
843
843
|
- Conditional branches that are known to be taken, or known to be not taken are converted to gotos (and the gotos will often be eliminated by re-ordering blocks)
|
|
844
844
|
- Conditional branches that would be known to be taken, or known to be not taken if evalated at the end of one of their predecessors will be bypassed from that predecessor. Amongst other things, this converts for and while loops, that can be proven to iterate at least once, into do-while loops.
|
|
845
845
|
- Improved the emitter's algorithm for ordering blocks to avoid some more gotos
|
|
846
|
+
|
|
847
|
+
### 1.1.25
|
|
848
|
+
|
|
849
|
+
- Bug fixes
|
|
850
|
+
- fixes a copy paste error that could cause strange results in the interpreter, possibly leading to incorrect optimizations.
|
package/build/api.cjs
CHANGED
|
@@ -18,42 +18,42 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var api_exports = {};
|
|
20
20
|
__export(api_exports, {
|
|
21
|
-
checkCompilerVersion: () =>
|
|
22
|
-
collectNamespaces: () =>
|
|
23
|
-
createDocumentationMap: () =>
|
|
24
|
-
diagnostic: () =>
|
|
25
|
-
diagnosticHelper: () =>
|
|
26
|
-
findNamesInScope: () =>
|
|
27
|
-
findUsingForNode: () =>
|
|
28
|
-
formatAst: () =>
|
|
29
|
-
formatAstLongLines: () =>
|
|
30
|
-
getApiFunctionInfo: () =>
|
|
31
|
-
getApiMapping: () =>
|
|
32
|
-
getSuperClasses: () =>
|
|
33
|
-
hasProperty: () =>
|
|
34
|
-
isClassVariable: () =>
|
|
35
|
-
isLocal: () =>
|
|
36
|
-
isLookupCandidate: () =>
|
|
37
|
-
isStateNode: () =>
|
|
38
|
-
lookupByFullName: () =>
|
|
39
|
-
lookupNext: () =>
|
|
40
|
-
lookupResultContains: () =>
|
|
41
|
-
lookupWithType: () =>
|
|
42
|
-
makeToyboxLink: () =>
|
|
43
|
-
mapVarDeclsByType: () =>
|
|
44
|
-
markInvokeClassMethod: () =>
|
|
45
|
-
parseSdkVersion: () =>
|
|
46
|
-
sameLookupResult: () =>
|
|
47
|
-
traverseAst: () =>
|
|
48
|
-
variableDeclarationName: () =>
|
|
49
|
-
visitReferences: () =>
|
|
50
|
-
visit_resources: () =>
|
|
51
|
-
visitorNode: () =>
|
|
21
|
+
checkCompilerVersion: () => import_chunk_SNWJ2FZL.checkCompilerVersion,
|
|
22
|
+
collectNamespaces: () => import_chunk_SNWJ2FZL.collectNamespaces,
|
|
23
|
+
createDocumentationMap: () => import_chunk_SNWJ2FZL.createDocumentationMap,
|
|
24
|
+
diagnostic: () => import_chunk_SNWJ2FZL.diagnostic,
|
|
25
|
+
diagnosticHelper: () => import_chunk_SNWJ2FZL.diagnosticHelper,
|
|
26
|
+
findNamesInScope: () => import_chunk_SNWJ2FZL.findNamesInScope,
|
|
27
|
+
findUsingForNode: () => import_chunk_SNWJ2FZL.findUsingForNode,
|
|
28
|
+
formatAst: () => import_chunk_SNWJ2FZL.formatAst,
|
|
29
|
+
formatAstLongLines: () => import_chunk_SNWJ2FZL.formatAstLongLines,
|
|
30
|
+
getApiFunctionInfo: () => import_chunk_SNWJ2FZL.getApiFunctionInfo,
|
|
31
|
+
getApiMapping: () => import_chunk_SNWJ2FZL.getApiMapping,
|
|
32
|
+
getSuperClasses: () => import_chunk_SNWJ2FZL.getSuperClasses,
|
|
33
|
+
hasProperty: () => import_chunk_SNWJ2FZL.hasProperty,
|
|
34
|
+
isClassVariable: () => import_chunk_SNWJ2FZL.isClassVariable,
|
|
35
|
+
isLocal: () => import_chunk_SNWJ2FZL.isLocal,
|
|
36
|
+
isLookupCandidate: () => import_chunk_SNWJ2FZL.isLookupCandidate,
|
|
37
|
+
isStateNode: () => import_chunk_SNWJ2FZL.isStateNode,
|
|
38
|
+
lookupByFullName: () => import_chunk_SNWJ2FZL.lookupByFullName,
|
|
39
|
+
lookupNext: () => import_chunk_SNWJ2FZL.lookupNext,
|
|
40
|
+
lookupResultContains: () => import_chunk_SNWJ2FZL.lookupResultContains,
|
|
41
|
+
lookupWithType: () => import_chunk_SNWJ2FZL.lookupWithType,
|
|
42
|
+
makeToyboxLink: () => import_chunk_SNWJ2FZL.makeToyboxLink,
|
|
43
|
+
mapVarDeclsByType: () => import_chunk_SNWJ2FZL.mapVarDeclsByType,
|
|
44
|
+
markInvokeClassMethod: () => import_chunk_SNWJ2FZL.markInvokeClassMethod,
|
|
45
|
+
parseSdkVersion: () => import_chunk_SNWJ2FZL.parseSdkVersion,
|
|
46
|
+
sameLookupResult: () => import_chunk_SNWJ2FZL.sameLookupResult,
|
|
47
|
+
traverseAst: () => import_chunk_SNWJ2FZL.traverseAst,
|
|
48
|
+
variableDeclarationName: () => import_chunk_SNWJ2FZL.variableDeclarationName,
|
|
49
|
+
visitReferences: () => import_chunk_SNWJ2FZL.visitReferences,
|
|
50
|
+
visit_resources: () => import_chunk_SNWJ2FZL.visit_resources,
|
|
51
|
+
visitorNode: () => import_chunk_SNWJ2FZL.visitorNode
|
|
52
52
|
});
|
|
53
53
|
module.exports = __toCommonJS(api_exports);
|
|
54
|
-
var
|
|
54
|
+
var import_chunk_SNWJ2FZL = require("./chunk-SNWJ2FZL.cjs");
|
|
55
55
|
var import_chunk_QFQPBQSO = require("./chunk-QFQPBQSO.cjs");
|
|
56
|
-
(0,
|
|
56
|
+
(0, import_chunk_SNWJ2FZL.init_api)();
|
|
57
57
|
// Annotate the CommonJS export names for ESM import in node:
|
|
58
58
|
0 && (module.exports = {
|
|
59
59
|
checkCompilerVersion,
|
|
@@ -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_SNWJ2FZL_exports = {};
|
|
30
|
+
__export(chunk_SNWJ2FZL_exports, {
|
|
31
31
|
EnumTagsConst: () => EnumTagsConst,
|
|
32
32
|
LastTypeTag: () => LastTypeTag,
|
|
33
33
|
ObjectLikeTagsConst: () => ObjectLikeTagsConst,
|
|
@@ -125,7 +125,7 @@ __export(chunk_3HVXWNU4_exports, {
|
|
|
125
125
|
visitorNode: () => visitorNode,
|
|
126
126
|
xml_util_exports: () => xml_util_exports
|
|
127
127
|
});
|
|
128
|
-
module.exports = __toCommonJS(
|
|
128
|
+
module.exports = __toCommonJS(chunk_SNWJ2FZL_exports);
|
|
129
129
|
var import_chunk_QFQPBQSO = require("./chunk-QFQPBQSO.cjs");
|
|
130
130
|
var import_prettier_plugin_monkeyc = require("@markw65/prettier-plugin-monkeyc");
|
|
131
131
|
var import_node_assert = __toESM(require("node:assert"));
|
|
@@ -22210,7 +22210,7 @@ function interpBytecode(bc, localState, context) {
|
|
|
22210
22210
|
}
|
|
22211
22211
|
case 24: {
|
|
22212
22212
|
const symbol = context.symbolTable?.symbols.get(bc.arg);
|
|
22213
|
-
xpush(
|
|
22213
|
+
xpush(256, symbol?.str);
|
|
22214
22214
|
break;
|
|
22215
22215
|
}
|
|
22216
22216
|
case 3:
|
|
@@ -22344,6 +22344,17 @@ function interpFunc(func, context) {
|
|
|
22344
22344
|
return cloneState2(liveInState.get(block.offset));
|
|
22345
22345
|
},
|
|
22346
22346
|
(block, bc, localState) => {
|
|
22347
|
+
if (interpLogging) {
|
|
22348
|
+
if ((0, import_chunk_QFQPBQSO.wouldLog)("interp", 8)) {
|
|
22349
|
+
(0, import_chunk_QFQPBQSO.log)(
|
|
22350
|
+
`${interpStateToString(localState)}
|
|
22351
|
+
${bytecodeToString(
|
|
22352
|
+
bc,
|
|
22353
|
+
context.symbolTable
|
|
22354
|
+
)}`
|
|
22355
|
+
);
|
|
22356
|
+
}
|
|
22357
|
+
}
|
|
22347
22358
|
switch (bc.op) {
|
|
22348
22359
|
case 19: {
|
|
22349
22360
|
selfStores.delete(bc);
|
|
@@ -29896,7 +29907,7 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
|
|
|
29896
29907
|
const opt_time = await (0, import_chunk_QFQPBQSO.first_modified)(
|
|
29897
29908
|
Object.values(fnMap).map((v) => v.output)
|
|
29898
29909
|
);
|
|
29899
|
-
if (source_time < opt_time &&
|
|
29910
|
+
if (source_time < opt_time && 1680477048993 < opt_time) {
|
|
29900
29911
|
return { hasTests, diagnostics: prevDiagnostics };
|
|
29901
29912
|
}
|
|
29902
29913
|
}
|
|
@@ -29928,7 +29939,7 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
|
|
|
29928
29939
|
JSON.stringify({
|
|
29929
29940
|
hasTests: hasTests2,
|
|
29930
29941
|
diagnostics,
|
|
29931
|
-
optimizerVersion: "1.1.
|
|
29942
|
+
optimizerVersion: "1.1.25",
|
|
29932
29943
|
...Object.fromEntries(
|
|
29933
29944
|
configOptionsToCheck.map((option) => [option, config[option]])
|
|
29934
29945
|
)
|
package/build/optimizer.cjs
CHANGED
|
@@ -18,27 +18,27 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var optimizer_exports = {};
|
|
20
20
|
__export(optimizer_exports, {
|
|
21
|
-
StateNodeAttributes: () =>
|
|
22
|
-
buildOptimizedProject: () =>
|
|
21
|
+
StateNodeAttributes: () => import_chunk_SNWJ2FZL.StateNodeAttributes,
|
|
22
|
+
buildOptimizedProject: () => import_chunk_SNWJ2FZL.buildOptimizedProject,
|
|
23
23
|
copyRecursiveAsNeeded: () => import_chunk_QFQPBQSO.copyRecursiveAsNeeded,
|
|
24
|
-
defaultConfig: () =>
|
|
25
|
-
display: () =>
|
|
26
|
-
generateApiMirTests: () =>
|
|
27
|
-
generateOneConfig: () =>
|
|
28
|
-
generateOptimizedProject: () =>
|
|
29
|
-
getConfig: () =>
|
|
30
|
-
getProjectAnalysis: () =>
|
|
31
|
-
get_jungle: () =>
|
|
32
|
-
isErrorWithLocation: () =>
|
|
33
|
-
launchSimulator: () =>
|
|
34
|
-
manifestProducts: () =>
|
|
35
|
-
mctree: () =>
|
|
36
|
-
simulateProgram: () =>
|
|
24
|
+
defaultConfig: () => import_chunk_SNWJ2FZL.defaultConfig,
|
|
25
|
+
display: () => import_chunk_SNWJ2FZL.display,
|
|
26
|
+
generateApiMirTests: () => import_chunk_SNWJ2FZL.generateApiMirTests,
|
|
27
|
+
generateOneConfig: () => import_chunk_SNWJ2FZL.generateOneConfig,
|
|
28
|
+
generateOptimizedProject: () => import_chunk_SNWJ2FZL.generateOptimizedProject,
|
|
29
|
+
getConfig: () => import_chunk_SNWJ2FZL.getConfig,
|
|
30
|
+
getProjectAnalysis: () => import_chunk_SNWJ2FZL.getProjectAnalysis,
|
|
31
|
+
get_jungle: () => import_chunk_SNWJ2FZL.get_jungle,
|
|
32
|
+
isErrorWithLocation: () => import_chunk_SNWJ2FZL.isErrorWithLocation,
|
|
33
|
+
launchSimulator: () => import_chunk_SNWJ2FZL.launchSimulator,
|
|
34
|
+
manifestProducts: () => import_chunk_SNWJ2FZL.manifestProducts,
|
|
35
|
+
mctree: () => import_chunk_SNWJ2FZL.mctree,
|
|
36
|
+
simulateProgram: () => import_chunk_SNWJ2FZL.simulateProgram
|
|
37
37
|
});
|
|
38
38
|
module.exports = __toCommonJS(optimizer_exports);
|
|
39
|
-
var
|
|
39
|
+
var import_chunk_SNWJ2FZL = require("./chunk-SNWJ2FZL.cjs");
|
|
40
40
|
var import_chunk_QFQPBQSO = require("./chunk-QFQPBQSO.cjs");
|
|
41
|
-
(0,
|
|
41
|
+
(0, import_chunk_SNWJ2FZL.init_optimizer)();
|
|
42
42
|
// Annotate the CommonJS export names for ESM import in node:
|
|
43
43
|
0 && (module.exports = {
|
|
44
44
|
StateNodeAttributes,
|
package/build/sdk-util.cjs
CHANGED
|
@@ -18,23 +18,23 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var sdk_util_exports = {};
|
|
20
20
|
__export(sdk_util_exports, {
|
|
21
|
-
SectionKinds: () =>
|
|
22
|
-
appSupport: () =>
|
|
23
|
-
connectiq: () =>
|
|
24
|
-
getDeviceInfo: () =>
|
|
25
|
-
getFunctionDocumentation: () =>
|
|
26
|
-
getLanguages: () =>
|
|
27
|
-
getSdkPath: () =>
|
|
28
|
-
isWin: () =>
|
|
29
|
-
optimizeProgram: () =>
|
|
30
|
-
readPrg: () =>
|
|
31
|
-
readPrgWithOffsets: () =>
|
|
32
|
-
xmlUtil: () =>
|
|
21
|
+
SectionKinds: () => import_chunk_SNWJ2FZL.SectionKinds,
|
|
22
|
+
appSupport: () => import_chunk_SNWJ2FZL.appSupport,
|
|
23
|
+
connectiq: () => import_chunk_SNWJ2FZL.connectiq,
|
|
24
|
+
getDeviceInfo: () => import_chunk_SNWJ2FZL.getDeviceInfo,
|
|
25
|
+
getFunctionDocumentation: () => import_chunk_SNWJ2FZL.getFunctionDocumentation,
|
|
26
|
+
getLanguages: () => import_chunk_SNWJ2FZL.getLanguages,
|
|
27
|
+
getSdkPath: () => import_chunk_SNWJ2FZL.getSdkPath,
|
|
28
|
+
isWin: () => import_chunk_SNWJ2FZL.isWin,
|
|
29
|
+
optimizeProgram: () => import_chunk_SNWJ2FZL.optimizeProgram,
|
|
30
|
+
readPrg: () => import_chunk_SNWJ2FZL.readPrg,
|
|
31
|
+
readPrgWithOffsets: () => import_chunk_SNWJ2FZL.readPrgWithOffsets,
|
|
32
|
+
xmlUtil: () => import_chunk_SNWJ2FZL.xml_util_exports
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(sdk_util_exports);
|
|
35
|
-
var
|
|
35
|
+
var import_chunk_SNWJ2FZL = require("./chunk-SNWJ2FZL.cjs");
|
|
36
36
|
var import_chunk_QFQPBQSO = require("./chunk-QFQPBQSO.cjs");
|
|
37
|
-
(0,
|
|
37
|
+
(0, import_chunk_SNWJ2FZL.init_sdk_util)();
|
|
38
38
|
// Annotate the CommonJS export names for ESM import in node:
|
|
39
39
|
0 && (module.exports = {
|
|
40
40
|
SectionKinds,
|
package/build/worker-thread.cjs
CHANGED
|
@@ -21,15 +21,15 @@ __export(worker_thread_exports, {
|
|
|
21
21
|
default: () => worker_thread_default
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(worker_thread_exports);
|
|
24
|
-
var
|
|
24
|
+
var import_chunk_SNWJ2FZL = require("./chunk-SNWJ2FZL.cjs");
|
|
25
25
|
var import_chunk_QFQPBQSO = require("./chunk-QFQPBQSO.cjs");
|
|
26
26
|
var import_node_worker_threads = require("node:worker_threads");
|
|
27
27
|
var require_worker_thread = (0, import_chunk_QFQPBQSO.__commonJS)({
|
|
28
28
|
"src/worker-thread.ts"() {
|
|
29
|
-
(0,
|
|
29
|
+
(0, import_chunk_SNWJ2FZL.init_worker_task)();
|
|
30
30
|
if (import_node_worker_threads.parentPort) {
|
|
31
31
|
import_node_worker_threads.parentPort.on("message", async (task) => {
|
|
32
|
-
return import_node_worker_threads.parentPort.postMessage(await (0,
|
|
32
|
+
return import_node_worker_threads.parentPort.postMessage(await (0, import_chunk_SNWJ2FZL.performTask)(task));
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
}
|
package/package.json
CHANGED