@markw65/monkeyc-optimizer 1.1.20 → 1.1.21

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.
@@ -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: () => 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
21
+ StateNodeAttributes: () => import_chunk_ZDTW2QRS.StateNodeAttributes,
22
+ buildOptimizedProject: () => import_chunk_ZDTW2QRS.buildOptimizedProject,
23
+ copyRecursiveAsNeeded: () => import_chunk_HHQDDCTP.copyRecursiveAsNeeded,
24
+ defaultConfig: () => import_chunk_ZDTW2QRS.defaultConfig,
25
+ display: () => import_chunk_ZDTW2QRS.display,
26
+ generateApiMirTests: () => import_chunk_ZDTW2QRS.generateApiMirTests,
27
+ generateOneConfig: () => import_chunk_ZDTW2QRS.generateOneConfig,
28
+ generateOptimizedProject: () => import_chunk_ZDTW2QRS.generateOptimizedProject,
29
+ getConfig: () => import_chunk_ZDTW2QRS.getConfig,
30
+ getProjectAnalysis: () => import_chunk_ZDTW2QRS.getProjectAnalysis,
31
+ get_jungle: () => import_chunk_ZDTW2QRS.get_jungle,
32
+ isErrorWithLocation: () => import_chunk_ZDTW2QRS.isErrorWithLocation,
33
+ launchSimulator: () => import_chunk_ZDTW2QRS.launchSimulator,
34
+ manifestProducts: () => import_chunk_ZDTW2QRS.manifestProducts,
35
+ mctree: () => import_chunk_ZDTW2QRS.mctree,
36
+ simulateProgram: () => import_chunk_ZDTW2QRS.simulateProgram
37
37
  });
38
38
  module.exports = __toCommonJS(optimizer_exports);
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)();
39
+ var import_chunk_ZDTW2QRS = require("./chunk-ZDTW2QRS.cjs");
40
+ var import_chunk_HHQDDCTP = require("./chunk-HHQDDCTP.cjs");
41
+ (0, import_chunk_ZDTW2QRS.init_optimizer)();
42
42
  // Annotate the CommonJS export names for ESM import in node:
43
43
  0 && (module.exports = {
44
44
  StateNodeAttributes,
@@ -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: () => 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
21
+ SectionKinds: () => import_chunk_ZDTW2QRS.SectionKinds,
22
+ appSupport: () => import_chunk_ZDTW2QRS.appSupport,
23
+ connectiq: () => import_chunk_ZDTW2QRS.connectiq,
24
+ getDeviceInfo: () => import_chunk_ZDTW2QRS.getDeviceInfo,
25
+ getFunctionDocumentation: () => import_chunk_ZDTW2QRS.getFunctionDocumentation,
26
+ getLanguages: () => import_chunk_ZDTW2QRS.getLanguages,
27
+ getSdkPath: () => import_chunk_ZDTW2QRS.getSdkPath,
28
+ isWin: () => import_chunk_ZDTW2QRS.isWin,
29
+ optimizeProgram: () => import_chunk_ZDTW2QRS.optimizeProgram,
30
+ readPrg: () => import_chunk_ZDTW2QRS.readPrg,
31
+ readPrgWithOffsets: () => import_chunk_ZDTW2QRS.readPrgWithOffsets,
32
+ xmlUtil: () => import_chunk_ZDTW2QRS.xml_util_exports
33
33
  });
34
34
  module.exports = __toCommonJS(sdk_util_exports);
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)();
35
+ var import_chunk_ZDTW2QRS = require("./chunk-ZDTW2QRS.cjs");
36
+ var import_chunk_HHQDDCTP = require("./chunk-HHQDDCTP.cjs");
37
+ (0, import_chunk_ZDTW2QRS.init_sdk_util)();
38
38
  // Annotate the CommonJS export names for ESM import in node:
