@markw65/monkeyc-optimizer 1.1.55 → 1.1.56

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 CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  All notable changes to the "monkeyc-optimizer" package will be documented in this file.
4
4
 
5
+ ### 1.1.56
6
+
7
+ - Fix regression caused by the fix to #24 (Fixes #26)
8
+ - Fix bug in the post build optimizer for system 7 devices, caused by not handling the new argcincsp bytecode
9
+
5
10
  ### 1.1.55
6
11
 
7
12
  - Allow class typedef lookups from static methods
package/build/api.cjs CHANGED
@@ -18,47 +18,47 @@ 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: () => import_chunk_GWRGLJLB.checkCompilerVersion,
22
- collectNamespaces: () => import_chunk_GWRGLJLB.collectNamespaces,
23
- createDocumentationMap: () => import_chunk_GWRGLJLB.createDocumentationMap,
24
- diagnostic: () => import_chunk_GWRGLJLB.diagnostic,
25
- diagnosticHelper: () => import_chunk_GWRGLJLB.diagnosticHelper,
26
- findNamesInScope: () => import_chunk_GWRGLJLB.findNamesInScope,
27
- findUsingForNode: () => import_chunk_GWRGLJLB.findUsingForNode,
28
- formatAst: () => import_chunk_GWRGLJLB.formatAst,
29
- formatAstLongLines: () => import_chunk_GWRGLJLB.formatAstLongLines,
30
- formatScopedName: () => import_chunk_GWRGLJLB.formatScopedName,
31
- getApiFunctionInfo: () => import_chunk_GWRGLJLB.getApiFunctionInfo,
32
- getApiMapping: () => import_chunk_GWRGLJLB.getApiMapping,
33
- getSuperClasses: () => import_chunk_GWRGLJLB.getSuperClasses,
21
+ checkCompilerVersion: () => import_chunk_M3LMSSY7.checkCompilerVersion,
22
+ collectNamespaces: () => import_chunk_M3LMSSY7.collectNamespaces,
23
+ createDocumentationMap: () => import_chunk_M3LMSSY7.createDocumentationMap,
24
+ diagnostic: () => import_chunk_M3LMSSY7.diagnostic,
25
+ diagnosticHelper: () => import_chunk_M3LMSSY7.diagnosticHelper,
26
+ findNamesInScope: () => import_chunk_M3LMSSY7.findNamesInScope,
27
+ findUsingForNode: () => import_chunk_M3LMSSY7.findUsingForNode,
28
+ formatAst: () => import_chunk_M3LMSSY7.formatAst,
29
+ formatAstLongLines: () => import_chunk_M3LMSSY7.formatAstLongLines,
30
+ formatScopedName: () => import_chunk_M3LMSSY7.formatScopedName,
31
+ getApiFunctionInfo: () => import_chunk_M3LMSSY7.getApiFunctionInfo,
32
+ getApiMapping: () => import_chunk_M3LMSSY7.getApiMapping,
33
+ getSuperClasses: () => import_chunk_M3LMSSY7.getSuperClasses,
34
34
  hasProperty: () => import_chunk_MBTLUWXR.hasProperty,
