@markw65/monkeyc-optimizer 1.1.19 → 1.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -0
- package/build/api.cjs +34 -34
- package/build/{chunk-IAUHYWVN.cjs → chunk-APACX34C.cjs} +107 -4
- package/build/{chunk-O5LFMOIG.cjs → chunk-DCGJCC63.cjs} +424 -433
- package/build/optimizer.cjs +19 -19
- package/build/sdk-util.cjs +15 -15
- package/build/src/data-flow.d.ts +3 -6
- package/build/src/readprg/bytecode.d.ts +2 -2
- package/build/src/readprg/dce.d.ts +1 -0
- package/build/src/util.d.ts +8 -0
- package/build/util.cjs +25 -23
- package/build/worker-pool.cjs +6 -6
- package/build/worker-thread.cjs +5 -5
- package/package.json +1 -1
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: () =>
|
|
23
|
-
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: () =>
|
|
21
|
+
StateNodeAttributes: () => import_chunk_DCGJCC63.StateNodeAttributes,
|
|
22
|
+
buildOptimizedProject: () => import_chunk_DCGJCC63.buildOptimizedProject,
|
|
23
|
+
copyRecursiveAsNeeded: () => import_chunk_APACX34C.copyRecursiveAsNeeded,
|
|
24
|
+
defaultConfig: () => import_chunk_DCGJCC63.defaultConfig,
|
|
25
|
+
display: () => import_chunk_DCGJCC63.display,
|
|
26
|
+
generateApiMirTests: () => import_chunk_DCGJCC63.generateApiMirTests,
|
|
27
|
+
generateOneConfig: () => import_chunk_DCGJCC63.generateOneConfig,
|
|
28
|
+
generateOptimizedProject: () => import_chunk_DCGJCC63.generateOptimizedProject,
|
|
29
|
+
getConfig: () => import_chunk_DCGJCC63.getConfig,
|
|
30
|
+
getProjectAnalysis: () => import_chunk_DCGJCC63.getProjectAnalysis,
|
|
31
|
+
get_jungle: () => import_chunk_DCGJCC63.get_jungle,
|
|
32
|
+
isErrorWithLocation: () => import_chunk_DCGJCC63.isErrorWithLocation,
|
|
33
|
+
launchSimulator: () => import_chunk_DCGJCC63.launchSimulator,
|
|
34
|
+
manifestProducts: () => import_chunk_DCGJCC63.manifestProducts,
|
|
35
|
+
mctree: () => import_chunk_DCGJCC63.mctree,
|
|
36
|
+
simulateProgram: () => import_chunk_DCGJCC63.simulateProgram
|
|
37
37
|
});
|
|
38
38
|
module.exports = __toCommonJS(optimizer_exports);
|
|
39
|
-
var
|
|
40
|
-
var
|
|
41
|
-
(0,
|
|
39
|
+
var import_chunk_DCGJCC63 = require("./chunk-DCGJCC63.cjs");
|
|
40
|
+
var import_chunk_APACX34C = require("./chunk-APACX34C.cjs");
|
|
41
|
+
(0, import_chunk_DCGJCC63.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_DCGJCC63.SectionKinds,
|
|
22
|
+
appSupport: () => import_chunk_DCGJCC63.appSupport,
|
|
23
|
+
connectiq: () => import_chunk_DCGJCC63.connectiq,
|
|
24
|
+
getDeviceInfo: () => import_chunk_DCGJCC63.getDeviceInfo,
|
|
25
|
+
getFunctionDocumentation: () => import_chunk_DCGJCC63.getFunctionDocumentation,
|
|
26
|
+
getLanguages: () => import_chunk_DCGJCC63.getLanguages,
|
|
27
|
+
getSdkPath: () => import_chunk_DCGJCC63.getSdkPath,
|
|
28
|
+
isWin: () => import_chunk_DCGJCC63.isWin,
|
|
29
|
+
optimizeProgram: () => import_chunk_DCGJCC63.optimizeProgram,
|
|
30
|
+
readPrg: () => import_chunk_DCGJCC63.readPrg,
|
|
31
|
+
readPrgWithOffsets: () => import_chunk_DCGJCC63.readPrgWithOffsets,
|
|
32
|
+
xmlUtil: () => import_chunk_DCGJCC63.xml_util_exports
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(sdk_util_exports);
|
|
35
|
-
var
|
|
36
|
-
var
|
|
37
|
-
(0,
|
|
35
|
+
var import_chunk_DCGJCC63 = require("./chunk-DCGJCC63.cjs");
|
|
36
|
+
var import_chunk_APACX34C = require("./chunk-APACX34C.cjs");
|
|
37
|
+
(0, import_chunk_DCGJCC63.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/src/data-flow.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { mctree } from "@markw65/prettier-plugin-monkeyc";
|
|
2
2
|
import { BaseEvent, Block } from "./control-flow";
|
|
3
3
|
import { FunctionStateNode, ProgramStateAnalysis, StateNodeDecl } from "./optimizer-types";
|
|
4
|
+
import { GenericQueue } from "./util";
|
|
4
5
|
export declare type RefNode = mctree.Identifier | mctree.MemberExpression | mctree.Literal;
|
|
5
6
|
export declare type MemberDecl = {
|
|
6
7
|
type: "MemberDecl";
|
|
@@ -101,10 +102,6 @@ export declare function buildDataFlowGraph(state: ProgramStateAnalysis, func: Fu
|
|
|
101
102
|
identifiers: Set<string>;
|
|
102
103
|
graph: Block<Event>;
|
|
103
104
|
};
|
|
104
|
-
export declare class DataflowQueue {
|
|
105
|
-
|
|
106
|
-
private queue;
|
|
107
|
-
enqueue(block: DataFlowBlock): void;
|
|
108
|
-
dequeue(): DataFlowBlock;
|
|
109
|
-
empty(): boolean;
|
|
105
|
+
export declare class DataflowQueue extends GenericQueue<DataFlowBlock> {
|
|
106
|
+
constructor();
|
|
110
107
|
}
|
|
@@ -51,9 +51,9 @@ export declare type FuncEntry = {
|
|
|
51
51
|
export declare function offsetToString(offset: number): string;
|
|
52
52
|
export declare function fixSectionSize(section: SectionKinds, sections: Context["sections"], newSize: number): void;
|
|
53
53
|
export declare function optimizeBytecode(context: Context): void;
|
|
54
|
-
export declare function functionBanner(func: FuncEntry, context: Context | null, pass: string): () => string;
|
|
54
|
+
export declare function functionBanner(func: FuncEntry, context: Context | null, pass: string, footer?: (block: Block) => string): () => string;
|
|
55
55
|
export declare function printFunction(func: FuncEntry, context: Context | null): void;
|
|
56
|
-
export declare function functionToString(func: FuncEntry, context: Context | null): string;
|
|
56
|
+
export declare function functionToString(func: FuncEntry, context: Context | null, footer?: (block: Block) => string): string;
|
|
57
57
|
export declare function blockToString(block: Block, context: Context | null): string;
|
|
58
58
|
export declare function bytecodeToString(bytecode: Bytecode, symbolTable: SymbolTable | null | undefined): string;
|
|
59
59
|
export declare function findFunctions({ bytecodes, symbolTable, exceptionsMap, }: Context): Map<number, FuncEntry>;
|
package/build/src/util.d.ts
CHANGED
|
@@ -23,3 +23,11 @@ export declare function readByLine(file: string, lineHandler: LineHandler): Prom
|
|
|
23
23
|
export declare function promiseAll<T>(promiseFn: (i: number) => Promise<T> | null, parallelism: number): Promise<T[]>;
|
|
24
24
|
export declare function copyRecursiveAsNeeded(source: string, target: string, filter?: (src: string, tgt: string) => boolean): Promise<void>;
|
|
25
25
|
export declare function popcount(x: number): number;
|
|
26
|
+
export declare class GenericQueue<Block> {
|
|
27
|
+
private enqueued;
|
|
28
|
+
private queue;
|
|
29
|
+
constructor(sort: (a: Block, b: Block) => number);
|
|
30
|
+
enqueue(block: Block): void;
|
|
31
|
+
dequeue(): Block;
|
|
32
|
+
empty(): boolean;
|
|
33
|
+
}
|
package/build/util.cjs
CHANGED
|
@@ -18,33 +18,35 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var util_exports = {};
|
|
20
20
|
__export(util_exports, {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
21
|
+
GenericQueue: () => import_chunk_APACX34C.GenericQueue,
|
|
22
|
+
bumpLogging: () => import_chunk_APACX34C.bumpLogging,
|
|
23
|
+
copyRecursiveAsNeeded: () => import_chunk_APACX34C.copyRecursiveAsNeeded,
|
|
24
|
+
every: () => import_chunk_APACX34C.every,
|
|
25
|
+
first_modified: () => import_chunk_APACX34C.first_modified,
|
|
26
|
+
forEach: () => import_chunk_APACX34C.forEach,
|
|
27
|
+
globSome: () => import_chunk_APACX34C.globSome,
|
|
28
|
+
globa: () => import_chunk_APACX34C.globa,
|
|
29
|
+
last_modified: () => import_chunk_APACX34C.last_modified,
|
|
30
|
+
log: () => import_chunk_APACX34C.log,
|
|
31
|
+
logger: () => import_chunk_APACX34C.logger,
|
|
32
|
+
map: () => import_chunk_APACX34C.map,
|
|
33
|
+
popcount: () => import_chunk_APACX34C.popcount,
|
|
34
|
+
promiseAll: () => import_chunk_APACX34C.promiseAll,
|
|
35
|
+
pushUnique: () => import_chunk_APACX34C.pushUnique,
|
|
36
|
+
readByLine: () => import_chunk_APACX34C.readByLine,
|
|
37
|
+
reduce: () => import_chunk_APACX34C.reduce,
|
|
38
|
+
sameArrays: () => import_chunk_APACX34C.sameArrays,
|
|
39
|
+
setBanner: () => import_chunk_APACX34C.setBanner,
|
|
40
|
+
some: () => import_chunk_APACX34C.some,
|
|
41
|
+
spawnByLine: () => import_chunk_APACX34C.spawnByLine,
|
|
42
|
+
wouldLog: () => import_chunk_APACX34C.wouldLog
|
|
42
43
|
});
|
|
43
44
|
module.exports = __toCommonJS(util_exports);
|
|
44
|
-
var
|
|
45
|
-
(0,
|
|
45
|
+
var import_chunk_APACX34C = require("./chunk-APACX34C.cjs");
|
|
46
|
+
(0, import_chunk_APACX34C.init_util)();
|
|
46
47
|
// Annotate the CommonJS export names for ESM import in node:
|
|
47
48
|
0 && (module.exports = {
|
|
49
|
+
GenericQueue,
|
|
48
50
|
bumpLogging,
|
|
49
51
|
copyRecursiveAsNeeded,
|
|
50
52
|
every,
|
package/build/worker-pool.cjs
CHANGED
|
@@ -18,14 +18,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var worker_pool_exports = {};
|
|
20
20
|
__export(worker_pool_exports, {
|
|
21
|
-
runTaskInPool: () =>
|
|
22
|
-
startPool: () =>
|
|
23
|
-
stopPool: () =>
|
|
21
|
+
runTaskInPool: () => import_chunk_DCGJCC63.runTaskInPool,
|
|
22
|
+
startPool: () => import_chunk_DCGJCC63.startPool,
|
|
23
|
+
stopPool: () => import_chunk_DCGJCC63.stopPool
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(worker_pool_exports);
|
|
26
|
-
var
|
|
27
|
-
var
|
|
28
|
-
(0,
|
|
26
|
+
var import_chunk_DCGJCC63 = require("./chunk-DCGJCC63.cjs");
|
|
27
|
+
var import_chunk_APACX34C = require("./chunk-APACX34C.cjs");
|
|
28
|
+
(0, import_chunk_DCGJCC63.init_worker_pool)();
|
|
29
29
|
// Annotate the CommonJS export names for ESM import in node:
|
|
30
30
|
0 && (module.exports = {
|
|
31
31
|
runTaskInPool,
|
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
|
|
25
|
-
var
|
|
24
|
+
var import_chunk_DCGJCC63 = require("./chunk-DCGJCC63.cjs");
|
|
25
|
+
var import_chunk_APACX34C = require("./chunk-APACX34C.cjs");
|
|
26
26
|
var import_node_worker_threads = require("node:worker_threads");
|
|
27
|
-
var require_worker_thread = (0,
|
|
27
|
+
var require_worker_thread = (0, import_chunk_APACX34C.__commonJS)({
|
|
28
28
|
"src/worker-thread.ts"() {
|
|
29
|
-
(0,
|
|
29
|
+
(0, import_chunk_DCGJCC63.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_DCGJCC63.performTask)(task));
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
}
|
package/package.json
CHANGED