39
39
  0 && (module.exports = {
40
40
  SectionKinds,
@@ -51,10 +51,11 @@ 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, footer?: (block: Block) => string): () => string;
54
+ export declare function functionBanner(func: FuncEntry, context: Context | null, pass: string, extra?: (block: Block, footer: boolean) => string): () => string;
55
55
  export declare function printFunction(func: FuncEntry, context: Context | null): void;
56
- export declare function functionToString(func: FuncEntry, context: Context | null, footer?: (block: Block) => string): string;
56
+ export declare function functionToString(func: FuncEntry, context: Context | null, extra?: (block: Block, footer: boolean) => string): string;
57
57
  export declare function blockToString(block: Block, context: Context | null): string;
58
+ export declare function lineInfoToString(lineInfo: LineNumber, context: Context | null): string;
58
59
  export declare function bytecodeToString(bytecode: Bytecode, symbolTable: SymbolTable | null | undefined): string;
59
60
  export declare function findFunctions({ bytecodes, symbolTable, exceptionsMap, }: Context): Map<number, FuncEntry>;
60
61
  export declare function makeArgless(bc: Bytecode, op: Opcodes): void;
@@ -1,5 +1,8 @@
1
1
  import { Block, FuncEntry } from "./bytecode";
2
+ import { Bytecode } from "./opcodes";
2
3
  export declare function postOrderTraverse(func: FuncEntry, visitor: (block: Block) => void): void;
3
4
  export declare function intersect<T>(a: Set<T>, b: Set<T>): Set<T>;
4
5
  export declare type DomLike = Map<number, Set<number>>;
5
6
  export declare function computePostDominators(func: FuncEntry): DomLike;
7
+ export declare function postOrderPropagate<T>(func: FuncEntry, preBlock: (block: Block) => T, processBc: (block: Block, bc: Bytecode, state: T) => void, postBlock: (block: Block, state: T) => void, merge: (state: T, predBlock: Block, isExPred: boolean) => boolean): void;
8
+ export declare function rpoPropagate<T>(func: FuncEntry, preBlock: (block: Block) => T, processBc: (block: Block, bc: Bytecode, state: T) => void, postBlock: (block: Block, state: T) => void, merge: (from: Block, state: T, predBlock: Block, isExSucc: boolean) => boolean): void;
@@ -1,3 +1,6 @@
1
1
  import { Context, FuncEntry } from "./bytecode";
2
2
  export declare function localDCE(func: FuncEntry, context: Context): boolean;
3
- export declare function computeLiveLocals(func: FuncEntry): Map<number, Set<number>>;
3
+ export declare function computeLiveLocals(func: FuncEntry): {
4
+ liveInLocals: Map<number, Set<number>>;
5
+ liveOutLocals: Map<number, Set<number>>;
6
+ };
@@ -0,0 +1,19 @@
1
+ import { ExactOrUnion } from "../optimizer";
2
+ import { Context, FuncEntry } from "./bytecode";
3
+ import { Lputv } from "./opcodes";
4
+ interface InterpItemInfo {
5
+ type: ExactOrUnion;
6
+ equivs?: Set<number>;
7
+ }
8
+ interface InterpStackElem extends InterpItemInfo {
9
+ dup?: number;
10
+ }
11
+ declare type InterpState = {
12
+ stack: InterpStackElem[];
13
+ locals: InterpItemInfo[];
14
+ };
15
+ export declare function interpFunc(func: FuncEntry, context: Context): {
16
+ liveInState: Map<number, InterpState>;
17
+ equivSets: Map<Lputv, Set<number>>;
18
+ };
19
+ export {};
@@ -0,0 +1,2 @@
1
+ import { FuncEntry } from "./bytecode";
2
+ export declare function computeConflictGraph(func: FuncEntry): void;
package/build/util.cjs CHANGED
@@ -18,32 +18,32 @@ 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
- 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
21
+ GenericQueue: () => import_chunk_HHQDDCTP.GenericQueue,
22
+ bumpLogging: () => import_chunk_HHQDDCTP.bumpLogging,
23
+ copyRecursiveAsNeeded: () => import_chunk_HHQDDCTP.copyRecursiveAsNeeded,
24
+ every: () => import_chunk_HHQDDCTP.every,
25
+ first_modified: () => import_chunk_HHQDDCTP.first_modified,
26
+ forEach: () => import_chunk_HHQDDCTP.forEach,
27
+ globSome: () => import_chunk_HHQDDCTP.globSome,
28
+ globa: () => import_chunk_HHQDDCTP.globa,
29
+ last_modified: () => import_chunk_HHQDDCTP.last_modified,
30
+ log: () => import_chunk_HHQDDCTP.log,
31
+ logger: () => import_chunk_HHQDDCTP.logger,
32
+ map: () => import_chunk_HHQDDCTP.map,
33
+ popcount: () => import_chunk_HHQDDCTP.popcount,
34
+ promiseAll: () => import_chunk_HHQDDCTP.promiseAll,
35
+ pushUnique: () => import_chunk_HHQDDCTP.pushUnique,
36
+ readByLine: () => import_chunk_HHQDDCTP.readByLine,
37
+ reduce: () => import_chunk_HHQDDCTP.reduce,
38
+ sameArrays: () => import_chunk_HHQDDCTP.sameArrays,
39
+ setBanner: () => import_chunk_HHQDDCTP.setBanner,
40
+ some: () => import_chunk_HHQDDCTP.some,
41
+ spawnByLine: () => import_chunk_HHQDDCTP.spawnByLine,
42
+ wouldLog: () => import_chunk_HHQDDCTP.wouldLog
43
43
  });