35
- isClassVariable: () => import_chunk_GWRGLJLB.isClassVariable,
36
- isLocal: () => import_chunk_GWRGLJLB.isLocal,
37
- isLookupCandidate: () => import_chunk_GWRGLJLB.isLookupCandidate,
38
- isStateNode: () => import_chunk_GWRGLJLB.isStateNode,
39
- lookupByFullName: () => import_chunk_GWRGLJLB.lookupByFullName,
40
- lookupNext: () => import_chunk_GWRGLJLB.lookupNext,
41
- lookupResultContains: () => import_chunk_GWRGLJLB.lookupResultContains,
42
- lookupWithType: () => import_chunk_GWRGLJLB.lookupWithType,
43
- makeToyboxLink: () => import_chunk_GWRGLJLB.makeToyboxLink,
44
- mapVarDeclsByType: () => import_chunk_GWRGLJLB.mapVarDeclsByType,
45
- markInvokeClassMethod: () => import_chunk_GWRGLJLB.markInvokeClassMethod,
46
- parseSdkVersion: () => import_chunk_GWRGLJLB.parseSdkVersion,
47
- resolveDiagnostics: () => import_chunk_GWRGLJLB.resolveDiagnostics,
48
- resolveDiagnosticsMap: () => import_chunk_GWRGLJLB.resolveDiagnosticsMap,
49
- sameLookupResult: () => import_chunk_GWRGLJLB.sameLookupResult,
35
+ isClassVariable: () => import_chunk_M3LMSSY7.isClassVariable,
36
+ isLocal: () => import_chunk_M3LMSSY7.isLocal,
37
+ isLookupCandidate: () => import_chunk_M3LMSSY7.isLookupCandidate,
38
+ isStateNode: () => import_chunk_M3LMSSY7.isStateNode,
39
+ lookupByFullName: () => import_chunk_M3LMSSY7.lookupByFullName,
40
+ lookupNext: () => import_chunk_M3LMSSY7.lookupNext,
41
+ lookupResultContains: () => import_chunk_M3LMSSY7.lookupResultContains,
42
+ lookupWithType: () => import_chunk_M3LMSSY7.lookupWithType,
43
+ makeToyboxLink: () => import_chunk_M3LMSSY7.makeToyboxLink,
44
+ mapVarDeclsByType: () => import_chunk_M3LMSSY7.mapVarDeclsByType,
45
+ markInvokeClassMethod: () => import_chunk_M3LMSSY7.markInvokeClassMethod,
46
+ parseSdkVersion: () => import_chunk_M3LMSSY7.parseSdkVersion,
47
+ resolveDiagnostics: () => import_chunk_M3LMSSY7.resolveDiagnostics,
48
+ resolveDiagnosticsMap: () => import_chunk_M3LMSSY7.resolveDiagnosticsMap,
49
+ sameLookupResult: () => import_chunk_M3LMSSY7.sameLookupResult,
50
50
  traverseAst: () => import_chunk_MBTLUWXR.traverseAst,
51
- variableDeclarationName: () => import_chunk_GWRGLJLB.variableDeclarationName,
52
- visitReferences: () => import_chunk_GWRGLJLB.visitReferences,
53
- visit_resources: () => import_chunk_GWRGLJLB.visit_resources,
54
- visitorNode: () => import_chunk_GWRGLJLB.visitorNode
51
+ variableDeclarationName: () => import_chunk_M3LMSSY7.variableDeclarationName,
52
+ visitReferences: () => import_chunk_M3LMSSY7.visitReferences,
53
+ visit_resources: () => import_chunk_M3LMSSY7.visit_resources,
54
+ visitorNode: () => import_chunk_M3LMSSY7.visitorNode
55
55
  });
56
56
  module.exports = __toCommonJS(api_exports);
57
- var import_chunk_GWRGLJLB = require("./chunk-GWRGLJLB.cjs");
57
+ var import_chunk_M3LMSSY7 = require("./chunk-M3LMSSY7.cjs");
58
58
  var import_chunk_SG7ODKRM = require("./chunk-SG7ODKRM.cjs");
59
59
  var import_chunk_MBTLUWXR = require("./chunk-MBTLUWXR.cjs");
60
60
  var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
61
- (0, import_chunk_GWRGLJLB.init_api)();
61
+ (0, import_chunk_M3LMSSY7.init_api)();
62
62
  // Annotate the CommonJS export names for ESM import in node:
