@markw65/monkeyc-optimizer 1.1.23 → 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 CHANGED
@@ -828,3 +828,23 @@ Bug Fixes
828
828
  ### 1.1.23
829
829
 
830
830
  No functional change, just fixes a typo that broke the typescript exports.
831
+
832
+ ### 1.1.24
833
+
834
+ - Bug fixes
835
+
836
+ - Conversion of unary `-x` to `0 - x` was too restrictive, causing some missed optimization opportunities
837
+
838
+ - Post Build Optimizations
839
+ - Added a pass equivalent to `Minimize Locals` in the source-to-source optimizer. This pass can see and re-assign all the locals, so it does better than the source-to-source optimizer. In addition, it maintains the variable mapping, so the debugger still sees the original names. As a result, its probably best to disable the `Minimize Locals` pass if the post build optimizer is enabled.
840
+ - Added a pass similar to `Size Based PRE` in the source-to-source optimizer. Currently this only optimizes constants and Symbols, but it has visibility to a lot of things the source-to-source optimizer can't see; so the two passes are complementary. I've added an option in case it causes problems, but it's enabled by default when the post build optimizer is enabled.
841
+ - Added various new optimizations to the interp pass:
842
+ - Handles a few more byte codes
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
+ - 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
+ - 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: () => import_chunk_27ZJJM2Y.checkCompilerVersion,
22
- collectNamespaces: () => import_chunk_27ZJJM2Y.collectNamespaces,
23
- createDocumentationMap: () => import_chunk_27ZJJM2Y.createDocumentationMap,
24
- diagnostic: () => import_chunk_27ZJJM2Y.diagnostic,
25
- diagnosticHelper: () => import_chunk_27ZJJM2Y.diagnosticHelper,
26
- findNamesInScope: () => import_chunk_27ZJJM2Y.findNamesInScope,
27
- findUsingForNode: () => import_chunk_27ZJJM2Y.findUsingForNode,
28
- formatAst: () => import_chunk_27ZJJM2Y.formatAst,
29
- formatAstLongLines: () => import_chunk_27ZJJM2Y.formatAstLongLines,
30
- getApiFunctionInfo: () => import_chunk_27ZJJM2Y.getApiFunctionInfo,
31
- getApiMapping: () => import_chunk_27ZJJM2Y.getApiMapping,
32
- getSuperClasses: () => import_chunk_27ZJJM2Y.getSuperClasses,
33
- hasProperty: () => import_chunk_27ZJJM2Y.hasProperty,
34
- isClassVariable: () => import_chunk_27ZJJM2Y.isClassVariable,
35
- isLocal: () => import_chunk_27ZJJM2Y.isLocal,
36
- isLookupCandidate: () => import_chunk_27ZJJM2Y.isLookupCandidate,
37
- isStateNode: () => import_chunk_27ZJJM2Y.isStateNode,
38
- lookupByFullName: () => import_chunk_27ZJJM2Y.lookupByFullName,
39
- lookupNext: () => import_chunk_27ZJJM2Y.lookupNext,
40
- lookupResultContains: () => import_chunk_27ZJJM2Y.lookupResultContains,
41
- lookupWithType: () => import_chunk_27ZJJM2Y.lookupWithType,
42
- makeToyboxLink: () => import_chunk_27ZJJM2Y.makeToyboxLink,
43
- mapVarDeclsByType: () => import_chunk_27ZJJM2Y.mapVarDeclsByType,
44
- markInvokeClassMethod: () => import_chunk_27ZJJM2Y.markInvokeClassMethod,
45
- parseSdkVersion: () => import_chunk_27ZJJM2Y.parseSdkVersion,
46
- sameLookupResult: () => import_chunk_27ZJJM2Y.sameLookupResult,
47
- traverseAst: () => import_chunk_27ZJJM2Y.traverseAst,
48
- variableDeclarationName: () => import_chunk_27ZJJM2Y.variableDeclarationName,
49
- visitReferences: () => import_chunk_27ZJJM2Y.visitReferences,
50
- visit_resources: () => import_chunk_27ZJJM2Y.visit_resources,
51
- visitorNode: () => import_chunk_27ZJJM2Y.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 import_chunk_27ZJJM2Y = require("./chunk-27ZJJM2Y.cjs");
55
- var import_chunk_HHQDDCTP = require("./chunk-HHQDDCTP.cjs");
56
- (0, import_chunk_27ZJJM2Y.init_api)();
54
+ var import_chunk_SNWJ2FZL = require("./chunk-SNWJ2FZL.cjs");
55
+ var import_chunk_QFQPBQSO = require("./chunk-QFQPBQSO.cjs");
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 chunk_HHQDDCTP_exports = {};
30
- __export(chunk_HHQDDCTP_exports, {
29
+ var chunk_QFQPBQSO_exports = {};
30
+ __export(chunk_QFQPBQSO_exports, {
31
31
  GenericQueue: () => GenericQueue,
32
32
  __commonJS: () => __commonJS,
33
33
  __esm: () => __esm,
@@ -58,7 +58,7 @@ __export(chunk_HHQDDCTP_exports, {
58
58
  spawnByLine: () => spawnByLine,
59
59
  wouldLog: () => wouldLog
60
60
  });
61
- module.exports = __toCommonJS(chunk_HHQDDCTP_exports);
61
+ module.exports = __toCommonJS(chunk_QFQPBQSO_exports);
62
62
  var child_process = __toESM(require("child_process"));
63
63
  var fsc = __toESM(require("fs"));
64
64
  var fs = __toESM(require("fs/promises"));
@@ -5455,7 +5455,7 @@ var require_priorityqueuejs = __commonJS({
5455
5455
  });
5456
5456
  function logger(module2, level, message) {
5457
5457
  if (wouldLog(module2, level)) {
5458
- log(message);
5458
+ log(typeof message === "function" ? message() : message);
5459
5459
  }
5460
5460
  }
5461
5461
  function wouldLog(module2, level) {