44
44
  module.exports = __toCommonJS(util_exports);
45
- var import_chunk_APACX34C = require("./chunk-APACX34C.cjs");
46
- (0, import_chunk_APACX34C.init_util)();
45
+ var import_chunk_HHQDDCTP = require("./chunk-HHQDDCTP.cjs");
46
+ (0, import_chunk_HHQDDCTP.init_util)();
47
47
  // Annotate the CommonJS export names for ESM import in node:
48
48
  0 && (module.exports = {
49
49
  GenericQueue,
@@ -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 import_chunk_DCGJCC63 = require("./chunk-DCGJCC63.cjs");
25
- var import_chunk_APACX34C = require("./chunk-APACX34C.cjs");
24
+ var import_chunk_ZDTW2QRS = require("./chunk-ZDTW2QRS.cjs");
25
+ var import_chunk_HHQDDCTP = require("./chunk-HHQDDCTP.cjs");
26
26
  var import_node_worker_threads = require("node:worker_threads");
27
- var require_worker_thread = (0, import_chunk_APACX34C.__commonJS)({
27
+ var require_worker_thread = (0, import_chunk_HHQDDCTP.__commonJS)({
28
28
  "src/worker-thread.ts"() {
29
- (0, import_chunk_DCGJCC63.init_worker_task)();
29
+ (0, import_chunk_ZDTW2QRS.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, import_chunk_DCGJCC63.performTask)(task));
32
+ return import_node_worker_threads.parentPort.postMessage(await (0, import_chunk_ZDTW2QRS.performTask)(task));
33
33
  });
34
34
  }
35
35
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@markw65/monkeyc-optimizer",
3
3
  "type": "commonjs",
4
- "version": "1.1.20",
4
+ "version": "1.1.21",
5
5
  "description": "Source to source optimizer for Garmin Monkey C code",
6
6
  "main": "build/optimizer.cjs",
7
7
  "types": "build/src/optimizer.d.ts",
@@ -21,12 +21,13 @@
21
21
  "build-debug": "node esbuild.mjs",
22
22
  "build-release": "node esbuild.mjs --release",
23
23
  "prepack": "node esbuild.mjs --release",
24
- "test": "npm run test-mocha && npm run test-optimized && npm run test-unopt && npm run test-remote && npm run test-remote-tests",
24
+ "test": "npm run test-mocha && npm run test-optimized && npm run test-unopt && npm run test-post-only && npm run test-remote && npm run test-remote-tests",
25
25
  "test-mocha": "npx mocha --timeout 999999 build/mocha.cjs",
26
26
  "test-remote": "node ./test/test.js --showInfo --postOptimize --product=pick-one --github",
27
27
  "test-remote-tests": "node ./test/test.js --showInfo --postOptimize --product=pick-one --run-tests --github",
28
28
  "test-optimized": "node test/test.js --showInfo --postOptimize --typeCheckLevel Strict --run-tests --product=fenix5 --product=fr235 --jungle ./test/OptimizerTests/monkey.jungle",
29
29
  "test-unopt": "node test/test.js --typeCheckLevel Strict --skipOptimization --run-tests --product=fenix5 --product=fr235 --jungle ./test/OptimizerTests/monkey.jungle",
30
+ "test-post-only": "node test/test.js --typeCheckLevel Strict --skipOptimization --postOptimize --run-tests --product=fenix5 --product=fr235 --jungle ./test/OptimizerTests/monkey.jungle",
30
31
  "test-garmin-opt": "node test/test.js --typeCheckLevel Strict --skipOptimization --garminOptLevel=2 --run-tests --product=fenix5 --product=fr235 --jungle ./test/OptimizerTests/monkey.jungle",
31
32
  "eslint": "npx eslint ."
32
33
  },
@@ -36,7 +37,6 @@
36
37
  "build/sdk-util.cjs",
37
38
  "build/api.cjs",
38
39
  "build/worker-thread.cjs",
39
- "build/worker-pool.cjs",
40
40
  "build/chunk-*.cjs",
41
41
  "build/src/**/*.d.ts"
42
42
  ],
@@ -1,34 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var worker_pool_exports = {};
20
- __export(worker_pool_exports, {
21
- runTaskInPool: () => import_chunk_DCGJCC63.runTaskInPool,
22
- startPool: () => import_chunk_DCGJCC63.startPool,
23
- stopPool: () => import_chunk_DCGJCC63.stopPool
24
- });
25
- module.exports = __toCommonJS(worker_pool_exports);
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
- // Annotate the CommonJS export names for ESM import in node:
30
- 0 && (module.exports = {
31
- runTaskInPool,
32
- startPool,
33
- stopPool
34
- });