63
63
  0 && (module.exports = {
64
64
  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 chunk_GWRGLJLB_exports = {};
30
- __export(chunk_GWRGLJLB_exports, {
29
+ var chunk_M3LMSSY7_exports = {};
30
+ __export(chunk_M3LMSSY7_exports, {
31
31
  EnumTagsConst: () => EnumTagsConst,
32
32
  LastTypeTag: () => LastTypeTag,
33
33
  ObjectLikeTagsConst: () => ObjectLikeTagsConst,
@@ -133,7 +133,7 @@ __export(chunk_GWRGLJLB_exports, {
133
133
  visitorNode: () => visitorNode,
134
134
  xml_util_exports: () => xml_util_exports
135
135
  });
136
- module.exports = __toCommonJS(chunk_GWRGLJLB_exports);
136
+ module.exports = __toCommonJS(chunk_M3LMSSY7_exports);
137
137
  var import_chunk_SG7ODKRM = require("./chunk-SG7ODKRM.cjs");
138
138
  var import_chunk_MBTLUWXR = require("./chunk-MBTLUWXR.cjs");
139
139
  var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
@@ -18250,40 +18250,42 @@ function lookupNext(state, results, decls, property) {
18250
18250
  const items = [];
18251
18251
  const addToItems = (sns) => sns.forEach((module2) => {
18252
18252
  if (!isStateNode(module2)) {
18253
- if (module2.type === "EnumStringMember") {
18254
- if (!module2.init) {
18255
- addToItems(lookupByFullName(state, "Toybox.Lang.Number"));
18256
- } else if (module2.init.type === "Literal") {
18257
- const [, type] = (0, import_chunk_MBTLUWXR.getNodeValue)(module2.init);
18258
- switch (type) {
18259
- case "Null":
18260
- return;
18261
- case "Boolean":
18262
- case "Char":
18263
- case "Double":
18264
- case "Float":
18265
- case "Long":
18266
- case "Number":
18267
- case "String":
18268
- addToItems(lookupByFullName(state, `Toybox.Lang.${type}`));
18269
- return;
18270
- }
18271
- } else {
18272
- [
18273
- "Boolean",
18274
- "Char",
18275
- "Double",
18276
- "Float",
18277
- "Long",
18278
- "Number",
18279
- "String"
18280
- ].forEach(
18281
- (type) => addToItems(lookupByFullName(state, `Toybox.Lang.${type}`))
18282
- );
18283
- return;
18253
+ if (module2.type !== "EnumStringMember")
18254
+ return;
18255
+ if (!module2.init) {
18256
+ addToItems(lookupByFullName(state, "Toybox.Lang.Number"));
18257
+ return;
18258
+ }
18259
+ if (module2.init.type === "Literal") {
18260
+ const [, type] = (0, import_chunk_MBTLUWXR.getNodeValue)(module2.init);
18261
+ switch (type) {
18262
+ case "Null":
18263
+ break;
18264
+ case "Boolean":
18265
+ case "Char":
18266
+ case "Double":
18267
+ case "Float":
18268
+ case "Long":
18269
+ case "Number":
18270
+ case "String":
18271
+ addToItems(lookupByFullName(state, `Toybox.Lang.${type}`));
18272
+ break;
18273
+ default:
18274
+ unhandledType(type);
18284
18275
  }
18276
+ return;
18285
18277
  }
18286
- addToItems(lookupByFullName(state, "Toybox.Lang.Object"));
18278
+ [
18279
+ "Boolean",
18280
+ "Char",
18281
+ "Double",
18282
+ "Float",
18283
+ "Long",
18284
+ "Number",
18285
+ "String"
18286
+ ].forEach(
18287
+ (type) => addToItems(lookupByFullName(state, `Toybox.Lang.${type}`))
18288
+ );
18287
18289
  return;
18288
18290
  }
18289
18291
  const res = checkOne(state, module2, decls, property);
@@ -19318,6 +19320,7 @@ var init_api = (0, import_chunk_ABYVSU2C.__esm)({
19318
19320
  init_types();
19319
19321
  (0, import_chunk_SG7ODKRM.init_util)();
19320
19322
  (0, import_chunk_MBTLUWXR.init_ast)();
19323
+ init_data_flow();
19321
19324
  init_visitor();
19322
19325
  }
19323
19326
  });
@@ -22612,6 +22615,7 @@ function sizeBasedPRE2(func, context) {
22612
22615
  case 24:
22613
22616
  return BigInt(bc.arg) << 8n | BigInt(bc.op);
22614
22617
  case 1:
22618
+ case 74:
22615
22619
  if (incSp != null) {
22616
22620
  incSp = false;
22617
22621
  }
@@ -22674,7 +22678,7 @@ function sizeBasedPRE2(func, context) {
22674
22678
  }
22675
22679
  });
22676
22680
  });
22677
- let nextSlot = func.argc + (incSp?.arg ?? 0);
22681
+ let nextSlot = func.argc + (incSp?.op === 1 ? incSp.arg : incSp?.arg.incsp ?? 0);
22678
22682
  const bytecode = (op, arg) => {
22679
22683
  const bc = { op, arg, size: opcodeSize(op), offset: context.nextOffset++ };
22680
22684
  if (arg == null)
@@ -22759,7 +22763,11 @@ function sizeBasedPRE2(func, context) {
22759
22763
  }
22760
22764
  });
22761
22765
  if (incSp) {
22762
- incSp.arg += insertionBlocks.size;
22766
+ if (incSp.op === 1) {
22767
+ incSp.arg += insertionBlocks.size;
22768
+ } else {
22769
+ incSp.arg.incsp += insertionBlocks.size;
22770
+ }
22763
22771
  } else {
22764
22772
  const startBlock = func.blocks.get(func.offset);
22765
22773
  const index = startBlock.bytecodes.length === 0 || startBlock.bytecodes[0].op !== 53 ? 0 : 1;
@@ -29022,7 +29030,7 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
29022
29030
  const opt_time = await (0, import_chunk_SG7ODKRM.first_modified)(
29023
29031
  Object.values(fnMap).map((v) => v.output)
29024
29032
  );
29025
- if (source_time < opt_time && 1713229195228 < opt_time) {
29033
+ if (source_time < opt_time && 1713286417604 < opt_time) {
29026
29034
  return {
29027
29035
  hasTests,
29028
29036
  diagnostics: prevDiagnostics,
@@ -29061,7 +29069,7 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
29061
29069
  hasTests: hasTests2,
29062
29070
  diagnostics,
29063
29071
  sdkVersion,
29064
- optimizerVersion: "1.1.55",
29072
+ optimizerVersion: "1.1.56",
29065
29073
  ...Object.fromEntries(
29066
29074
  configOptionsToCheck.map((option) => [option, config[option]])
29067
29075
  )
@@ -18,28 +18,28 @@ 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_GWRGLJLB.StateNodeAttributes,
22
- buildOptimizedProject: () => import_chunk_GWRGLJLB.buildOptimizedProject,
21
+ StateNodeAttributes: () => import_chunk_M3LMSSY7.StateNodeAttributes,
22
+ buildOptimizedProject: () => import_chunk_M3LMSSY7.buildOptimizedProject,
23
23
  copyRecursiveAsNeeded: () => import_chunk_SG7ODKRM.copyRecursiveAsNeeded,
24
- defaultConfig: () => import_chunk_GWRGLJLB.defaultConfig,
25
- display: () => import_chunk_GWRGLJLB.display,
26
- generateOneConfig: () => import_chunk_GWRGLJLB.generateOneConfig,
27
- generateOptimizedProject: () => import_chunk_GWRGLJLB.generateOptimizedProject,
28
- getConfig: () => import_chunk_GWRGLJLB.getConfig,
29
- getProjectAnalysis: () => import_chunk_GWRGLJLB.getProjectAnalysis,
30
- get_jungle: () => import_chunk_GWRGLJLB.get_jungle,
31
- isErrorWithLocation: () => import_chunk_GWRGLJLB.isErrorWithLocation,
32
- launchSimulator: () => import_chunk_GWRGLJLB.launchSimulator,
33
- manifestProducts: () => import_chunk_GWRGLJLB.manifestProducts,
34
- mctree: () => import_chunk_GWRGLJLB.mctree,
35
- simulateProgram: () => import_chunk_GWRGLJLB.simulateProgram
24
+ defaultConfig: () => import_chunk_M3LMSSY7.defaultConfig,
25
+ display: () => import_chunk_M3LMSSY7.display,
26
+ generateOneConfig: () => import_chunk_M3LMSSY7.generateOneConfig,
27
+ generateOptimizedProject: () => import_chunk_M3LMSSY7.generateOptimizedProject,
28
+ getConfig: () => import_chunk_M3LMSSY7.getConfig,
29
+ getProjectAnalysis: () => import_chunk_M3LMSSY7.getProjectAnalysis,
30
+ get_jungle: () => import_chunk_M3LMSSY7.get_jungle,
31
+ isErrorWithLocation: () => import_chunk_M3LMSSY7.isErrorWithLocation,
32
+ launchSimulator: () => import_chunk_M3LMSSY7.launchSimulator,
33
+ manifestProducts: () => import_chunk_M3LMSSY7.manifestProducts,
34
+ mctree: () => import_chunk_M3LMSSY7.mctree,
35
+ simulateProgram: () => import_chunk_M3LMSSY7.simulateProgram
36
36
  });
37
37
  module.exports = __toCommonJS(optimizer_exports);
38
- var import_chunk_GWRGLJLB = require("./chunk-GWRGLJLB.cjs");
38
+ var import_chunk_M3LMSSY7 = require("./chunk-M3LMSSY7.cjs");
39
39
  var import_chunk_SG7ODKRM = require("./chunk-SG7ODKRM.cjs");
40
40
  var import_chunk_MBTLUWXR = require("./chunk-MBTLUWXR.cjs");
41
41
  var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
42
- (0, import_chunk_GWRGLJLB.init_optimizer)();
42
+ (0, import_chunk_M3LMSSY7.init_optimizer)();
43
43
  // Annotate the CommonJS export names for ESM import in node:
44
44
  0 && (module.exports = {
45
45
  StateNodeAttributes,
@@ -18,25 +18,25 @@ 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_GWRGLJLB.SectionKinds,
22
- appSupport: () => import_chunk_GWRGLJLB.appSupport,
23
- connectiq: () => import_chunk_GWRGLJLB.connectiq,
24
- getDeviceInfo: () => import_chunk_GWRGLJLB.getDeviceInfo,
25
- getFunctionDocumentation: () => import_chunk_GWRGLJLB.getFunctionDocumentation,
26
- getLanguages: () => import_chunk_GWRGLJLB.getLanguages,
27
- getSdkPath: () => import_chunk_GWRGLJLB.getSdkPath,
28
- isWin: () => import_chunk_GWRGLJLB.isWin,
29
- optimizeProgram: () => import_chunk_GWRGLJLB.optimizeProgram,
30
- readPrg: () => import_chunk_GWRGLJLB.readPrg,
31
- readPrgWithOffsets: () => import_chunk_GWRGLJLB.readPrgWithOffsets,
32
- xmlUtil: () => import_chunk_GWRGLJLB.xml_util_exports
21
+ SectionKinds: () => import_chunk_M3LMSSY7.SectionKinds,
22
+ appSupport: () => import_chunk_M3LMSSY7.appSupport,
23
+ connectiq: () => import_chunk_M3LMSSY7.connectiq,
24
+ getDeviceInfo: () => import_chunk_M3LMSSY7.getDeviceInfo,
25
+ getFunctionDocumentation: () => import_chunk_M3LMSSY7.getFunctionDocumentation,
26
+ getLanguages: () => import_chunk_M3LMSSY7.getLanguages,
27
+ getSdkPath: () => import_chunk_M3LMSSY7.getSdkPath,
28
+ isWin: () => import_chunk_M3LMSSY7.isWin,
29
+ optimizeProgram: () => import_chunk_M3LMSSY7.optimizeProgram,
30
+ readPrg: () => import_chunk_M3LMSSY7.readPrg,
31
+ readPrgWithOffsets: () => import_chunk_M3LMSSY7.readPrgWithOffsets,
32
+ xmlUtil: () => import_chunk_M3LMSSY7.xml_util_exports
33
33
  });
34
34
  module.exports = __toCommonJS(sdk_util_exports);
35
- var import_chunk_GWRGLJLB = require("./chunk-GWRGLJLB.cjs");
35
+ var import_chunk_M3LMSSY7 = require("./chunk-M3LMSSY7.cjs");
36
36
  var import_chunk_SG7ODKRM = require("./chunk-SG7ODKRM.cjs");
37
37
  var import_chunk_MBTLUWXR = require("./chunk-MBTLUWXR.cjs");
38
38
  var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
39
- (0, import_chunk_GWRGLJLB.init_sdk_util)();
39
+ (0, import_chunk_M3LMSSY7.init_sdk_util)();
40
40
  // Annotate the CommonJS export names for ESM import in node:
41
41
  0 && (module.exports = {
42
42
  SectionKinds,
@@ -21,17 +21,17 @@ __export(worker_thread_exports, {
21
21
  default: () => worker_thread_default
22
22
  });
23
23
  module.exports = __toCommonJS(worker_thread_exports);
24
- var import_chunk_GWRGLJLB = require("./chunk-GWRGLJLB.cjs");
24
+ var import_chunk_M3LMSSY7 = require("./chunk-M3LMSSY7.cjs");
25
25
  var import_chunk_SG7ODKRM = require("./chunk-SG7ODKRM.cjs");
26
26
  var import_chunk_MBTLUWXR = require("./chunk-MBTLUWXR.cjs");
27
27
  var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
28
28
  var import_node_worker_threads = require("node:worker_threads");
29
29
  var require_worker_thread = (0, import_chunk_ABYVSU2C.__commonJS)({
30
30
  "src/worker-thread.ts"() {
31
- (0, import_chunk_GWRGLJLB.init_worker_task)();
31
+ (0, import_chunk_M3LMSSY7.init_worker_task)();
32
32
  if (import_node_worker_threads.parentPort) {
33
33
  import_node_worker_threads.parentPort.on("message", async (task) => {
34
- return import_node_worker_threads.parentPort.postMessage(await (0, import_chunk_GWRGLJLB.performTask)(task));
34
+ return import_node_worker_threads.parentPort.postMessage(await (0, import_chunk_M3LMSSY7.performTask)(task));
35
35
  });
36
36
  }
37
37
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@markw65/monkeyc-optimizer",
3
3
  "type": "commonjs",
4
- "version": "1.1.55",
4
+ "version": "1.1.56",
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",